Younify Connect SDK main object.

Use the shared singleton instance to interact with the sdk. Before the sdk can be meaningfully used configure must be called.

Implements

Implemented by

Accessors

Methods

  • Configures the SDK with the specified options.

    Parameters

    • options: ConnectOptions

      The configuration options.

      Before using the sdk it must be configured by using this method with a valid ConnectOptions instance. It is safe to call this method repeatedly to change the options dynamically at runtime if desired.

    Returns Promise<void>

  • Configures the SDK with the specified options.

    Parameters

    • options: ConnectOptions

      The configuration options.

      Before using the sdk it must be configured by using this method with a valid ConnectOptions instance. It is safe to call this method repeatedly to change the options dynamically at runtime if desired.

    Returns Promise<void>

  • Sets the user's tokens.

    Parameters

    • accessToken: null | string

      The user's access token.

    • refreshToken: null | string

      The user's refresh token.

      Set the user's access and refresh tokens that are required for accessing streaming services. User tokens can be obtained by creating a user object from the backend api.

    Returns Promise<void>

  • Sets the user's tokens.

    Parameters

    • accessToken: null | string

      The user's access token.

    • refreshToken: null | string

      The user's refresh token.

      Set the user's access and refresh tokens that are required for accessing streaming services. User tokens can be obtained by creating a user object from the backend api.

    Returns Promise<void>

  • Requests the user to consent to the privacy policy if it has not yet been accepted.

    Parameters

    • cancellationTicket: null | CancellationTicket

      The ticket to manually cancel the operation.

    Returns Promise<boolean>

    A boolean indicating whether the user consented or not.

    Opens the privacy policy consent flow if the privacy policy has not yet been accepted or completes immediately with true if it has.

  • Requests the user to consent to the privacy policy if it has not yet been accepted.

    Parameters

    • cancellationTicket: null | CancellationTicket

      The ticket to manually cancel the operation.

    Returns Promise<boolean>

    A boolean indicating whether the user consented or not.

    Opens the privacy policy consent flow if the privacy policy has not yet been accepted or completes immediately with true if it has.

  • Link a streaming service.

    Parameters

    Returns Promise<boolean>

    A boolean indicating whether the service was linked or not.

    Opens the service linking flow which involves a web view login for the specified service followed by profile selection and optional pin collection if supported. If linking is successful, the success flag will be true. If linking was canceled then the success flag will be false. If linking fails the promise will reject.

    Caution: Given the task based architecture of the sdk and the asynchronous nature of this method, care should be taken when invoking it from user interactive elements to debounce or otherwise prevent multiple invocations until the previous one completes.

  • Link a streaming service.

    Parameters

    Returns Promise<boolean>

    A boolean indicating whether the service was linked or not.

    Opens the service linking flow which involves a web view login for the specified service followed by profile selection and optional pin collection if supported. If linking is successful, the success flag will be true. If linking was canceled then the success flag will be false. If linking fails the promise will reject.

    Caution: Given the task based architecture of the sdk and the asynchronous nature of this method, care should be taken when invoking it from user interactive elements to debounce or otherwise prevent multiple invocations until the previous one completes.

  • Manage a linked service.

    Parameters

    Returns Promise<void>

    The service object that was managed.

    Opens the linked service management flow which allows the user to change their profile selection and pin if supported.

    Caution: Given the task based architecture of the sdk and the asynchronous nature of this method, care should be taken when invoking it from user interactive elements to debounce or otherwise prevent multiple invocations until the previous one completes.

  • Manage a linked service.

    Parameters

    Returns Promise<void>

    The service object that was managed.

    Opens the linked service management flow which allows the user to change their profile selection and pin if supported.

    Caution: Given the task based architecture of the sdk and the asynchronous nature of this method, care should be taken when invoking it from user interactive elements to debounce or otherwise prevent multiple invocations until the previous one completes.

  • Unlink a linked service.

    Parameters

    Returns Promise<void>

    The service object that was unlinked.

  • Unlink a linked service.

    Parameters

    Returns Promise<void>

    The service object that was unlinked.

  • Fetch all services.

    Parameters

    • cancellationTicket: null | CancellationTicket

      The ticket to manually cancel the operation.

    Returns Promise<StreamingService[]>

    All services.

    Retrieves a list of all services.

  • Fetch all services.

    Parameters

    • cancellationTicket: null | CancellationTicket

      The ticket to manually cancel the operation.

    Returns Promise<StreamingService[]>

    All services.

    Retrieves a list of all services.

  • Fetch linked services.

    Parameters

    • cancellationTicket: null | CancellationTicket

      The ticket to manually cancel the operation.

    Returns Promise<StreamingService[]>

    All linked services.

    Retrieves a list of all the user's linked services.

  • Fetch linked services.

    Parameters

    • cancellationTicket: null | CancellationTicket

      The ticket to manually cancel the operation.

    Returns Promise<StreamingService[]>

    All linked services.

    Retrieves a list of all the user's linked services.

  • Fetch linked services.

    Parameters

    • cancellationTicket: null | CancellationTicket

      The ticket to manually cancel the operation.

    Returns Promise<StreamingService[]>

    All broken services.

    Retrieves a list of all the user's broken services.

  • Fetch linked services.

    Parameters

    • cancellationTicket: null | CancellationTicket

      The ticket to manually cancel the operation.

    Returns Promise<StreamingService[]>

    All broken services.

    Retrieves a list of all the user's broken services.

  • Fetch all streaming categories.

    Parameters

    • cancellationTicket: null | CancellationTicket

      The ticket to manually cancel the operation.

    Returns Promise<StreamingCategory[]>

    All streaming categories.

    Retrieves a list of all streaming categories.

  • Fetch all streaming categories.

    Parameters

    • cancellationTicket: null | CancellationTicket

      The ticket to manually cancel the operation.

    Returns Promise<StreamingCategory[]>

    All streaming categories.

    Retrieves a list of all streaming categories.

  • Fetch streaming category contents.

    Parameters

    • categories: StreamingCategory[]

      The list of categories to fetch content for.

    • services: StreamingService[]

      The list of streaming services to fetch content for.

    • cancellationTicket: null | CancellationTicket

      The ticket to manually cancel the operation.

    • serviceError: null | ((service: StreamingService, error: Error) => void)

      The optional error handler to call when a problem occurs accessing a service.

    • categoryServiceComplete: null | ((category: StreamingCategory, service: StreamingService, content: StreamingContent[], error: null | Error) => void)

      The optional completion handler to call when retrieving content for a single category and service.

    Returns Promise<FetchContentCategoryResult[]>

    Complete fetched content for all services and all categories or an empty array if categoryServiceComplete is non-null.

    Retrieves the content for the categories and services specified. serviceError will be called when a service error occurs. categoryServiceComplete will be called with the results for a single category-service pair. Specifying this callback will cause the response promise to resolve with an empty array for performance.

  • Fetch streaming category contents.

    Parameters

    • categories: StreamingCategory[]

      The list of categories to fetch content for.

    • services: StreamingService[]

      The list of streaming services to fetch content for.

    • cancellationTicket: null | CancellationTicket

      The ticket to manually cancel the operation.

    • serviceError: null | ((service: StreamingService, error: Error) => void)

      The optional error handler to call when a problem occurs accessing a service.

    • categoryServiceComplete: null | ((category: StreamingCategory, service: StreamingService, content: StreamingContent[], error: null | Error) => void)

      The optional completion handler to call when retrieving content for a single category and service.

    Returns Promise<FetchContentCategoryResult[]>

    Complete fetched content for all services and all categories or an empty array if categoryServiceComplete is non-null.

    Retrieves the content for the categories and services specified. serviceError will be called when a service error occurs. categoryServiceComplete will be called with the results for a single category-service pair. Specifying this callback will cause the response promise to resolve with an empty array for performance.

  • Fetch content children.

    Parameters

    Returns Promise<StreamingContent[]>

    The children of the requested content item.

    Retrieves the children of the given parent content object. The content object must be a folder to have children.

    Examples include using a content that represents a series where the children would be its seasons, or a content that represents a season where the children would be its episodes.

  • Fetch content children.

    Parameters

    Returns Promise<StreamingContent[]>

    The children of the requested content item.

    Retrieves the children of the given parent content object. The content object must be a folder to have children.

    Examples include using a content that represents a series where the children would be its seasons, or a content that represents a season where the children would be its episodes.

  • Fetch content details.

    Parameters

    Returns Promise<StreamingContentDetails>

    The details of the requested content item.

    Retrieves content details.

    Details or additional metadata properties currently include browse path and estimated durations.

  • Fetch content details.

    Parameters

    Returns Promise<StreamingContentDetails>

    The details of the requested content item.

    Retrieves content details.

    Details or additional metadata properties currently include browse path and estimated durations.

  • Search a streaming service.

    Parameters

    • services: StreamingService[]

      The streaming service to search.

    • searchPhrase: string

      The list of streaming services to fetch content for.

    • cancellationTicket: null | CancellationTicket

      The ticket to manually cancel the operation.

    • serviceComplete: null | ((service: StreamingService, content: StreamingContent[], error: null | Error) => void)

      The optional completion handler to call when retrieving search results for a single service.

    Returns Promise<SearchContentServiceResult[]>

    Complete search results for all services or an empty array if serviceComplete is non-null.

    Searches the given services with the specified searchPhrase. serviceComplete will be called with the results for a single service. Specifying this callback will cause the response promise to resolve with an empty array for performance.

  • Search a streaming service.

    Parameters

    • services: StreamingService[]

      The streaming service to search.

    • searchPhrase: string

      The list of streaming services to fetch content for.

    • cancellationTicket: null | CancellationTicket

      The ticket to manually cancel the operation.

    • serviceComplete: null | ((service: StreamingService, content: StreamingContent[], error: null | Error) => void)

      The optional completion handler to call when retrieving search results for a single service.

    Returns Promise<SearchContentServiceResult[]>

    Complete search results for all services or an empty array if serviceComplete is non-null.

    Searches the given services with the specified searchPhrase. serviceComplete will be called with the results for a single service. Specifying this callback will cause the response promise to resolve with an empty array for performance.

  • Fetch an image.

    Parameters

    • url: string

      The image url to fetch.

    • cancellationTicket: null | CancellationTicket

      The ticket to manually cancel the operation.

    Returns Promise<string>

    Image data as a base64 string.

    Retrieves the image from the specified image url.

    Directly fetching image urls in any other way can lead to missing data or 404s depending on the streaming service.

  • Fetch an image.

    Parameters

    • url: string

      The image url to fetch.

    • cancellationTicket: null | CancellationTicket

      The ticket to manually cancel the operation.

    Returns Promise<string>

    Image data as a base64 string.

    Retrieves the image from the specified image url.

    Directly fetching image urls in any other way can lead to missing data or 404s depending on the streaming service.