@teemill/platform 0.1.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.
@@ -0,0 +1,13 @@
1
+ .gitignore
2
+ .npmignore
3
+ .openapi-generator-ignore
4
+ README.md
5
+ api.ts
6
+ base.ts
7
+ common.ts
8
+ configuration.ts
9
+ git_push.sh
10
+ index.ts
11
+ package.json
12
+ tsconfig.esm.json
13
+ tsconfig.json
@@ -0,0 +1 @@
1
+ 7.5.0
@@ -0,0 +1,23 @@
1
+ # OpenAPI Generator Ignore
2
+ # Generated by openapi-generator https://github.com/openapitools/openapi-generator
3
+
4
+ # Use this file to prevent files from being overwritten by the generator.
5
+ # The patterns follow closely to .gitignore or .dockerignore.
6
+
7
+ # As an example, the C# client generator defines ApiClient.cs.
8
+ # You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
9
+ #ApiClient.cs
10
+
11
+ # You can match any string of characters against a directory, file or extension with a single asterisk (*):
12
+ #foo/*/qux
13
+ # The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
14
+
15
+ # You can recursively match patterns against a directory, file or extension with a double asterisk (**):
16
+ #foo/**/qux
17
+ # This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
18
+
19
+ # You can also negate patterns with an exclamation (!).
20
+ # For example, you can ignore all files in a docs folder with the file extension .md:
21
+ #docs/*.md
22
+ # Then explicitly reverse the ignore rule for a single file:
23
+ #!docs/README.md
package/README.md ADDED
@@ -0,0 +1,46 @@
1
+ ## @teemill/platform@0.1.1
2
+
3
+ This generator creates TypeScript/JavaScript client that utilizes [axios](https://github.com/axios/axios). The generated Node module can be used in the following environments:
4
+
5
+ Environment
6
+ * Node.js
7
+ * Webpack
8
+ * Browserify
9
+
10
+ Language level
11
+ * ES5 - you must have a Promises/A+ library installed
12
+ * ES6
13
+
14
+ Module system
15
+ * CommonJS
16
+ * ES6 module system
17
+
18
+ It can be used in both TypeScript and JavaScript. In TypeScript, the definition will be automatically resolved via `package.json`. ([Reference](https://www.typescriptlang.org/docs/handbook/declaration-files/consumption.html))
19
+
20
+ ### Building
21
+
22
+ To build and compile the typescript sources to javascript use:
23
+ ```
24
+ npm install
25
+ npm run build
26
+ ```
27
+
28
+ ### Publishing
29
+
30
+ First build the package then run `npm publish`
31
+
32
+ ### Consuming
33
+
34
+ navigate to the folder of your consuming project and run one of the following commands.
35
+
36
+ _published:_
37
+
38
+ ```
39
+ npm install @teemill/platform@0.1.1 --save
40
+ ```
41
+
42
+ _unPublished (not recommended):_
43
+
44
+ ```
45
+ npm install PATH_TO_GENERATED_PACKAGE --save
46
+ ```
package/api.ts ADDED
@@ -0,0 +1,302 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Platform API
5
+ * Manage Your podOS platform Currently this API is in development and is not yet publicly accessible. All paths and models are subject to change. For full documentation on functionality and account settings go to [teemill.com](https://teemill.com)
6
+ *
7
+ * The version of the OpenAPI document: 0.1.1
8
+ * Contact: hello@teemill.com
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+
16
+ import type { Configuration } from './configuration';
17
+ import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
18
+ import globalAxios from 'axios';
19
+ // Some imports not used depending on template conditions
20
+ // @ts-ignore
21
+ import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common';
22
+ import type { RequestArgs } from './base';
23
+ // @ts-ignore
24
+ import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError, operationServerMap } from './base';
25
+
26
+ /**
27
+ *
28
+ * @export
29
+ * @interface ApiError
30
+ */
31
+ export interface ApiError {
32
+ /**
33
+ *
34
+ * @type {string}
35
+ * @memberof ApiError
36
+ */
37
+ 'code'?: string;
38
+ /**
39
+ *
40
+ * @type {string}
41
+ * @memberof ApiError
42
+ */
43
+ 'message': string;
44
+ }
45
+ /**
46
+ *
47
+ * @export
48
+ * @interface Platform
49
+ */
50
+ export interface Platform {
51
+ /**
52
+ *
53
+ * @type {Array<PlatformLogo>}
54
+ * @memberof Platform
55
+ */
56
+ 'logos': Array<PlatformLogo>;
57
+ }
58
+ /**
59
+ *
60
+ * @export
61
+ * @interface PlatformLogo
62
+ */
63
+ export interface PlatformLogo {
64
+ /**
65
+ *
66
+ * @type {string}
67
+ * @memberof PlatformLogo
68
+ */
69
+ 'url': string;
70
+ /**
71
+ *
72
+ * @type {{ [key: string]: string; }}
73
+ * @memberof PlatformLogo
74
+ */
75
+ 'meta': { [key: string]: string; };
76
+ }
77
+ /**
78
+ *
79
+ * @export
80
+ * @interface ValidationError
81
+ */
82
+ export interface ValidationError {
83
+ /**
84
+ *
85
+ * @type {string}
86
+ * @memberof ValidationError
87
+ */
88
+ 'message': string;
89
+ /**
90
+ *
91
+ * @type {{ [key: string]: Array<string>; }}
92
+ * @memberof ValidationError
93
+ */
94
+ 'errors': { [key: string]: Array<string>; };
95
+ }
96
+
97
+ /**
98
+ * PlatformApi - axios parameter creator
99
+ * @export
100
+ */
101
+ export const PlatformApiAxiosParamCreator = function (configuration?: Configuration) {
102
+ return {
103
+ /**
104
+ *
105
+ * @summary Get platform details
106
+ * @param {string} project Project unique identifier
107
+ * @param {*} [options] Override http request option.
108
+ * @throws {RequiredError}
109
+ */
110
+ getPlatform: async (project: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
111
+ // verify required parameter 'project' is not null or undefined
112
+ assertParamExists('getPlatform', 'project', project)
113
+ const localVarPath = `/v1/platform`;
114
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
115
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
116
+ let baseOptions;
117
+ if (configuration) {
118
+ baseOptions = configuration.baseOptions;
119
+ }
120
+
121
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
122
+ const localVarHeaderParameter = {} as any;
123
+ const localVarQueryParameter = {} as any;
124
+
125
+ // authentication session-oauth required
126
+ // oauth required
127
+ await setOAuthToObject(localVarHeaderParameter, "session-oauth", [], configuration)
128
+
129
+ // authentication api-key required
130
+ await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration)
131
+
132
+ if (project !== undefined) {
133
+ localVarQueryParameter['project'] = project;
134
+ }
135
+
136
+
137
+
138
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
139
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
140
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
141
+
142
+ return {
143
+ url: toPathString(localVarUrlObj),
144
+ options: localVarRequestOptions,
145
+ };
146
+ },
147
+ /**
148
+ *
149
+ * @summary Update platform
150
+ * @param {string} project Project unique identifier
151
+ * @param {Platform} platform
152
+ * @param {*} [options] Override http request option.
153
+ * @throws {RequiredError}
154
+ */
155
+ updatePlatform: async (project: string, platform: Platform, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
156
+ // verify required parameter 'project' is not null or undefined
157
+ assertParamExists('updatePlatform', 'project', project)
158
+ // verify required parameter 'platform' is not null or undefined
159
+ assertParamExists('updatePlatform', 'platform', platform)
160
+ const localVarPath = `/v1/platform`;
161
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
162
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
163
+ let baseOptions;
164
+ if (configuration) {
165
+ baseOptions = configuration.baseOptions;
166
+ }
167
+
168
+ const localVarRequestOptions = { method: 'PATCH', ...baseOptions, ...options};
169
+ const localVarHeaderParameter = {} as any;
170
+ const localVarQueryParameter = {} as any;
171
+
172
+ // authentication session-oauth required
173
+ // oauth required
174
+ await setOAuthToObject(localVarHeaderParameter, "session-oauth", [], configuration)
175
+
176
+ // authentication api-key required
177
+ await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration)
178
+
179
+ if (project !== undefined) {
180
+ localVarQueryParameter['project'] = project;
181
+ }
182
+
183
+
184
+
185
+ localVarHeaderParameter['Content-Type'] = 'application/json';
186
+
187
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
188
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
189
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
190
+ localVarRequestOptions.data = serializeDataIfNeeded(platform, localVarRequestOptions, configuration)
191
+
192
+ return {
193
+ url: toPathString(localVarUrlObj),
194
+ options: localVarRequestOptions,
195
+ };
196
+ },
197
+ }
198
+ };
199
+
200
+ /**
201
+ * PlatformApi - functional programming interface
202
+ * @export
203
+ */
204
+ export const PlatformApiFp = function(configuration?: Configuration) {
205
+ const localVarAxiosParamCreator = PlatformApiAxiosParamCreator(configuration)
206
+ return {
207
+ /**
208
+ *
209
+ * @summary Get platform details
210
+ * @param {string} project Project unique identifier
211
+ * @param {*} [options] Override http request option.
212
+ * @throws {RequiredError}
213
+ */
214
+ async getPlatform(project: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Platform>> {
215
+ const localVarAxiosArgs = await localVarAxiosParamCreator.getPlatform(project, options);
216
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
217
+ const localVarOperationServerBasePath = operationServerMap['PlatformApi.getPlatform']?.[localVarOperationServerIndex]?.url;
218
+ return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
219
+ },
220
+ /**
221
+ *
222
+ * @summary Update platform
223
+ * @param {string} project Project unique identifier
224
+ * @param {Platform} platform
225
+ * @param {*} [options] Override http request option.
226
+ * @throws {RequiredError}
227
+ */
228
+ async updatePlatform(project: string, platform: Platform, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Platform>> {
229
+ const localVarAxiosArgs = await localVarAxiosParamCreator.updatePlatform(project, platform, options);
230
+ const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
231
+ const localVarOperationServerBasePath = operationServerMap['PlatformApi.updatePlatform']?.[localVarOperationServerIndex]?.url;
232
+ return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
233
+ },
234
+ }
235
+ };
236
+
237
+ /**
238
+ * PlatformApi - factory interface
239
+ * @export
240
+ */
241
+ export const PlatformApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
242
+ const localVarFp = PlatformApiFp(configuration)
243
+ return {
244
+ /**
245
+ *
246
+ * @summary Get platform details
247
+ * @param {string} project Project unique identifier
248
+ * @param {*} [options] Override http request option.
249
+ * @throws {RequiredError}
250
+ */
251
+ getPlatform(project: string, options?: any): AxiosPromise<Platform> {
252
+ return localVarFp.getPlatform(project, options).then((request) => request(axios, basePath));
253
+ },
254
+ /**
255
+ *
256
+ * @summary Update platform
257
+ * @param {string} project Project unique identifier
258
+ * @param {Platform} platform
259
+ * @param {*} [options] Override http request option.
260
+ * @throws {RequiredError}
261
+ */
262
+ updatePlatform(project: string, platform: Platform, options?: any): AxiosPromise<Platform> {
263
+ return localVarFp.updatePlatform(project, platform, options).then((request) => request(axios, basePath));
264
+ },
265
+ };
266
+ };
267
+
268
+ /**
269
+ * PlatformApi - object-oriented interface
270
+ * @export
271
+ * @class PlatformApi
272
+ * @extends {BaseAPI}
273
+ */
274
+ export class PlatformApi extends BaseAPI {
275
+ /**
276
+ *
277
+ * @summary Get platform details
278
+ * @param {string} project Project unique identifier
279
+ * @param {*} [options] Override http request option.
280
+ * @throws {RequiredError}
281
+ * @memberof PlatformApi
282
+ */
283
+ public getPlatform(project: string, options?: RawAxiosRequestConfig) {
284
+ return PlatformApiFp(this.configuration).getPlatform(project, options).then((request) => request(this.axios, this.basePath));
285
+ }
286
+
287
+ /**
288
+ *
289
+ * @summary Update platform
290
+ * @param {string} project Project unique identifier
291
+ * @param {Platform} platform
292
+ * @param {*} [options] Override http request option.
293
+ * @throws {RequiredError}
294
+ * @memberof PlatformApi
295
+ */
296
+ public updatePlatform(project: string, platform: Platform, options?: RawAxiosRequestConfig) {
297
+ return PlatformApiFp(this.configuration).updatePlatform(project, platform, options).then((request) => request(this.axios, this.basePath));
298
+ }
299
+ }
300
+
301
+
302
+
package/base.ts ADDED
@@ -0,0 +1,86 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Platform API
5
+ * Manage Your podOS platform Currently this API is in development and is not yet publicly accessible. All paths and models are subject to change. For full documentation on functionality and account settings go to [teemill.com](https://teemill.com)
6
+ *
7
+ * The version of the OpenAPI document: 0.1.1
8
+ * Contact: hello@teemill.com
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+
16
+ import type { Configuration } from './configuration';
17
+ // Some imports not used depending on template conditions
18
+ // @ts-ignore
19
+ import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
20
+ import globalAxios from 'axios';
21
+
22
+ export const BASE_PATH = "https://localhost:8080".replace(/\/+$/, "");
23
+
24
+ /**
25
+ *
26
+ * @export
27
+ */
28
+ export const COLLECTION_FORMATS = {
29
+ csv: ",",
30
+ ssv: " ",
31
+ tsv: "\t",
32
+ pipes: "|",
33
+ };
34
+
35
+ /**
36
+ *
37
+ * @export
38
+ * @interface RequestArgs
39
+ */
40
+ export interface RequestArgs {
41
+ url: string;
42
+ options: RawAxiosRequestConfig;
43
+ }
44
+
45
+ /**
46
+ *
47
+ * @export
48
+ * @class BaseAPI
49
+ */
50
+ export class BaseAPI {
51
+ protected configuration: Configuration | undefined;
52
+
53
+ constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
54
+ if (configuration) {
55
+ this.configuration = configuration;
56
+ this.basePath = configuration.basePath ?? basePath;
57
+ }
58
+ }
59
+ };
60
+
61
+ /**
62
+ *
63
+ * @export
64
+ * @class RequiredError
65
+ * @extends {Error}
66
+ */
67
+ export class RequiredError extends Error {
68
+ constructor(public field: string, msg?: string) {
69
+ super(msg);
70
+ this.name = "RequiredError"
71
+ }
72
+ }
73
+
74
+ interface ServerMap {
75
+ [key: string]: {
76
+ url: string,
77
+ description: string,
78
+ }[];
79
+ }
80
+
81
+ /**
82
+ *
83
+ * @export
84
+ */
85
+ export const operationServerMap: ServerMap = {
86
+ }
package/common.ts ADDED
@@ -0,0 +1,150 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Platform API
5
+ * Manage Your podOS platform Currently this API is in development and is not yet publicly accessible. All paths and models are subject to change. For full documentation on functionality and account settings go to [teemill.com](https://teemill.com)
6
+ *
7
+ * The version of the OpenAPI document: 0.1.1
8
+ * Contact: hello@teemill.com
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+
16
+ import type { Configuration } from "./configuration";
17
+ import type { RequestArgs } from "./base";
18
+ import type { AxiosInstance, AxiosResponse } from 'axios';
19
+ import { RequiredError } from "./base";
20
+
21
+ /**
22
+ *
23
+ * @export
24
+ */
25
+ export const DUMMY_BASE_URL = 'https://example.com'
26
+
27
+ /**
28
+ *
29
+ * @throws {RequiredError}
30
+ * @export
31
+ */
32
+ export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) {
33
+ if (paramValue === null || paramValue === undefined) {
34
+ throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
35
+ }
36
+ }
37
+
38
+ /**
39
+ *
40
+ * @export
41
+ */
42
+ export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) {
43
+ if (configuration && configuration.apiKey) {
44
+ const localVarApiKeyValue = typeof configuration.apiKey === 'function'
45
+ ? await configuration.apiKey(keyParamName)
46
+ : await configuration.apiKey;
47
+ object[keyParamName] = localVarApiKeyValue;
48
+ }
49
+ }
50
+
51
+ /**
52
+ *
53
+ * @export
54
+ */
55
+ export const setBasicAuthToObject = function (object: any, configuration?: Configuration) {
56
+ if (configuration && (configuration.username || configuration.password)) {
57
+ object["auth"] = { username: configuration.username, password: configuration.password };
58
+ }
59
+ }
60
+
61
+ /**
62
+ *
63
+ * @export
64
+ */
65
+ export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) {
66
+ if (configuration && configuration.accessToken) {
67
+ const accessToken = typeof configuration.accessToken === 'function'
68
+ ? await configuration.accessToken()
69
+ : await configuration.accessToken;
70
+ object["Authorization"] = "Bearer " + accessToken;
71
+ }
72
+ }
73
+
74
+ /**
75
+ *
76
+ * @export
77
+ */
78
+ export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) {
79
+ if (configuration && configuration.accessToken) {
80
+ const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
81
+ ? await configuration.accessToken(name, scopes)
82
+ : await configuration.accessToken;
83
+ object["Authorization"] = "Bearer " + localVarAccessTokenValue;
84
+ }
85
+ }
86
+
87
+ function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void {
88
+ if (parameter == null) return;
89
+ if (typeof parameter === "object") {
90
+ if (Array.isArray(parameter)) {
91
+ (parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key !== '' ? `${key}[]` : key));
92
+ }
93
+ else {
94
+ Object.keys(parameter).forEach(currentKey =>
95
+ setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`)
96
+ );
97
+ }
98
+ }
99
+ else {
100
+ if (urlSearchParams.has(key)) {
101
+ urlSearchParams.append(key, parameter);
102
+ }
103
+ else {
104
+ urlSearchParams.set(key, parameter);
105
+ }
106
+ }
107
+ }
108
+
109
+ /**
110
+ *
111
+ * @export
112
+ */
113
+ export const setSearchParams = function (url: URL, ...objects: any[]) {
114
+ const searchParams = new URLSearchParams(url.search);
115
+ setFlattenedQueryParams(searchParams, objects);
116
+ url.search = decodeURIComponent(searchParams.toString());
117
+ }
118
+
119
+ /**
120
+ *
121
+ * @export
122
+ */
123
+ export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) {
124
+ const nonString = typeof value !== 'string';
125
+ const needsSerialization = nonString && configuration && configuration.isJsonMime
126
+ ? configuration.isJsonMime(requestOptions.headers['Content-Type'])
127
+ : nonString;
128
+ return needsSerialization
129
+ ? JSON.stringify(value !== undefined ? value : {})
130
+ : (value || "");
131
+ }
132
+
133
+ /**
134
+ *
135
+ * @export
136
+ */
137
+ export const toPathString = function (url: URL) {
138
+ return url.pathname + url.search + url.hash
139
+ }
140
+
141
+ /**
142
+ *
143
+ * @export
144
+ */
145
+ export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
146
+ return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
147
+ const axiosRequestArgs = {...axiosArgs.options, url: (axios.defaults.baseURL ? '' : configuration?.basePath ?? basePath) + axiosArgs.url};
148
+ return axios.request<T, R>(axiosRequestArgs);
149
+ };
150
+ }