avadev/AvaTax-REST-V2-JS-SDK

Types for the SDK

Rest11 opened this issue · 9 comments

I haven't found any types for this SDK, so I can't use it because I don't know which methods it has, how use it. Please provide it, because the library has only one file AvaTaxClient.js with the not readable code something like this

*/},{key:'queryTaxRules',value:function queryTaxRules(){var _ref318=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},filter=_ref318.filter,include=_ref318.include,top=_ref318.top,skip=_ref318.skip,orderBy=_ref318.orderBy;var path=this.buildUrl({url:'/api/v2/taxrules',parameters:{$filter:filter,$include:include,$top:top,$skip:skip,$orderBy:orderBy}});var strClientId=this.appNM+'; '+this.appVer+'; JavascriptSdk; 22.3.0; '+this.machineNM;return this.restCall({url:path,verb:'get',payload:null,clientId:strClientId});}/**

It seems to be a similar issue to: #124

Not having any typescript types makes it such a hassle to work with. We have to do the semi-old-school way of calling the API, looking at the responses and manually typing it out and trying our best to figure out what types etc would be returned.

Stripe for example is an excellent example of the typed SDK, it makes it so effortless for developers that haven't work too with SDK to understand what is going on with it and make changes to it.

The JavaScript Avatax SDK has existing limitations due to the fact that no models are present. When the caller is passing information to a method which will invoke the corresponding Avatax API, they have no idea what the model looks like or is expected without digging through the Avalara documentation on their own.

We have created a Typescript version of the Avatax SDK, which includes full support for models and enums. Javascript and Typescript developers will now get intelisense from any IDE which supports type files. Additionally, they will be able to navigate directly to the model definitions in the IDE and see exactly what is required and optional instead of having to look at some external documentation. We also added documentation for each method in the SDK which describes what the API does and other information.

The new version of the SDK is fully backwards compatible, so existing developers can take advantage of these new, useful features without having to make any changes to their code base.

We are looking for people willing to test out an early version of the SDK.

Steps to use:
1. npm install ava-typescript --save
2. Replace all require / imports to 'avatax' to 'ava-typescript'

Thank you.
cc: @renarsvilnis @Rest11

@svc-developer Hmmmm this ava-typescript package doesn't seem to have any discernable source other than it's published by the same account as this one.

Unfortunately every type has every field marked as required when in reality most are optional. Making this fairly difficult to actually use.

@mattmatters Could you help point to a few examples of this issue? As it was coded to detect which fields are required and optional and mark them as such. Its possible the logic is not working in all cases

I think we figured out what you were referring to. We will update the typescript version to resolve the issue you pointed out. Thank you so much for your feedback @mattmatters

I can see that this repo is now written in typescript, should we use ava-typescript or avatax?

@hyldmo We will be releasing Avatax v22.11.0 later today which will include Typescript support. Ava-Typescript library was for beta testing only, after the release today, everyone should use avatax.

We have released the Typescript version of the JS SDK today (11/3/22), release 22.11.1. Please check it out we welcome any feedback. https://github.com/avadev/AvaTax-REST-V2-JS-SDK/releases/tag/22.11.1

Note to all devs trying ava-typescript: ava-typescript will now be deprecated and unpublished as we released Typescript with the 22.11.1 release on 11-03-22 for Avatax, please point to that release as it will be what we use for Typescript and Javascript moving forward. @hyldmo @renarsvilnis @mattmatters @Rest11