Skip to content

Commit 45ea5e2

Browse files
authored
Merge pull request #43 from allanpk716/master
Introduced a method, SetAlternateBaseURL(), enabling the selection of…
2 parents 48672b8 + 294eecf commit 45ea5e2

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tmdb.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ var json = jsoniter.ConfigFastest
2121

2222
// TMDb constants
2323
const (
24-
baseURL = "https://api.themoviedb.org/3"
24+
defaultBaseURL = "https://api.themoviedb.org/3"
25+
alternateBaseURL = "https://api.tmdb.org/3"
2526
permissionURL = "https://www.themoviedb.org/authenticate/"
2627
authenticationURL = "/authentication/"
2728
movieURL = "/movie/"
@@ -44,6 +45,8 @@ const (
4445
watchProvidersURL = "/watch/providers/"
4546
)
4647

48+
var baseURL = defaultBaseURL
49+
4750
// Client type is a struct to instantiate this pkg.
4851
type Client struct {
4952
// TMDb apiKey to use the client.
@@ -218,6 +221,11 @@ func (c *Client) fmtOptions(
218221
return options
219222
}
220223

224+
// SetAlternateBaseURL sets an alternate base url.
225+
func (c *Client) SetAlternateBaseURL() {
226+
baseURL = alternateBaseURL
227+
}
228+
221229
// Error type represents an error returned by the TMDB API.
222230
type Error struct {
223231
StatusMessage string `json:"status_message,omitempty"`

0 commit comments

Comments
 (0)