Hierarchy

  • default
    • Authentication

Constructors

  • Parameters

    • __namedParameters: EndpointOptions

    Returns Authentication

Methods

  • Creates a Bearer token required to authorize Platform API calls using application credentials.

    Success response schema:

    interface res {
    access_token: string
    token_type: string = 'Bearer'
    expires_in: number
    scope: string
    created_at: number
    }

    Failure response schema: Error schema

    Example:

    const token = await client.authentication.getApplicationToken({
    client_id: '7ZY15L7crVZul8i3PZPrnpOkEURK7xnXEWRZdE6K39M',
    client_secret: 'cxMZ0tbe604qj_13hibNmc3GDsXUQfpzHt9PvweihFc'
    })

    Parameters

    • options: _DeepAnyObjectObject<Record<string, unknown> & AuthApplicationTokenAttr>

    Returns Promise<IPlatformTokenResult>

  • Creates a Bearer token required to authorize Platform API calls using user credentials.

    Success response schema:

    interface res {
    access_token: string
    token_type: string = 'Bearer'
    expires_in: number
    refresh_token: string
    scope: string
    created_at: number
    }

    Failure response schema: Error schema

    Example:

    const token = await client.authentication.getUserToken({
    client_id: '7ZY15L7crVZul8i3PZPrnpOkEURK7xnXEWRZdE6K39M',
    client_secret: 'cxMZ0tbe604qj_13hibNmc3GDsXUQfpzHt9PvweihFc',
    username: 'spree@example.com',
    password: 'spree123'
    })

    Parameters

    • options: _DeepAnyObjectObject<Record<string, unknown> & AuthUserTokenAttr>

    Returns Promise<IPlatformUserTokenResult>

  • Refreshes the Bearer token required to authorize OAuth API calls.

    Success response schema:

    interface res {
    access_token: string
    token_type: string = 'Bearer'
    expires_in: number
    refresh_token: string
    scope: string
    created_at: number
    }

    Failure response schema: Error schema

    Example:

    const token = await client.authentication.refreshUserToken({
    refresh_token: 'aebe2886d7dbba6f769e20043e40cfa3447e23ad9d8e82c632f60ed63a2f0df1'
    })

    Parameters

    • options: _DeepAnyObjectObject<Record<string, unknown> & AuthRefreshTokenAttr>

    Returns Promise<IPlatformUserTokenResult>

  • Type Parameters

    • ResponseType = JsonApiResponse

    Parameters

    • method: HttpMethod
    • url: string
    • Optional tokens: IToken
    • Optional params: any
    • Optional responseParsing: ResponseParsing

    Returns Promise<ResultResponse<ResponseType>>

  • The HTTP error code returned by Spree is not indicative of its response shape. This function determines the information provided by Spree and uses everything available.

    Parameters

    • error: default

    Returns ErrorType

  • Parameters

    • error: Error

    Returns default

  • Parameters

    • error: default

    Returns default

  • Parameters

    • tokens: IToken

    Returns {
        [headerName: string]: string;
    }

    • [headerName: string]: string

Properties

fetcher: Fetcher

Generated using TypeDoc