Hierarchy

  • default
    • Authentication

Constructors

  • Parameters

    • __namedParameters: EndpointOptions

    Returns Authentication

Methods

  • Creates a 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
    created_at: number
    }

    Failure response schema: Error schema

    Example:

    const token = await client.authentication.getToken({
    username: 'spree@example.com',
    password: 'spree123'
    })

    Parameters

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

    Returns Promise<IOAuthTokenResult>

  • 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
    created_at: number
    }

    Failure response schema: Error schema

    Example:

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

    Parameters

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

    Returns Promise<IOAuthTokenResult>

  • Revokes a Bearer token (access token) or a refresh token.

    Success response schema: Success schema

    Failure response schema: Error schema

    Example:

    const response = await client.authentication.revokeToken({
    token: 'aebe2886d7dbba6f769e20043e40cfa3447e23ad9d8e82c632f60ed63a2f0df1'
    })

    Parameters

    • optons: _DeepAnyObjectObject<Record<string, unknown> & RevokeTokenAttr>

    Returns Promise<EmptyObjectResult>

  • 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