STSCMSManager
@interface STSCMSManager : NSObject
STSCMSManager provides convenient method to access CMS member resources.
-
Returns the STSCMSManager instance, creating it if it doesn’t exist yet.
Declaration
Objective-C
+ (nonnull STSCMSManager *)sharedManager;
Swift
class func shared() -> STSCMSManager
Return Value
The shared STSCMSManager object.
-
Initialize a new STSCMSManager object with custom host.
Declaration
Objective-C
- (nonnull instancetype)initWithCustomHost:(NSString *_Nullable)customHost;
Swift
init(customHost: String?)
Parameters
customHost
The cutom host to be applied.
Return Value
The STSCMSManager object.
-
Set the member JWT, the JWT will be used when sending request to CMS API. We strongly suggest calling this method as soon as you get your member JWT. If you don’t call this method, other STSCMSManager methods would return the resources that a guest can reach only. If you want your member could get their purchased goods, set their member JWT before call other STSCMSManager methods.
Declaration
Objective-C
- (void)setJWT:(NSString *_Nullable)JWT completion:(void (^_Nullable)(BOOL))completion;
Swift
func setJWT(_ JWT: String?, completion: ((Bool) -> Void)? = nil)
Parameters
JWT
The member token got from StraaS server.
nil
if the current user is a guest.completion
A block object to be executed when the task finishes. This block has no return value and takes one argument: a boolean value indicates whether or not the JWT is succesfully setted. You should successfully configure your app by calling STSApplication’s configureApplication method before setting the JWT, otherwise, member JWT won’t be setted.
-
Request a video that matchs the request parameter.
Declaration
Objective-C
- (NSString *_Nullable) getVideoWithVideoId:(nonnull NSString *)videoId success:(nonnull void (^)(STSVideo *_Nonnull))success failure:(nonnull void (^)(NSError *_Nonnull))failure;
Swift
func getVideoWithVideoId(_ videoId: String, success: @escaping (STSVideo) -> Void, failure: @escaping (Error) -> Void) -> String?
Parameters
videoId
The id of the video you want to find.
success
A block object to be executed when the task finishes successfully. This block has no return value and takes one argument: the STSVideo object.
failure
A block object to be executed when the task finishes unsuccessfully. This block has no return value and takes one argument: the error object describing the error that occurred.
Return Value
The ID of the new request. Returns
nil
if the application is unauthorized. -
Request a playlist that matches the request parameter.
Declaration
Objective-C
- (NSString *_Nullable) getPlaylistWithPlaylistId:(nonnull NSString *)playlistId success:(nonnull void (^)(STSPlaylist *_Nonnull))success failure:(nonnull void (^)(NSError *_Nonnull))failure;
Swift
func getPlaylistWithPlaylistId(_ playlistId: String, success: @escaping (STSPlaylist) -> Void, failure: @escaping (Error) -> Void) -> String?
Parameters
playlistId
The id of the playlist you want to find.
success
A block object to be executed when the task finishes successfully. This block has no return value and takes one argument: the STSPlaylist object.
failure
A block object to be executed when the task finishes unsuccessfully. This block has no return value and takes one argument: the error object describing the error that occurred.
Return Value
The ID of the new request. Returns
nil
if the application is unauthorized. -
Request the list of playlist items of the specified playlist.
Declaration
Objective-C
- (NSString *_Nullable) getPlaylistItemsWithPlaylistId:(nonnull NSString *)playlistId success: (nonnull void (^)( NSArray<STSPlaylistItem *> *_Nonnull))success failure:(nonnull void (^)(NSError *_Nonnull))failure;
Swift
func getPlaylistItems(withPlaylistId playlistId: String, success: @escaping ([STSPlaylistItem]) -> Void, failure: @escaping (Error) -> Void) -> String?
Parameters
playlistId
The id of the playlist you want to to get playlist items.
success
A block object to be executed when the task finishes successfully. This block has no return value and takes one argument: an array of STSPlaylistItem objects.
failure
A block object to be executed when the task finishes unsuccessfully. This block has no return value and takes one argument: the error object describing the error that occurred.
Return Value
The ID of the new request. Returns
nil
if the application is unauthorized. -
Request the list of categories that match the request parameter.
Declaration
Objective-C
- (NSString *_Nullable) getCategoryListWithPage:(NSUInteger)page success:(nonnull void (^)(NSArray<STSCategory *> *_Nonnull, STSPagination *_Nonnull))success failure:(nonnull void (^)(NSError *_Nonnull))failure;
Swift
func getCategoryList(withPage page: UInt, success: @escaping ([STSCategory], STSPagination) -> Void, failure: @escaping (Error) -> Void) -> String?
Parameters
page
The page of results to fetch.
success
A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: an array of STSCategory objects, and the pagination object.
failure
A block object to be executed when the task finishes unsuccessfully. This block has no return value and takes one argument: the error object describing the error that occurred.
Return Value
The ID of the new request. Returns
nil
if the application is unauthorized. -
Request the list of tags that match the request parameter.
Declaration
Objective-C
- (NSString *_Nullable) getTagListWithPage:(NSUInteger)page success:(nonnull void (^)(NSArray<STSTag *> *_Nonnull, STSPagination *_Nonnull))success failure:(nonnull void (^)(NSError *_Nonnull))failure;
Swift
func getTagList(withPage page: UInt, success: @escaping ([STSTag], STSPagination) -> Void, failure: @escaping (Error) -> Void) -> String?
Parameters
page
The page of results to fetch.
success
A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: an array of STSTag objects, and the pagination object.
failure
A block object to be executed when the task finishes unsuccessfully. This block has no return value and takes one argument: the error object describing the error that occurred.
Return Value
The ID of the new request. Returns
nil
if the application is unauthorized. -
Request the list of videos that match the request parameter.
Declaration
Objective-C
- (NSString *_Nullable) getVideoListWithPage:(NSUInteger)page sort:(NSString *_Nullable)sort success:(nonnull void (^)(NSArray<STSVideo *> *_Nonnull, STSPagination *_Nonnull))success failure:(nonnull void (^)(NSError *_Nonnull))failure;
Swift
func getVideoList(withPage page: UInt, sort: String?, success: @escaping ([STSVideo], STSPagination) -> Void, failure: @escaping (Error) -> Void) -> String?
Parameters
page
The page of results to fetch.
sort
Default value is
-created_at
. Data sorted with {+,-} by which column {created_at,start_time,started_at,ccu_statistic_summary.ccu}. Apply - to sort in descending order. For example, sort=-created_at. When you sort data by a column which belongs to its included resource, the resource is included automatically.success
A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: an array of STSVideo objects, and the pagination object.
failure
A block object to be executed when the task finishes unsuccessfully. This block has no return value and takes one argument: the error object describing the error that occurred.
Return Value
The ID of the new request. Returns
nil
if the application is unauthorized. -
Request the list of videos that match the request parameter.
Declaration
Objective-C
- (NSString *_Nullable) getVideoListWithPage:(NSUInteger)page sort:(NSString *_Nullable)sort configuration:(STSGetVideoListConfiguration *_Nullable)configuration success:(nonnull void (^)(NSArray<STSVideo *> *_Nonnull, STSPagination *_Nonnull))success failure:(nonnull void (^)(NSError *_Nonnull))failure;
Swift
func getVideoList(withPage page: UInt, sort: String?, configuration: STSGetVideoListConfiguration?, success: @escaping ([STSVideo], STSPagination) -> Void, failure: @escaping (Error) -> Void) -> String?
Parameters
page
The page of results to fetch.
sort
Default value is
-created_at
. Data sorted with {+,-} by which column {created_at,start_time,started_at,ccu_statistic_summary.ccu}. Apply - to sort in descending order. For example, sort=-created_at. When you sort data by a column which belongs to its included resource, the resource is included automatically.configuration
The configuration defines the request rules of how to get a video list.
success
A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: an array of STSVideo objects, and the pagination object.
failure
A block object to be executed when the task finishes unsuccessfully. This block has no return value and takes one argument: the error object describing the error that occurred.
Return Value
The ID of the new request. Returns
nil
if the application is unauthorized. -
Request the list of playlists that match the request parameter.
Declaration
Objective-C
- (NSString *_Nullable) getPlaylistsWithPage:(NSUInteger)page sort:(NSString *_Nullable)sort success:(nonnull void (^)(NSArray<STSPlaylist *> *_Nonnull, STSPagination *_Nonnull))success failure:(nonnull void (^)(NSError *_Nonnull))failure;
Swift
func getPlaylistsWithPage(_ page: UInt, sort: String?, success: @escaping ([STSPlaylist], STSPagination) -> Void, failure: @escaping (Error) -> Void) -> String?
Parameters
page
The page of results to fetch.
sort
Default value is
-created_at
. Data sorted with {+,-} by which column {created_at}. Apply - to sort in descending order. For example, sort=-created_at. When you sort data by a column which belongs to its included resource, the resource is included automatically.success
A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: an array of STSPlaylist objects, and the pagination object.
failure
A block object to be executed when the task finishes unsuccessfully. This block has no return value and takes one argument: the error object describing the error that occurred.
Return Value
The ID of the new request. Returns
nil
if the application is unauthorized. -
Request a live that match the request parameter.
Declaration
Objective-C
- (NSString *_Nullable) getLiveWithId:(nonnull NSString *)liveId success:(nonnull void (^)(STSLive *_Nonnull))success failure:(nonnull void (^)(NSError *_Nonnull))failure;
Swift
func getLiveWithId(_ liveId: String, success: @escaping (STSLive) -> Void, failure: @escaping (Error) -> Void) -> String?
Parameters
liveId
The id of the live you want to find.
success
A block object to be executed when the task finishes successfully. This block has no return value and takes one argument: the live object.
failure
A block object to be executed when the task finishes unsuccessfully. This block has no return value and takes one argument: the error object describing the error that occurred.
Return Value
The ID of the new request. Returns
nil
if the application is unauthorized. -
Request a list of available lives.
Declaration
Objective-C
- (NSString *_Nullable) getLiveListWithPage:(NSUInteger)page sort:(NSString *_Nullable)sort success:(nonnull void (^)(NSArray<STSLive *> *_Nonnull, STSPagination *_Nonnull))success failure:(nonnull void (^)(NSError *_Nonnull))failure;
Swift
func getLiveList(withPage page: UInt, sort: String?, success: @escaping ([STSLive], STSPagination) -> Void, failure: @escaping (Error) -> Void) -> String?
Parameters
page
The page of results to fetch.
sort
Default value is
-start_time
. Data sorted with {+,-} by which column {created_at,start_time,started_at,ccu_statistic_summary.ccu}. Apply - to sort in descending order. For example, sort=-created_at. When you sort data by a column which belongs to its included resource, the resource is included automatically.success
A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the live object array, and the pagination object.
failure
A block object to be executed when the task finishes unsuccessfully. This block has no return value and takes one argument: the error object describing the error that occurred.
Return Value
The ID of the new request. Returns
nil
if the application is unauthorized. -
Request a list of available lives.
Declaration
Objective-C
- (NSString *_Nullable) getLiveListWithPage:(NSUInteger)page sort:(NSString *_Nullable)sort configuration:(STSGetLiveListConfiguration *_Nullable)configuration success:(nonnull void (^)(NSArray<STSLive *> *_Nonnull, STSPagination *_Nonnull))success failure:(nonnull void (^)(NSError *_Nonnull))failure;
Swift
func getLiveList(withPage page: UInt, sort: String?, configuration: STSGetLiveListConfiguration?, success: @escaping ([STSLive], STSPagination) -> Void, failure: @escaping (Error) -> Void) -> String?
Parameters
page
The page of results to fetch.
sort
Default value is
-start_time
. Data sorted with {+,-} by which column {created_at,start_time,started_at,ccu_statistic_summary.ccu}. Apply - to sort in descending order. For example, sort=-created_at. When you sort data by a column which belongs to its included resource, the resource is included automatically.configuration
The configuration defines the request rules of how to get a live list.
success
A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the live object array, and the pagination object.
failure
A block object to be executed when the task finishes unsuccessfully. This block has no return value and takes one argument: the error object describing the error that occurred.
Return Value
The ID of the new request. Returns
nil
if the application is unauthorized. -
Cancel a request by ID.
Declaration
Objective-C
- (void)cancelRequest:(nonnull NSString *)requestID;
Swift
func cancelRequest(_ requestID: String)
Parameters
requestID
The ID of the request.