Hierarchy

  • default
    • Account

Constructors

  • Parameters

    • __namedParameters: EndpointOptions

    Returns Account

Methods

  • Creates new account and returns its attributes. See api docs.

    Success response schema: Success schema

    Failure response schema: Error schema

    Example:

    const response = await client.account.create({
    user: {
    email: 'john@snow.org',
    password: 'spree123',
    password_confirmation: 'spree123'
    }
    })

    Parameters

    • options: _DeepAnyObjectObject<Record<string, unknown> & {
          user: {
              email: string;
              password: string;
              password_confirmation: string;
              first_name?: string;
              last_name?: string;
              public_metadata?: {
                  [key: string]: string;
              };
              private_metadata?: {
                  [key: string]: string;
              };
          };
      }>

    Returns Promise<IAccountResult>

  • Confirms new account e-mail and returns account registration status. See reference.

    Success response schema:

    {
    data: {
    state: string
    }
    }

    Failure response schema: Error schema

    Example:

    const response = await client.account.confirm({ confirmation_token: '2xssfC9Hzf8DJXyRZGmB' })
    

    Parameters

    • option: _DeepAnyObjectObject<Record<string, unknown> & {
          confirmation_token: string;
      }>

    Returns Promise<IAccountConfirmationResult>

  • Sends an account recovery link to the provided email address. The link allows resetting the password for the account.

    Success response schema: Success schema

    Failure response schema: Error schema

    Example:

    const response = await client.account.forgotPassword({
    user: {
    email: 'spree@example.com'
    }
    })

    Parameters

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

    Returns Promise<NoContentResult>

  • Changes the password associated with the account using an account recovery token.

    Success response schema: Success schema

    Failure response schema: Error schema

    Example:

    const response = await client.account.resetPassword({
    reset_password_token: '7381273269536713689562374856',
    user: {
    password: '123!@#asdASD',
    password_confirmation: '123!@#asdASD'
    }
    })

    Parameters

    • options: _DeepAnyObjectObject<Record<string, unknown> & ResetPasswordParams & {
          reset_password_token: string;
      }>

    Returns Promise<NoContentResult>

  • Updates account and returns its attributes. See api docs.

    Required token: Bearer token

    Success response schema: Success schema

    Failure response schema: Error schema

    Example:

    const response = await client.account.update({
    bearer_token: '7381273269536713689562374856',
    user: {
    email: 'john@snow.org',
    password: 'new_spree123',
    password_confirmation: 'new_spree123'
    }
    })

    Parameters

    • options: _DeepAnyObjectObject<RequiredAccountToken & Record<string, unknown> & {
          user: {
              email: string;
              password?: string;
              password_confirmation?: string;
              first_name?: string;
              last_name?: string;
              bill_address_id?: string;
              ship_address_id?: string;
              public_metadata?: {
                  [key: string]: string;
              };
              private_metadata?: {
                  [key: string]: string;
              };
          };
      }>

    Returns Promise<IAccountResult>

  • Returns current user information. See api docs.

    Required token: Bearer token

    Success response schema: Success schema

    Failure response schema: Error schema

    Example:

    const response = await client.account.accountInfo({ bearer_token: '7381273269536713689562374856' })
    

    Parameters

    • options: AccountInfoOptions

    Returns Promise<IAccountResult>

  • Returns a list of Credit Cards for the signed in User. See api docs.

    Required token: Bearer token

    Success response schema: Success schema

    Failure response schema: Error schema

    Example:

    const response = await client.account.creditCardsList({ bearer_token: '7381273269536713689562374856' })
    

    Parameters

    • options: _DeepAnyObjectObject<RequiredAccountToken & IQuery & Record<string, any>>

    Returns Promise<ICreditCardsResult>

  • Return the User's default Credit Card. See api docs.

    Required token: Bearer token

    Success response schema: Success schema

    Failure response schema: Error schema

    Example:

    const response = await client.account.defaultCreditCard({ bearer_token: '7381273269536713689562374856' })
    

    Parameters

    • options: _DeepAnyObjectObject<RequiredAccountToken & IQuery & Record<string, any>>

    Returns Promise<ICreditCardResult>

  • Remove a User's Credit Card. See api docs.

    Required token: Bearer token

    Success response schema: Success schema

    Failure response schema: Error schema

    Example:

    const response = await client.account.removeCreditCard({
    bearer_token: '7381273269536713689562374856',
    id: '14'
    })

    Parameters

    • options: _DeepAnyObjectObject<RequiredAccountToken & IQuery & {
          id: string;
      }>

    Returns Promise<NoContentResult>

  • Returns Orders placed by the User. Only completed ones. See api docs.

    Required token: Bearer token

    Success response schema: Success schema

    Failure response schema: Error schema

    Example:

    const response = await client.account.completedOrdersList({
    bearer_token: '7381273269536713689562374856'
    })

    Parameters

    • options: _DeepAnyObjectObject<RequiredAccountToken & IQuery & Record<string, any>>

    Returns Promise<IOrdersResult>

  • Return the User's completed Order. See api docs.

    Required token: Bearer token

    Success response schema: Success schema

    Failure response schema: Error schema

    Example:

    const response = await client.account.completedOrder({
    bearer_token: '7381273269536713689562374856',
    order_number: 'R653163382'
    })

    Parameters

    • options: _DeepAnyObjectObject<RequiredAccountToken & IQuery & {
          order_number: string;
      }>

    Returns Promise<IOrderResult>

  • Returns a list of Addresses for the signed in User. See api docs.

    Required token: Bearer token

    Success response schema: Success schema

    Failure response schema: Error schema

    Example:

    const response = await client.account.addressesList({
    bearer_token: '7381273269536713689562374856'
    })

    Parameters

    • options: _DeepAnyObjectObject<RequiredAccountToken & Record<string, unknown> & Record<string, any>>

    Returns Promise<AccountAddressesResult>

  • Returns a single address for the signed in User.

    Required token: Bearer token

    Success response schema: Success schema

    Failure response schema: Error schema

    Example:

    const response = await client.account.showAddress({
    bearer_token: '7381273269536713689562374856',
    id: '1'
    })

    Parameters

    • options: _DeepAnyObjectObject<RequiredAccountToken & IQuery & {
          id: string;
      }>

    Returns Promise<AccountAddressResult>

  • Create a new Address for the signed in User. See api docs.

    Required token: Bearer token

    Options schema:

    interface options {
    address: {
    firstname: string
    lastname: string
    address1: string
    address2?: string
    city: string
    phone?: string
    zipcode: string
    state_name: string // State Abbreviations
    country_iso: string // Country ISO (2-chars) or ISO3 (3-chars)
    company?: string
    }
    }

    Success response schema: Success schema

    Failure response schema: Error schema

    Example:

    const response = await client.account.createAddress({
    bearer_token: '7381273269536713689562374856',
    address: {
    firstname: 'John',
    lastname: 'Snow',
    address1: '7735 Old Georgetown Road',
    address2: '2nd Floor',
    city: 'Bethesda',
    phone: '3014445002',
    zipcode: '20814',
    state_name: 'MD',
    country_iso: 'US',
    company: 'Spark'
    }
    })

    Parameters

    • options: _DeepAnyObjectObject<RequiredAccountToken & IQuery & AccountAddressParams>

    Returns Promise<AccountAddressResult>

  • Removes selected Address for the signed in User. See api docs.

    Required token: Bearer token

    Success response schema: Success schema

    Failure response schema: Error schema

    Example:

    const response = await client.account.removeAddress({
    bearer_token: '7381273269536713689562374856',
    id: '1'
    })

    Parameters

    • options: _DeepAnyObjectObject<RequiredAccountToken & Record<string, unknown> & {
          id: string;
      }>

    Returns Promise<NoContentResult>

  • Update selected Address for the signed in User. See api docs.

    Required token: Bearer token

    Options schema:

    interface options {
    id: string
    address: {
    firstname: string
    lastname: string
    address1: string
    address2?: string
    city: string
    phone?: string
    zipcode: string
    state_name: string // State Abbreviations
    country_iso: string // Country ISO (2-chars) or ISO3 (3-chars)
    company?: string
    }
    }

    Success response schema: Success schema

    Failure response schema: Error schema

    Example:

    const response = await client.account.updateAddress({
    bearer_token: '7381273269536713689562374856',
    id: '1',
    address: {
    firstname: 'John',
    lastname: 'Snow',
    address1: '7735 Old Georgetown Road',
    address2: '2nd Floor',
    city: 'Bethesda',
    phone: '3014445002',
    zipcode: '20814',
    state_name: 'MD',
    country_iso: 'US',
    company: 'Spark'
    }
    })

    Parameters

    • options: _DeepAnyObjectObject<RequiredAccountToken & Record<string, unknown> & AccountAddressParams & {
          id: string;
      }>

    Returns Promise<AccountAddressResult>

  • 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