Skip to content

Latest commit

 

History

History
492 lines (412 loc) · 13.5 KB

Documentation.md

File metadata and controls

492 lines (412 loc) · 13.5 KB

Classes

API

Core class for Samsung TV Plus API.

Auth

Authentication APIs

Content

Content APIs

## API Core class for Samsung TV Plus API.

Kind: global class

new API(endpoint, opts)

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://...', {...})

apI.getEndpoint() ⇒ string

return api endpoint

Kind: instance method of API

apI.getKeys() ⇒ object

return keys

Kind: instance method of API

apI.setToken(val)

set token

Kind: instance method of API

Param Type
val string

apI.getToken() ⇒ string

return token

Kind: instance method of API

apI.getCountry() ⇒ string

return contry code

Kind: instance method of API

apI.request(uri, opts, cb)

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)

Auth

Authentication APIs

Kind: global class

new Auth(api)

Param Type
api Auth

Example

var auth = new Auth(api)

auth.api : API

api instance

Kind: instance property of Auth

auth.loadSeedkey(cb)

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

Content APIs

Kind: global class

new Content(api)

Param Type
api Content

Example

var content = new Content(api)

content.api : API

api instance

Kind: instance property of Content

content.loadRequest(type, opts, cb)

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'))
 })

content.loadPrograms(opts, cb)

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'))
 })

content.loadSeries(opts, cb)

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'))
 })

content.loadGroups(opts, cb)

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'))
 })

content.loadIntiles(opts, cb)

load intile

Kind: instance method of Content

Param Type Description
opts LOAD_OPTIONS
cb function cb(err, data)

content.loadSchedules(opts, cb)

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'))
 })

content.updateRequest(type, items, opts, cb)

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)
 })

content.updatePrograms(items, opts, cb)

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)
 })

content.updateSeries(items, opts, cb)

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)
 })

content.updateGroups(items, opts, cb)

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)
 })

content.updateIntiles(items, opts, cb)

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)
 })

content.updateSchedules(items, opts, cb)

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)
 })

content.deleteRequest(type, items, opts, cb)

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)
 })

content.deleteSchedules(items, opts, cb)

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)
 })

Content~LOAD_OPTIONS : object

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

Content~UPDATE_OPTIONS : object

Kind: inner typedef of Content
Properties

Name Type Description
country string optional. default api.getCountry()
provider_id string optional. default api.getKeys().provider_id

Content~KEYS : string

Kind: inner typedef of Content
Properties

Name Description
PROGRAM id
SERIES series_id
GROUPS group_id

Content~TYPES : string

Kind: inner typedef of Content
Properties

Name Description
PROGRAM program
SERIES series
GROUPS groups