Documentation
¶
Overview ¶
Package api provides package-level convenience functions for the Kodik API.
Each function is a thin wrapper around the corresponding method on client.DefaultClient with context.Background. Initialize the default client once via client.Init before calling any function in this package:
func main() {
client.Init("your-api-token")
resp, err := api.Search(&models.SearchParams{
Title: "Inception",
Limit: 5,
})
if err != nil {
log.Fatal(err)
}
fmt.Println("found:", len(resp.Results))
}
Available endpoints ¶
- Search — /search full-text and ID-based material search
- List — /list paginated catalogue listing
- Genres — /genres genres with material counts
- Countries — /countries countries with material counts
- Years — /years release years with material counts
- Qualities — /qualities/v2 video qualities with material counts
- Translations — /translations/v2 voice-overs with material counts
Context and explicit clients ¶
When you need per-request timeouts, cancellation, or multiple API tokens, use client.Client methods directly instead of this package:
c := client.NewClient("your-api-token")
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
resp, err := c.Search(ctx, params)
Index ¶
- func Countries(params *models.CountriesParams) (*models.CountriesResponse, error)
- func Genres(params *models.GenresParams) (*models.GenresResponse, error)
- func List(params *models.ListParams) (*models.ListResponse, error)
- func Qualities(params *models.QualitiesParams) (*models.QualitiesResponse, error)
- func Search(params *models.SearchParams) (*models.SearchResponse, error)
- func Translations(params *models.TranslationsParams) (*models.TranslationsResponse, error)
- func Years(params *models.YearsParams) (*models.YearsResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Countries ¶
func Countries(params *models.CountriesParams) (*models.CountriesResponse, error)
Countries calls the /countries endpoint using the global DefaultClient.
func Genres ¶
func Genres(params *models.GenresParams) (*models.GenresResponse, error)
Genres calls the /genres endpoint using the global DefaultClient.
func List ¶
func List(params *models.ListParams) (*models.ListResponse, error)
List calls the /list endpoint using the global DefaultClient.
func Qualities ¶
func Qualities(params *models.QualitiesParams) (*models.QualitiesResponse, error)
Qualities calls the /qualities/v2 endpoint using the global DefaultClient.
func Search ¶
func Search(params *models.SearchParams) (*models.SearchResponse, error)
Search calls the /search endpoint using the global DefaultClient.
func Translations ¶
func Translations(params *models.TranslationsParams) (*models.TranslationsResponse, error)
Translations calls the /translations/v2 endpoint using the global DefaultClient.
func Years ¶
func Years(params *models.YearsParams) (*models.YearsResponse, error)
Years calls the /years endpoint using the global DefaultClient.
Types ¶
This section is empty.