Skip to content

Commit

Permalink
feat: update resources to schema v1.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
pviti committed Jan 26, 2024
1 parent 9e2c96c commit 87dd737
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 14 deletions.
23 changes: 16 additions & 7 deletions gen/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"openapi": "3.0.1",
"info": {
"title": "Commerce Layer Provisioning API",
"version": "1.0.1",
"version": "1.0.2",
"contact": {
"name": "API Support",
"url": "https://commercelayer.io",
Expand Down Expand Up @@ -3549,14 +3549,23 @@
"example": false,
"nullable": false
},
"subscription_totals": {
"subscription_info": {
"type": "object",
"description": "The number of current organizations, markets, memberships, and SKUs associated with the active subscription.",
"description": "Information about the current subscription such as the plan type, limits and subscription totals counter.",
"example": {
"organizations": 1,
"markets": 0,
"memberships": 0,
"skus": 0
"plan_type": "growth",
"limits": {
"markets": 5,
"skus": 10000,
"organizations": 2,
"memberships": 5
},
"totals": {
"organizations": 1,
"markets": 0,
"memberships": 2,
"skus": 0
}
},
"nullable": false
},
Expand Down
4 changes: 2 additions & 2 deletions specs/sdk.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { ObjectType, isResourceType } from '../src/common'
let clp: CommerceLayerProvisioningClient


// eslint-disable-next-line @typescript-eslint/no-unused-vars
beforeAll(async () => { clp = await getClient() })


Expand Down Expand Up @@ -60,7 +59,8 @@ describe('SDK suite', () => {
type: 'roles',
created_at: new Date().toISOString(),
updated_at: new Date().toISOString(),
name: 'Test Role'
name: 'Test Role',
kind: 'custom'
}

expect(isResourceType(customer)).toBeTruthy()
Expand Down
2 changes: 1 addition & 1 deletion src/commercelayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const debug = Debug('commercelayer')


// Autogenerated schema version number, do not remove this line
const OPEN_API_SCHEMA_VERSION = '1.0.1'
const OPEN_API_SCHEMA_VERSION = '1.0.2'
export { OPEN_API_SCHEMA_VERSION }


Expand Down
2 changes: 1 addition & 1 deletion src/resources/organizations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ interface Organization extends Resource {
max_concurrent_imports: number
region?: string | null
can_switch_live: boolean
subscription_totals: Record<string, any>
subscription_info: Record<string, any>

memberships?: Membership[] | null
roles?: Role[] | null
Expand Down
6 changes: 3 additions & 3 deletions test/common.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import getToken from './token'
import CommerceLayer, { CommerceLayerProvisioningClient, QueryParamsList, QueryParamsRetrieve } from '../src'
import CommerceLayerProvisioning, { CommerceLayerProvisioningClient, QueryParamsList, QueryParamsRetrieve } from '../src'
import dotenv from 'dotenv'
import { inspect } from 'util'
import axios, { AxiosRequestConfig } from 'axios'
Expand Down Expand Up @@ -61,15 +61,15 @@ const initClient = async (): Promise<CommerceLayerProvisioningClient> => {
if (token === null) throw new Error('Unable to get access token')
const accessToken = token.accessToken
currentAccessToken = accessToken
const client = CommerceLayer({ accessToken, domain })
const client = CommerceLayerProvisioning({ accessToken, domain })
client.config({ timeout: GLOBAL_TIMEOUT })
jest.setTimeout(GLOBAL_TIMEOUT)
return client
}

const fakeClient = async (): Promise<CommerceLayerProvisioningClient> => {
const accessToken = 'fake-access-token'
const client = CommerceLayer({ accessToken, domain })
const client = CommerceLayerProvisioning({ accessToken, domain })
currentAccessToken = accessToken
return client
}
Expand Down

0 comments on commit 87dd737

Please sign in to comment.