{"_id":"56ad4721cdbb3d170064eaf9","githubsync":"","version":{"_id":"56acd71213ac890d001c3c7d","project":"56acd71213ac890d001c3c7a","__v":15,"createdAt":"2016-01-30T15:30:26.928Z","releaseDate":"2016-01-30T15:30:26.928Z","categories":["56acd71313ac890d001c3c7e","56acd8f113ac890d001c3c81","56acd8f95ac4060d0027865e","56acd93a13ac890d001c3c82","56ad20660ab3c00d00ce3347","56ad356a2a7860170013f714","56ad47eb0ab3c00d00ce334f","56afd523bc304a0d00ace1df","56b29a019621f20d00efb37e","56b657e11bc6970d009feee7","5845cc3c39950c1b002afe77","5845cde163c11b250037967e","5846efd45d064323007b17b4","588604da4674e32300efd160","588627882393d50f00f1322c"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"project":"56acd71213ac890d001c3c7a","user":"56acd6caa040860d00ac94a2","__v":4,"category":{"_id":"56ad356a2a7860170013f714","__v":5,"version":"56acd71213ac890d001c3c7d","pages":["56ad35e23fc1020d009776e3","56ad37781a7ee417009ced1d","56ad3859693f0a0d0085f0cd","56ad38d71c09150d00a183ad","56ad4721cdbb3d170064eaf9"],"project":"56acd71213ac890d001c3c7a","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-01-30T22:12:58.236Z","from_sync":false,"order":10,"slug":"singularity-on-demand-events","title":"Singularity: On-Demand Events"},"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-01-30T23:28:33.759Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":4,"body":"This event is used to return the tiers for a channel. It is used as follows:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"socket.emit('channel-tiers', {\\n  access_token: \\\"channel Oauth2 access token\\\"\\n  params: {\\n      subscriberInfo: true, \\n      subscriberCount: true, \\n      sort: 'oldest'\\n  }\\n});\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n**params** is a JSON object of optional parameters that can be used to request particular subscriber data for the specified channel(s) for each tier. Each element of **params** is described as follows:\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Parameter\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"subscriberInfo\",\n    \"0-1\": \"Boolean\",\n    \"0-2\": \"Default false. Returns subscriber info for each tier.\",\n    \"1-0\": \"subscriberCount\",\n    \"1-1\": \"Boolean\",\n    \"1-2\": \"Default is false. If true, returns the subscriber count for each tier.\",\n    \"2-0\": \"sort\",\n    \"2-1\": \"String\",\n    \"2-2\": \"Applies a sort to the returned results. Options include:\\n\\n* **newest**: Default. Sort from newest to tier to oldest.\\n* **oldest**: Sort from oldest tier to newest.\"\n  },\n  \"cols\": 3,\n  \"rows\": 3\n}\n[/block]\nThis event emits **app-channel-tiers** back to your application upon completion. If using Socket.IO, you would listen for the event as follows:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"socket.on('app-channel-tiers', function(response){\\n   // Do something with response.\\n});\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nThe **response** JSON object has the following structure:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n   result: {\\n      status: 1,\\n      message: \\\"Channel Tiers.\\\"\\n   },\\n   channel: {\\n      names: {\\n         gamewisp: \\\"GameWisp channel name\\\",\\n         twitch: \\\"twitch channel name\\\",\\n         youtube: \\\"youtube channel name\\\"\\n      },\\n      ids: {\\n         gamewisp: \\\"channel identifier\\\",\\n         twitch: \\\"12312312q\\\",\\n         youtube: \\\"UCiqp4J8asdkssssssssdfae\\\"\\n      }  \\n   },\\n   data:{\\n         channel_id: \\\"channel-identifier\\\",\\n         status: \\\"authenticated\\\",\\n         tiers: [\\n            {\\n               id: \\\"123\\\",\\n               title: \\\"Tier Title\\\",\\n               level: \\\"1\\\",\\n               cost: \\\"4.99\\\",\\n               description: \\\"Tier description\\\",\\n               published: true,\\n               subscriber_count: \\\"12\\\",\\n               subscribers: [\\n                  {\\n                     ids: {\\n                        gamewisp: \\\"12354\\\",\\n                        twitch: null\\n                     },\\n                     usernames: {\\n                        gamewisp: \\\"gamewisp-user-name\\\",\\n                        twitch: null\\n                     },\\n                     status: \\\"active\\\",\\n                     amount: \\\"4.99\\\",\\n                     subscribed_at: \\\"2015-05-21 00:00:00\\\",\\n                     end_of_access: \\\"2016-01-21 00:00:00\\\",\\n                     tier_id: \\\"123\\\"\\n                  },\\n                 //More subscribers...\\n               ],\\n               benefits: [\\n                  {\\n                     id: \\\"3\\\",\\n                     delivery: \\\"delivery-messaging\\\",\\n                     title: \\\"Subscriber Messaging\\\",\\n                     description: \\\"Receive Subscriber-only messages from me.\\\",\\n                     channel_data: null,\\n                     type: \\\"unknown-type\\\",\\n                     month_delay: null,\\n                     recurring: false,\\n                     recurring_input: false,\\n                     receieve_immediately: false,\\n                     removed_at: null,\\n                     subscriber_limit: null,\\n                     tier_bonus: false,\\n                     quantity: 1,\\n                     multiplier: 1\\n                  },\\n                  //More benefits...\\n               ]\\n            },\\n            //More tiers...\\n         ]\\n      }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nNote that if **subscriberCount** and **subscriberInfo** are false, the **subscriber_count** and **subscribers** fields will not be present.\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"This response may be very large\",\n  \"body\": \"Depending on how you use this event, the resulting response object can be very large.\"\n}\n[/block]","excerpt":"Request the tiers for a particular channel.","slug":"channel-tiers","type":"fn","title":"channel-tiers"}

channel-tiers

Request the tiers for a particular channel.

This event is used to return the tiers for a channel. It is used as follows: [block:code] { "codes": [ { "code": "socket.emit('channel-tiers', {\n access_token: \"channel Oauth2 access token\"\n params: {\n subscriberInfo: true, \n subscriberCount: true, \n sort: 'oldest'\n }\n});", "language": "javascript" } ] } [/block] **params** is a JSON object of optional parameters that can be used to request particular subscriber data for the specified channel(s) for each tier. Each element of **params** is described as follows: [block:parameters] { "data": { "h-0": "Parameter", "h-1": "Type", "h-2": "Description", "0-0": "subscriberInfo", "0-1": "Boolean", "0-2": "Default false. Returns subscriber info for each tier.", "1-0": "subscriberCount", "1-1": "Boolean", "1-2": "Default is false. If true, returns the subscriber count for each tier.", "2-0": "sort", "2-1": "String", "2-2": "Applies a sort to the returned results. Options include:\n\n* **newest**: Default. Sort from newest to tier to oldest.\n* **oldest**: Sort from oldest tier to newest." }, "cols": 3, "rows": 3 } [/block] This event emits **app-channel-tiers** back to your application upon completion. If using Socket.IO, you would listen for the event as follows: [block:code] { "codes": [ { "code": "socket.on('app-channel-tiers', function(response){\n // Do something with response.\n});", "language": "javascript" } ] } [/block] The **response** JSON object has the following structure: [block:code] { "codes": [ { "code": "{\n result: {\n status: 1,\n message: \"Channel Tiers.\"\n },\n channel: {\n names: {\n gamewisp: \"GameWisp channel name\",\n twitch: \"twitch channel name\",\n youtube: \"youtube channel name\"\n },\n ids: {\n gamewisp: \"channel identifier\",\n twitch: \"12312312q\",\n youtube: \"UCiqp4J8asdkssssssssdfae\"\n } \n },\n data:{\n channel_id: \"channel-identifier\",\n status: \"authenticated\",\n tiers: [\n {\n id: \"123\",\n title: \"Tier Title\",\n level: \"1\",\n cost: \"4.99\",\n description: \"Tier description\",\n published: true,\n subscriber_count: \"12\",\n subscribers: [\n {\n ids: {\n gamewisp: \"12354\",\n twitch: null\n },\n usernames: {\n gamewisp: \"gamewisp-user-name\",\n twitch: null\n },\n status: \"active\",\n amount: \"4.99\",\n subscribed_at: \"2015-05-21 00:00:00\",\n end_of_access: \"2016-01-21 00:00:00\",\n tier_id: \"123\"\n },\n //More subscribers...\n ],\n benefits: [\n {\n id: \"3\",\n delivery: \"delivery-messaging\",\n title: \"Subscriber Messaging\",\n description: \"Receive Subscriber-only messages from me.\",\n channel_data: null,\n type: \"unknown-type\",\n month_delay: null,\n recurring: false,\n recurring_input: false,\n receieve_immediately: false,\n removed_at: null,\n subscriber_limit: null,\n tier_bonus: false,\n quantity: 1,\n multiplier: 1\n },\n //More benefits...\n ]\n },\n //More tiers...\n ]\n }\n}", "language": "json" } ] } [/block] Note that if **subscriberCount** and **subscriberInfo** are false, the **subscriber_count** and **subscribers** fields will not be present. [block:callout] { "type": "warning", "title": "This response may be very large", "body": "Depending on how you use this event, the resulting response object can be very large." } [/block]