OrderCloud.io's Angular SDK
The official client library for building Angular (6.0.0+) solutions on OrderCloud.io's B2B ecommerce platform
This SDK aims to greatly improve developer productivity and reduce errors by providing discoverable, strongly-typed wrappers for all public endpoints and request/response models.
All included methods are a 1:1 reflection of the API with the addition of the
OcAuthService for authentication and the
OcTokenService exposed as a convenience service for setting and getting authentication tokens
This Angular SDK is made possible by leveraging Swagger's open source tools with our Open API Specification:
- angular 6.0.0+
- ngx-cookie 4.0.0+
From the npm registry:
npm install --save @ordercloud/angular-sdk
In your root app module:
Your First API Call
Now that your app is configured you can authenticate and make your first api call!
All of the filtering options you love from the API are available through the SDK as well. Simply pass in a key/value pair to the filters object on list calls where the
key is any top-level API model or a custom indexed xp value and the
value is the value you'd like to filter on.
Let's run through a couple scenarios and what the call will look like with the SDK:
My products where xp.Featured is true
My orders submitted after April 20th, 2018
Users with the last name starting with Smith:
Users with the last name starting with Smith or users with the last name ending with Jones
My products where xp.Color is not red and not blue
And of course you can mix and match filters to your heart's content.
Impersonation allows a seller user to make an api call on behalf of another user. The SDK enables this by exposing the
As() method for each service.
Assuming you are already authenticated and have the required ImpersonationConfigs set up for your organization, an impersonation call will look something like this:
Many resources in the API support xp, or extendable properties, which let API consumers define their own properties. Typed xp is an opt-in feature of this SDK which allows strong typing on those consumer-defined properties.
;user.xp.age // strongly typed numberuser.xp.isHighRoller // strongly typed boolean
This SDK takes advantage of the version of the HTTP service introduced in Angular 4.3
Every method can be configured with
reportProgress by setting their values in the options object. If omitted they will default to
The API reference should be your go to reference but if you get stuck or have some feedback about this SDK please drop us a line on our community slack channel or ask a question on StackOverflow just use the tag
Because this SDK is generated with the help of the swagger codegen we can't accept PR's on this project directly (as they would simply get overwritten when regenerated) but please open an issue if you notice any bugs, typos, or have general feedback about the SDK. We really want to make this SDK a pleasure to use!