Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ContactClient

The client service for Contact-specific requests with special logic.

Hierarchy

Index

Constructors

constructor

Accessors

config

Methods

delete

  • Type parameters

    • T

    Parameters

    • url: string

      Compass API endpoint with a valid Id

    • Default value opts: RequestOptions = { showErrors: true }

      Optional request headers

    Returns Promise<ResponseData<T>>

    • A detailed response object as a Promise

Private findAddress

  • findAddress(allAddresses: ContactAddress[], requestedAddress: string): object
  • Parameters

    • allAddresses: ContactAddress[]

      Array of all addresses associated to a Contact

    • requestedAddress: string

      Requested address type

    Returns object

    • An address id and a message indicating success/failure details
    • addressId: number
    • message: string

get

  • Type parameters

    • T

    Parameters

    • url: string

      Compass API endpoint

    • Default value opts: RequestOptions = { showErrors: true }

      Optional request headers

    • Default value from: number = 0

      Number of elements you would like to skip

    • Default value size: number = 500

      Number of elements you would like to receive (max is 500)

    • Default value includeDeleted: boolean = false

      Include deleted records in GET

    Returns Promise<ResponseData<T>>

    • A detailed response object as a Promise

getContactAddress

  • Parameters

    • contactId: number

      Cosential contact id

    • addressType: string

      Required address type. ['office', 'home']

    • Default value opts: RequestOptions = { showErrors: true }

      Optional request headers

    Returns Promise<ResponseData<ContactAddress>>

    A detailed response object containing a ContactAddress as a Promise

getContactImage

  • Parameters

    • contactId: number

      Cosential contact id

    • Default value imageType: string = "profilepicture"

      Required image type. ['profilepicture', 'cardfront', 'cardback']

    • Default value opts: RequestOptions = { showErrors: true }

      Optional request headers

    Returns Promise<ResponseData<Image>>

    • A detailed response object containing an Image as a Promise

getSearch

  • Note: This function should only be used to search endpoints which do not have search via POST implemented, e.g. /emails. All other searches should be performed via the above search function.

    Type parameters

    • T

    Parameters

    • url: string

      Compass API endpoint

    • queryString: string

      Complete search query

    • Default value opts: RequestOptions = { showErrors: true }

      Optional request headers

    Returns Promise<ResponseData<T>>

    • A detailed response object as a Promise

Private mostRecentDate

  • mostRecentDate<T>(allAddresses: ContactAddress[], addressType: string): string
  • Type parameters

    • T

    Parameters

    • allAddresses: ContactAddress[]

      Array of all addresses associated to a Contact

    • addressType: string

      Address type to be looked up for most recent date

    Returns string

    • Most recent date for an address type as a string

post

  • Type parameters

    • T

    Parameters

    • url: string

      Compass API endpoint

    • payload: T

      Array of elements

    • Default value opts: RequestOptions = { showErrors: true }

      Optional request headers

    Returns Promise<ResponseData<T>>

    • A detailed response object as a Promise

put

  • Type parameters

    • T

    Parameters

    • url: string

      Compass API endpoint with a valid Id

    • payload: T

      Updated element including new and existing values

    • Default value opts: RequestOptions = { showErrors: true }

      Optional request headers

    Returns Promise<ResponseData<T>>

    • A detailed response object as a Promise

search

  • search<T>(url: string, queryString: string, fields?: string, from?: number, size?: number, includeDeleted?: boolean, opts?: RequestOptions): Promise<ResponseData<T>>
  • Type parameters

    • T

    Parameters

    • url: string

      Compass API endpoint

    • queryString: string

      Complete search query

    • Default value fields: string = null
    • Default value from: number = 0

      Number of elements you would like to skip

    • Default value size: number = 500

      Number of elements you would like to receive (max is 500)

    • Default value includeDeleted: boolean = false

      Include deleted records in search

    • Default value opts: RequestOptions = { showErrors: true }

      Optional request headers

    Returns Promise<ResponseData<T>>

    • A detailed response object as a Promise

searchForAll

  • searchForAll<T>(url: string, queryString: string, fields?: string, includeDeleted?: boolean, opts?: RequestOptions): Promise<ResponseData<T[]>>
  • Type parameters

    • T

    Parameters

    • url: string

      Compass API endpoint

    • queryString: string

      Complete search query

    • Default value fields: string = null

      Comma-separated fields to return

    • Default value includeDeleted: boolean = false

      Include deleted records in search

    • Default value opts: RequestOptions = {showErrors: true}

      Optional request headers

    Returns Promise<ResponseData<T[]>>

    • A detailed response object as a Promise

updateContactImage

  • Parameters

    • contactId: number

      The Contact's Id

    • imageType: string

      Which image should be set. Either 'profilepicture', 'cardfront', or 'cardback'

    • contentType: string

      'image/gif', image/jpeg', 'image/png', or 'image/tiff'

    • imageData: string

      The raw base 64 encoded image data

    • Default value opts: RequestOptions = { showErrors: true }

      Optional request headers

    Returns Promise<ResponseData<Image>>

    • A detailed response object containing an Image as a Promise

Generated using TypeDoc