All classes in the resource folder should implement this interface so that they can be instantiated in the main barrel.

Hierarchy (view full)

Constructors

Accessors

Methods

  • A helper function to ensure that API calls are successful and return a valid status code.

    Type Parameters

    • T

    Parameters

    • call: (() => Promise<AxiosResponse<T, any>>)

      The API call to guard for exceptions and bad return codes.

        • (): Promise<AxiosResponse<T, any>>
        • Returns Promise<AxiosResponse<T, any>>

    Returns Promise<T>

    A promise of the type returned by Axios in the data field.

  • Get a contact by external ID. If you have more than one contact with the same external ID, this will return the first contact that matches the external ID. Use getContacts to return all contacts with the same external ID.

    Parameters

    • externalId: string

      The external ID of the contact to retrieve. This ID represents the user in an external system.

    Returns Promise<Contact>

    A contact that matches the external ID.

  • Searches for a contact using various search parameters. You must supply either a term or an external ID.

    Parameters

    • limit: number

      The number of items to return per page. Must be between 1 and 100 inclusive.

    • page: number

      The page number to return. Must be greater than 0.

    • Optionalterm: string

      The search term to use. This will search the known name (the name you gave the contact), first name, last name, external ID, and email address of the contact. This parameter is limited to 50 chars max.

    • OptionalexternalId: string

      The external ID of the contact to retrieve. This ID represents the user in an external system.

    • OptionalsinceUTC: string

      The date and time to use as a filter. This will return all contacts that were created or updated after this date and time.

    • OptionalcontactStatus: ContactStatusPersona[]

      An array of contact statuses. Contacts with a status in this array will be returned.

    Returns Promise<ContactList>

    A list of contacts that match the search criteria.

  • A helper function that will either return the variable's value or throw an exception if the value is null or undefined. Unit testing is simplified by avoiding ??

    Type Parameters

    • T

    Parameters

    • name: string

      The name of the variable being checked

    • value: undefined | null | T

      The value of the variable being checked

    Returns T

    The value of the variable if it is available, otherwise an exception is thrown.