diskio-api 1.0.0 → 1.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.
package/cjs/index.d.ts CHANGED
@@ -49,4 +49,130 @@ export declare class DiskioAPIClient {
49
49
  };
50
50
  };
51
51
  }> | undefined, `${string}/${string}`>>;
52
+ diskio: {
53
+ upload: (files: File[]) => Promise<import("openapi-fetch").FetchResponse<{
54
+ parameters: {
55
+ query?: never;
56
+ header?: never;
57
+ path?: never;
58
+ cookie?: never;
59
+ };
60
+ requestBody: {
61
+ content: {
62
+ "multipart/form-data": {
63
+ files: string[];
64
+ };
65
+ };
66
+ };
67
+ responses: {
68
+ 200: {
69
+ headers: {
70
+ [name: string]: unknown;
71
+ };
72
+ content: {
73
+ "application/json": components["schemas"]["response.model"] & {
74
+ response: string[];
75
+ };
76
+ };
77
+ };
78
+ };
79
+ }, {
80
+ body: {
81
+ files: any;
82
+ };
83
+ }, `${string}/${string}`>>;
84
+ download: (name: string) => Promise<import("openapi-fetch").FetchResponse<{
85
+ parameters: {
86
+ query?: never;
87
+ header?: never;
88
+ path: {
89
+ name: string;
90
+ };
91
+ cookie?: never;
92
+ };
93
+ requestBody?: never;
94
+ responses: {
95
+ 200: {
96
+ headers: {
97
+ [name: string]: unknown;
98
+ };
99
+ content: {
100
+ "application/octet-stream": string;
101
+ };
102
+ };
103
+ 404: {
104
+ headers: {
105
+ [name: string]: unknown;
106
+ };
107
+ content: {
108
+ "application/json": components["schemas"]["not-found-response.model"] & {
109
+ response: string;
110
+ };
111
+ };
112
+ };
113
+ 500: {
114
+ headers: {
115
+ [name: string]: unknown;
116
+ };
117
+ content: {
118
+ "application/json": components["schemas"]["internal-server-error-response.model"] & {
119
+ response: string;
120
+ };
121
+ };
122
+ };
123
+ };
124
+ }, {
125
+ params: {
126
+ path: {
127
+ name: string;
128
+ };
129
+ };
130
+ responseType: string;
131
+ }, `${string}/${string}`>>;
132
+ delete: (name: string) => Promise<import("openapi-fetch").FetchResponse<{
133
+ parameters: {
134
+ query?: never;
135
+ header?: never;
136
+ path: {
137
+ name: string;
138
+ };
139
+ cookie?: never;
140
+ };
141
+ requestBody?: never;
142
+ responses: {
143
+ 200: {
144
+ headers: {
145
+ [name: string]: unknown;
146
+ };
147
+ content?: never;
148
+ };
149
+ 404: {
150
+ headers: {
151
+ [name: string]: unknown;
152
+ };
153
+ content: {
154
+ "application/json": components["schemas"]["not-found-response.model"] & {
155
+ response: string;
156
+ };
157
+ };
158
+ };
159
+ 500: {
160
+ headers: {
161
+ [name: string]: unknown;
162
+ };
163
+ content: {
164
+ "application/json": components["schemas"]["internal-server-error-response.model"] & {
165
+ response: string;
166
+ };
167
+ };
168
+ };
169
+ };
170
+ }, {
171
+ params: {
172
+ path: {
173
+ name: string;
174
+ };
175
+ };
176
+ }, `${string}/${string}`>>;
177
+ };
52
178
  }
package/cjs/index.js CHANGED
@@ -23,6 +23,17 @@ class DiskioAPIClient {
23
23
  return this.authentication;
24
24
  }
25
25
  };
26
+ this.diskio = {
27
+ upload: (files) => {
28
+ return this.client.POST('/diskio', { body: { files: files } });
29
+ },
30
+ download: (name) => {
31
+ return this.client.GET('/diskio/{name}', { params: { path: { name } }, responseType: 'arraybuffer' });
32
+ },
33
+ delete: (name) => {
34
+ return this.client.DELETE('/diskio/{name}', { params: { path: { name } } });
35
+ }
36
+ };
26
37
  this.client = (0, openapi_fetch_1.default)({ baseUrl, headers: { Bearer: 'access_token' } });
27
38
  this.client.use(this.authenticate);
28
39
  }
package/mjs/index.d.ts CHANGED
@@ -49,4 +49,130 @@ export declare class DiskioAPIClient {
49
49
  };
50
50
  };
51
51
  }> | undefined, `${string}/${string}`>>;
52
+ diskio: {
53
+ upload: (files: File[]) => Promise<import("openapi-fetch").FetchResponse<{
54
+ parameters: {
55
+ query?: never;
56
+ header?: never;
57
+ path?: never;
58
+ cookie?: never;
59
+ };
60
+ requestBody: {
61
+ content: {
62
+ "multipart/form-data": {
63
+ files: string[];
64
+ };
65
+ };
66
+ };
67
+ responses: {
68
+ 200: {
69
+ headers: {
70
+ [name: string]: unknown;
71
+ };
72
+ content: {
73
+ "application/json": components["schemas"]["response.model"] & {
74
+ response: string[];
75
+ };
76
+ };
77
+ };
78
+ };
79
+ }, {
80
+ body: {
81
+ files: any;
82
+ };
83
+ }, `${string}/${string}`>>;
84
+ download: (name: string) => Promise<import("openapi-fetch").FetchResponse<{
85
+ parameters: {
86
+ query?: never;
87
+ header?: never;
88
+ path: {
89
+ name: string;
90
+ };
91
+ cookie?: never;
92
+ };
93
+ requestBody?: never;
94
+ responses: {
95
+ 200: {
96
+ headers: {
97
+ [name: string]: unknown;
98
+ };
99
+ content: {
100
+ "application/octet-stream": string;
101
+ };
102
+ };
103
+ 404: {
104
+ headers: {
105
+ [name: string]: unknown;
106
+ };
107
+ content: {
108
+ "application/json": components["schemas"]["not-found-response.model"] & {
109
+ response: string;
110
+ };
111
+ };
112
+ };
113
+ 500: {
114
+ headers: {
115
+ [name: string]: unknown;
116
+ };
117
+ content: {
118
+ "application/json": components["schemas"]["internal-server-error-response.model"] & {
119
+ response: string;
120
+ };
121
+ };
122
+ };
123
+ };
124
+ }, {
125
+ params: {
126
+ path: {
127
+ name: string;
128
+ };
129
+ };
130
+ responseType: string;
131
+ }, `${string}/${string}`>>;
132
+ delete: (name: string) => Promise<import("openapi-fetch").FetchResponse<{
133
+ parameters: {
134
+ query?: never;
135
+ header?: never;
136
+ path: {
137
+ name: string;
138
+ };
139
+ cookie?: never;
140
+ };
141
+ requestBody?: never;
142
+ responses: {
143
+ 200: {
144
+ headers: {
145
+ [name: string]: unknown;
146
+ };
147
+ content?: never;
148
+ };
149
+ 404: {
150
+ headers: {
151
+ [name: string]: unknown;
152
+ };
153
+ content: {
154
+ "application/json": components["schemas"]["not-found-response.model"] & {
155
+ response: string;
156
+ };
157
+ };
158
+ };
159
+ 500: {
160
+ headers: {
161
+ [name: string]: unknown;
162
+ };
163
+ content: {
164
+ "application/json": components["schemas"]["internal-server-error-response.model"] & {
165
+ response: string;
166
+ };
167
+ };
168
+ };
169
+ };
170
+ }, {
171
+ params: {
172
+ path: {
173
+ name: string;
174
+ };
175
+ };
176
+ }, `${string}/${string}`>>;
177
+ };
52
178
  }
package/mjs/index.js CHANGED
@@ -17,6 +17,17 @@ export class DiskioAPIClient {
17
17
  return this.authentication;
18
18
  }
19
19
  };
20
+ this.diskio = {
21
+ upload: (files) => {
22
+ return this.client.POST('/diskio', { body: { files: files } });
23
+ },
24
+ download: (name) => {
25
+ return this.client.GET('/diskio/{name}', { params: { path: { name } }, responseType: 'arraybuffer' });
26
+ },
27
+ delete: (name) => {
28
+ return this.client.DELETE('/diskio/{name}', { params: { path: { name } } });
29
+ }
30
+ };
20
31
  this.client = createClient({ baseUrl, headers: { Bearer: 'access_token' } });
21
32
  this.client.use(this.authenticate);
22
33
  }
@@ -42,6 +42,156 @@ export interface paths {
42
42
  patch?: never;
43
43
  trace?: never;
44
44
  };
45
+ "/diskio": {
46
+ parameters: {
47
+ query?: never;
48
+ header?: never;
49
+ path?: never;
50
+ cookie?: never;
51
+ };
52
+ get?: never;
53
+ put?: never;
54
+ /** Upload a file */
55
+ post: {
56
+ parameters: {
57
+ query?: never;
58
+ header?: never;
59
+ path?: never;
60
+ cookie?: never;
61
+ };
62
+ requestBody: {
63
+ content: {
64
+ "multipart/form-data": {
65
+ files: string[];
66
+ };
67
+ };
68
+ };
69
+ responses: {
70
+ /** @description File names */
71
+ 200: {
72
+ headers: {
73
+ [name: string]: unknown;
74
+ };
75
+ content: {
76
+ "application/json": components["schemas"]["response.model"] & {
77
+ response: string[];
78
+ };
79
+ };
80
+ };
81
+ };
82
+ };
83
+ delete?: never;
84
+ options?: never;
85
+ head?: never;
86
+ patch?: never;
87
+ trace?: never;
88
+ };
89
+ "/diskio/{name}": {
90
+ parameters: {
91
+ query?: never;
92
+ header?: never;
93
+ path?: never;
94
+ cookie?: never;
95
+ };
96
+ /** Download a file */
97
+ get: {
98
+ parameters: {
99
+ query?: never;
100
+ header?: never;
101
+ path: {
102
+ name: string;
103
+ };
104
+ cookie?: never;
105
+ };
106
+ requestBody?: never;
107
+ responses: {
108
+ /** @description File */
109
+ 200: {
110
+ headers: {
111
+ [name: string]: unknown;
112
+ };
113
+ content: {
114
+ "application/octet-stream": string;
115
+ };
116
+ };
117
+ /** @description Folder not found */
118
+ 404: {
119
+ headers: {
120
+ [name: string]: unknown;
121
+ };
122
+ content: {
123
+ "application/json": components["schemas"]["not-found-response.model"] & {
124
+ /** @example Not found: File not found */
125
+ response: string;
126
+ };
127
+ };
128
+ };
129
+ /** @description Internal server error */
130
+ 500: {
131
+ headers: {
132
+ [name: string]: unknown;
133
+ };
134
+ content: {
135
+ "application/json": components["schemas"]["internal-server-error-response.model"] & {
136
+ /** @example Internal server error: Unknown error */
137
+ response: string;
138
+ };
139
+ };
140
+ };
141
+ };
142
+ };
143
+ put?: never;
144
+ post?: never;
145
+ /** Delete a file */
146
+ delete: {
147
+ parameters: {
148
+ query?: never;
149
+ header?: never;
150
+ path: {
151
+ name: string;
152
+ };
153
+ cookie?: never;
154
+ };
155
+ requestBody?: never;
156
+ responses: {
157
+ /** @description File deleted */
158
+ 200: {
159
+ headers: {
160
+ [name: string]: unknown;
161
+ };
162
+ content?: never;
163
+ };
164
+ /** @description Folder not found */
165
+ 404: {
166
+ headers: {
167
+ [name: string]: unknown;
168
+ };
169
+ content: {
170
+ "application/json": components["schemas"]["not-found-response.model"] & {
171
+ /** @example Not found: File not found */
172
+ response: string;
173
+ };
174
+ };
175
+ };
176
+ /** @description Internal server error */
177
+ 500: {
178
+ headers: {
179
+ [name: string]: unknown;
180
+ };
181
+ content: {
182
+ "application/json": components["schemas"]["internal-server-error-response.model"] & {
183
+ /** @example Internal server error: Unknown error */
184
+ response: string;
185
+ };
186
+ };
187
+ };
188
+ };
189
+ };
190
+ options?: never;
191
+ head?: never;
192
+ patch?: never;
193
+ trace?: never;
194
+ };
45
195
  }
46
196
  export type webhooks = Record<string, never>;
47
197
  export interface components {
@@ -56,6 +206,18 @@ export interface components {
56
206
  /** @example 1707947871721 */
57
207
  timestamp: number;
58
208
  };
209
+ "not-found-response.model": components["schemas"]["response.model"] & {
210
+ /** @example Not found: Authorization header not found */
211
+ response: string;
212
+ /** @example 404 */
213
+ code?: number;
214
+ };
215
+ "internal-server-error-response.model": components["schemas"]["response.model"] & {
216
+ /** @example Internal server error */
217
+ response: string;
218
+ /** @example 500 */
219
+ code?: number;
220
+ };
59
221
  };
60
222
  responses: never;
61
223
  parameters: never;
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "openapi": "3.1.0",
3
3
  "info": {
4
- "title": "Crosscutting API",
5
- "summary": "A boilerplate for building contract-first APIs in TypeScript with OpenAPI. Includes OpenAPI definition, compliant server setup, and npm package generation for seamless API development.",
4
+ "title": "Diskio API",
5
+ "summary": "An API Client for diskio-server",
6
6
  "version": "0.0.0"
7
7
  },
8
8
  "servers": [
@@ -15,6 +15,10 @@
15
15
  {
16
16
  "name": "Crosscutting",
17
17
  "description": "Operation related to a crosscutting actions"
18
+ },
19
+ {
20
+ "name": "DiskIO",
21
+ "description": "Operation related to the diskio-core API"
18
22
  }
19
23
  ],
20
24
  "paths": {
@@ -57,6 +61,224 @@
57
61
  }
58
62
  }
59
63
  }
64
+ },
65
+ "/diskio": {
66
+ "post": {
67
+ "tags": [
68
+ "DiskIO"
69
+ ],
70
+ "summary": "Upload a file",
71
+ "requestBody": {
72
+ "required": true,
73
+ "content": {
74
+ "multipart/form-data": {
75
+ "schema": {
76
+ "type": "object",
77
+ "properties": {
78
+ "files": {
79
+ "type": "array",
80
+ "items": {
81
+ "type": "string",
82
+ "format": "binary"
83
+ }
84
+ }
85
+ },
86
+ "required": [
87
+ "files"
88
+ ]
89
+ }
90
+ }
91
+ }
92
+ },
93
+ "responses": {
94
+ "200": {
95
+ "description": "File names",
96
+ "content": {
97
+ "application/json": {
98
+ "schema": {
99
+ "allOf": [
100
+ {
101
+ "$ref": "#/components/schemas/response.model"
102
+ },
103
+ {
104
+ "type": "object",
105
+ "required": [
106
+ "response"
107
+ ],
108
+ "properties": {
109
+ "response": {
110
+ "type": "array",
111
+ "items": {
112
+ "type": "string"
113
+ }
114
+ }
115
+ }
116
+ }
117
+ ]
118
+ }
119
+ }
120
+ }
121
+ }
122
+ }
123
+ }
124
+ },
125
+ "/diskio/{name}": {
126
+ "get": {
127
+ "tags": [
128
+ "DiskIO"
129
+ ],
130
+ "summary": "Download a file",
131
+ "parameters": [
132
+ {
133
+ "name": "name",
134
+ "in": "path",
135
+ "required": true,
136
+ "schema": {
137
+ "type": "string",
138
+ "example": "7b1d2a45/1211/4517/b968/dbb6799aef6b/meme.mp4"
139
+ }
140
+ }
141
+ ],
142
+ "responses": {
143
+ "200": {
144
+ "description": "File",
145
+ "content": {
146
+ "application/octet-stream": {
147
+ "schema": {
148
+ "type": "string",
149
+ "format": "binary"
150
+ }
151
+ }
152
+ }
153
+ },
154
+ "404": {
155
+ "description": "Folder not found",
156
+ "content": {
157
+ "application/json": {
158
+ "schema": {
159
+ "allOf": [
160
+ {
161
+ "$ref": "#/components/schemas/not-found-response.model"
162
+ },
163
+ {
164
+ "type": "object",
165
+ "required": [
166
+ "response"
167
+ ],
168
+ "properties": {
169
+ "response": {
170
+ "type": "string",
171
+ "example": "Not found: File not found"
172
+ }
173
+ }
174
+ }
175
+ ]
176
+ }
177
+ }
178
+ }
179
+ },
180
+ "500": {
181
+ "description": "Internal server error",
182
+ "content": {
183
+ "application/json": {
184
+ "schema": {
185
+ "allOf": [
186
+ {
187
+ "$ref": "#/components/schemas/internal-server-error-response.model"
188
+ },
189
+ {
190
+ "type": "object",
191
+ "required": [
192
+ "response"
193
+ ],
194
+ "properties": {
195
+ "response": {
196
+ "type": "string",
197
+ "example": "Internal server error: Unknown error"
198
+ }
199
+ }
200
+ }
201
+ ]
202
+ }
203
+ }
204
+ }
205
+ }
206
+ }
207
+ },
208
+ "delete": {
209
+ "tags": [
210
+ "DiskIO"
211
+ ],
212
+ "summary": "Delete a file",
213
+ "parameters": [
214
+ {
215
+ "name": "name",
216
+ "in": "path",
217
+ "required": true,
218
+ "schema": {
219
+ "type": "string",
220
+ "example": "7b1d2a45/1211/4517/b968/dbb6799aef6b/meme.mp4"
221
+ }
222
+ }
223
+ ],
224
+ "responses": {
225
+ "200": {
226
+ "description": "File deleted"
227
+ },
228
+ "404": {
229
+ "description": "Folder not found",
230
+ "content": {
231
+ "application/json": {
232
+ "schema": {
233
+ "allOf": [
234
+ {
235
+ "$ref": "#/components/schemas/not-found-response.model"
236
+ },
237
+ {
238
+ "type": "object",
239
+ "required": [
240
+ "response"
241
+ ],
242
+ "properties": {
243
+ "response": {
244
+ "type": "string",
245
+ "example": "Not found: File not found"
246
+ }
247
+ }
248
+ }
249
+ ]
250
+ }
251
+ }
252
+ }
253
+ },
254
+ "500": {
255
+ "description": "Internal server error",
256
+ "content": {
257
+ "application/json": {
258
+ "schema": {
259
+ "allOf": [
260
+ {
261
+ "$ref": "#/components/schemas/internal-server-error-response.model"
262
+ },
263
+ {
264
+ "type": "object",
265
+ "required": [
266
+ "response"
267
+ ],
268
+ "properties": {
269
+ "response": {
270
+ "type": "string",
271
+ "example": "Internal server error: Unknown error"
272
+ }
273
+ }
274
+ }
275
+ ]
276
+ }
277
+ }
278
+ }
279
+ }
280
+ }
281
+ }
60
282
  }
61
283
  },
62
284
  "components": {
@@ -89,6 +311,52 @@
89
311
  "example": "1707947871721"
90
312
  }
91
313
  }
314
+ },
315
+ "not-found-response.model": {
316
+ "allOf": [
317
+ {
318
+ "$ref": "#/components/schemas/response.model"
319
+ },
320
+ {
321
+ "type": "object",
322
+ "required": [
323
+ "response"
324
+ ],
325
+ "properties": {
326
+ "response": {
327
+ "type": "string",
328
+ "example": "Not found: Authorization header not found"
329
+ },
330
+ "code": {
331
+ "type": "number",
332
+ "example": 404
333
+ }
334
+ }
335
+ }
336
+ ]
337
+ },
338
+ "internal-server-error-response.model": {
339
+ "allOf": [
340
+ {
341
+ "$ref": "#/components/schemas/response.model"
342
+ },
343
+ {
344
+ "type": "object",
345
+ "required": [
346
+ "response"
347
+ ],
348
+ "properties": {
349
+ "response": {
350
+ "type": "string",
351
+ "example": "Internal server error"
352
+ },
353
+ "code": {
354
+ "type": "number",
355
+ "example": 500
356
+ }
357
+ }
358
+ }
359
+ ]
92
360
  }
93
361
  }
94
362
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "diskio-api",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "An API Client for diskio-server",
5
5
  "type": "module",
6
6
  "main": "cjs/index.js",