1.0.5 • Published 1 year ago
@timbenniks/contentstack-endpoints v1.0.5
@timbenniks/contentstack-endpoints
A utility package that provides Contentstack API endpoints based on cloud provider and region. This package helps you easily get the correct API endpoints for different Contentstack environments and regions.
Beware: this is open source and maintained by @timbenniks and it's not officially supported contentstack. Support questions go to @timbenniks directly.
Installation
npm install @timbenniks/contentstack-endpointsUsage
ESM (recommended)
import { getContentstackEndpoints } from "@timbenniks/contentstack-endpoints";
// Get default North America endpoints
const naEndpoints = getContentstackEndpoints();
console.log(naEndpoints.contentDelivery); // https://cdn.contentstack.io
// Get Azure Europe endpoints
const azureEuEndpoints = getContentstackEndpoints(Region.AZURE_EU);
console.log(azureEuEndpoints.contentDelivery); // https://azure-eu-cdn.contentstack.comCommonJS
const {
getContentstackEndpoints,
} = require("@timbenniks/contentstack-endpoints");
// Get default North America endpoints
const naEndpoints = getContentstackEndpoints();
console.log(naEndpoints.contentDelivery); // https://cdn.contentstack.ioAPI
getContentstackEndpoints(region?: Region, omitHttps: boolean): ContentstackEndpoints
Returns an object containing all Contentstack API endpoints for the specified cloud and region.
Parameters
regionasRegion.US,Region.EU,Region.AZURE_NA,Region.AZURE_EU, orRegion.GCP_NAomitHttpsas boolean
Returns
An object containing the following endpoints:
contentDelivery: Content Delivery API endpointcontentManagement: Content Management API endpointimageDelivery: Image Delivery API endpointassets: Assets API endpointautomate: Automate API endpoint (not available for GCP)graphql: GraphQL API endpointgraphqlPreview: GraphQL Preview API endpointbrandKit: Brand Kit API endpointbrandKitGenAI: Brand Kit GenAI and Knowledge Vault endpointpersonalizeManagement: Personalize Management API endpointpersonalizeEdge: Personalize Edge API endpointapplication: Contentstack web applicationpreview: REST Preview API endpoint
License
MIT