@flipdish/orgmanagement
v1.0.20
Published
OpenAPI client for @flipdish/orgmanagement
Downloads
1,201
Readme
@flipdish/orgmanagement
This package provides a Typescript/JavaScript client for interacting with Flipdish's Organisation Management APIs over HTTP.
Internally the package utilizes the axios as its HTTP client.
Example code
import { OrgsApi, Configuration, OrgCountryCodeEnum } from '@flipdish/orgmanagement';
import { describe, expect, test } from '@jest/globals';
const configuration = new Configuration({
basePath: "https://api.flipdish.co",
// to get the API key, you should follow these docs:
// https://developers.flipdish.com/docs/getting-started
accessToken: process.env.FLIPDISH_API_KEY,
// if using in a browser set useDefaultUserAgent
// to true to prevent errors
// useDefaultUserAgent: true
});
const orgs = new OrgsApi(configuration);
describe('Org Management Tests', () => {
describe('Orgs', () => {
let testOrg: any = {
name: "Macdonald's Test Org",
emailAddress: "[email protected]",
countryCode: OrgCountryCodeEnum.Gb
};
test('Create org', async () => {
const orgsCreateResponse = await orgs.createOrg({ createOrg: testOrg });
expect(orgsCreateResponse.status).toBe(201);
testOrg = { ...testOrg, orgId: orgsCreateResponse.data.data?.orgId };
expect(orgsCreateResponse.data.data).toMatchObject(testOrg);
});
test('Get org by id', async () => {
const orgsResponse = await orgs.getOrgById({ orgId: testOrg.orgId });
expect(orgsResponse.data.data).toMatchObject(testOrg);
})
test('List org by id', async () => {
const orgsResponse = await orgs.getAllOrgs({ brandId: "doesntExist" });
expect(orgsResponse.data.data).toHaveLength(0);
})
});
});
The generated Node module can be used in the following environments:
Environment
- Node.js
- Webpack
- Browserify
Language level
- ES5 - you must have a Promises/A+ library installed
- ES6
Module system
- CommonJS
- ES6 module system
It can be used in both TypeScript and JavaScript. In TypeScript, the definition will be automatically resolved via package.json
. (Reference)