sportal365-content-sdk
TypeScript icon, indicating that this package has built-in type declarations

0.10.13 • Public • Published

Sportal365 Typescript SDK

SDK Installation

NPM

npm install sportal365-content-sdk

Yarn

yarn add sportal365-content-sdk

SDK Example Usage

Example

import withAuthorization from "sportal365-content-sdk/oauth";
import { ContentApi } from "sportal365-content-sdk";

(async () => {
  const authRequest = withAuthorization(
    clientId,
    clientSecret,
    username,
    password
  );

  const auth = await authRequest();
  const sdk = new ContentApi(auth);
  const articles = await sdk.articles.getArticlesV2({
    page: 1,
    language: "en",
    limit: 10,
    project: "smp.demo",
  });
})();

Available Resources and Operations

  • getArticleById - An article obtained by its ID. Note the Swagger list of returned properties does not include custom created properties from /articles/properties. Note also that content properties is_adult_content/is_sensitive_content would always be included in response DTOs as adult_content/sensitive_content for backward compatibility
  • getArticles - A paginated list of articles. Note the Swagger list of returned properties does not include custom created properties from /articles/properties. Note also that content properties is_adult_content/is_sensitive_content would always be included in response DTOs as adult_content/sensitive_content for backward compatibility
  • getArticlesV2 - A paginated list of articles. Note the Swagger list of returned properties does not include custom created properties from /articles/properties. Note also that content properties is_adult_content/is_sensitive_content would always be included in response DTOs as adult_content/sensitive_content for backward compatibility
  • getRelatedArticles - Get related content of an article. No resources from provider:sports-search-api will be returned
  • getRelatedArticlesV2 - Get related content of an article, including sport relations from different providers
  • searchArticles - A paginated list of articles. Note the list of queried/returned properties does not include custom created properties from /articles/properties
  • searchArticlesV2 - A paginated list of articles. Note the list of queried/returned properties does not include custom created properties from /articles/properties. Note also that content properties is_adult_content/is_sensitive_content would always be included in response DTOs as adult_content/sensitive_content for backward compatibility
  • getBannerById - Get Single Banner. Note the Swagger list of returned properties does not include custom created properties from /banners/properties
  • getBanners - List of all Banners. Note the Swagger list of returned properties does not include custom created properties from /banners/properties
  • searchBanners - A filtered list of Banners. Note the list of queried/returned properties does not include custom created properties from /banners/properties
  • getGalleries - A paginated list of galleries. Note the Swagger list of returned properties does not include custom created properties from /galleries/properties. Note also that content properties is_adult_content/is_sensitive_content would always be included in response DTOs as adult_content/sensitive_content for backward compatibility
  • getGalleriesV2 - A paginated list of galleries. Note the Swagger list of returned properties does not include custom created properties from /galleries/properties. Note also that content properties is_adult_content/is_sensitive_content would always be included in response DTOs as adult_content/sensitive_content for backward compatibility
  • getGalleryById - A gallery obtained by its ID. Note the Swagger list of returned properties does not include custom created properties from /galleries/properties. Note also that content properties is_adult_content/is_sensitive_content would always be included in response DTOs as adult_content/sensitive_content for backward compatibility
  • getRelatedGalleries - Get related content of a gallery. No resources from provider:sports-search-api will be returned
  • getRelatedGalleriesV2 - Get related content of a gallery, including sport relations from different providers
  • searchGalleries - A paginated list of galleries. Note the list of queried/returned properties does not include custom created properties from /galleries/properties. Note also that content properties is_adult_content/is_sensitive_content would always be included in response DTOs as adult_content/sensitive_content for backward compatibility
  • searchGalleriesV2 - A paginated list of galleries. Note the list of queried/returned properties does not include custom created properties from /galleries/properties. Note also that content properties is_adult_content/is_sensitive_content would always be included in response DTOs as adult_content/sensitive_content for backward compatibility
  • getLatestFeed - Aggregated list of articles, videos, galleries, liveblogs from the last 5 days
  • getMappings - Get ID mappings according to various filters
  • getRelatedVideos - Get related content of a video. No resources from provider:sports-search-api will be returned
  • getRelatedVideosV2 - Get related content of a video, including sport relations from different providers
  • getVideoById - A video obtained by its ID. Note the Swagger list of returned properties does not include custom created properties from /videos/properties. Note also that content properties is_adult_content/is_sensitive_content would always be included in response DTOs as adult_content/sensitive_content for backward compatibility
  • getVideos - A paginated list of videos. Note the Swagger list of returned properties does not include custom created properties from /videos/properties. Note also that content properties is_adult_content/is_sensitive_content would always be included in response DTOs as adult_content/sensitive_content for backward compatibility
  • getVideosV2 - A paginated list of videos. Note the Swagger list of returned properties does not include custom created properties from /videos/properties. Note also that content properties is_adult_content/is_sensitive_content would always be included in response DTOs as adult_content/sensitive_content for backward compatibility
  • searchVideos - A paginated list of videos. Note the list of queried/returned properties does not include custom created properties from /videos/properties. Note also that content properties is_adult_content/is_sensitive_content would always be included in response DTOs as adult_content/sensitive_content for backward compatibility
  • searchVideosV2 - A paginated list of videos. Note the list of queried/returned properties does not include custom created properties from /videos/properties. Note also that content properties is_adult_content/is_sensitive_content would always be included in response DTOs as adult_content/sensitive_content for backward compatibility
  • getRelatedWikiPages - Get related content of a wiki page
  • getWikiPageById - A wiki page obtained by its ID. Note the Swagger list of returned properties does not include custom created properties from /wiki-pages/properties
  • getWikiPages - A paginated list of wiki pages. Note the Swagger list of returned properties does not include custom created properties from /wiki-pages/properties
  • searchWikiPages - A paginated list of wiki pages. Note the list of queried/returned properties does not include custom created properties from /wiki-pages/properties

Server Selection

Select Server by Name

You can override the default server globally by passing a server name to the server: string optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the names associated with the available servers:

Name Server Variables
sandbox https://content.api.sandbox.sportal365.com None
prod https://content.api.sportal365.com None
staging https://content.api.staging.sportal365.com None
integration https://content.api.integration.sportal365.com None
betway https://content.api.de2.sportal365.com None
bet365 https://content.api.de1.sportal365.com None
livescore https://content.api.uk1.sportal365.com None

Example

import withAuthorization from "sportal365-content-sdk/oauth";
import { ContentApi } from "sportal365-content-sdk";

(async () => {
  const authRequest = withAuthorization(
    clientId,
    clientSecret,
    username,
    password,
    "integration"
  );

  const authData = await authRequest();
  const sdk = new ContentApi({
    auth: authData.auth,
    server: "integration",
  });
  const articles = await sdk.articles.getArticlesV2({
    page: 1,
    language: "en",
    limit: 10,
    project: "smp.frontend",
  });
})();

Direct token implementation

Directly pass the token to the SDK instance

If you have an oath token you won't need to go through the authRequest() process and you can directly pass the token to the instance of the ContentApi you are making

import { ContentApi } from "sportal365-content-sdk";

(async () => {
  const sdk = new ContentApi({
    auth: "example_token",
  });
  const articles = await sdk.articles.getArticlesV2({
    page: 1,
    language: "en",
    limit: 10,
    project: "smp.frontend",
  });
})();

Readme

Keywords

none

Package Sidebar

Install

npm i sportal365-content-sdk

Weekly Downloads

1

Version

0.10.13

License

none

Unpacked Size

1.32 MB

Total Files

296

Last publish

Collaborators

  • mediaplatform