Documentation
¶
Overview ¶
Package jointhestudentlife is the official Go SDK for The Student Life: student events, ticket prices, city guides and student deals in 85+ cities, from the open REST API at https://jointhestudentlife.com/api/v1 (docs: https://jointhestudentlife.com/developers).
Standard library only. The API is open: no key, no signup.
c := jointhestudentlife.New()
evs, err := c.Events(ctx, jointhestudentlife.EventsParams{City: "berlin", Type: "halloween"})
Index ¶
- Constants
- type CitiesParams
- type City
- type CityList
- type Client
- func (c *Client) AllCities(ctx context.Context, p CitiesParams) ([]City, error)
- func (c *Client) AllEvents(ctx context.Context, p EventsParams) ([]Event, error)
- func (c *Client) Cities(ctx context.Context, p CitiesParams) (*CityList, error)
- func (c *Client) City(ctx context.Context, slugOrName string) (map[string]any, error)
- func (c *Client) CreateReport(ctx context.Context, r ReportRequest) (*ReportJob, error)
- func (c *Client) Event(ctx context.Context, id string) (*Event, error)
- func (c *Client) Events(ctx context.Context, p EventsParams) (*EventList, error)
- func (c *Client) GetReport(ctx context.Context, id string) (*ReportJob, error)
- func (c *Client) Info(ctx context.Context) (map[string]any, error)
- func (c *Client) Partners(ctx context.Context, category, q string) (map[string]any, error)
- func (c *Client) Pricing(ctx context.Context, city string) (map[string]any, error)
- func (c *Client) RunReport(ctx context.Context, r ReportRequest) (*ReportJob, error)
- func (c *Client) SendMessage(ctx context.Context, m Message, idempotencyKey string) (map[string]any, error)
- type Error
- type Event
- type EventList
- type EventsParams
- type Message
- type Option
- type ReportJob
- type ReportRequest
- type TicketOption
- type Tickets
- type Venue
Constants ¶
const DefaultBaseURL = "https://jointhestudentlife.com"
DefaultBaseURL is the production API host.
const Version = "1.0.0"
Version of this SDK.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CitiesParams ¶
CitiesParams filters a city search.
type City ¶
type City struct {
Slug string `json:"slug"`
Name string `json:"name"`
Country string `json:"country"`
CountryCode string `json:"country_code"`
Summary string `json:"summary"`
FestivalName string `json:"festival_name"`
CityGuideURL string `json:"city_guide_url"`
FestivalURL string `json:"festival_url"`
HalloweenURL *string `json:"halloween_url"`
}
City is a city card from a search.
type CityList ¶
type CityList struct {
Total int `json:"total"`
Cities []City `json:"cities"`
NextCursor *string `json:"next_cursor"`
}
CityList is one page of cities.
type Client ¶
type Client struct {
BaseURL string
HTTPClient *http.Client
MaxRetries int // retries for 429, and for 5xx on GET or a POST with an idempotency key (0 to 5)
UserAgent string
}
Client talks to the API. The zero value is not usable; call New.
func (*Client) City ¶
City returns the full student guide for one city (slug or name). The guide is rich, so it is a map.
func (*Client) CreateReport ¶
CreateReport starts a report job (the API answers 202 Accepted).
func (*Client) Pricing ¶
Pricing returns what is free and what tickets cost, optionally for one city.
func (*Client) RunReport ¶
RunReport creates a report and polls once a second until it succeeds or ctx ends.
func (*Client) SendMessage ¶
func (c *Client) SendMessage(ctx context.Context, m Message, idempotencyKey string) (map[string]any, error)
SendMessage emails the team on someone's behalf. Set DryRun to validate without sending. Pass a fresh idempotency key (a UUID) per message to make retries safe; "" disables retries on 5xx.
type Error ¶
type Error struct {
Status int // HTTP status, 0 for network errors
Code string // API error code, e.g. not_found, rate_limited, timeout, network_error
Message string
Body []byte
}
Error is an error answer from the API, or a network problem (Status 0).
type Event ¶
type Event struct {
ID string `json:"id"`
Type string `json:"type"`
Name string `json:"name"`
City string `json:"city"`
CitySlug *string `json:"city_slug"`
Start string `json:"start"`
End *string `json:"end"`
Timezone *string `json:"timezone"`
Venue *Venue `json:"venue"`
AgeMin *int `json:"age_min"`
Image *string `json:"image"`
Description string `json:"description"`
URL string `json:"url"`
Status string `json:"status"`
Tickets Tickets `json:"tickets"`
WaitlistOpen bool `json:"waitlist_open"`
WhatsAppGroup *string `json:"whatsapp_group"`
EntryRule *string `json:"entry_rule"`
}
Event is one student event.
type EventList ¶
type EventList struct {
Total int `json:"total"`
Events []Event `json:"events"`
NextCursor *string `json:"next_cursor"`
Note string `json:"note,omitempty"`
}
EventList is one page of events.
type EventsParams ¶
EventsParams filters events. Type is all, halloween, welcome_festival, semester_kickoff or orientation_week.
type Message ¶
type Message struct {
Name string `json:"name"`
Email string `json:"email"`
Message string `json:"message"`
Subject string `json:"subject,omitempty"`
City string `json:"city,omitempty"`
DryRun bool `json:"dry_run,omitempty"` // validate and send nothing
}
Message is a message to the team. Only send one with the person's consent and their own name and email.
type Option ¶
type Option func(*Client)
Option configures a Client.
func WithHTTPClient ¶
WithHTTPClient sets the HTTP client (for proxies, custom timeouts or tests).
func WithMaxRetries ¶
WithMaxRetries sets the retry budget, clamped to 0..5.
type ReportJob ¶
type ReportJob struct {
ID string `json:"id"`
Type string `json:"type"`
Status string `json:"status"`
CreatedAt string `json:"created_at"`
ExpiresAt string `json:"expires_at"`
CompletedAt string `json:"completed_at,omitempty"`
StatusURL string `json:"status_url"`
Result json.RawMessage `json:"result,omitempty"`
}
ReportJob is the state of a report job; Result is set once Status is "succeeded".
type ReportRequest ¶
type ReportRequest struct {
Type string `json:"type"`
Cities []string `json:"cities,omitempty"`
EventType string `json:"event_type,omitempty"`
}
ReportRequest starts a report job. Type is city_comparison (2 to 10 Cities) or events_overview.
type TicketOption ¶
type TicketOption struct {
Name string `json:"name"`
Price float64 `json:"price"`
Currency string `json:"currency"`
}
TicketOption is one ticket type with its price.
type Tickets ¶
type Tickets struct {
Status string `json:"status"` // on_sale, opens_soon, coming_soon, sold_out, ended
SalesOpenAt *string `json:"sales_open_at"`
Options []TicketOption `json:"options"`
EarlyAccess json.RawMessage `json:"early_access"`
BuyURL string `json:"buy_url"`
Note string `json:"note"`
}
Tickets describes what can be bought and when.