0.10.13 • Published 2 months ago
sportal365-content-sdk v0.10.13
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
- getAuthorById - Get Single Authors
- getAuthors - List of all 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
- getCategories - A paginated list of categories
- getCategoryById - A category obtained by its ID
- searchCategories - A paginated list of categories
distribution
- getChannelById - Get Single Channel
- getDistributionChannels
- getDistributionRegions
- getRegionById - Get Single Region
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
- getImageById - An image obtained by its ID
- getImages - A paginated list of images
- getImagesV2 - A paginated list of images
- getRelatedImages - Get related content of an image. No resources from provider:sports-search-api will be returned
- getRelatedImagesV2 - Get related content of an image, including sport relations from different providers
- searchImages - A paginated list of images
- searchImagesV2 - A paginated list of images
latestFeed
- getLatestFeed - Aggregated list of articles, videos, galleries, liveblogs from the last 5 days
lists
- getListById - Get Single List
- getListByIdV2 - Get single list by ID
- getLists - List of all Lists
- getListsV2 - A paginated list of lists
- searchLists
- searchListsV2
miscellaneous
- getMappings - Get ID mappings according to various filters
tags
- getTagById - Get Single Tag
- getTags - List of all Tags
- searchTags
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
- getCommentPolicies
- getCommentPolicyById - Get Single Comment Policy
contentOrigins
- getContentOriginById - Get Single Origin
- getContentOrigins
contentProperties
contentStatuses
- getContentStatuses
- getStatusById - Get Single Status
contentTypes
- getContentTypeById - Get Single Type
- getContentTypes
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",
});
})();