File

src/lib/fs/caas/caas-access-data.ts

Description

This data class contains all the data needed to connect to a CaaS instance.

Index

Methods

Constructor

constructor(baseUrl: string, tenantId: string, project: string, collection: CaasCollection, apiKey: string)

Creates an instance of CaasAccessData. The the readme for more information about how to obtain the required information.

Parameters :
Name Type Optional Description
baseUrl string No

The base URL represents the URL the CaaS is hosted at.

tenantId string No

The tenant ID is the customer's name the CaaS instances was created for.

project string No

The project ID identifies the FirstSpirit project that is connected to the CaaS instance.

collection CaasCollection No

A collection helps to distinguish between preview and released content.

apiKey string No

The CaaS API key identifies the permission for the access to the CaaS instance.

Methods

collectionUrl
collectionUrl()

This function returns the collection URL based on the parameter passed to the constructor.

Returns : URL

The collection URL generated in the format //..

tokenUrl
tokenUrl()
Returns : any
import { CaasCollection } from './caas-collection';


/**
 * This data class contains all the data needed to connect to a CaaS instance.
 *
 * @export
 * @class CaasAccessData
 */
export class CaasAccessData {
  /**
   * Creates an instance of CaasAccessData.
   * The the readme for more information about how to obtain the required information.
   *
   * @param {string} baseUrl The base URL represents the URL the CaaS is hosted at.
   * @param {string} tenantId The tenant ID is the customer's name the CaaS instances was created for.
   * @param {string} project The project ID identifies the FirstSpirit project that is connected to the CaaS instance.
   * @param {CaasCollection} collection A collection helps to distinguish between preview and released content.
   * @param {string} apiKey The CaaS API key identifies the permission for the access to the CaaS instance.
   * @memberof CaasAccessData
   */
  constructor(
    private baseUrl: string,
    private tenantId: string,
    private project: string,
    private collection: CaasCollection,
    readonly apiKey: string
  ) {}

  /**
   * This function returns the collection URL based on the parameter passed to the constructor.
   *
   * @return {string} The collection URL generated in the format <baseURL>/<tenantId>/<projectId>.<collection>.
   * @memberof CaasAccessData
   */
  collectionUrl(): URL {
    return new URL(`${this.baseUrl}/${this.tenantId}/${this.project}.${this.collection}`);
  }

  tokenUrl() {
    return new URL(`_logic/securetoken?tenant=${this.tenantId}`, this.collectionUrl().origin).href
  }
}

results matching ""

    No results matching ""