Class OnspringClient

OnspringClient - A client that can communicate with the Onspring API.

Constructors

  • Parameters

    • baseUrl: undefined | null | string

      The base url that will be used to make requests to the Onspring API.

    • apiKey: undefined | null | string

      The api key that will be used to authorize requests made by this client.

    • config: CreateAxiosDefaults<any> = {}

    Returns OnspringClient

    • A new instance of the OnspringClient class.

    Throws

    • Thrown when the baseUrl is not a valid url.

    Throws

    • Thrown when the apiKey is null/undefined/empty/whitespace.

Properties

_client: AxiosInstance

client - The axios instance that will be used to make requests to the Onspring API.

Methods

  • Parameters

    • listItemRequest: ListItemRequest

      The request that will be used to add or update the list item.

    Returns Promise<ApiResponse<ListItemResponse>>

    • A promise that resolves to an ApiResponse of type ListItemResponse.

    Method

    addOrUpdateListItem - Adds or updates a list item depending on if an id is provided or not.

  • Returns Promise<boolean>

    • A promise that resolves to a boolean indicating if the client can connect to the Onspring API.

    Method

    canConnect - Determines if the client can connect to the Onspring API.

  • Type Parameters

    • T

    Parameters

    • endpoint: string

      The endpoint that will be used to make the request.

    • config: AxiosRequestConfig<any> = {}

      The configuration that will be used to make the request.

    Returns Promise<ApiResponse<T>>

    • A promise that resolves to an ApiResponse of type T.

    Method

    delete - Makes a DELETE request to the specified endpoint.

  • Parameters

    • recordId: number

      The id of the record that the file is held on.

    • fieldId: number

      The id of the field that the file is held in.

    • fileId: number

      The id of the file to delete.

    Returns Promise<ApiResponse<any>>

    • A promise that resolves to an ApiResponse of type any.

    Method

    deleteFileById - Deletes a file by its id.

  • Parameters

    • listId: number

      The id of the list that the list item belongs to.

    • itemId: string

      The id of the list item to delete.

    Returns Promise<ApiResponse<any>>

    • A promise that resolves to an ApiResponse of type any.

    Method

    deleteListItemById - Deletes a list item by its id.

  • Parameters

    • appId: number

      The id of the app that the record belongs to.

    • recordId: number

      The id of the record to delete.

    Returns Promise<ApiResponse<any>>

    • A promise that resolves to an ApiResponse of type any.

    Method

    deleteRecordById - Deletes a record by its id.

  • Parameters

    • appId: number

      The id of the app that the records belong to.

    • recordIds: number[]

      The ids of the records to delete.

    Returns Promise<ApiResponse<any>>

    • A promise that resolves to an ApiResponse of type any.

    Method

    deleteRecordsByIds - Deletes records by their ids.

  • Type Parameters

    • T

    Parameters

    • endpoint: string

      The endpoint that will be used to make the request.

    • config: AxiosRequestConfig<any> = {}

      The configuration that will be used to make the request.

    Returns Promise<ApiResponse<T>>

    • A promise that resolves to an ApiResponse of type T.

    Method

    get - Makes a GET request to the specified endpoint.

  • Parameters

    • appId: number

      The id of the app to get.

    Returns Promise<ApiResponse<App>>

    • A promise that resolves to an ApiResponse of type App.

    Method

    getAppById - Gets an app by its id.

  • Parameters

    • appIds: number[]

      The ids of the apps to get.

    Returns Promise<ApiResponse<CollectionResponse<App>>>

    • A promise that resolves to an ApiResponse of type CollectionResponse.

    Method

    getAppsByIds - Gets a list of apps by their ids.

  • Parameters

    • fieldId: number

      The id of the field to get.

    Returns Promise<ApiResponse<Field>>

    • A promise that resolves to an ApiResponse of type Field.

    Method

    getFieldById - Gets a field by its id.

  • Parameters

    • appId: number

      The id of the app to get the fields for.

    • pagingRequest: PagingRequest = ...

      The paging request that will be used to get the fields.

    Returns Promise<ApiResponse<GetPagedFieldsResponse>>

    • A promise that resolves to an ApiResponse of type GetPagedFieldsResponse.

    Method

    getFieldsByAppId - Gets a paged list of fields by an app id.

  • Parameters

    • fieldIds: number[]

      The ids of the fields to get.

    Returns Promise<ApiResponse<CollectionResponse<Field>>>

    • A promise that resolves to an ApiResponse of type CollectionResponse.

    Method

    getFieldsByIds - Gets a list of fields by their ids.

  • Parameters

    • recordId: number

      The id of the record that the file is attached to.

    • fieldId: number

      The id of the field that the file is attached to.

    • fileId: number

      The id of the file to get.

    Returns Promise<ApiResponse<File>>

    • A promise that resolves to an ApiResponse of type File.

    Method

    getFileById - Gets a file by its id.

  • Parameters

    • recordId: number

      The id of the record that the file is attached to.

    • fieldId: number

      The id of the field that the file is attached to.

    • fileId: number

      The id of the file to get the information for.

    Returns Promise<ApiResponse<FileInfo>>

    • A promise that resolves to an ApiResponse of type FileInfo.

    Method

    getFileInfoById - Gets a file's information by its id.

  • Parameters

    Returns Promise<ApiResponse<Record>>

    • A promise that resolves to an ApiResponse of type Record.

    Method

    getRecordById - Gets a record by its id.

  • Parameters

    • reportId: number

      The id of the report to get.

    • apiDataFormat: DataFormat = DataFormat.Raw

      The data format that the report data will be returned in.

    • dataType: ReportDataType = ReportDataType.ReportData

      The type of data that will be returned.

    Returns Promise<ApiResponse<ReportData>>

    • A promise that resolves to an ApiResponse of type ReportData.

    Method

    getReportById - Gets a report by its id.

  • Parameters

    • appId: number

      The id of the app to get the reports for.

    • pagingRequest: PagingRequest = ...

      The paging request that will be used to get the reports.

    Returns Promise<ApiResponse<GetPagedReportsResponse>>

    • A promise that resolves to an ApiResponse of type GetPagedReportsResponse.

    Method

    getReportsByAppId - Gets a paged list of reports by the app id.

  • Type Parameters

    • T

    Parameters

    • endpoint: string

      The endpoint that will be used to make the request.

    • data: any

      The data that will be sent with the request.

    • config: AxiosRequestConfig<any> = {}

      The configuration that will be used to make the request.

    Returns Promise<ApiResponse<T>>

    • A promise that resolves to an ApiResponse of type T.

    Method

    post - Makes a POST request to the specified endpoint.

  • Type Parameters

    • T

    Parameters

    • endpoint: string

      The endpoint that will be used to make the request.

    • data: any

      The data that will be sent with the request.

    • config: AxiosRequestConfig<any> = {}

      The configuration that will be used to make the request.

    Returns Promise<ApiResponse<T>>

    • A promise that resolves to an ApiResponse of type T.

    Method

    put - Makes a PUT request to the specified endpoint.