@teemill/warehouse-packaging 0.1.0

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,169 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Packaging API
5
+ * Manage Packaging 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.0
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 * as runtime from '../runtime';
17
+ import type {
18
+ ApiError,
19
+ Packaging,
20
+ PackagingListResponse,
21
+ } from '../models/index';
22
+ import {
23
+ ApiErrorFromJSON,
24
+ ApiErrorToJSON,
25
+ PackagingFromJSON,
26
+ PackagingToJSON,
27
+ PackagingListResponseFromJSON,
28
+ PackagingListResponseToJSON,
29
+ } from '../models/index';
30
+
31
+ export interface GetPackagingRequest {
32
+ project: string;
33
+ packagingId: string;
34
+ }
35
+
36
+ export interface ListPackagingRequest {
37
+ project: string;
38
+ pageToken?: number;
39
+ pageSize?: number;
40
+ }
41
+
42
+ /**
43
+ *
44
+ */
45
+ export class PackagingApi extends runtime.BaseAPI {
46
+
47
+ /**
48
+ * Get packaging
49
+ * Get a packaging resource
50
+ */
51
+ async getPackagingRaw(requestParameters: GetPackagingRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Packaging>> {
52
+ if (requestParameters.project === null || requestParameters.project === undefined) {
53
+ throw new runtime.RequiredError('project','Required parameter requestParameters.project was null or undefined when calling getPackaging.');
54
+ }
55
+
56
+ if (requestParameters.packagingId === null || requestParameters.packagingId === undefined) {
57
+ throw new runtime.RequiredError('packagingId','Required parameter requestParameters.packagingId was null or undefined when calling getPackaging.');
58
+ }
59
+
60
+ const queryParameters: any = {};
61
+
62
+ if (requestParameters.project !== undefined) {
63
+ queryParameters['project'] = requestParameters.project;
64
+ }
65
+
66
+ const headerParameters: runtime.HTTPHeaders = {};
67
+
68
+ if (this.configuration && this.configuration.accessToken) {
69
+ // oauth required
70
+ headerParameters["Authorization"] = await this.configuration.accessToken("session-oauth", []);
71
+ }
72
+
73
+ if (this.configuration && this.configuration.apiKey) {
74
+ headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // api-key authentication
75
+ }
76
+
77
+ const response = await this.request({
78
+ path: `/v1/warehouse/packaging/{packagingId}`.replace(`{${"packagingId"}}`, encodeURIComponent(String(requestParameters.packagingId))),
79
+ method: 'GET',
80
+ headers: headerParameters,
81
+ query: queryParameters,
82
+ }, initOverrides);
83
+
84
+ return new runtime.JSONApiResponse(response, (jsonValue) => PackagingFromJSON(jsonValue));
85
+ }
86
+
87
+ /**
88
+ * Get packaging
89
+ * Get a packaging resource
90
+ */
91
+ async getPackaging(
92
+ project: string, packagingId: string,
93
+ initOverrides?: RequestInit | runtime.InitOverrideFunction
94
+ ): Promise<Packaging> {
95
+ const response = await this.getPackagingRaw(
96
+ {
97
+ project: project,packagingId: packagingId,
98
+ },
99
+ initOverrides
100
+ );
101
+
102
+ return await response.value();
103
+ }
104
+
105
+ /**
106
+ * Lists packaging items paginated into chunks
107
+ * List packaging
108
+ */
109
+ async listPackagingRaw(requestParameters: ListPackagingRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PackagingListResponse>> {
110
+ if (requestParameters.project === null || requestParameters.project === undefined) {
111
+ throw new runtime.RequiredError('project','Required parameter requestParameters.project was null or undefined when calling listPackaging.');
112
+ }
113
+
114
+ const queryParameters: any = {};
115
+
116
+ if (requestParameters.project !== undefined) {
117
+ queryParameters['project'] = requestParameters.project;
118
+ }
119
+
120
+ if (requestParameters.pageToken !== undefined) {
121
+ queryParameters['pageToken'] = requestParameters.pageToken;
122
+ }
123
+
124
+ if (requestParameters.pageSize !== undefined) {
125
+ queryParameters['pageSize'] = requestParameters.pageSize;
126
+ }
127
+
128
+ const headerParameters: runtime.HTTPHeaders = {};
129
+
130
+ if (this.configuration && this.configuration.accessToken) {
131
+ // oauth required
132
+ headerParameters["Authorization"] = await this.configuration.accessToken("session-oauth", []);
133
+ }
134
+
135
+ if (this.configuration && this.configuration.apiKey) {
136
+ headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // api-key authentication
137
+ }
138
+
139
+ const response = await this.request({
140
+ path: `/v1/warehouse/packaging`,
141
+ method: 'GET',
142
+ headers: headerParameters,
143
+ query: queryParameters,
144
+ }, initOverrides);
145
+
146
+ return new runtime.JSONApiResponse(response, (jsonValue) => PackagingListResponseFromJSON(jsonValue));
147
+ }
148
+
149
+ /**
150
+ * Lists packaging items paginated into chunks
151
+ * List packaging
152
+ */
153
+ async listPackaging(
154
+ project: string,
155
+ optionalParameters: runtime.OptionalOnly<ListPackagingRequest> = {},
156
+ initOverrides?: RequestInit | runtime.InitOverrideFunction
157
+ ): Promise<PackagingListResponse> {
158
+ const response = await this.listPackagingRaw(
159
+ {
160
+ project: project,
161
+ ...optionalParameters,
162
+ },
163
+ initOverrides
164
+ );
165
+
166
+ return await response.value();
167
+ }
168
+
169
+ }
@@ -0,0 +1,3 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export * from './PackagingApi';
package/src/index.ts ADDED
@@ -0,0 +1,5 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export * from './runtime';
4
+ export * from './apis/index';
5
+ export * from './models/index';
@@ -0,0 +1,74 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Packaging API
5
+ * Manage Packaging 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.0
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
+ import { exists, mapValues } from '../runtime';
16
+ /**
17
+ *
18
+ * @export
19
+ * @interface ApiError
20
+ */
21
+ export interface ApiError {
22
+ /**
23
+ *
24
+ * @type {string}
25
+ * @memberof ApiError
26
+ */
27
+ code?: string;
28
+ /**
29
+ *
30
+ * @type {string}
31
+ * @memberof ApiError
32
+ */
33
+ message: string;
34
+ }
35
+
36
+ /**
37
+ * Check if a given object implements the ApiError interface.
38
+ */
39
+ export function instanceOfApiError(value: object): boolean {
40
+ let isInstance = true;
41
+ isInstance = isInstance && "message" in value;
42
+
43
+ return isInstance;
44
+ }
45
+
46
+ export function ApiErrorFromJSON(json: any): ApiError {
47
+ return ApiErrorFromJSONTyped(json, false);
48
+ }
49
+
50
+ export function ApiErrorFromJSONTyped(json: any, ignoreDiscriminator: boolean): ApiError {
51
+ if ((json === undefined) || (json === null)) {
52
+ return json;
53
+ }
54
+ return {
55
+
56
+ 'code': !exists(json, 'code') ? undefined : json['code'],
57
+ 'message': json['message'],
58
+ };
59
+ }
60
+
61
+ export function ApiErrorToJSON(value?: ApiError | null): any {
62
+ if (value === undefined) {
63
+ return undefined;
64
+ }
65
+ if (value === null) {
66
+ return null;
67
+ }
68
+ return {
69
+
70
+ 'code': value.code,
71
+ 'message': value.message,
72
+ };
73
+ }
74
+
@@ -0,0 +1,102 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Packaging API
5
+ * Manage Packaging 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.0
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
+ import { exists, mapValues } from '../runtime';
16
+ /**
17
+ *
18
+ * @export
19
+ * @interface Packaging
20
+ */
21
+ export interface Packaging {
22
+ /**
23
+ * Unique object identifier
24
+ * @type {string}
25
+ * @memberof Packaging
26
+ */
27
+ id: string;
28
+ /**
29
+ * A reference to the resource location
30
+ * @type {string}
31
+ * @memberof Packaging
32
+ */
33
+ ref: string;
34
+ /**
35
+ *
36
+ * @type {string}
37
+ * @memberof Packaging
38
+ */
39
+ name: string;
40
+ /**
41
+ *
42
+ * @type {string}
43
+ * @memberof Packaging
44
+ */
45
+ image: string;
46
+ /**
47
+ * Weight in grams
48
+ * @type {number}
49
+ * @memberof Packaging
50
+ */
51
+ weight: number;
52
+ }
53
+
54
+ /**
55
+ * Check if a given object implements the Packaging interface.
56
+ */
57
+ export function instanceOfPackaging(value: object): boolean {
58
+ let isInstance = true;
59
+ isInstance = isInstance && "id" in value;
60
+ isInstance = isInstance && "ref" in value;
61
+ isInstance = isInstance && "name" in value;
62
+ isInstance = isInstance && "image" in value;
63
+ isInstance = isInstance && "weight" in value;
64
+
65
+ return isInstance;
66
+ }
67
+
68
+ export function PackagingFromJSON(json: any): Packaging {
69
+ return PackagingFromJSONTyped(json, false);
70
+ }
71
+
72
+ export function PackagingFromJSONTyped(json: any, ignoreDiscriminator: boolean): Packaging {
73
+ if ((json === undefined) || (json === null)) {
74
+ return json;
75
+ }
76
+ return {
77
+
78
+ 'id': json['id'],
79
+ 'ref': json['ref'],
80
+ 'name': json['name'],
81
+ 'image': json['image'],
82
+ 'weight': json['weight'],
83
+ };
84
+ }
85
+
86
+ export function PackagingToJSON(value?: Packaging | null): any {
87
+ if (value === undefined) {
88
+ return undefined;
89
+ }
90
+ if (value === null) {
91
+ return null;
92
+ }
93
+ return {
94
+
95
+ 'id': value.id,
96
+ 'ref': value.ref,
97
+ 'name': value.name,
98
+ 'image': value.image,
99
+ 'weight': value.weight,
100
+ };
101
+ }
102
+
@@ -0,0 +1,82 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Packaging API
5
+ * Manage Packaging 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.0
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
+ import { exists, mapValues } from '../runtime';
16
+ import type { Packaging } from './Packaging';
17
+ import {
18
+ PackagingFromJSON,
19
+ PackagingFromJSONTyped,
20
+ PackagingToJSON,
21
+ } from './Packaging';
22
+
23
+ /**
24
+ *
25
+ * @export
26
+ * @interface PackagingListResponse
27
+ */
28
+ export interface PackagingListResponse {
29
+ /**
30
+ *
31
+ * @type {Array<Packaging>}
32
+ * @memberof PackagingListResponse
33
+ */
34
+ packaging: Array<Packaging>;
35
+ /**
36
+ *
37
+ * @type {number}
38
+ * @memberof PackagingListResponse
39
+ */
40
+ nextPageToken: number;
41
+ }
42
+
43
+ /**
44
+ * Check if a given object implements the PackagingListResponse interface.
45
+ */
46
+ export function instanceOfPackagingListResponse(value: object): boolean {
47
+ let isInstance = true;
48
+ isInstance = isInstance && "packaging" in value;
49
+ isInstance = isInstance && "nextPageToken" in value;
50
+
51
+ return isInstance;
52
+ }
53
+
54
+ export function PackagingListResponseFromJSON(json: any): PackagingListResponse {
55
+ return PackagingListResponseFromJSONTyped(json, false);
56
+ }
57
+
58
+ export function PackagingListResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): PackagingListResponse {
59
+ if ((json === undefined) || (json === null)) {
60
+ return json;
61
+ }
62
+ return {
63
+
64
+ 'packaging': ((json['packaging'] as Array<any>).map(PackagingFromJSON)),
65
+ 'nextPageToken': json['nextPageToken'],
66
+ };
67
+ }
68
+
69
+ export function PackagingListResponseToJSON(value?: PackagingListResponse | null): any {
70
+ if (value === undefined) {
71
+ return undefined;
72
+ }
73
+ if (value === null) {
74
+ return null;
75
+ }
76
+ return {
77
+
78
+ 'packaging': ((value.packaging as Array<any>).map(PackagingToJSON)),
79
+ 'nextPageToken': value.nextPageToken,
80
+ };
81
+ }
82
+
@@ -0,0 +1,5 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export * from './ApiError';
4
+ export * from './Packaging';
5
+ export * from './PackagingListResponse';