0.10.13 • Published 2 months ago

sportal365-content-sdk v0.10.13

Weekly downloads
-
License
-
Repository
-
Last release
2 months ago

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

articles

  • 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

authors

banners

  • 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

categories

distribution

galleries

  • 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

images

latestFeed

  • getLatestFeed - Aggregated list of articles, videos, galleries, liveblogs from the last 5 days

lists

miscellaneous

  • getMappings - Get ID mappings according to various filters

tags

videos

  • 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

wikiPages

  • 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

commentPolicies

contentOrigins

contentProperties

contentStatuses

contentTypes

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:

NameServerVariables
sandboxhttps://content.api.sandbox.sportal365.comNone
prodhttps://content.api.sportal365.comNone
staginghttps://content.api.staging.sportal365.comNone
integrationhttps://content.api.integration.sportal365.comNone
betwayhttps://content.api.de2.sportal365.comNone
bet365https://content.api.de1.sportal365.comNone
livescorehttps://content.api.uk1.sportal365.comNone

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",
  });
})();
0.10.13

2 months ago

0.10.11

2 months ago

0.10.12

2 months ago

0.10.10

2 months ago

0.10.9

3 months ago

0.10.7

3 months ago

0.10.8

3 months ago

0.10.5

3 months ago

0.10.6

3 months ago

0.10.3

4 months ago

0.10.4

4 months ago

0.10.2

4 months ago

0.10.1

6 months ago

0.10.0

6 months ago