@acoustic-content-sdk/tooling-rest

Simple HTTP client to connect to Acoustic Content for tooling purposes.

Usage no npm install needed!

<script type="module">
  import acousticContentSdkToolingRest from 'https://cdn.skypack.dev/@acoustic-content-sdk/tooling-rest';
</script>

README

npm

Simple HTTP client to connect to Acoustic Content for tooling purposes.

API Documentation

Home > @acoustic-content-sdk/tooling-rest

tooling-rest package

Simple HTTP client to connect to Acoustic Content for tooling purposes.

Functions

Function Description
createClient(aApiUrl) Constructs a REST client that allows to login against acoustic content and that allows to send requests
luceneEscapeKeyValue(aKey, aTerm) Generates a search selector and escapes the value. If the value is missing the method generates an expression that searches for missing values.
luceneEscapeKeyValueAnd(aKey, aTerms) Generates a selector and joins with 'AND'
luceneEscapeKeyValueOr(aKey, aTerms) Generates a selector and joins with 'OR'
luceneEscapeTerm(aTerm) Escapes a term according to lucence syntax

Interfaces

Interface Description
BasicRestClient
ProtectedRestClient
PublicRestClient

Variables

Variable Description
authoringContent Read authoring content
authoringSearch Performs an authoring search
deliveryContent Read delivery content
deliverySearch Performs a delivery search
site Callback to return the current site
VERSION Version and build number of the package

Home > @acoustic-content-sdk/tooling-rest > createClient

createClient() function

Constructs a REST client that allows to login against acoustic content and that allows to send requests

Signature:

export declare function createClient(aApiUrl: string): PublicRestClient;

Parameters

Parameter Type Description
aApiUrl string the API URL

Returns:

PublicRestClient

a REST client

Home > @acoustic-content-sdk/tooling-rest > luceneEscapeKeyValue

luceneEscapeKeyValue() function

Generates a search selector and escapes the value. If the value is missing the method generates an expression that searches for missing values.

Signature:

export declare function luceneEscapeKeyValue(aKey: string, aTerm: string | null | undefined): string;

Parameters

Parameter Type Description
aKey string the search key
aTerm string | null | undefined the unescaped value

Returns:

string

the result of the escaping

Home > @acoustic-content-sdk/tooling-rest > luceneEscapeKeyValueAnd

luceneEscapeKeyValueAnd() function

Generates a selector and joins with 'AND'

Signature:

export declare function luceneEscapeKeyValueAnd(aKey: string, ...aTerms: string[]): string;

Parameters

Parameter Type Description
aKey string the search key
aTerms string[] the unescaped value

Returns:

string

the result of the escaping

Home > @acoustic-content-sdk/tooling-rest > luceneEscapeKeyValueOr

luceneEscapeKeyValueOr() function

Generates a selector and joins with 'OR'

Signature:

export declare function luceneEscapeKeyValueOr(aKey: string, ...aTerms: string[]): string;

Parameters

Parameter Type Description
aKey string the search key
aTerms string[] the unescaped value

Returns:

string

the result of the escaping

Home > @acoustic-content-sdk/tooling-rest > luceneEscapeTerm

luceneEscapeTerm() function

Escapes a term according to lucence syntax

Signature:

export declare function luceneEscapeTerm(aTerm: string): string;

Parameters

Parameter Type Description
aTerm string term to escape

Returns:

string

the escaped term

Home > @acoustic-content-sdk/tooling-rest > BasicRestClient

BasicRestClient interface

Signature:

export interface BasicRestClient 

Properties

Property Type Description
get <T>(aRelPath: string, aQuery?: ParsedUrlQueryInput) => Promise<T> Performs a GET operation for JSON

Home > @acoustic-content-sdk/tooling-rest > ProtectedRestClient

ProtectedRestClient interface

Signature:

export interface ProtectedRestClient extends BasicRestClient 

Properties

Property Type Description
logout () => Promise<PublicRestClient> Execute a logout

Home > @acoustic-content-sdk/tooling-rest > PublicRestClient

PublicRestClient interface

Signature:

export interface PublicRestClient extends BasicRestClient 

Properties

Property Type Description
login (aCredentials?: Credentials) => Promise<ProtectedRestClient> Login against acoustic content.

Home > @acoustic-content-sdk/tooling-rest > authoringContent

authoringContent variable

Read authoring content

Signature:

authoringContent: (aClient: ProtectedRestClient) => (aId: string) => Promise<AuthoringContentItem>

Home > @acoustic-content-sdk/tooling-rest > authoringSearch

authoringSearch variable

Performs an authoring search

Signature:

authoringSearch: (aClient: ProtectedRestClient) => <T>(aQuery: ParsedUrlQueryInput) => Promise<SearchResults<T>>

Home > @acoustic-content-sdk/tooling-rest > deliveryContent

deliveryContent variable

Read delivery content

Signature:

deliveryContent: (aClient: ProtectedRestClient) => (aId: string) => Promise<ContentItemWithLayout>

Home > @acoustic-content-sdk/tooling-rest > deliverySearch

deliverySearch variable

Performs a delivery search

Signature:

deliverySearch: (aClient: ProtectedRestClient) => <T>(aQuery: ParsedUrlQueryInput) => Promise<SearchResults<T>>

Home > @acoustic-content-sdk/tooling-rest > site

site variable

Callback to return the current site

Signature:

site: (aClient: ProtectedRestClient) => () => Promise<ContentItemWithLayout>

Home > @acoustic-content-sdk/tooling-rest > VERSION

VERSION variable

Version and build number of the package

Signature:

VERSION: {
    version: {
        major: string;
        minor: string;
        patch: string;
        branch: string;
    };
    build: Date;
}

Home > @acoustic-content-sdk/tooling-rest > ProtectedRestClient > logout

ProtectedRestClient.logout property

Execute a logout

Signature:

logout: () => Promise<PublicRestClient>;

Home > @acoustic-content-sdk/tooling-rest > BasicRestClient > get

BasicRestClient.get property

Performs a GET operation for JSON

Signature:

get: <T>(aRelPath: string, aQuery?: ParsedUrlQueryInput) => Promise<T>;

Home > @acoustic-content-sdk/tooling-rest > PublicRestClient > login

PublicRestClient.login property

Login against acoustic content.

Signature:

login: (aCredentials?: Credentials) => Promise<ProtectedRestClient>;