Kind: global class
- API
- new API(endpoint, opts)
- .getEndpoint() ⇒
string
- .getKeys() ⇒
object
- .setToken(val)
- .getToken() ⇒
string
- .getCountry() ⇒
string
- .request(uri, opts, cb)
Param | Type |
---|---|
endpoint | string |
opts | object |
opts.devkey | string |
opts.provider_id | string |
opts.provider_name | string |
opts.country | string |
Example
var api = new API('https://...', {...})
return api endpoint
Kind: instance method of API
return keys
Kind: instance method of API
set token
Kind: instance method of API
Param | Type |
---|---|
val | string |
return token
Kind: instance method of API
return contry code
Kind: instance method of API
request
Kind: instance method of API
Param | Type | Description |
---|---|---|
uri | string |
|
opts | object |
|
opts.method | object |
POST , GET default is GET |
opts.data | object |
|
cb | function |
cb(err, data) |
Authentication APIs
Kind: global class
Param | Type |
---|---|
api | Auth |
Example
var auth = new Auth(api)
auth.api : API
api instance
Kind: instance property of Auth
load seedkey
Kind: instance method of Auth
Param | Type | Description |
---|---|---|
cb | function |
cb(err, data) |
Example
auth.loadSeedkey(function (err, data) {
console.log(err, data)
// null, { token: '4cf0....' }
})
Content APIs
Kind: global class
- Content
- new Content(api)
- instance
- .api :
API
- .loadRequest(type, opts, cb)
- .loadPrograms(opts, cb)
- .loadSeries(opts, cb)
- .loadGroups(opts, cb)
- .loadIntiles(opts, cb)
- .loadSchedules(opts, cb)
- .updateRequest(type, items, opts, cb)
- .updatePrograms(items, opts, cb)
- .updateSeries(items, opts, cb)
- .updateGroups(items, opts, cb)
- .updateIntiles(items, opts, cb)
- .updateSchedules(items, opts, cb)
- .deleteRequest(type, items, opts, cb)
- .deleteSchedules(items, opts, cb)
- .api :
- inner
- ~LOAD_OPTIONS :
object
- ~UPDATE_OPTIONS :
object
- ~KEYS :
string
- ~TYPES :
string
- ~LOAD_OPTIONS :
Param | Type |
---|---|
api | Content |
Example
var content = new Content(api)
content.api : API
api instance
Kind: instance property of Content
execute load request
Kind: instance method of Content
Param | Type | Description |
---|---|---|
type | TYPES |
program , series , groups , schedule |
opts | LOAD_OPTIONS |
|
cb | function |
cb(err, data) |
Example
content.loadRequest('program', { page: 1, limit: 5, country: 'KR' }, function (err, data) {
console.log(err, _.pluck(data.items, 'id'))
})
load program
Kind: instance method of Content
Param | Type | Description |
---|---|---|
opts | LOAD_OPTIONS |
|
cb | function |
cb(err, data) |
Example
content.loadPrograms({ page: 1, limit: 5, country: 'KR' }, function (err, data) {
console.log(err, _.pluck(data.items, 'id'))
})
load series
Kind: instance method of Content
Param | Type | Description |
---|---|---|
opts | LOAD_OPTIONS |
|
cb | function |
cb(err, data) |
Example
content.loadSeries({ page: 1, limit: 5, country: 'KR' }, function (err, data) {
console.log(err, _.pluck(data.items, 'series_id'))
})
load groups
Kind: instance method of Content
Param | Type | Description |
---|---|---|
opts | LOAD_OPTIONS |
|
cb | function |
cb(err, data) |
Example
content.loadGroups({ page: 1, limit: 5, country: 'KR' }, function (err, data) {
console.log(err, _.pluck(data.items, 'series_id'))
})
load intile
Kind: instance method of Content
Param | Type | Description |
---|---|---|
opts | LOAD_OPTIONS |
|
cb | function |
cb(err, data) |
load schedules
Kind: instance method of Content
Param | Type | Description |
---|---|---|
opts | LOAD_OPTIONS |
|
cb | function |
cb(err, data) |
Example
content.loadSchedules({ starttime: '2015-12-11T00:56:19+09:00', endtime: '2015-12-11T00:56:19+09:00', country: 'KR' }, function (err, data) {
console.log(err, _.pluck(data.items, 'schedule_id'))
})
execute update request
Kind: instance method of Content
Param | Type | Description |
---|---|---|
type | TYPES |
program , series , groups , schedule |
items | array |
|
opts | UPDATE_OPTIONS |
|
cb | function |
cb(err, result) |
Example
content.updateRequest('program', [{
'id': 'pr000000000025440391'
...
}], { country: 'KR' }, function (err, result) {
console.log(err, result)
})
update program
Kind: instance method of Content
Param | Type | Description |
---|---|---|
items | array |
|
opts | UPDATE_OPTIONS |
|
cb | function |
cb(err, result) |
Example
content.updatePrograms([{
'id': 'pr000000000025440391'
...
}], { country: 'KR' }, function (err, result) {
console.log(err, result)
})
update series
Kind: instance method of Content
Param | Type | Description |
---|---|---|
items | array |
|
opts | UPDATE_OPTIONS |
|
cb | function |
cb(err, result) |
Example
content.updateSeries([{
'id': 'pr000000000025440391'
...
}], { country: 'KR' }, function (err, result) {
console.log(err, result)
})
update groups
Kind: instance method of Content
Param | Type | Description |
---|---|---|
items | array |
|
opts | UPDATE_OPTIONS |
|
cb | function |
cb(err, result) |
Example
content.updateGroups([{
'group_id': 'gr000000000025440391'
...
}], { country: 'KR' }, function (err, result) {
console.log(err, result)
})
update intile
Kind: instance method of Content
Param | Type | Description |
---|---|---|
items | array |
|
opts | UPDATE_OPTIONS |
|
cb | function |
cb(err, result) |
Example
content.updateIntile([{
'category_id': 'ca000000000025440391'
...
}], { country: 'KR', service_id: 'SVID###' }, function (err, result) {
console.log(err, result)
})
update schedule
Kind: instance method of Content
Param | Type | Description |
---|---|---|
items | array |
|
opts | UPDATE_OPTIONS |
|
opts.service_id | string |
|
cb | function |
cb(err, result) |
Example
content.updateSchedules([{
'schedule_id': 'SC000000000025440391'
...
}], { service_id: '', country: 'KR' }, function (err, result) {
console.log(err, result)
})
execute delete request
Kind: instance method of Content
Param | Type | Description |
---|---|---|
type | TYPES |
schedule |
items | array |
|
opts | UPDATE_OPTIONS |
|
cb | function |
cb(err, result) |
Example
content.deleteRequest('program', [{
'id': 'pr000000000025440391'
...
}], { country: 'KR' }, function (err, result) {
console.log(err, result)
})
update schedule
Kind: instance method of Content
Param | Type | Description |
---|---|---|
items | array |
|
opts | UPDATE_OPTIONS |
|
opts.service_id | string |
|
cb | function |
cb(err, result) |
Example
content.deleteSchedules([{
'schedule_id': 'SC000000000025440391'
...
}], { service_id: '', country: 'KR' }, function (err, result) {
console.log(err, result)
})
Kind: inner typedef of Content
Properties
Name | Type | Description |
---|---|---|
country | string |
optional. default api.getCountry() |
provider_id | string |
optional. default api.getKeys().provider_id |
page | number |
optional. default 1 |
limit | number |
optional. default 10 |
starttime | number |
optional. for schedule ex) 2015-12-11T00:56:19+09:00 |
endtime | number |
optional. for schedule ex) 2015-12-11T00:56:19+09:00 |
Kind: inner typedef of Content
Properties
Name | Type | Description |
---|---|---|
country | string |
optional. default api.getCountry() |
provider_id | string |
optional. default api.getKeys().provider_id |
Kind: inner typedef of Content
Properties
Name | Description |
---|---|
PROGRAM | id |
SERIES | series_id |
GROUPS | group_id |
Kind: inner typedef of Content
Properties
Name | Description |
---|---|
PROGRAM | program |
SERIES | series |
GROUPS | groups |