Documentation ¶
Index ¶
- Constants
- func AllocateBool(v bool) *bool
- func AllocateFloat32(v float32) *float32
- func AllocateInt(v int) *int
- func AllocateString(v string) *string
- func AllocateTime(v string) *time.Time
- func CheckResponse(res *http.Response) error
- type APIKeyError
- type AuthService
- type AuthTokenError
- type Client
- func (c *Client) BareDo(ctx context.Context, req *http.Request) (*Response, error)
- func (c *Client) Client() *http.Client
- func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*Response, error)
- func (c *Client) NewRequest(m string, u string, b interface{}) (*http.Request, error)
- func (c *Client) NewURL(p string, v interface{}) (string, error)
- func (c *Client) WithAuthToken(t string) *Client
- type Credentials
- type CredentialsError
- type Episode
- type ErrorResponse
- type Feature
- type FeatureDetails
- type FeatureEntity
- type FeaturesPopularParameters
- type FeaturesSearchParameters
- type FeaturesService
- type File
- type FileError
- type FormatsListResponse
- type FormatsService
- type ID
- type Language
- type LanguagesService
- type LinkError
- type Login
- type Pagination
- type Quota
- type QuotaError
- type Rate
- type RateLimitError
- type RelatedLink
- type Response
- type ResponseError
- type Season
- type Subtitle
- type SubtitleEntity
- type SubtitlesDownloadParameters
- type SubtitlesDownloadResponse
- type SubtitlesLatestParameters
- type SubtitlesPopularParameters
- type SubtitlesSearchParameters
- type SubtitlesService
- func (s *SubtitlesService) Download(ctx context.Context, p *SubtitlesDownloadParameters) (*SubtitlesDownloadResponse, *Response, error)
- func (s *SubtitlesService) Latest(ctx context.Context, p *SubtitlesLatestParameters) ([]*SubtitleEntity, *Response, error)
- func (s *SubtitlesService) Popular(ctx context.Context, p *SubtitlesPopularParameters) ([]*SubtitleEntity, *Response, error)
- func (s *SubtitlesService) Search(ctx context.Context, p *SubtitlesSearchParameters) ([]*SubtitleEntity, *Response, error)
- type Uploader
- type User
- type UserAgentError
- type UsersService
Constants ¶
const (
Version = "0.0.1"
)
Variables ¶
This section is empty.
Functions ¶
func AllocateBool ¶
Allocates a new bool value to store v and returns a pointer to it.
func AllocateFloat32 ¶
Allocates a new float32 value to store v and returns a pointer to it.
func AllocateInt ¶
Allocates a new int value to store v and returns a pointer to it.
func AllocateString ¶
Allocates a new string value to store v and returns a pointer to it.
func AllocateTime ¶
Allocates a new time.Time value to store v and returns a pointer to it.
func CheckResponse ¶
Types ¶
type APIKeyError ¶
type APIKeyError ResponseError
func (*APIKeyError) Error ¶
func (e *APIKeyError) Error() string
type AuthService ¶
type AuthService service
func (*AuthService) Login ¶
func (s *AuthService) Login(ctx context.Context, c *Credentials) (*Login, *Response, error)
Creates a token to authenticate a user.
type AuthTokenError ¶
type AuthTokenError ResponseError
func (*AuthTokenError) Error ¶
func (e *AuthTokenError) Error() string
type Client ¶
type Client struct { APIKey string UserAgent string BaseURL *url.URL Auth *AuthService Features *FeaturesService Formats *FormatsService Languages *LanguagesService Subtitles *SubtitlesService Users *UsersService // contains filtered or unexported fields }
func (*Client) NewRequest ¶
func (*Client) WithAuthToken ¶
type Credentials ¶
type CredentialsError ¶
type CredentialsError ResponseError
func (*CredentialsError) Error ¶
func (e *CredentialsError) Error() string
type ErrorResponse ¶
type ErrorResponse struct { ResponseError Errors []error }
func (*ErrorResponse) Error ¶
func (e *ErrorResponse) Error() string
type Feature ¶
type Feature struct { EpisodeNumber *int `json:"episode_number,omitempty"` FeatureID *ID `json:"feature_id,omitempty"` FeatureType *string `json:"feature_type,omitempty"` IMDBID *ID `json:"imdb_id,omitempty"` IMGURL *string `json:"img_url,omitempty"` OriginalTitle *string `json:"original_title,omitempty"` ParentIMDBID *ID `json:"parent_imdb_id,omitempty"` ParentTitle *string `json:"parent_title,omitempty"` SeasonNumber *int `json:"season_number,omitempty"` Seasons *Season `json:"seasons,omitempty"` SeasonsCount *int `json:"seasons_count,omitempty"` SubtitlesCount *int `json:"subtitles_count,omitempty"` SubtitlesCounts *map[string]int `json:"subtitles_counts,omitempty"` Title *string `json:"title,omitempty"` TitleAka []*string `json:"title_aka,omitempty"` TMDBID *ID `json:"tmdb_id,omitempty"` URL *string `json:"url,omitempty"` Year *string `json:"year,omitempty"` }
type FeatureDetails ¶
type FeatureDetails struct { EpisodeNumber *int `json:"episode_number,omitempty"` FeatureID *ID `json:"feature_id,omitempty"` FeatureType *string `json:"feature_type,omitempty"` IMDBID *ID `json:"imdb_id,omitempty"` MovieName *string `json:"movie_name,omitempty"` ParentFeatureID *ID `json:"parent_feature_id,omitempty"` ParentIMDBID *ID `json:"parent_imdb_id,omitempty"` ParentTitle *string `json:"parent_title,omitempty"` ParentTMDBID *ID `json:"parent_tmdb_id,omitempty"` SeasonNumber *int `json:"season_number,omitempty"` Title *string `json:"title,omitempty"` TMDBID *ID `json:"tmdb_id,omitempty"` Year *int `json:"year,omitempty"` }
type FeatureEntity ¶
type FeaturesService ¶
type FeaturesService service
func (*FeaturesService) Popular ¶
func (s *FeaturesService) Popular(ctx context.Context, p *FeaturesPopularParameters) ([]*FeatureEntity, *Response, error)
Discovers popular features, according to last 30 days downloads.
func (*FeaturesService) Search ¶
func (s *FeaturesService) Search(ctx context.Context, p *FeaturesSearchParameters) ([]*FeatureEntity, *Response, error)
Searches for features.
type FileError ¶
type FileError ResponseError
type FormatsListResponse ¶
type FormatsListResponse struct {
OutputFormats []*string `json:"output_formats,omitempty"`
}
type FormatsService ¶
type FormatsService service
func (*FormatsService) List ¶
func (s *FormatsService) List(ctx context.Context) (*FormatsListResponse, *Response, error)
Lists subtitle formats.
type ID ¶
type ID int64
The OpenSubtitles API is inconsistent as it may represent IDs in either string or int32. This type helps by casting any ID to int64 for consistency.
func AllocateID ¶
Allocates a new ID value to store v and returns a pointer to it.
func (*ID) UnmarshalJSON ¶
type LanguagesService ¶
type LanguagesService service
type LinkError ¶
type LinkError ResponseError
type Login ¶
type Login struct { // Returns the base URL with the protocol and version, which can be utilized // with the SetBaseURL method of the Client. It is distinct from the BaseURL // because the latter includes the service host without the protocol and API // version. ClientBaseURL string `json:"-"` BaseURL *string `json:"base_url,omitempty"` Token *string `json:"token,omitempty"` User *User `json:"user,omitempty"` }
func (*Login) UnmarshalJSON ¶
type Pagination ¶
type QuotaError ¶
type QuotaError struct { ResponseError Quota }
func (*QuotaError) Error ¶
func (e *QuotaError) Error() string
type RateLimitError ¶
type RateLimitError ResponseError
func (*RateLimitError) Error ¶
func (e *RateLimitError) Error() string
type RelatedLink ¶
type ResponseError ¶
func (*ResponseError) Error ¶
func (e *ResponseError) Error() string
type Subtitle ¶
type Subtitle struct { AITranslated *bool `json:"ai_translated,omitempty"` Comments *string `json:"comments,omitempty"` DownloadCount *int `json:"download_count,omitempty"` FeatureDetails *FeatureDetails `json:"feature_details,omitempty"` Files []*File `json:"files,omitempty"` ForeignPartsOnly *bool `json:"foreign_parts_only,omitempty"` FPS *float32 `json:"fps,omitempty"` FromTrusted *bool `json:"from_trusted,omitempty"` HD *bool `json:"hd,omitempty"` HearingImpaired *bool `json:"hearing_impaired,omitempty"` Language *string `json:"language,omitempty"` MachineTranslated *bool `json:"machine_translated,omitempty"` NewDownloadCount *int `json:"new_download_count,omitempty"` Ratings *float32 `json:"ratings,omitempty"` RelatedLinks []*RelatedLink `json:"related_links,omitempty"` Release *string `json:"release,omitempty"` SubtitleID *ID `json:"subtitle_id,omitempty"` UploadDate *time.Time `json:"upload_date,omitempty"` Uploader *Uploader `json:"uploader,omitempty"` URL *string `json:"url,omitempty"` Votes *int `json:"votes,omitempty"` }
type SubtitleEntity ¶
type SubtitlesDownloadParameters ¶
type SubtitlesDownloadParameters struct { FileID ID `json:"file_id,omitempty"` FileName string `json:"file_name,omitempty"` ForceDownload bool `json:"force_download,omitempty"` InFPS int `json:"in_fps,omitempty"` OutFPS int `json:"out_fps,omitempty"` SubFormat string `json:"sub_format,omitempty"` Timeshift int `json:"timeshift,omitempty"` }
type SubtitlesSearchParameters ¶
type SubtitlesSearchParameters struct { AITranslated string `url:"ai_translated,omitempty"` EpisodeNumber int `url:"episode_number,omitempty"` ForeignPartsOnly string `url:"foreign_parts_only,omitempty"` HearingImpaired string `url:"hearing_impaired,omitempty"` ID ID `url:"id,omitempty"` IMDBID ID `url:"imdb_id,omitempty"` Languages []string `url:"languages,omitempty" del:","` MachineTranslated string `url:"machine_translated,omitempty"` Moviehash string `url:"moviehash,omitempty"` MoviehashMatch string `url:"moviehash_match,omitempty"` OrderBy string `url:"order_by,omitempty"` OrderDirection string `url:"order_direction,omitempty"` Page int `url:"page,omitempty"` ParentFeatureID ID `url:"parent_feature_id,omitempty"` ParentIMDBID ID `url:"parent_imdb_id,omitempty"` ParentTMDBID ID `url:"parent_tmdb_id,omitempty"` Query string `url:"query,omitempty"` SeasonNumber int `url:"season_number,omitempty"` TMDBID ID `url:"tmdb_id,omitempty"` TrustedSources string `url:"trusted_sources,omitempty"` Type string `url:"type,omitempty"` UserID ID `url:"user_id,omitempty"` Year int `url:"year,omitempty"` }
type SubtitlesService ¶
type SubtitlesService service
func (*SubtitlesService) Download ¶
func (s *SubtitlesService) Download(ctx context.Context, p *SubtitlesDownloadParameters) (*SubtitlesDownloadResponse, *Response, error)
Requests a download URL for a subtitles.
func (*SubtitlesService) Latest ¶
func (s *SubtitlesService) Latest(ctx context.Context, p *SubtitlesLatestParameters) ([]*SubtitleEntity, *Response, error)
Discovers the last uploaded subtitles.
func (*SubtitlesService) Popular ¶
func (s *SubtitlesService) Popular(ctx context.Context, p *SubtitlesPopularParameters) ([]*SubtitleEntity, *Response, error)
Discovers popular subtitles, according to last 30 days downloads.
func (*SubtitlesService) Search ¶
func (s *SubtitlesService) Search(ctx context.Context, p *SubtitlesSearchParameters) ([]*SubtitleEntity, *Response, error)
Searches for subtitles.
type User ¶
type User struct { AllowedDownloads *int `json:"allowed_downloads,omitempty"` AllowedTranslations *int `json:"allowed_translations,omitempty"` DownloadsCount *int `json:"downloads_count,omitempty"` ExtInstalled *bool `json:"ext_installed,omitempty"` Level *string `json:"level,omitempty"` RemainingDownloads *int `json:"remaining_downloads,omitempty"` UserID *ID `json:"user_id,omitempty"` Username *string `json:"username,omitempty"` VIP *bool `json:"vip,omitempty"` }
type UserAgentError ¶
type UserAgentError ResponseError
func (*UserAgentError) Error ¶
func (e *UserAgentError) Error() string