A Yelp Fusion API Golang package with no external dependencies.
Please refer to the official Yelp Fusion documentation for the request/response models.
-
Endpoint Request Interface:
-
Business Endpoints:
-
Event Endpoints:
-
Category Endpoints:
go get github.com/JoshuaPortelance/yelp-fusion-go
Returns the unmarshalled JSON data following response model from the Yelp Fusion documentation.
This is implemented per endpoint. The BusinessSearchRequest's definition of this is shown below. There is a similar definition for each endpoint request type.
func (r *BusinessSearchRequest) Get() (*Businesses, error)
Returns an open and unmodified http.Response pointer.
func (r *Request) GetResponse() (*http.Response, error)
The open http.Response will need to be closed manually.
Timeout will set the http.Client Timeout duration to abort the request if the server doesn't complete the response within that time in milliseconds.
client := yelp.Client{
Key: "YOUR_API_KEY",
Timeout: 5000,
}
client := yelp.Client{Key:"YOUR_API_KEY"}
search := client.NewBusinessSearch()
search.AddParameter("location", "Victoria, British Columbia")
search.AddParameter("term", "Red Fish Blue Fish")
data, _ := search.Get()
fmt.Println(data.Businesses[0].Name)
client := yelp.Client{Key:"YOUR_API_KEY"}
search := client.NewPhoneSearch()
search.AddParameter("phone", "+12502986877")
data, _ := search.Get()
fmt.Println(data.Businesses[0].Name)
client := yelp.Client{Key:"YOUR_API_KEY"}
search := client.NewTransactionSearch("delivery")
search.AddParameter("location", "Seattle, Washington")
data, _ := search.Get()
fmt.Println(data.Businesses[0].Name)
client := yelp.Client{Key:"YOUR_API_KEY"}
search := client.NewBusinessDetails("red-fish-blue-fish-victoria")
search.AddParameter("location", "Victoria, British Columbia")
data, _ := search.Get()
fmt.Println(data.Name)
client := yelp.Client{Key:"YOUR_API_KEY"}
search := client.NewBusinessMatch()
search.AddParameter("name", "Red Fish Blue Fish")
search.AddParameter("address1", "1006 Wharf Street")
search.AddParameter("city", "Victoria")
search.AddParameter("state", "BC")
search.AddParameter("country", "CA")
data, _ := search.Get()
fmt.Println(data.Businesses[0].Name)
client := yelp.Client{Key:"YOUR_API_KEY"}
search := client.NewReviews("red-fish-blue-fish-victoria")
search.AddParameter("location", "Victoria, British Columbia")
data, _ := search.Get()
fmt.Println(data.Reviews[0].Text)
client := yelp.Client{Key:"YOUR_API_KEY"}
search := client.NewAutocomplete()
search.AddParameter("text", "Red Fish")
search.AddParameter("latitude", "48.4243002")
search.AddParameter("longitude", "-123.3706659")
data, _ := search.Get()
fmt.Println(data.Terms[0].Text)
client := yelp.Client{Key:"YOUR_API_KEY"}
search := client.NewEventLookup("red-fish-blue-fish-victoria")
data, _ := search.Get()
fmt.Println(data.Description)
client := yelp.Client{Key:"YOUR_API_KEY"}
search := client.NewEventSearch()
search.AddParameter("location", "Victoria, British Columbia")
data, _ := search.Get()
fmt.Println(data.Events[0].Name)
client := yelp.Client{Key:"YOUR_API_KEY"}
search := client.NewFeaturedEvent()
search.AddParameter("location", "Victoria, British Columbia")
data, _ := search.Get()
fmt.Println(data.Description)
client := yelp.Client{Key:"YOUR_API_KEY"}
search := client.NewAllCategories()
data, _ := search.Get()
fmt.Println(data.Categories[0].Alias)
client := yelp.Client{Key:"YOUR_API_KEY"}
search := client.NewCategoryDetails("arts")
data, _ := search.Get()
fmt.Println(data.Title)