Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
orb-billing
Advanced tools
npm add orb-billing
yarn add orb-billing
import { Orb } from "orb-billing";
(async() => {
const sdk = new Orb({
security: {
apiKey: "",
},
});
const res = await sdk.availability.ping();
if (res.statusCode == 200) {
// handle response
}
})();
Some of the endpoints in this SDK support pagination. To use pagination, you make your SDK calls as usual, but the
returned response object will have a next
method that can be called to pull down the next group of results. If the
return value of next
is null
, then there are no more pages to be fetched.
Here's an example of one such pagination call:
/* eslint-disable prefer-const */
import { Orb } from "orb-billing";
// Initialize the SDK with an API key.
const sdk = new Orb({
security: {
apiKeyAuth: "",
},
});
async function paginationDemo() {
let cursor: string | undefined;
// We start by attempting to fetch at least one page of results.
do {
// The SDK call takes the cursor and any additional arguments to filter the
// coupon data.
const response = await sdk.coupon.list({ cursor, showArchived: false });
const { statusCode } = response;
if (statusCode !== 200) {
throw new Error(`Unexpected status code sent from server: ${statusCode}`);
}
// We capture the cursor for the next iteration but we also check if we
// received an empty page of results as a signal to stop making additional
// requests.
cursor = response.coupons?.paginationMetadata.nextCursor;
const page = response.coupons?.data;
if (!page?.length) {
break;
}
// At this point we have a page of coupon entries that we can collect or
// iterate through as shown below.
page.forEach((coupon) => {
const { redemptionCode: code, timesRedeemed } = coupon;
console.log(`Coupon ${code} was redeemed ${timesRedeemed} times.`);
});
// The loop will continue if we received a cursor for additional results.
} while (cursor);
}
// Run the demo function.
paginationDemo();
This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version.
While we value open-source contributions to this SDK, this library is generated programmatically. Feel free to open a PR or a Github issue as a proof of concept and we'll do our best to include it in a future release!
FAQs
The official TypeScript library for the Orb API
The npm package orb-billing receives a total of 119,294 weekly downloads. As such, orb-billing popularity was classified as popular.
We found that orb-billing demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.