-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jonathan Wenger
committed
Jan 15, 2025
1 parent
c36b0ba
commit 6a45eb7
Showing
2 changed files
with
67 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,13 +27,7 @@ navigate to the folder of your consuming project and run one of the following co | |
_published:_ | ||
|
||
``` | ||
npm install [email protected] --save | ||
``` | ||
|
||
_unPublished (not recommended):_ | ||
|
||
``` | ||
npm install PATH_TO_GENERATED_PACKAGE --save | ||
npm install [email protected] --save | ||
``` | ||
|
||
<a name="getting-started"></a> | ||
|
@@ -42,6 +36,7 @@ npm install PATH_TO_GENERATED_PACKAGE --save | |
|
||
```typescript | ||
import * as AvalaraSdk from "avalara-sdk"; | ||
import { AvaTaxEnvironment } from "avalara-sdk/runtime"; | ||
|
||
const configParams: AvalaraSdk.Runtime.ConfigurationParameters = { | ||
appName: "asv-sdk-test-app", | ||
|
@@ -54,151 +49,81 @@ const configParams: AvalaraSdk.Runtime.ConfigurationParameters = { | |
}; | ||
const config = new AvalaraSdk.Runtime.Configuration(configParams); | ||
let client = new AvalaraSdk.Runtime.ApiClient(config); | ||
let api = new AvalaraSdk.Avatax.V2.UtilitiesApi(client); | ||
const result = await api.ping(); | ||
``` | ||
|
||
<a name="documentation-for-authorization"></a> | ||
|
||
## Documentation for Authorization | ||
|
||
<a name="OAuth Client Credentials Flow"></a> | ||
|
||
### OAuth Client Credentials | ||
|
||
- **Type**: OAuth | ||
- **Flow**: client_credentials | ||
- **Scopes**: | ||
- avatax_api: avatax_api scope. | ||
|
||
```typescript | ||
import * as AvalaraSdk from "avalara-sdk"; | ||
|
||
const configParams: Runtime.ConfigurationParameters = { | ||
appName: "asv-sdk-test-app", | ||
appVersion: "1.0", | ||
environment: AvaTaxEnvironment.Sandbox, | ||
machineName: "test-machine", | ||
timeout: 3000, | ||
clientId: "<YOUR CLIENT ID>", | ||
clientSecret: "<YOUR CLIENT SECRET>", | ||
testBasePath: "https://localhost:3000", | ||
}; | ||
const config = new AvalaraSdk.Runtime.Configuration(configParams); | ||
let client = new AvalaraSdk.Runtime.ApiClient(config); | ||
// Client ID and Client Secret will be used to perform client credentials flow prior to making the request. | ||
// Bearer token will be appended to the Authorization header. | ||
let api = new AvalaraSdk.Avatax.V2.UtilitiesApi(client); | ||
const result = await api.ping(); | ||
``` | ||
|
||
<a name="OAuth Device Code Flow"></a> | ||
|
||
### OAuth Device Code | ||
|
||
- **Type**: OAuth | ||
- **Flow**: device_code | ||
- **Scopes**: | ||
- avatax_api: avatax_api scope. | ||
|
||
```typescript | ||
import * as AvalaraSdk from "avalara-sdk"; | ||
|
||
const configParams: Runtime.ConfigurationParameters = { | ||
appName: "asv-sdk-test-app", | ||
appVersion: "1.0", | ||
environment: AvaTaxEnvironment.Sandbox, | ||
machineName: "test-machine", | ||
timeout: 3000, | ||
clientId: "<YOUR AVALARA IDENTITY CLIENT ID>", | ||
testBasePath: "https://localhost:3000", | ||
let api = new AvalaraSdk.EInvoicing.V1.MandatesApi(client); | ||
let requestParameters: AvalaraSdk.EInvoicing.V1.GetMandatesInterface = { | ||
xAvalaraClient: "Swagger UI; 22.7.0; Custom; 1.0", | ||
}; | ||
const config = new AvalaraSdk.Runtime.Configuration(configParams); | ||
// Pass in the scope (avatax_api in this instance), and the configuration object, clientID is a required property for the flow. | ||
// Fetches the device code and verification url required for the user part of the flow (where they open the URI in their web browser and authenticate) | ||
const response = await OAuthHelper.initiateDeviceAuthorizationFlow( | ||
"avatax_api", | ||
config | ||
); | ||
// User Interaction needs to happen here - some polling logic is needed to wait for offline user to authenticate to verification_uri through browser | ||
// Once completed, bearer token will be returned. | ||
const tokenResponse = await OAuthHelper.getAccessTokenForDeviceFlow( | ||
response.deviceCode, | ||
config | ||
); | ||
// Add bearer token into the configuration options. | ||
configuration.bearerToken = tokenResponse.accessToken; | ||
let client = new AvalaraSdk.Runtime.ApiClient(config); | ||
// Provided bearer token will be appended to Authorization header for each request. | ||
let api = new AvalaraSdk.Avatax.V2.UtilitiesApi(client); | ||
const result = await api.ping(); | ||
const result = await api.getMandates(requestParameters); | ||
console.log(result); | ||
``` | ||
|
||
<a name="documentation-for-api-endpoints"></a> | ||
## Documentation for API Endpoints | ||
|
||
<a name="documentation-for-EInvoicing-V1-api-endpoints"></a> | ||
|
||
### EInvoicing V1 API Documentation | ||
|
||
Class | Method | HTTP request | Description | ||
------------ | ------------- | ------------- | ------------- | ||
*DataInputFieldsApi* | [**getDataInputFields**](docs/EInvoicing/V1/DataInputFieldsApi.md#getdatainputfields) | **GET** /data-input-fields | Returns the optionality of document fields for different country mandates | ||
*DocumentsApi* | [**downloadDocument**](docs/EInvoicing/V1/DocumentsApi.md#downloaddocument) | **GET** /documents/{documentId}/$download | Returns a copy of the document | ||
*DocumentsApi* | [**fetchDocuments**](docs/EInvoicing/V1/DocumentsApi.md#fetchdocuments) | **POST** /documents/$fetch | Fetch the inbound document from a tax authority | ||
*DocumentsApi* | [**getDocumentList**](docs/EInvoicing/V1/DocumentsApi.md#getdocumentlist) | **GET** /documents | Returns a summary of documents for a date range | ||
*DocumentsApi* | [**getDocumentStatus**](docs/EInvoicing/V1/DocumentsApi.md#getdocumentstatus) | **GET** /documents/{documentId}/status | Checks the status of a document | ||
*DocumentsApi* | [**submitDocument**](docs/EInvoicing/V1/DocumentsApi.md#submitdocument) | **POST** /documents | Submits a document to Avalara E-Invoicing API | ||
*InteropApi* | [**submitInteropDocument**](docs/EInvoicing/V1/InteropApi.md#submitinteropdocument) | **POST** /interop/documents | Submit a document | ||
*MandatesApi* | [**getMandateDataInputFields**](docs/EInvoicing/V1/MandatesApi.md#getmandatedatainputfields) | **GET** /mandates/{mandateId}/data-input-fields | Returns document field information for a country mandate, a selected document type, and its version | ||
*MandatesApi* | [**getMandates**](docs/EInvoicing/V1/MandatesApi.md#getmandates) | **GET** /mandates | List country mandates that are supported by the Avalara E-Invoicing platform | ||
*TradingPartnersApi* | [**batchSearchParticipants**](docs/EInvoicing/V1/TradingPartnersApi.md#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**](docs/EInvoicing/V1/TradingPartnersApi.md#downloadbatchsearchreport) | **GET** /trading-partners/batch-searches/{id}/$download-results | Download batch search results in a csv file. | ||
*TradingPartnersApi* | [**getBatchSearchDetail**](docs/EInvoicing/V1/TradingPartnersApi.md#getbatchsearchdetail) | **GET** /trading-partners/batch-searches/{id} | Get the batch search details for a given id. | ||
*TradingPartnersApi* | [**listBatchSearches**](docs/EInvoicing/V1/TradingPartnersApi.md#listbatchsearches) | **GET** /trading-partners/batch-searches | List all batch searches that were previously submitted. | ||
*TradingPartnersApi* | [**searchParticipants**](docs/EInvoicing/V1/TradingPartnersApi.md#searchparticipants) | **GET** /trading-partners | Returns a list of participants matching the input query. | ||
| Class | Method | HTTP request | Description | | ||
| -------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | | ||
| _DataInputFieldsApi_ | [**getDataInputFields**](docs/EInvoicing/V1/DataInputFieldsApi.md#getdatainputfields) | **GET** /data-input-fields | Returns the optionality of document fields for different country mandates | | ||
| _DocumentsApi_ | [**downloadDocument**](docs/EInvoicing/V1/DocumentsApi.md#downloaddocument) | **GET** /documents/{documentId}/$download | Returns a copy of the document | | ||
| _DocumentsApi_ | [**fetchDocuments**](docs/EInvoicing/V1/DocumentsApi.md#fetchdocuments) | **POST** /documents/$fetch | Fetch the inbound document from a tax authority | | ||
| _DocumentsApi_ | [**getDocumentList**](docs/EInvoicing/V1/DocumentsApi.md#getdocumentlist) | **GET** /documents | Returns a summary of documents for a date range | | ||
| _DocumentsApi_ | [**getDocumentStatus**](docs/EInvoicing/V1/DocumentsApi.md#getdocumentstatus) | **GET** /documents/{documentId}/status | Checks the status of a document | | ||
| _DocumentsApi_ | [**submitDocument**](docs/EInvoicing/V1/DocumentsApi.md#submitdocument) | **POST** /documents | Submits a document to Avalara E-Invoicing API | | ||
| _InteropApi_ | [**submitInteropDocument**](docs/EInvoicing/V1/InteropApi.md#submitinteropdocument) | **POST** /interop/documents | Submit a document | | ||
| _MandatesApi_ | [**getMandateDataInputFields**](docs/EInvoicing/V1/MandatesApi.md#getmandatedatainputfields) | **GET** /mandates/{mandateId}/data-input-fields | Returns document field information for a country mandate, a selected document type, and its version | | ||
| _MandatesApi_ | [**getMandates**](docs/EInvoicing/V1/MandatesApi.md#getmandates) | **GET** /mandates | List country mandates that are supported by the Avalara E-Invoicing platform | | ||
| _TradingPartnersApi_ | [**batchSearchParticipants**](docs/EInvoicing/V1/TradingPartnersApi.md#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**](docs/EInvoicing/V1/TradingPartnersApi.md#downloadbatchsearchreport) | **GET** /trading-partners/batch-searches/{id}/$download-results | Download batch search results in a csv file. | | ||
| _TradingPartnersApi_ | [**getBatchSearchDetail**](docs/EInvoicing/V1/TradingPartnersApi.md#getbatchsearchdetail) | **GET** /trading-partners/batch-searches/{id} | Get the batch search details for a given id. | | ||
| _TradingPartnersApi_ | [**listBatchSearches**](docs/EInvoicing/V1/TradingPartnersApi.md#listbatchsearches) | **GET** /trading-partners/batch-searches | List all batch searches that were previously submitted. | | ||
| _TradingPartnersApi_ | [**searchParticipants**](docs/EInvoicing/V1/TradingPartnersApi.md#searchparticipants) | **GET** /trading-partners | Returns a list of participants matching the input query. | | ||
|
||
<a name="documentation-for-models"></a> | ||
|
||
## Documentation for Models | ||
|
||
<a name="documentation-for-EInvoicing-V1-models"></a> | ||
|
||
### EInvoicing V1 Model Documentation | ||
|
||
- [EInvoicing.V1.BadDownloadRequest](docs/EInvoicing/V1/BadDownloadRequest.md) | ||
- [EInvoicing.V1.BadRequest](docs/EInvoicing/V1/BadRequest.md) | ||
- [EInvoicing.V1.BatchSearch](docs/EInvoicing/V1/BatchSearch.md) | ||
- [EInvoicing.V1.BatchSearchListResponse](docs/EInvoicing/V1/BatchSearchListResponse.md) | ||
- [EInvoicing.V1.ConditionalForField](docs/EInvoicing/V1/ConditionalForField.md) | ||
- [EInvoicing.V1.DataInputField](docs/EInvoicing/V1/DataInputField.md) | ||
- [EInvoicing.V1.DataInputFieldNotUsedFor](docs/EInvoicing/V1/DataInputFieldNotUsedFor.md) | ||
- [EInvoicing.V1.DataInputFieldOptionalFor](docs/EInvoicing/V1/DataInputFieldOptionalFor.md) | ||
- [EInvoicing.V1.DataInputFieldRequiredFor](docs/EInvoicing/V1/DataInputFieldRequiredFor.md) | ||
- [EInvoicing.V1.DataInputFieldsResponse](docs/EInvoicing/V1/DataInputFieldsResponse.md) | ||
- [EInvoicing.V1.DirectorySearchResponse](docs/EInvoicing/V1/DirectorySearchResponse.md) | ||
- [EInvoicing.V1.DirectorySearchResponseValueInner](docs/EInvoicing/V1/DirectorySearchResponseValueInner.md) | ||
- [EInvoicing.V1.DirectorySearchResponseValueInnerAddressesInner](docs/EInvoicing/V1/DirectorySearchResponseValueInnerAddressesInner.md) | ||
- [EInvoicing.V1.DirectorySearchResponseValueInnerIdentifiersInner](docs/EInvoicing/V1/DirectorySearchResponseValueInnerIdentifiersInner.md) | ||
- [EInvoicing.V1.DirectorySearchResponseValueInnerSupportedDocumentTypesInner](docs/EInvoicing/V1/DirectorySearchResponseValueInnerSupportedDocumentTypesInner.md) | ||
- [EInvoicing.V1.DocumentFetch](docs/EInvoicing/V1/DocumentFetch.md) | ||
- [EInvoicing.V1.DocumentFetchRequest](docs/EInvoicing/V1/DocumentFetchRequest.md) | ||
- [EInvoicing.V1.DocumentFetchRequestDataInner](docs/EInvoicing/V1/DocumentFetchRequestDataInner.md) | ||
- [EInvoicing.V1.DocumentFetchRequestMetadata](docs/EInvoicing/V1/DocumentFetchRequestMetadata.md) | ||
- [EInvoicing.V1.DocumentListResponse](docs/EInvoicing/V1/DocumentListResponse.md) | ||
- [EInvoicing.V1.DocumentStatusResponse](docs/EInvoicing/V1/DocumentStatusResponse.md) | ||
- [EInvoicing.V1.DocumentSubmissionError](docs/EInvoicing/V1/DocumentSubmissionError.md) | ||
- [EInvoicing.V1.DocumentSubmitResponse](docs/EInvoicing/V1/DocumentSubmitResponse.md) | ||
- [EInvoicing.V1.DocumentSummary](docs/EInvoicing/V1/DocumentSummary.md) | ||
- [EInvoicing.V1.ErrorResponse](docs/EInvoicing/V1/ErrorResponse.md) | ||
- [EInvoicing.V1.ForbiddenError](docs/EInvoicing/V1/ForbiddenError.md) | ||
- [EInvoicing.V1.InputDataFormats](docs/EInvoicing/V1/InputDataFormats.md) | ||
- [EInvoicing.V1.InternalServerError](docs/EInvoicing/V1/InternalServerError.md) | ||
- [EInvoicing.V1.Mandate](docs/EInvoicing/V1/Mandate.md) | ||
- [EInvoicing.V1.MandateDataInputField](docs/EInvoicing/V1/MandateDataInputField.md) | ||
- [EInvoicing.V1.MandateDataInputFieldNamespace](docs/EInvoicing/V1/MandateDataInputFieldNamespace.md) | ||
- [EInvoicing.V1.MandatesResponse](docs/EInvoicing/V1/MandatesResponse.md) | ||
- [EInvoicing.V1.NotFoundError](docs/EInvoicing/V1/NotFoundError.md) | ||
- [EInvoicing.V1.NotUsedForField](docs/EInvoicing/V1/NotUsedForField.md) | ||
- [EInvoicing.V1.RequiredWhenField](docs/EInvoicing/V1/RequiredWhenField.md) | ||
- [EInvoicing.V1.StatusEvent](docs/EInvoicing/V1/StatusEvent.md) | ||
- [EInvoicing.V1.SubmitDocumentMetadata](docs/EInvoicing/V1/SubmitDocumentMetadata.md) | ||
- [EInvoicing.V1.SubmitInteropDocument202Response](docs/EInvoicing/V1/SubmitInteropDocument202Response.md) | ||
- [EInvoicing.V1.WorkflowIds](docs/EInvoicing/V1/WorkflowIds.md) | ||
- [EInvoicing.V1.BadDownloadRequest](docs/EInvoicing/V1/BadDownloadRequest.md) | ||
- [EInvoicing.V1.BadRequest](docs/EInvoicing/V1/BadRequest.md) | ||
- [EInvoicing.V1.BatchSearch](docs/EInvoicing/V1/BatchSearch.md) | ||
- [EInvoicing.V1.BatchSearchListResponse](docs/EInvoicing/V1/BatchSearchListResponse.md) | ||
- [EInvoicing.V1.ConditionalForField](docs/EInvoicing/V1/ConditionalForField.md) | ||
- [EInvoicing.V1.DataInputField](docs/EInvoicing/V1/DataInputField.md) | ||
- [EInvoicing.V1.DataInputFieldNotUsedFor](docs/EInvoicing/V1/DataInputFieldNotUsedFor.md) | ||
- [EInvoicing.V1.DataInputFieldOptionalFor](docs/EInvoicing/V1/DataInputFieldOptionalFor.md) | ||
- [EInvoicing.V1.DataInputFieldRequiredFor](docs/EInvoicing/V1/DataInputFieldRequiredFor.md) | ||
- [EInvoicing.V1.DataInputFieldsResponse](docs/EInvoicing/V1/DataInputFieldsResponse.md) | ||
- [EInvoicing.V1.DirectorySearchResponse](docs/EInvoicing/V1/DirectorySearchResponse.md) | ||
- [EInvoicing.V1.DirectorySearchResponseValueInner](docs/EInvoicing/V1/DirectorySearchResponseValueInner.md) | ||
- [EInvoicing.V1.DirectorySearchResponseValueInnerAddressesInner](docs/EInvoicing/V1/DirectorySearchResponseValueInnerAddressesInner.md) | ||
- [EInvoicing.V1.DirectorySearchResponseValueInnerIdentifiersInner](docs/EInvoicing/V1/DirectorySearchResponseValueInnerIdentifiersInner.md) | ||
- [EInvoicing.V1.DirectorySearchResponseValueInnerSupportedDocumentTypesInner](docs/EInvoicing/V1/DirectorySearchResponseValueInnerSupportedDocumentTypesInner.md) | ||
- [EInvoicing.V1.DocumentFetch](docs/EInvoicing/V1/DocumentFetch.md) | ||
- [EInvoicing.V1.DocumentFetchRequest](docs/EInvoicing/V1/DocumentFetchRequest.md) | ||
- [EInvoicing.V1.DocumentFetchRequestDataInner](docs/EInvoicing/V1/DocumentFetchRequestDataInner.md) | ||
- [EInvoicing.V1.DocumentFetchRequestMetadata](docs/EInvoicing/V1/DocumentFetchRequestMetadata.md) | ||
- [EInvoicing.V1.DocumentListResponse](docs/EInvoicing/V1/DocumentListResponse.md) | ||
- [EInvoicing.V1.DocumentStatusResponse](docs/EInvoicing/V1/DocumentStatusResponse.md) | ||
- [EInvoicing.V1.DocumentSubmissionError](docs/EInvoicing/V1/DocumentSubmissionError.md) | ||
- [EInvoicing.V1.DocumentSubmitResponse](docs/EInvoicing/V1/DocumentSubmitResponse.md) | ||
- [EInvoicing.V1.DocumentSummary](docs/EInvoicing/V1/DocumentSummary.md) | ||
- [EInvoicing.V1.ErrorResponse](docs/EInvoicing/V1/ErrorResponse.md) | ||
- [EInvoicing.V1.ForbiddenError](docs/EInvoicing/V1/ForbiddenError.md) | ||
- [EInvoicing.V1.InputDataFormats](docs/EInvoicing/V1/InputDataFormats.md) | ||
- [EInvoicing.V1.InternalServerError](docs/EInvoicing/V1/InternalServerError.md) | ||
- [EInvoicing.V1.Mandate](docs/EInvoicing/V1/Mandate.md) | ||
- [EInvoicing.V1.MandateDataInputField](docs/EInvoicing/V1/MandateDataInputField.md) | ||
- [EInvoicing.V1.MandateDataInputFieldNamespace](docs/EInvoicing/V1/MandateDataInputFieldNamespace.md) | ||
- [EInvoicing.V1.MandatesResponse](docs/EInvoicing/V1/MandatesResponse.md) | ||
- [EInvoicing.V1.NotFoundError](docs/EInvoicing/V1/NotFoundError.md) | ||
- [EInvoicing.V1.NotUsedForField](docs/EInvoicing/V1/NotUsedForField.md) | ||
- [EInvoicing.V1.RequiredWhenField](docs/EInvoicing/V1/RequiredWhenField.md) | ||
- [EInvoicing.V1.StatusEvent](docs/EInvoicing/V1/StatusEvent.md) | ||
- [EInvoicing.V1.SubmitDocumentMetadata](docs/EInvoicing/V1/SubmitDocumentMetadata.md) | ||
- [EInvoicing.V1.SubmitInteropDocument202Response](docs/EInvoicing/V1/SubmitInteropDocument202Response.md) | ||
- [EInvoicing.V1.WorkflowIds](docs/EInvoicing/V1/WorkflowIds.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters