# README
Go API client for openapi
REST interface to Avalara's enterprise tax service, AvaTax.
Overview
This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.
- API version: v2
- Package version: 1.0.0
- Build package: org.openapitools.codegen.languages.GoClientCodegen For more information, please visit https://developer.avalara.com
Installation
Install the following dependencies:
go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/context
Put the package under your project folder and add the following in import:
import openapi "github.com/stripedapps/avalara-go-sdk"
To use a proxy, set the environment variable HTTP_PROXY
:
os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")
Configuration of Server URL
Default configuration comes with Servers
field that contains server objects as defined in the OpenAPI specification.
Select Server Configuration
For using other server than the one defined on index 0 set context value sw.ContextServerIndex
of type int
.
ctx := context.WithValue(context.Background(), openapi.ContextServerIndex, 1)
Templated Server URL
Templated server URL is formatted using default variables from configuration or from context value sw.ContextServerVariables
of type map[string]string
.
ctx := context.WithValue(context.Background(), openapi.ContextServerVariables, map[string]string{
"basePath": "v2",
})
Note, enum values are always validated and all unused variables are silently ignored.
URLs Configuration per Operation
Each operation can use different server URL defined using OperationServers
map in the Configuration
.
An operation is uniquely identified by "{classname}Service.{nickname}"
string.
Similar rules for overriding default operation server index and variables applies by using sw.ContextOperationServerIndices
and sw.ContextOperationServerVariables
context maps.
ctx := context.WithValue(context.Background(), openapi.ContextOperationServerIndices, map[string]int{
"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), openapi.ContextOperationServerVariables, map[string]map[string]string{
"{classname}Service.{nickname}": {
"port": "8443",
},
})
Documentation for API Endpoints
All URIs are relative to https://rest-sbx-preview.avalara.net
Class | Method | HTTP request | Description |
---|---|---|---|
AccountsAPI | ApiV2AccountsByIdDelete | Delete /api/v2/accounts/{id} | Delete a single account |
AccountsAPI | ApiV2AccountsByIdGet | Get /api/v2/accounts/{id} | Retrieve a single account |
AccountsAPI | ApiV2AccountsByIdPut | Put /api/v2/accounts/{id} | Update a single account |
AccountsAPI | ApiV2AccountsGet | Get /api/v2/accounts | Retrieve all accounts |
AccountsAPI | ApiV2AccountsPost | Post /api/v2/accounts | Create a new account |
AddressesAPI | ApiV2AddressesResolvePost | Post /api/v2/addresses/resolve | Retrieve geolocation information for a specified address |
BatchesAPI | ApiV2BatchesGet | Get /api/v2/batches | Retrieve all batches |
BatchesAPI | ApiV2CompaniesByCompanyIdBatchesByIdDelete | Delete /api/v2/companies/{companyId}/batches/{id} | Delete a single batch |
BatchesAPI | ApiV2CompaniesByCompanyIdBatchesByIdGet | Get /api/v2/companies/{companyId}/batches/{id} | Retrieve a single batch |
BatchesAPI | ApiV2CompaniesByCompanyIdBatchesByIdPut | Put /api/v2/companies/{companyId}/batches/{id} | Update a single batch |
BatchesAPI | ApiV2CompaniesByCompanyIdBatchesGet | Get /api/v2/companies/{companyId}/batches | Retrieve all batches for this company |
BatchesAPI | ApiV2CompaniesByCompanyIdBatchesPost | Post /api/v2/companies/{companyId}/batches | Create a new batch |
CompaniesAPI | ApiV2CompaniesByIdDelete | Delete /api/v2/companies/{id} | Delete a single company |
CompaniesAPI | ApiV2CompaniesByIdGet | Get /api/v2/companies/{id} | Retrieve a single company |
CompaniesAPI | ApiV2CompaniesByIdPut | Put /api/v2/companies/{id} | Update a single company |
CompaniesAPI | ApiV2CompaniesGet | Get /api/v2/companies | Retrieve all companies |
CompaniesAPI | ApiV2CompaniesInitializePost | Post /api/v2/companies/initialize | Quick setup for a company with a single physical address |
CompaniesAPI | ApiV2CompaniesPost | Post /api/v2/companies | Create a new company |
ContactsAPI | ApiV2CompaniesByCompanyIdContactsByIdDelete | Delete /api/v2/companies/{companyId}/contacts/{id} | Delete a single contact |
ContactsAPI | ApiV2CompaniesByCompanyIdContactsByIdGet | Get /api/v2/companies/{companyId}/contacts/{id} | Retrieve a single contact |
ContactsAPI | ApiV2CompaniesByCompanyIdContactsByIdPut | Put /api/v2/companies/{companyId}/contacts/{id} | Update a single contact |
ContactsAPI | ApiV2CompaniesByCompanyIdContactsGet | Get /api/v2/companies/{companyId}/contacts | Retrieve contacts for this company |
ContactsAPI | ApiV2CompaniesByCompanyIdContactsPost | Post /api/v2/companies/{companyId}/contacts | Create a new contact |
ContactsAPI | ApiV2ContactsGet | Get /api/v2/contacts | Retrieve all contacts |
DefinitionsAPI | ApiV2DefinitionsNexusByCountryByRegionGet | Get /api/v2/definitions/nexus/{country}/{region} | Retrieve the full list of Avalara-supported nexus for a country and region. |
DefinitionsAPI | ApiV2DefinitionsNexusByCountryGet | Get /api/v2/definitions/nexus/{country} | Retrieve the full list of Avalara-supported nexus for a country. |
DefinitionsAPI | ApiV2DefinitionsNexusGet | Get /api/v2/definitions/nexus | Retrieve the full list of Avalara-supported nexus for all countries and regions. |
DefinitionsAPI | ApiV2DefinitionsSubscriptiontypesGet | Get /api/v2/definitions/subscriptiontypes | Retrieve the full list of Avalara-supported subscription types |
DefinitionsAPI | ApiV2DefinitionsTaxauthoritiesGet | Get /api/v2/definitions/taxauthorities | Retrieve the full list of Avalara-supported tax authorities. |
DefinitionsAPI | ApiV2DefinitionsTaxauthorityformsGet | Get /api/v2/definitions/taxauthorityforms | Retrieve the full list of Avalara-supported tax authorities. |
DefinitionsAPI | ApiV2DefinitionsTaxcodesGet | Get /api/v2/definitions/taxcodes | Retrieve the full list of Avalara-supported tax codes. |
FilingCalendarsAPI | ApiV2CompaniesByCompanyIdFilingcalendarsByIdDelete | Delete /api/v2/companies/{companyId}/filingcalendars/{id} | Delete a single filing calendar |
FilingCalendarsAPI | ApiV2CompaniesByCompanyIdFilingcalendarsByIdGet | Get /api/v2/companies/{companyId}/filingcalendars/{id} | Retrieve a single filing calendar |
FilingCalendarsAPI | ApiV2CompaniesByCompanyIdFilingcalendarsByIdPut | Put /api/v2/companies/{companyId}/filingcalendars/{id} | Update a single filing calendar |
FilingCalendarsAPI | ApiV2CompaniesByCompanyIdFilingcalendarsGet | Get /api/v2/companies/{companyId}/filingcalendars | Retrieve filing calendars for this company |
FilingCalendarsAPI | ApiV2CompaniesByCompanyIdFilingcalendarsPost | Post /api/v2/companies/{companyId}/filingcalendars | Create a new filing calendar |
FilingCalendarsAPI | ApiV2FilingcalendarsGet | Get /api/v2/filingcalendars | Retrieve all filing calendars |
ItemsAPI | ApiV2CompaniesByCompanyIdItemsByIdDelete | Delete /api/v2/companies/{companyId}/items/{id} | Delete a single item |
ItemsAPI | ApiV2CompaniesByCompanyIdItemsByIdGet | Get /api/v2/companies/{companyId}/items/{id} | Retrieve a single item |
ItemsAPI | ApiV2CompaniesByCompanyIdItemsByIdPut | Put /api/v2/companies/{companyId}/items/{id} | Update a single item |
ItemsAPI | ApiV2CompaniesByCompanyIdItemsGet | Get /api/v2/companies/{companyId}/items | Retrieve items for this company |
ItemsAPI | ApiV2CompaniesByCompanyIdItemsPost | Post /api/v2/companies/{companyId}/items | Create a new item |
ItemsAPI | ApiV2ItemsGet | Get /api/v2/items | Retrieve all items |
LocationsAPI | ApiV2CompaniesByCompanyIdLocationsByIdDelete | Delete /api/v2/companies/{companyId}/locations/{id} | Delete a single location |
LocationsAPI | ApiV2CompaniesByCompanyIdLocationsByIdGet | Get /api/v2/companies/{companyId}/locations/{id} | Retrieve a single location |
LocationsAPI | ApiV2CompaniesByCompanyIdLocationsByIdPut | Put /api/v2/companies/{companyId}/locations/{id} | Update a single location |
LocationsAPI | ApiV2CompaniesByCompanyIdLocationsGet | Get /api/v2/companies/{companyId}/locations | Retrieve locations for this company |
LocationsAPI | ApiV2CompaniesByCompanyIdLocationsPost | Post /api/v2/companies/{companyId}/locations | Create a new location |
LocationsAPI | ApiV2LocationsGet | Get /api/v2/locations | Retrieve all locations |
NexusAPI | ApiV2CompaniesByCompanyIdNexusByIdDelete | Delete /api/v2/companies/{companyId}/nexus/{id} | Delete a single nexus |
NexusAPI | ApiV2CompaniesByCompanyIdNexusByIdGet | Get /api/v2/companies/{companyId}/nexus/{id} | Retrieve a single nexus |
NexusAPI | ApiV2CompaniesByCompanyIdNexusByIdPut | Put /api/v2/companies/{companyId}/nexus/{id} | Update a single nexus |
NexusAPI | ApiV2CompaniesByCompanyIdNexusGet | Get /api/v2/companies/{companyId}/nexus | Retrieve nexus for this company |
NexusAPI | ApiV2CompaniesByCompanyIdNexusPost | Post /api/v2/companies/{companyId}/nexus | Create a new nexus |
NexusAPI | ApiV2NexusGet | Get /api/v2/nexus | Retrieve all nexus |
PasswordsAPI | ApiV2PasswordsPut | Put /api/v2/passwords | Change Password |
SettingsAPI | ApiV2CompaniesByCompanyIdSettingsByIdDelete | Delete /api/v2/companies/{companyId}/settings/{id} | Delete a single setting |
SettingsAPI | ApiV2CompaniesByCompanyIdSettingsByIdGet | Get /api/v2/companies/{companyId}/settings/{id} | Retrieve a single setting |
SettingsAPI | ApiV2CompaniesByCompanyIdSettingsByIdPut | Put /api/v2/companies/{companyId}/settings/{id} | Update a single setting |
SettingsAPI | ApiV2CompaniesByCompanyIdSettingsGet | Get /api/v2/companies/{companyId}/settings | Retrieve all settings for this company |
SettingsAPI | ApiV2CompaniesByCompanyIdSettingsPost | Post /api/v2/companies/{companyId}/settings | Create a new setting |
SettingsAPI | ApiV2SettingsGet | Get /api/v2/settings | Retrieve all settings |
SubscriptionsAPI | ApiV2AccountsByAccountIdSubscriptionsByIdDelete | Delete /api/v2/accounts/{accountId}/subscriptions/{id} | Delete a single subscription |
SubscriptionsAPI | ApiV2AccountsByAccountIdSubscriptionsByIdGet | Get /api/v2/accounts/{accountId}/subscriptions/{id} | Retrieve a single subscription |
SubscriptionsAPI | ApiV2AccountsByAccountIdSubscriptionsByIdPut | Put /api/v2/accounts/{accountId}/subscriptions/{id} | Update a single subscription |
SubscriptionsAPI | ApiV2AccountsByAccountIdSubscriptionsGet | Get /api/v2/accounts/{accountId}/subscriptions | Retrieve subscriptions for this account |
SubscriptionsAPI | ApiV2AccountsByAccountIdSubscriptionsPost | Post /api/v2/accounts/{accountId}/subscriptions | Create a new subscription |
SubscriptionsAPI | ApiV2SubscriptionsGet | Get /api/v2/subscriptions | Retrieve all subscriptions |
TaxCodesAPI | ApiV2CompaniesByCompanyIdTaxcodesByIdDelete | Delete /api/v2/companies/{companyId}/taxcodes/{id} | Delete a single tax code |
TaxCodesAPI | ApiV2CompaniesByCompanyIdTaxcodesByIdGet | Get /api/v2/companies/{companyId}/taxcodes/{id} | Retrieve a single tax code |
TaxCodesAPI | ApiV2CompaniesByCompanyIdTaxcodesByIdPut | Put /api/v2/companies/{companyId}/taxcodes/{id} | Update a single tax code |
TaxCodesAPI | ApiV2CompaniesByCompanyIdTaxcodesGet | Get /api/v2/companies/{companyId}/taxcodes | Retrieve tax codes for this company |
TaxCodesAPI | ApiV2CompaniesByCompanyIdTaxcodesPost | Post /api/v2/companies/{companyId}/taxcodes | Create a new tax code |
TaxCodesAPI | ApiV2TaxcodesGet | Get /api/v2/taxcodes | Retrieve all tax codes |
TaxRatesAPI | ApiV2TaxratesByaddressGet | Get /api/v2/taxrates/byaddress | Retrieve tax rates for a specified address |
TaxRatesAPI | ApiV2TaxratesBypostalcodeGet | Get /api/v2/taxrates/bypostalcode | Retrieve tax rates for a specified country and postal code |
TaxRulesAPI | ApiV2CompaniesByCompanyIdTaxrulesByIdDelete | Delete /api/v2/companies/{companyId}/taxrules/{id} | Delete a single tax rule |
TaxRulesAPI | ApiV2CompaniesByCompanyIdTaxrulesByIdGet | Get /api/v2/companies/{companyId}/taxrules/{id} | Retrieve a single tax rule |
TaxRulesAPI | ApiV2CompaniesByCompanyIdTaxrulesByIdPut | Put /api/v2/companies/{companyId}/taxrules/{id} | Update a single tax rule |
TaxRulesAPI | ApiV2CompaniesByCompanyIdTaxrulesGet | Get /api/v2/companies/{companyId}/taxrules | Retrieve tax rules for this company |
TaxRulesAPI | ApiV2CompaniesByCompanyIdTaxrulesPost | Post /api/v2/companies/{companyId}/taxrules | Create a new tax rule |
TaxRulesAPI | ApiV2TaxrulesGet | Get /api/v2/taxrules | Retrieve all tax rules |
TransactionsAPI | ApiV2CompaniesByCompanyCodeTransactionsByTransactionCodeAdjustPost | Post /api/v2/companies/{companyCode}/transactions/{transactionCode}/adjust | Correct a previously created transaction |
TransactionsAPI | ApiV2CompaniesByCompanyCodeTransactionsByTransactionCodeCancelPost | Post /api/v2/companies/{companyCode}/transactions/{transactionCode}/cancel | Cancel a transaction |
TransactionsAPI | ApiV2CompaniesByCompanyCodeTransactionsByTransactionCodeCommitPost | Post /api/v2/companies/{companyCode}/transactions/{transactionCode}/commit | Convert an invoice into a sale or purchase |
TransactionsAPI | ApiV2CompaniesByCompanyCodeTransactionsByTransactionCodeDelete | Delete /api/v2/companies/{companyCode}/transactions/{transactionCode} | Delete a single transaction |
TransactionsAPI | ApiV2CompaniesByCompanyCodeTransactionsByTransactionCodeGet | Get /api/v2/companies/{companyCode}/transactions/{transactionCode} | Retrieve a single transaction |
TransactionsAPI | ApiV2CompaniesByCompanyCodeTransactionsByTransactionCodePostPost | Post /api/v2/companies/{companyCode}/transactions/{transactionCode}/post | Mark a transaction as posted to the ledger |
TransactionsAPI | ApiV2CompaniesByCompanyCodeTransactionsCreatePost | Post /api/v2/companies/{companyCode}/transactions/create | Create a new transaction |
TransactionsAPI | ApiV2CompaniesByCompanyCodeTransactionsGet | Get /api/v2/companies/{companyCode}/transactions | Retrieve all transactions |
TransactionsAPI | ApiV2TransactionsByIdAdjustPost | Post /api/v2/transactions/{id}/adjust | Correct a previously created transaction |
TransactionsAPI | ApiV2TransactionsByIdCancelPost | Post /api/v2/transactions/{id}/cancel | Cancel a transaction |
TransactionsAPI | ApiV2TransactionsByIdCommitPost | Post /api/v2/transactions/{id}/commit | Convert an invoice into a sale or purchase |
TransactionsAPI | ApiV2TransactionsByIdDelete | Delete /api/v2/transactions/{id} | Delete a single transaction |
TransactionsAPI | ApiV2TransactionsByIdGet | Get /api/v2/transactions/{id} | Retrieve a single transaction |
TransactionsAPI | ApiV2TransactionsByIdPostPost | Post /api/v2/transactions/{id}/post | Mark a transaction as posted to the ledger |
TransactionsAPI | ApiV2TransactionsCreatePost | Post /api/v2/transactions/create | Create a new transaction |
UpcsAPI | ApiV2CompaniesByCompanyIdUpcsByIdDelete | Delete /api/v2/companies/{companyId}/upcs/{id} | Delete a single UPC |
UpcsAPI | ApiV2CompaniesByCompanyIdUpcsByIdGet | Get /api/v2/companies/{companyId}/upcs/{id} | Retrieve a single UPC |
UpcsAPI | ApiV2CompaniesByCompanyIdUpcsByIdPut | Put /api/v2/companies/{companyId}/upcs/{id} | Update a single UPC |
UpcsAPI | ApiV2CompaniesByCompanyIdUpcsGet | Get /api/v2/companies/{companyId}/upcs | Retrieve UPCs for this company |
UpcsAPI | ApiV2CompaniesByCompanyIdUpcsPost | Post /api/v2/companies/{companyId}/upcs | Create a new UPC |
UpcsAPI | ApiV2UpcsGet | Get /api/v2/upcs | Retrieve all UPCs |
UsersAPI | ApiV2AccountsByAccountIdUsersByIdDelete | Delete /api/v2/accounts/{accountId}/users/{id} | Delete a single user |
UsersAPI | ApiV2AccountsByAccountIdUsersByIdEntitlementsGet | Get /api/v2/accounts/{accountId}/users/{id}/entitlements | Retrieve all entitlements for a single user |
UsersAPI | ApiV2AccountsByAccountIdUsersByIdGet | Get /api/v2/accounts/{accountId}/users/{id} | Retrieve a single user |
UsersAPI | ApiV2AccountsByAccountIdUsersByIdPut | Put /api/v2/accounts/{accountId}/users/{id} | Update a single user |
UsersAPI | ApiV2AccountsByAccountIdUsersGet | Get /api/v2/accounts/{accountId}/users | Retrieve users for this account |
UsersAPI | ApiV2AccountsByAccountIdUsersPost | Post /api/v2/accounts/{accountId}/users | Create a new user |
UsersAPI | ApiV2UsersGet | Get /api/v2/users | Retrieve all users |
UtilitiesAPI | UtilitiesIsauthorizedPost | Post /utilities/isauthorized | Checks authentication and authorization to one or more operations on the service. |
UtilitiesAPI | UtilitiesIsserviceauthorizedPost | Post /utilities/isserviceauthorized | Checks if service is authorized for given service type |
UtilitiesAPI | UtilitiesPingGet | Get /utilities/ping | Tests connectivity and version of the service |
Documentation For Models
- AccountModel
- AddressInfo
- AddressResolutionModel
- AdjustTransactionModel
- BatchFileModel
- BatchModel
- CancelTransactionModel
- CheckServiceAuthorizedModel
- CommitTransactionModel
- CompanyInitializationModel
- CompanyModel
- ContactModel
- CoordinateInfo
- CreateTransactionModel
- CreateTransactionModelAddresses
- ErrorDetail
- ErrorInfo
- ErrorResult
- FetchResultAccountModel
- FetchResultBatchModel
- FetchResultCompanyModel
- FetchResultContactModel
- FetchResultFilingCalendarModel
- FetchResultItemModel
- FetchResultLocationModel
- FetchResultNexusModel
- FetchResultSettingModel
- FetchResultSubscriptionModel
- FetchResultSubscriptionTypeModel
- FetchResultTaxAuthorityFormModel
- FetchResultTaxAuthorityModel
- FetchResultTaxCodeModel
- FetchResultTaxRuleModel
- FetchResultTransactionModel
- FetchResultUPCModel
- FetchResultUserModel
- FilingCalendarModel
- ItemModel
- LineItemModel
- LineItemModelAddresses
- LocationModel
- NexusModel
- PasswordChangeModel
- PingResultModel
- PostTransactionModel
- RateModel
- SettingModel
- SubscriptionModel
- SubscriptionTypeModel
- TaxAuthorityFormModel
- TaxAuthorityInfo
- TaxAuthorityModel
- TaxCodeModel
- TaxOverrideModel
- TaxRateModel
- TaxRuleModel
- TransactionAddressModel
- TransactionLineDetailModel
- TransactionLineModel
- TransactionModel
- UPCModel
- UserEntitlementModel
- UserModel
Documentation For Authorization
Authentication schemes defined for the API:
UserSecurity
- Type: HTTP basic authentication
Example
auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{
UserName: "username",
Password: "password",
})
r, err := client.Service.Operation(auth, args)
ApiKeySecurity
- Type: API key
- API key parameter name: Authorization
- Location: HTTP header
Note, each API key must be added to a map of map[string]APIKey
where the key is: Authorization and passed in as the auth context for each request.
Example
auth := context.WithValue(
context.Background(),
sw.ContextAPIKeys,
map[string]sw.APIKey{
"Authorization": {Key: "API_KEY_STRING"},
},
)
r, err := client.Service.Operation(auth, args)
OauthSecurity
- Type: OAuth
- Flow: accessCode
- Authorization URL: http://doesnotexist.com//connect/authorize
- Scopes: N/A
Example
auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING")
r, err := client.Service.Operation(auth, args)
Or via OAuth2 module to automatically refresh tokens and perform user authentication.
import "golang.org/x/oauth2"
/* Perform OAuth2 round trip request and obtain a token */
tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token)
auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource)
r, err := client.Service.Operation(auth, args)
Documentation for Utility Methods
Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:
PtrBool
PtrInt
PtrInt32
PtrInt64
PtrFloat
PtrFloat32
PtrFloat64
PtrString
PtrTime