Show

TSL SDK provides methods for fetching details of a specific show and its current event, enabling you to get show and current event details in your app. Retrieve Shows information by "<show-key>". Same key used in the embed and in the url.

For example:

https://talkshop.live/watch/o_HHIe1c8GfZ the "show-key" is o_HHIe1c8GfZ

Show Details

getDetails(showKey:completion:)
Get detailed information about a specific show.

Parameters:

  • showKey: The unique identifier of the show.
  • completion: A closure that will be called once the show details are fetched. It takes a Result enum containing either the ShowData on success or an Error on failure.
let showInstance = Talkshoplive.Show()  
showInstance.getDetails(showKey: "show-key") { result in  
    switch result {  
    case .success(let show):  
        print("Show details: \(show)")  
    case .failure(let error):  
        // Handle error case  
        print("Error fetching show details: \(error)")  
    }  
}

Response:

struct Show: Codable {  
    let id: Int  
    let show_key: String  
    let name: String  
    let description: String  
    let status: String // see status below  
    let hls_playback_url: String // live or null  
    let hls_url: String //vod or null  
    let trailer_url: String //trailer  
    let air_date: datetime  
    let ended_at: datetime  
    let event_id: int
    let duration: int  
}

Show Status

getStatus(showKey:completion:)
Get the current event of a show.

Parameters:

  • showKey: The unique identifier of the show.
  • completion: A closure that will be called once the show details are fetched. It takes a Result enum containing either the ShowData on success or an Error on failure.
let showInstance = Talkshoplive.Show()  
showInstance.getStatus(showKey: "yourShowId") { result in  
    switch result {  
    case .success(let eventData):  
        print("Show's current event' details: \(eventData)")  
    case .failure(let error):  
        // Handle error case  
        print("Error fetching show's current event details: \(error)")  
    }  
}

Response:

struct EventData: Codable {  
    public var name: String
    public var status: String
    public var hls_playback_url: URL
    public var duration: Int
}
  

Show status -
created: the show has not started and trailer_url is ready to be consumed

live : the show is currently live and the stream hls_playback_url is ready to consume.

transcoding: the show is no longer live and the VOD is not available as it is being transcoded

finished: the show is no longer live and the VOD hls_url is ready to be consumed.

Show Products

getProducts(showKey:preLive:completion:)
Get Products list from specific show's details.

Parameters:

  • showKey: The unique identifier of the show.
  • preLive(optional): A flag indicating whether the request is related to pre products. Default is false.
  • completion: A closure that will be called once the products are fetched. It takes a Result enum containing either the [ProductData] on success or an Error on failure.
showInstance.getProducts(showKey: "yourShowKey", preLive: "true/false") { result in
    switch result {
    case .success(let products):
        print("Products: \(products)")
        
        //Please use following to find product's variants information
        for i in products {
            print("Product Details", i)
            if let variants = i.variants, variants.count > 0 {
                for j in variants {
                    print("SKU", (i.sku ?? ""))
                }
            }
        }
    case .failure(let error):
        // Handle error case
        print("Error fetching products list: \(error)")
    }
}