Skip to content

avadev/Avalara-SDK-Typescript

Repository files navigation

Avalara-SDK

This generator creates TypeScript/JavaScript client that utilizes Fetch API. The generated Node module can be used in the following environments:

Environment

  • Node.js
  • Webpack
  • Browserify

Language level

  • ES5 - you must have a Promises/A+ library installed
  • ES6

Module system

  • CommonJS
  • ES6 module system

It can be used in both TypeScript and JavaScript. In TypeScript, the definition should be automatically resolved via package.json. (Reference)

Consuming

navigate to the folder of your consuming project and run one of the following commands.

published:

npm install [email protected] --save

Getting Started

import * as AvalaraSdk from "avalara-sdk";
import { AvaTaxEnvironment } from "avalara-sdk/runtime";

const configParams: AvalaraSdk.Runtime.ConfigurationParameters = {
  appName: "asv-sdk-test-app",
  appVersion: "1.0",
  environment: AvaTaxEnvironment.Sandbox,
  machineName: "test-machine",
  timeout: 3000,
  bearerToken: "<YOUR BEARER TOKEN>",
  testBasePath: "https://localhost:3000",
};
const config = new AvalaraSdk.Runtime.Configuration(configParams);
let client = new AvalaraSdk.Runtime.ApiClient(config);
let api = new AvalaraSdk.EInvoicing.V1.MandatesApi(client);
let requestParameters: AvalaraSdk.EInvoicing.V1.GetMandatesInterface = {
  xAvalaraClient: "Swagger UI; 22.7.0; Custom; 1.0",
};
const result = await api.getMandates(requestParameters);
console.log(result);

Documentation for API Endpoints

EInvoicing V1 API Documentation

Class Method HTTP request Description
DataInputFieldsApi getDataInputFields GET /data-input-fields Returns the optionality of document fields for different country mandates
DocumentsApi downloadDocument GET /documents/{documentId}/$download Returns a copy of the document
DocumentsApi fetchDocuments POST /documents/$fetch Fetch the inbound document from a tax authority
DocumentsApi getDocumentList GET /documents Returns a summary of documents for a date range
DocumentsApi getDocumentStatus GET /documents/{documentId}/status Checks the status of a document
DocumentsApi submitDocument POST /documents Submits a document to Avalara E-Invoicing API
InteropApi submitInteropDocument POST /interop/documents Submit a document
MandatesApi getMandateDataInputFields GET /mandates/{mandateId}/data-input-fields Returns document field information for a country mandate, a selected document type, and its version
MandatesApi getMandates GET /mandates List country mandates that are supported by the Avalara E-Invoicing platform
TradingPartnersApi batchSearchParticipants POST /trading-partners/batch-searches Creates a batch search and performs a batch search in the directory for participants in the background.
TradingPartnersApi downloadBatchSearchReport GET /trading-partners/batch-searches/{id}/$download-results Download batch search results in a csv file.
TradingPartnersApi getBatchSearchDetail GET /trading-partners/batch-searches/{id} Get the batch search details for a given id.
TradingPartnersApi listBatchSearches GET /trading-partners/batch-searches List all batch searches that were previously submitted.
TradingPartnersApi searchParticipants GET /trading-partners Returns a list of participants matching the input query.

Documentation for Models

EInvoicing V1 Model Documentation