Skip to content

Commit

Permalink
add Request struct to the TripAdvisor package
Browse files Browse the repository at this point in the history
  • Loading branch information
algo7 committed Jan 22, 2024
1 parent 6cf304f commit 9ec0ef7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ review.csv
**source
**Default
**DevToolsActivePort
**pkg
**Project_Files
**tmp
**.DS_Store
Expand Down
25 changes: 25 additions & 0 deletions scraper/pkg/tripadvisor/tripadvisor.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package tripadvisor

// Request is a struct that represents the request body to query TripAdvisor endpoints.
type Request []struct {
Variables struct {
LocationID int `json:"locationId"`
Offset int `json:"offset"`
Filters []struct {
Axis string `json:"axis"` // "LANGUAGE"
Selections []string `json:"selections"` // ["en"]
} `json:"filters"`
Prefs any `json:"prefs"` // null
InitialPrefs struct {
} `json:"initialPrefs"` // empty struct
Limit int `json:"limit"`
FilterCacheKey any `json:"filterCacheKey"` // null
PrefsCacheKey string `json:"prefsCacheKey"` // format "locationReviewPrefs_<localtionID>"
NeedKeywords bool `json:"needKeywords"` // false
KeywordVariant string `json:"keywordVariant"`
} `json:"variables"`
Extensions struct {
// Hotel, Restaurant, Airline, etc all have different pre-registered query IDs.
PreRegisteredQueryID string `json:"preRegisteredQueryId"`
} `json:"extensions"`
}

0 comments on commit 9ec0ef7

Please sign in to comment.