-
Notifications
You must be signed in to change notification settings - Fork 0
/
watchproviders.go
105 lines (96 loc) · 3 KB
/
watchproviders.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
package wraptmdb
import "github.com/kwangsing3/http_methods_golang"
/*
* The MIT License (MIT)
*
* Copyright (c) kwangsing3
*
* https://github.com/wrapTMDB/wraptmdb_go
*
*/
type watchproviders struct{}
var Watchproviders watchproviders
/********************
* 1.GET /watch/providers/regions
* @description Returns a list of all of the countries we have watch provider (OTT/streaming) data for.
* @param {string} language(optional)
* @returns JSON
* @doc https://developers.themoviedb.org/3/watch-providers/get-available-regions
********************/
func (w *watchproviders) GetAvailableRegions(language string) interface{} {
var token = c_module.GetToken()
var header = c_module.GetHeader()
var targetURL string = baseURL + c_module.Route.WATCHPROVIDERS + "regions" + ` api_key=` + token
if language != "" {
targetURL += `&language=` + language
}
if token == "UnitTest_api_key" {
return targetURL
}
var data, _ = http_methods_golang.GET(targetURL, header)
return data
}
/********************
* 2.GET /watch/providers/movie
* @description Returns a list of the watch provider (OTT/streaming) data we have available for movies.
* You can specify a watch_region param if you want to further filter the list by country.
* @param {string} language(optional)
* @param {string} watch_region(optional)
* @returns JSON
* @doc https://developers.themoviedb.org/3/watch-providers/get-movie-providers
********************/
func (w *watchproviders) GetMovieProviders(
language string,
watch_region string,
) interface{} {
var token = c_module.GetToken()
var header = c_module.GetHeader()
var targetURL string = baseURL +
c_module.Route.WATCHPROVIDERS +
c_module.Route.MOVIE +
` api_key=` + token
if language != "" {
targetURL += `&language=` + language
}
if watch_region != "" {
targetURL += `&watch_region=` + watch_region
}
if token == "UnitTest_api_key" {
return targetURL
}
var data, _ = http_methods_golang.GET(targetURL, header)
return data
}
/********************
* 3.GET /watch/providers/tv
* @description Returns a list of the watch provider (OTT/streaming) data we have available for TV series.
* You can specify a watch_region param if you want to further filter the list by country.
* @param {string} language(optional)
* @param {string} watch_region(optional)
* @returns JSON
* @doc https://developers.themoviedb.org/3/watch-providers/get-tv-providers
********************/
func (w *watchproviders) GetTVProviders(language string, watch_region string) interface{} {
var token = c_module.GetToken()
var header = c_module.GetHeader()
var targetURL string = baseURL +
c_module.Route.WATCHPROVIDERS +
c_module.Route.TV +
` api_key=` + token
if language != "" {
targetURL += `&language=` + language
}
if watch_region != "" {
targetURL += `&watch_region=` + watch_region
}
if token == "UnitTest_api_key" {
return targetURL
}
var data, _ = http_methods_golang.GET(targetURL, header)
return data
}
/*
1.GET GetAvailableRegions
2.GET GetMovieProviders
3.GET GetTVProviders
*/