Documentation
¶
Overview ¶
Package airbnb is Crawlora's Airbnb API client for 7 endpoints, covering listing search, room details, calendars and reviews, and host profiles, listings and reviews. API documentation: https://crawlora.net/docs?utm_source=pkg.go.dev&utm_medium=referral&utm_campaign=platform-clients&utm_content=airbnb-go-api-docs
Index ¶
- Constants
- func OperationIDs() []string
- type Client
- func (c *Client) Call(ctx context.Context, operationID string, params Params) (any, error)
- func (c *Client) Close() error
- func (c *Client) Host(ctx context.Context, params Params) (any, error)
- func (c *Client) HostListings(ctx context.Context, params Params) (any, error)
- func (c *Client) HostReviews(ctx context.Context, params Params) (any, error)
- func (c *Client) Room(ctx context.Context, params Params) (any, error)
- func (c *Client) RoomCalendar(ctx context.Context, params Params) (any, error)
- func (c *Client) RoomReviews(ctx context.Context, params Params) (any, error)
- func (c *Client) Search(ctx context.Context, params Params) (any, error)
- type Params
Examples ¶
Constants ¶
const ( DefaultBaseURL = "https://api.crawlora.net/api/v1" Version = "0.1.2" )
const OperationCount = 7
OperationCount reports how many selected-platform operations this module exposes.
Variables ¶
This section is empty.
Functions ¶
func OperationIDs ¶
func OperationIDs() []string
OperationIDs returns the selected operation IDs in stable sorted order.
Types ¶
type Client ¶
Client calls only the operation IDs included in this platform module.
func NewClient ¶
NewClient creates a client using the supplied API key, or CRAWLORA_API_KEY when empty.
func (*Client) Call ¶
Call executes a selected platform operation by operation ID.
Example ¶
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
w.Header().Set("Content-Type", "application/json")
_, _ = w.Write([]byte(`{"ok":true}`))
}))
defer server.Close()
client := NewClient("your-crawlora-api-key")
client.BaseURL = server.URL + "/api/v1"
client.HTTPClient = server.Client()
result, err := client.Call(context.Background(), "airbnb-host", Params{"id": "sample-id"})
if err != nil {
panic(err)
}
fmt.Println(result.(map[string]any)["ok"])
Output: true
func (*Client) HostListings ¶
HostListings calls the airbnb-host-listings operation.
func (*Client) HostReviews ¶
HostReviews calls the airbnb-host-reviews operation.
func (*Client) RoomCalendar ¶
RoomCalendar calls the airbnb-room-calendar operation.
func (*Client) RoomReviews ¶
RoomReviews calls the airbnb-room-reviews operation.