builtondev / javascript-sdk Goto Github PK
View Code? Open in Web Editor NEWBuilton Javascript SDK
Home Page: https://builton.dev
License: MIT License
Builton Javascript SDK
Home Page: https://builton.dev
License: MIT License
As part of our discussion on how to handle sorting and filtering better,
we came to the conclusion of separating more between endpoints that handle collections and the specific instances of such a collection. E.g.
Payments:
collection specific methods, like:
get all payments, supporting filters and sort
Payment instance
instance specific methods, like:
update this instance
refresh this instance
We miss the recently added objects in the documentation.
The getAvailableOverview
function should not inject the id
in the simpleQuery
function, the getAvailableOverview
method should return an overview of all the providers.
See here: https://github.com/kvassAI/javascript-sdk/blob/master/src/collection/provider.js#L43
Add create and pay for order example
To make it easier to use the SDK on clients, we should create the notion of cart, which encapsulates the order logic.
E.g:
Cart().addProduct({productId, quantity})
- Don't have to be authenticated
Cart().removeProduct({productId, quantity})
- Don't have to be authenticated
Cart().empty()
- Don't have to be authenticated
Cart().removeProduct({productId, quantity})
- Don't have to be authenticated
Cart().checkout(paymentMethodId, deliveryAddress, resumeOrderId)
- Have to be authenticated
Paginating with a size of 0 seems to break the SDK:
builton.orders.search('581398', { size: 0, page: 0 }).then((orders) => {
console.log(orders);
});
Output:
Pagination {
page: 0,
size: 0,
current:
Order {
id: null,
paginate: [Function],
query: [Function],
get: [Function: get],
refresh: [Function: refresh],
update: [Function: update],
apiPath: 'orders' },
paginationTotal: undefined,
_query: [Function],
next: [Function],
previous: [Function],
goToPage: [Function] }
Right now we have user().login. Move this authentication logic into a kvass.authenticate method instead.
We currently have to send in the properties to update in a nested object, e.g.
user.update({ body: { mobile_phone_number: phoneNumber } }).then(console.log).catch(console.warn);
Would maybe be more userfriendly if we just sent it in as:
user.update({ mobile_phone_number: phoneNumber }).then(console.log).catch(console.warn);
Add example where we use the cart functionality
Use promises all around
We're missing the plan object.
See here: https://reference.kvass.ai/#plans
Some of the test json files are very big. We should use simpler examples so developers could read the json files more easily to understand what to expect as responses.
See provider.json, orders.json, products.json, payments.json
As a step to support SCA, Builton API now has a /payments/{PAYMENT_ID}/confirm
endpoint which can be reached (doesn't require authentication)
Go through new endpoints and update SDK accordingly
Lodash has a security vulnerability reported by Snyk.
We need to update @babel/cli when they release their fix as they have lodash as a dependency.
Seems like Add and Remove sub product from cart is not being saved.
Probably add this._saveCart()
before
javascript-sdk/src/functionality/cart.js
Line 86 in 167ea5d
and
javascript-sdk/src/functionality/cart.js
Line 95 in 167ea5d
Add our (KVASS.A) AI models and recommendation functionality to the sdk
We are not using the mocha-lcov-reporter
anymore. It needs to be removed from the devDependencies
.
We will soon release an administration/server-to-server SDK, we therefore need to remove all the administration functionalities from this one.
API supports sending sort
query params on GET requests, giving it properties in the model (with -
in front to sort in descending)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.