Class CFToolsClientBuilder

Hierarchy

  • CFToolsClientBuilder

Constructors

Methods

  • Sets the API credentials used to authenticate against endpoints that require authentication. Not every endpoint of the CFTools Cloud API requires authentication. Where not needed, the SDK will make unauthenticated requests. Whenever an endpoint requires authentication, these credentials must be set in order for the method to succeed.

    Parameters

    • applicationId: string
    • secret: string

    Returns CFToolsClientBuilder

  • The enterprise API is functionally equal with the data API, however, it looses the rate limits and with that allows much more requests per time unit compared to the general available data API. To use it, you require an enterprise access token.

    Parameters

    • token: string

      The Enterprise Access Token provided by CFTools

    Returns CFToolsClientBuilder

  • Allows to set the HTTP Client library builder. Intended use case is to modify the options that is passed to the built-in client builder, however, this can also be used to use your own preferred HTTP library with the sdk, as long as it adheres to the HttpClientBuilder contract.

    Example use case enabling debug logging and setting your own User Agent in requests:

    import {CFToolsClientBuilder, httpClient} from 'cftools-sdk';

    new CFToolsClientBuilder()
    .withHttpClient(() => new GotHttpClient(httpClient(false, {userAgent: 'myTool/1.0.0 (https://github.com/username/tool-repo)', enableDebugLogging: true})))
    .withServerApiId(process.env.CFTOOLS_SERVER_API_ID)
    .withCredentials(process.env.CFTOOLS_APPLICATION_ID, process.env.CFTOOLS_APPLICATION_SECRET)
    .build()

    Parameters

    • clientBuilder: HttpClientBuilder

    Returns CFToolsClientBuilder

  • Set the default server api ID identifying the CFTools Cloud server instance. This default API ID is not required. Methods will allow to override this default id, otherwise this ID needs to be set in order for the method to succeed.

    Methods that require authentication are marked in their documentation, that they require an authenticated client.

    Parameters

    • serverApiId: string

    Returns CFToolsClientBuilder

Generated using TypeDoc