Skip to content

Commit

Permalink
Merge pull request #43 from allanpk716/master
Browse files Browse the repository at this point in the history
Introduced a method, SetAlternateBaseURL(), enabling the selection of…
  • Loading branch information
cyruzin committed Apr 15, 2023
2 parents 48672b8 + 294eecf commit 45ea5e2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tmdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ var json = jsoniter.ConfigFastest

// TMDb constants
const (
baseURL = "https://api.themoviedb.org/3"
defaultBaseURL = "https://api.themoviedb.org/3"
alternateBaseURL = "https://api.tmdb.org/3"
permissionURL = "https://www.themoviedb.org/authenticate/"
authenticationURL = "/authentication/"
movieURL = "/movie/"
Expand All @@ -44,6 +45,8 @@ const (
watchProvidersURL = "/watch/providers/"
)

var baseURL = defaultBaseURL

// Client type is a struct to instantiate this pkg.
type Client struct {
// TMDb apiKey to use the client.
Expand Down Expand Up @@ -218,6 +221,11 @@ func (c *Client) fmtOptions(
return options
}

// SetAlternateBaseURL sets an alternate base url.
func (c *Client) SetAlternateBaseURL() {
baseURL = alternateBaseURL
}

// Error type represents an error returned by the TMDB API.
type Error struct {
StatusMessage string `json:"status_message,omitempty"`
Expand Down

0 comments on commit 45ea5e2

Please sign in to comment.