@quantcdn/quant-client 2.0.13 → 3.0.1

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.
Files changed (122) hide show
  1. package/README.md +49 -72
  2. package/dist/api/apis.d.ts +32 -0
  3. package/dist/api/apis.js +50 -0
  4. package/dist/api/applicationsApi.d.ts +104 -0
  5. package/dist/api/applicationsApi.js +431 -0
  6. package/dist/api/backupManagementApi.d.ts +106 -0
  7. package/dist/api/backupManagementApi.js +440 -0
  8. package/dist/api/commandsApi.d.ts +80 -0
  9. package/dist/api/commandsApi.js +316 -0
  10. package/dist/api/composeApi.d.ts +66 -0
  11. package/dist/api/composeApi.js +236 -0
  12. package/dist/api/containersApi.d.ts +67 -0
  13. package/dist/api/containersApi.js +236 -0
  14. package/dist/api/cronApi.d.ts +151 -0
  15. package/dist/api/cronApi.js +681 -0
  16. package/dist/api/environmentsApi.d.ts +194 -0
  17. package/dist/api/environmentsApi.js +861 -0
  18. package/dist/api/sSHAccessApi.d.ts +50 -0
  19. package/dist/api/sSHAccessApi.js +162 -0
  20. package/dist/api/scalingPolicyApi.d.ts +82 -0
  21. package/dist/api/scalingPolicyApi.js +307 -0
  22. package/dist/api/variablesApi.d.ts +83 -0
  23. package/dist/api/variablesApi.js +313 -0
  24. package/dist/api/volumesApi.d.ts +97 -0
  25. package/dist/api/volumesApi.js +405 -0
  26. package/dist/api.d.ts +2 -0
  27. package/dist/api.js +19 -0
  28. package/dist/model/application.d.ts +38 -0
  29. package/dist/model/application.js +93 -0
  30. package/dist/model/command.d.ts +34 -0
  31. package/dist/model/command.js +73 -0
  32. package/dist/model/compose.d.ts +32 -0
  33. package/dist/model/compose.js +58 -0
  34. package/dist/model/configuration.d.ts +26 -0
  35. package/dist/model/configuration.js +30 -0
  36. package/dist/model/container.d.ts +38 -0
  37. package/dist/model/container.js +78 -0
  38. package/dist/model/containerEnvironmentInner.d.ts +26 -0
  39. package/dist/model/containerEnvironmentInner.js +33 -0
  40. package/dist/model/containerImageReference.d.ts +28 -0
  41. package/dist/model/containerImageReference.js +43 -0
  42. package/dist/model/containerMountPointsInner.d.ts +27 -0
  43. package/dist/model/containerMountPointsInner.js +38 -0
  44. package/dist/model/createApplicationRequest.d.ts +28 -0
  45. package/dist/model/createApplicationRequest.js +43 -0
  46. package/dist/model/createBackup202Response.d.ts +27 -0
  47. package/dist/model/createBackup202Response.js +38 -0
  48. package/dist/model/createBackupRequest.d.ts +32 -0
  49. package/dist/model/createBackupRequest.js +33 -0
  50. package/dist/model/createCommandRequest.d.ts +25 -0
  51. package/dist/model/createCommandRequest.js +28 -0
  52. package/dist/model/createCronJob422Response.d.ts +26 -0
  53. package/dist/model/createCronJob422Response.js +33 -0
  54. package/dist/model/createCronJobRequest.d.ts +30 -0
  55. package/dist/model/createCronJobRequest.js +56 -0
  56. package/dist/model/createEnvironmentRequest.d.ts +34 -0
  57. package/dist/model/createEnvironmentRequest.js +53 -0
  58. package/dist/model/cron.d.ts +27 -0
  59. package/dist/model/cron.js +38 -0
  60. package/dist/model/cronRun.d.ts +48 -0
  61. package/dist/model/cronRun.js +89 -0
  62. package/dist/model/deleteBackup200Response.d.ts +26 -0
  63. package/dist/model/deleteBackup200Response.js +33 -0
  64. package/dist/model/downloadBackup200Response.d.ts +36 -0
  65. package/dist/model/downloadBackup200Response.js +38 -0
  66. package/dist/model/environment.d.ts +45 -0
  67. package/dist/model/environment.js +103 -0
  68. package/dist/model/getEcrLoginCredentials200Response.d.ts +28 -0
  69. package/dist/model/getEcrLoginCredentials200Response.js +43 -0
  70. package/dist/model/getScalingPolicies200Response.d.ts +26 -0
  71. package/dist/model/getScalingPolicies200Response.js +28 -0
  72. package/dist/model/getSshAccessCredentials200Response.d.ts +34 -0
  73. package/dist/model/getSshAccessCredentials200Response.js +68 -0
  74. package/dist/model/getSshAccessCredentials200ResponseCredentials.d.ts +28 -0
  75. package/dist/model/getSshAccessCredentials200ResponseCredentials.js +43 -0
  76. package/dist/model/listBackups200Response.d.ts +26 -0
  77. package/dist/model/listBackups200Response.js +28 -0
  78. package/dist/model/listBackups200ResponseBackupsInner.d.ts +29 -0
  79. package/dist/model/listBackups200ResponseBackupsInner.js +48 -0
  80. package/dist/model/models.d.ts +84 -0
  81. package/dist/model/models.js +370 -0
  82. package/dist/model/scalingPolicy.d.ts +35 -0
  83. package/dist/model/scalingPolicy.js +51 -0
  84. package/dist/model/syncOperation.d.ts +31 -0
  85. package/dist/model/syncOperation.js +58 -0
  86. package/dist/model/syncToEnvironmentRequest.d.ts +25 -0
  87. package/dist/model/syncToEnvironmentRequest.js +28 -0
  88. package/dist/model/updateComposeRequest.d.ts +26 -0
  89. package/dist/model/updateComposeRequest.js +28 -0
  90. package/dist/model/updateCronJobRequest.d.ts +29 -0
  91. package/dist/model/updateCronJobRequest.js +48 -0
  92. package/dist/model/updateEnvironmentComposeRequest.d.ts +26 -0
  93. package/dist/model/updateEnvironmentComposeRequest.js +28 -0
  94. package/dist/model/updateEnvironmentRequest.d.ts +26 -0
  95. package/dist/model/updateEnvironmentRequest.js +28 -0
  96. package/dist/model/updateEnvironmentStateRequest.d.ts +26 -0
  97. package/dist/model/updateEnvironmentStateRequest.js +33 -0
  98. package/dist/model/updateEnvironmentVariableRequest.d.ts +25 -0
  99. package/dist/model/updateEnvironmentVariableRequest.js +28 -0
  100. package/dist/model/validateCompose200Response.d.ts +27 -0
  101. package/dist/model/validateCompose200Response.js +38 -0
  102. package/dist/model/validateComposeRequest.d.ts +25 -0
  103. package/dist/model/validateComposeRequest.js +28 -0
  104. package/dist/model/variable.d.ts +26 -0
  105. package/dist/model/variable.js +33 -0
  106. package/dist/model/volume.d.ts +32 -0
  107. package/dist/model/volume.js +63 -0
  108. package/package.json +21 -40
  109. package/dist/src/client.d.ts +0 -15
  110. package/dist/src/client.js +0 -380
  111. package/dist/src/index.d.ts +0 -2
  112. package/dist/src/index.js +0 -42
  113. package/dist/src/interfaces.d.ts +0 -34
  114. package/dist/src/interfaces.js +0 -2
  115. package/dist/src/response.d.ts +0 -15
  116. package/dist/src/response.js +0 -103
  117. package/dist/src/types.d.ts +0 -68
  118. package/dist/src/types.js +0 -8
  119. package/dist/tests/client.test.d.ts +0 -1
  120. package/dist/tests/client.test.js +0 -191
  121. package/dist/tests/response.test.d.ts +0 -1
  122. package/dist/tests/response.test.js +0 -133
package/README.md CHANGED
@@ -1,88 +1,65 @@
1
- # QuantCDN client API
1
+ # Quant TypeScript Client
2
2
 
3
- Provides a client to common API interfaces on QuantCDN.
3
+ A TypeScript client for the Quant API.
4
4
 
5
- ## Install
5
+ ## Installation
6
6
 
7
- The preferred method for installation is via npm.
8
-
9
- ```
10
- npm i @quantcdn/quant-client
7
+ ```bash
8
+ npm install quant-ts-client
11
9
  ```
12
10
 
13
11
  ## Usage
14
12
 
15
- - Import `types` form '@quantcdn/quant-client' to correctly type parameters
16
- - All responses are generated using the `PaginatedResponse` object which provides an async iterator
17
-
18
- ```
19
- import { QuantClient, types } from '@quantcdn/quant-client'
20
-
21
- const config:types.Config = {
22
- organization: process.env.QUANT_CUSTOMER,
23
- project: process.env.QUANT_PROJECT,
24
- token: process.env.QUANT_TOKEN
25
- }
26
-
27
- // If making organization API requests with the client you need to provide bearer
28
- # config.bearer = process.env.QUANT_BEARER_TOKEN
29
-
30
- // Create a new client instance.
31
- const client = new QuantClient(config)
32
-
33
- // Perform requests to the project API.
34
- const p:types.URLPayload = {"url": "/*"}
35
- client.project.purge(p).then(async res => {
36
- const r = await res.first()
37
- console.log(r)
38
- })
39
-
40
- // Ping the API to verify details.
41
- client.project.ping().then(async res => {
42
- const b = await res.first()
43
- console.log(b)
44
- })
45
-
46
- // Access project metadata.
47
- client.project.meta().then(async res => {
48
- // res.first() will return the first page of the paginated response.
49
- for await (const i of res) {
50
- console.log(i)
51
- }
52
- })
13
+ ```typescript
14
+ import { EnvironmentsApi, Configuration } from 'quant-ts-client';
15
+
16
+ // Create a configuration with your API key
17
+ const config = new Configuration({
18
+ apiKey: 'YOUR_API_KEY',
19
+ basePath: 'YOUR_BASE_URL' // Optional if using the default base URL
20
+ });
21
+
22
+ // Initialize an API instance
23
+ const environmentsApi = new EnvironmentsApi(config);
24
+
25
+ // Example: Get all environments
26
+ environmentsApi.getAllEnvironments()
27
+ .then(response => {
28
+ console.log(response.data);
29
+ })
30
+ .catch(error => {
31
+ console.error(error);
32
+ });
53
33
  ```
54
34
 
55
- ## Available methods
35
+ ## Available APIs
56
36
 
57
- The `QuantClient` class has three properties to access different APIs that are exposed by Quant. These are `project`, `organization`, `search`. Both the project and search clients are project specific.
37
+ The client provides access to the following API endpoints:
58
38
 
59
- ### `client.project`
39
+ - `ApplicationsApi`
40
+ - `CommandsApi`
41
+ - `ComposeApi`
42
+ - `ContainersApi`
43
+ - `CronApi`
44
+ - `EnvironmentsApi`
45
+ - `ScalingPolicyApi`
46
+ - `VariablesApi`
47
+ - `VolumesApi`
60
48
 
61
- | Method | Description | Parameters |
62
- | --------- | -------------------------------------- | --------------------- |
63
- | ping | Ping the API to validate credentials | |
64
- | meta | Access the global meta for the project | |
65
- | markup | Send a HTML file | types.MarkupPayload |
66
- | file | Send a non-HTML file | types.FilePayload |
67
- | publish | Publish a URL | types.PublishPayload |
68
- | unpublish | Unpublish a URL | types.PublishPayload |
69
- | redirect | Create a redirect | types.RedirectPayload |
70
- | proxy | Create an origin proxy | types.ProxyPayload |
71
- | delete | Delete a resource | types.URLPayload |
72
- | revisions | Show revisions for a URL | types.URLPayload |
73
- | purge | Purge cache for the given URL | types.URLPayload |
49
+ ## Development
74
50
 
75
- ### `client.organization`
51
+ ### Building the package
76
52
 
77
- | Method | Description | Parameters |
78
- | ------- | ------------------------------------ | -------------------- |
79
- | wafLogs | Access WAF logs for the organization | types.WafLogsPayload |
53
+ ```bash
54
+ npm run build
55
+ ```
56
+
57
+ ### Publishing the package
58
+
59
+ ```bash
60
+ npm publish
61
+ ```
80
62
 
81
- ### `client.search`
63
+ ## License
82
64
 
83
- | Method | Description | Parameters |
84
- | ------ | --------------------------- | ------------------------ |
85
- | index | Add a new item to the index | types.SearchIndexPayload |
86
- | remove | Remove a URL form the index | types.URLPayload |
87
- | clear | Clear the projects index | |
88
- | status | Get the index status | |
65
+ MIT
@@ -0,0 +1,32 @@
1
+ /// <reference types="node" />
2
+ export * from './applicationsApi';
3
+ import { ApplicationsApi } from './applicationsApi';
4
+ export * from './backupManagementApi';
5
+ import { BackupManagementApi } from './backupManagementApi';
6
+ export * from './commandsApi';
7
+ import { CommandsApi } from './commandsApi';
8
+ export * from './composeApi';
9
+ import { ComposeApi } from './composeApi';
10
+ export * from './containersApi';
11
+ import { ContainersApi } from './containersApi';
12
+ export * from './cronApi';
13
+ import { CronApi } from './cronApi';
14
+ export * from './environmentsApi';
15
+ import { EnvironmentsApi } from './environmentsApi';
16
+ export * from './sSHAccessApi';
17
+ import { SSHAccessApi } from './sSHAccessApi';
18
+ export * from './scalingPolicyApi';
19
+ import { ScalingPolicyApi } from './scalingPolicyApi';
20
+ export * from './variablesApi';
21
+ import { VariablesApi } from './variablesApi';
22
+ export * from './volumesApi';
23
+ import { VolumesApi } from './volumesApi';
24
+ import * as http from 'http';
25
+ export declare class HttpError extends Error {
26
+ response: http.IncomingMessage;
27
+ body: any;
28
+ statusCode?: number | undefined;
29
+ constructor(response: http.IncomingMessage, body: any, statusCode?: number | undefined);
30
+ }
31
+ export { RequestFile } from '../model/models';
32
+ export declare const APIS: (typeof ApplicationsApi | typeof BackupManagementApi | typeof CommandsApi | typeof ComposeApi | typeof ContainersApi | typeof CronApi | typeof EnvironmentsApi | typeof SSHAccessApi | typeof ScalingPolicyApi | typeof VariablesApi | typeof VolumesApi)[];
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.APIS = exports.HttpError = void 0;
18
+ __exportStar(require("./applicationsApi"), exports);
19
+ const applicationsApi_1 = require("./applicationsApi");
20
+ __exportStar(require("./backupManagementApi"), exports);
21
+ const backupManagementApi_1 = require("./backupManagementApi");
22
+ __exportStar(require("./commandsApi"), exports);
23
+ const commandsApi_1 = require("./commandsApi");
24
+ __exportStar(require("./composeApi"), exports);
25
+ const composeApi_1 = require("./composeApi");
26
+ __exportStar(require("./containersApi"), exports);
27
+ const containersApi_1 = require("./containersApi");
28
+ __exportStar(require("./cronApi"), exports);
29
+ const cronApi_1 = require("./cronApi");
30
+ __exportStar(require("./environmentsApi"), exports);
31
+ const environmentsApi_1 = require("./environmentsApi");
32
+ __exportStar(require("./sSHAccessApi"), exports);
33
+ const sSHAccessApi_1 = require("./sSHAccessApi");
34
+ __exportStar(require("./scalingPolicyApi"), exports);
35
+ const scalingPolicyApi_1 = require("./scalingPolicyApi");
36
+ __exportStar(require("./variablesApi"), exports);
37
+ const variablesApi_1 = require("./variablesApi");
38
+ __exportStar(require("./volumesApi"), exports);
39
+ const volumesApi_1 = require("./volumesApi");
40
+ class HttpError extends Error {
41
+ constructor(response, body, statusCode) {
42
+ super('HTTP request failed');
43
+ this.response = response;
44
+ this.body = body;
45
+ this.statusCode = statusCode;
46
+ this.name = 'HttpError';
47
+ }
48
+ }
49
+ exports.HttpError = HttpError;
50
+ exports.APIS = [applicationsApi_1.ApplicationsApi, backupManagementApi_1.BackupManagementApi, commandsApi_1.CommandsApi, composeApi_1.ComposeApi, containersApi_1.ContainersApi, cronApi_1.CronApi, environmentsApi_1.EnvironmentsApi, sSHAccessApi_1.SSHAccessApi, scalingPolicyApi_1.ScalingPolicyApi, variablesApi_1.VariablesApi, volumesApi_1.VolumesApi];
@@ -0,0 +1,104 @@
1
+ /**
2
+ * QuantCloud API
3
+ * QuantCloud API
4
+ *
5
+ * The version of the OpenAPI document: 1.0.0
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ /// <reference types="node" />
13
+ import http from 'http';
14
+ import { Application } from '../model/application';
15
+ import { GetEcrLoginCredentials200Response } from '../model/getEcrLoginCredentials200Response';
16
+ import { Authentication, Interceptor } from '../model/models';
17
+ export declare enum ApplicationsApiApiKeys {
18
+ }
19
+ export declare class ApplicationsApi {
20
+ protected _basePath: string;
21
+ protected _defaultHeaders: any;
22
+ protected _useQuerystring: boolean;
23
+ protected authentications: {
24
+ default: Authentication;
25
+ };
26
+ protected interceptors: Interceptor[];
27
+ constructor(basePath?: string);
28
+ set useQuerystring(value: boolean);
29
+ set basePath(basePath: string);
30
+ set defaultHeaders(defaultHeaders: any);
31
+ get defaultHeaders(): any;
32
+ get basePath(): string;
33
+ setDefaultAuthentication(auth: Authentication): void;
34
+ setApiKey(key: ApplicationsApiApiKeys, value: string): void;
35
+ addInterceptor(interceptor: Interceptor): void;
36
+ /**
37
+ *
38
+ * @summary Create a new application
39
+ * @param organisation The organisation ID
40
+ * @param application
41
+ */
42
+ createApplication(organisation: string, application: Application, options?: {
43
+ headers: {
44
+ [name: string]: string;
45
+ };
46
+ }): Promise<{
47
+ response: http.IncomingMessage;
48
+ body: Application;
49
+ }>;
50
+ /**
51
+ *
52
+ * @summary Delete an application
53
+ * @param organisation The organisation ID
54
+ * @param application The application ID
55
+ */
56
+ deleteApplication(organisation: string, application: string, options?: {
57
+ headers: {
58
+ [name: string]: string;
59
+ };
60
+ }): Promise<{
61
+ response: http.IncomingMessage;
62
+ body?: any;
63
+ }>;
64
+ /**
65
+ *
66
+ * @summary Get a single application
67
+ * @param organisation The organisation ID
68
+ * @param application The application ID
69
+ */
70
+ getApplication(organisation: string, application: string, options?: {
71
+ headers: {
72
+ [name: string]: string;
73
+ };
74
+ }): Promise<{
75
+ response: http.IncomingMessage;
76
+ body: Application;
77
+ }>;
78
+ /**
79
+ *
80
+ * @summary Get ECR login credentials
81
+ * @param organisation The organisation ID
82
+ */
83
+ getEcrLoginCredentials(organisation: string, options?: {
84
+ headers: {
85
+ [name: string]: string;
86
+ };
87
+ }): Promise<{
88
+ response: http.IncomingMessage;
89
+ body: GetEcrLoginCredentials200Response;
90
+ }>;
91
+ /**
92
+ *
93
+ * @summary Get all applications for an organisation
94
+ * @param organisation The organisation ID
95
+ */
96
+ listApplications(organisation: string, options?: {
97
+ headers: {
98
+ [name: string]: string;
99
+ };
100
+ }): Promise<{
101
+ response: http.IncomingMessage;
102
+ body: Array<Application>;
103
+ }>;
104
+ }