@api-client/core 0.19.33 → 0.19.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@api-client/core",
3
3
  "description": "The API Client's core client library. Works in NodeJS and in a ES enabled browser.",
4
- "version": "0.19.33",
4
+ "version": "0.19.35",
5
5
  "license": "UNLICENSED",
6
6
  "exports": {
7
7
  "./browser.js": {
@@ -141,13 +141,15 @@ export class DeploymentsSdk extends SdkBase {
141
141
  return this.processListResponse<DeploymentSchema>(result, 'Unable to list environment deployments for an API. ')
142
142
  },
143
143
 
144
- listAllForEnvironment: async (
144
+ listForEnvironment: async (
145
145
  oid: string,
146
146
  apiId: string,
147
147
  env: DeploymentEnvironment,
148
+ options: ContextListOptions = {},
148
149
  request: SdkOptions = {}
149
150
  ): Promise<ContextListResult<DeploymentSchema>> => {
150
151
  const url = this.sdk.getUrl(RouteBuilder.deploymentsApisForEnv(oid, apiId, env))
152
+ this.sdk.appendListOptions(url, options)
151
153
  const { token = this.sdk.token } = request
152
154
  const result = await this.sdk.http.get(url.toString(), { token })
153
155
  return this.processListResponse<DeploymentSchema>(result, 'Unable to list environment deployments for an API. ')
@@ -644,6 +644,122 @@ export class SdkMock {
644
644
  )
645
645
  },
646
646
  },
647
+
648
+ deployments: {
649
+ list: async (init?: MockListResult, options?: InterceptOptions): Promise<void> => {
650
+ const { mock } = this
651
+ const respond = this.createDefaultResponse(
652
+ 200,
653
+ { 'content-type': 'application/json' },
654
+ () =>
655
+ JSON.stringify({
656
+ items: this.gen.deployments.deployments(init?.size ?? 5),
657
+ cursor: this.createCursorOption(init),
658
+ } as ContextListResult<DeploymentSchema>),
659
+ init
660
+ )
661
+ await mock.add(
662
+ {
663
+ match: { uri: RouteBuilder.deployments(':oid'), methods: ['GET'] },
664
+ respond,
665
+ },
666
+ options
667
+ )
668
+ },
669
+
670
+ create: async (init?: MockResult, options?: InterceptOptions): Promise<void> => {
671
+ const { mock } = this
672
+ const respond = this.createDefaultResponse(
673
+ 202,
674
+ { 'content-type': 'application/json' },
675
+ () => JSON.stringify(this.gen.deployments.deployment()),
676
+ init
677
+ )
678
+ await mock.add(
679
+ {
680
+ match: { uri: RouteBuilder.deployments(':oid'), methods: ['POST'] },
681
+ respond,
682
+ },
683
+ options
684
+ )
685
+ },
686
+
687
+ read: async (init?: MockResult, options?: InterceptOptions): Promise<void> => {
688
+ const { mock } = this
689
+ const respond = this.createDefaultResponse(
690
+ 200,
691
+ { 'content-type': 'application/json' },
692
+ () => JSON.stringify(this.gen.deployments.deployment()),
693
+ init
694
+ )
695
+ await mock.add(
696
+ {
697
+ match: { uri: RouteBuilder.deployment(':oid', ':did'), methods: ['GET'] },
698
+ respond,
699
+ },
700
+ options
701
+ )
702
+ },
703
+
704
+ deactivate: async (init?: MockResult, options?: InterceptOptions): Promise<void> => {
705
+ const { mock } = this
706
+ const respond = this.createDefaultResponse(204, undefined, undefined, init)
707
+ await mock.add(
708
+ {
709
+ match: { uri: RouteBuilder.deployment(':oid', ':did'), methods: ['DELETE'] },
710
+ respond,
711
+ },
712
+ options
713
+ )
714
+ },
715
+
716
+ apis: {
717
+ listAllForApi: async (init?: MockListResult, options?: InterceptOptions): Promise<void> => {
718
+ const { mock } = this
719
+ const respond = this.createDefaultResponse(
720
+ 200,
721
+ { 'content-type': 'application/json' },
722
+ () =>
723
+ JSON.stringify({
724
+ items: this.gen.deployments.deployments(init?.size ?? 3),
725
+ cursor: this.createCursorOption(init),
726
+ } as ContextListResult<DeploymentSchema>),
727
+ init
728
+ )
729
+ await mock.add(
730
+ {
731
+ match: { uri: RouteBuilder.deploymentsApisByEnv(':oid', ':apiId'), methods: ['GET'] },
732
+ respond,
733
+ },
734
+ options
735
+ )
736
+ },
737
+
738
+ listForEnvironment: async (init?: MockListResult, options?: InterceptOptions): Promise<void> => {
739
+ const { mock } = this
740
+ const respond = this.createDefaultResponse(
741
+ 200,
742
+ { 'content-type': 'application/json' },
743
+ () =>
744
+ JSON.stringify({
745
+ items: this.gen.deployments.deployments(init?.size ?? 5),
746
+ cursor: this.createCursorOption(init),
747
+ } as ContextListResult<DeploymentSchema>),
748
+ init
749
+ )
750
+ await mock.add(
751
+ {
752
+ match: {
753
+ uri: RouteBuilder.deploymentsApisForEnv(':oid', ':apiId', ':env' as unknown as DeploymentEnvironment),
754
+ methods: ['GET'],
755
+ },
756
+ respond,
757
+ },
758
+ options
759
+ )
760
+ },
761
+ },
762
+ },
647
763
  }
648
764
 
649
765
  /**