Options
All
  • Public
  • Public/Protected
  • All
Menu

Class MelhorEnvio

Hierarchy

  • MelhorEnvio

Index

Constructors

constructor

  • new MelhorEnvio(token: string, isSandbox?: boolean, timeout?: number, appInfo?: undefined | { email: string; name: string }): MelhorEnvio
  • 🚚 Melhor Envio Javascript API

    Parameters

    • token: string

      Token for API Requests. Can be generated direct in Melhor Envio Dashboard.

    • Default value isSandbox: boolean = false

      Use or not a sandbox environment for testing.

    • Default value timeout: number = 5000

      Timeout of the request.

    • Optional appInfo: undefined | { email: string; name: string }

      Info about your application

    Returns MelhorEnvio

Properties

Optional appInfo

appInfo: undefined | { email: string; name: string }

Info about your application

isSandbox

isSandbox: boolean

Use or not a sandbox environment for testing.

timeout

timeout: number

Timeout of the request.

token

token: string

Token for API Requests. Can be generated direct in Melhor Envio Dashboard.

Methods

addItemInCart

  • addItemInCart<T, S, NC>(data: T & Cart<S, NC>): Promise<Cart>

calculateShipment

checkout

fetch

  • fetch<T>(url: string, method?: Method, params?: AxiosRequestConfig["params"], data?: AxiosRequestConfig["data"]): Promise<T>
  • 📨 Fetch in the MelhorEnvio API

    Type parameters

    • T

    Parameters

    • url: string

      URL. Route to the fetch. can be /test

    • Default value method: Method = "GET"

      Method. Can be GET*. *POST.

    • Default value params: AxiosRequestConfig["params"] = {}

      Querystring params. Its most used in GET requests.

    • Default value data: AxiosRequestConfig["data"] = {}

      Data. Use for POST requests.

    Returns Promise<T>

generateLabel

getShipmentServices

  • getShipmentServices(): Promise<Services>

printLabel

Private sanitizePostalCode

  • sanitizePostalCode(postalCode: string): string

track

Generated using TypeDoc