@palmetto/media-sdk 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.
- package/README.md +155 -0
- package/dist/__generated__/schema.d.ts +554 -0
- package/dist/__generated__/schema.js +3 -0
- package/dist/__generated__/schema.js.map +1 -0
- package/dist/client.d.ts +26 -0
- package/dist/client.js +98 -0
- package/dist/client.js.map +1 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.js +18 -0
- package/dist/main.js.map +1 -0
- package/package.json +49 -0
package/README.md
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
# Media API SDK
|
|
2
|
+
|
|
3
|
+
## Installation
|
|
4
|
+
|
|
5
|
+
Install the SDK and peer dependencies:
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
yarn add @palmetto/result @palmetto/base-sdk-client @palmetto/media-sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### Create a client instance
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { MediaClient } from "@palmetto/media-sdk";
|
|
17
|
+
|
|
18
|
+
const client = new MediaClient({
|
|
19
|
+
apiUrl: app.config("media.api.url"),
|
|
20
|
+
authToken: app.config("media.api.userToken"),
|
|
21
|
+
});
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Create a new media
|
|
25
|
+
|
|
26
|
+
Public media and private media work similar ways. Use the `isPublic` flag to indicate if the media can be access publicly by any internet user.
|
|
27
|
+
|
|
28
|
+
Properties of `CreateMediaInput`:
|
|
29
|
+
|
|
30
|
+
- `filename`: name of the file to store. The name does not have to be unique. Media API creates unique names for all media.
|
|
31
|
+
- `contentType`: the MIME type of the file. Valid types:
|
|
32
|
+
- application/pdf
|
|
33
|
+
- image/png
|
|
34
|
+
- image/jpeg
|
|
35
|
+
- image/gif
|
|
36
|
+
- image/svg+xml
|
|
37
|
+
- video/mp4
|
|
38
|
+
- `isPublic: true`
|
|
39
|
+
- the file is stored in a publicly accessible bucket
|
|
40
|
+
- `publicUrl` is defined in the response with a URL that can be placed on any web page.
|
|
41
|
+
- `isPublic: false`
|
|
42
|
+
- the file is stored in a separate private bucket
|
|
43
|
+
- `publicUrl` is undefined, and you must request a signed URL to access the media.
|
|
44
|
+
- `expiresAfter`: (optional) the time after which the file should be deleted
|
|
45
|
+
- the cleanup process isn't exact. Files may live several hours after the expiresAfter value
|
|
46
|
+
- `permissions`: (optional) an array of Users API grants (entity permissions) allowing access to the media
|
|
47
|
+
- eg: `["customer:customer"]` grants access to any user with `customer:customer` grant.
|
|
48
|
+
- `associatedEntities`: (optional) an array of associated entities for the media
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
import { CreateMediaInput } from "@palmetto/media-sdk";
|
|
52
|
+
|
|
53
|
+
const file: File = {}; // get a reference to the <input type="file"> from the browser form
|
|
54
|
+
|
|
55
|
+
const media: CreateMediaInput = {
|
|
56
|
+
filename: file.name,
|
|
57
|
+
contentType: file.type as CreateMediaInput["contentType"],
|
|
58
|
+
isPublic: true,
|
|
59
|
+
expiresAfter: new Date(Date.now() + 24 * 3600 * 1000), // this media is deleted after 24 hours
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
// create the media itself
|
|
63
|
+
const createdMedia = await client.createMedia(media);
|
|
64
|
+
|
|
65
|
+
if (!createdMedia.ok) {
|
|
66
|
+
toast.error("Failed to create media:", createdMedia.error);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
try {
|
|
71
|
+
// next upload the media using the signed URL
|
|
72
|
+
const fetchResponse = await fetch(
|
|
73
|
+
new Request(createdMedia.data.signedUrlForUpload.url, {
|
|
74
|
+
headers: createdMedia.data.signedUrlForUpload.headers,
|
|
75
|
+
body: file,
|
|
76
|
+
method: "PUT",
|
|
77
|
+
}),
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
if (!fetchResponse.ok) {
|
|
81
|
+
toast.error("Failed to upload media. Please try again.");
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
} catch (error) {
|
|
85
|
+
toast.error("Failed to upload media. Please try again.");
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### getMediaById
|
|
91
|
+
|
|
92
|
+
Use `getMediaById` to access the media details and get a URL to download the file. See examples below.
|
|
93
|
+
|
|
94
|
+
- `id` the media ID
|
|
95
|
+
- `includeSignedUrl`: set to true to return the `signedUrlForDownload` in the response. (default: false)
|
|
96
|
+
- `inline`: set to true so that the download is done inline, false crafts the file download as an attachment. (default: false)
|
|
97
|
+
|
|
98
|
+
### Opening the media in a browser
|
|
99
|
+
|
|
100
|
+
For public media, you can use the `publicUrl` property to access the media. Private media must use a signed URL to download.
|
|
101
|
+
|
|
102
|
+
#### Public media
|
|
103
|
+
|
|
104
|
+
Public media URLs never change. They are valid until the media is deleted.
|
|
105
|
+
|
|
106
|
+
```ts
|
|
107
|
+
const { publicUrl } = createdMedia.data;
|
|
108
|
+
|
|
109
|
+
window.location.href = publicUrl;
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
#### Private media
|
|
113
|
+
|
|
114
|
+
Private media you must access using a signed URL. The signed URL is only valid for a few minutes so you must download the file soon after requesting the URL.
|
|
115
|
+
|
|
116
|
+
```ts
|
|
117
|
+
const getMediaResult = await client.getMediaById({
|
|
118
|
+
id: createdMedia.data.id,
|
|
119
|
+
includeSignedUrl: true,
|
|
120
|
+
inline: false,
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
if (!getMediaResult.ok) {
|
|
124
|
+
toast.error("Failed to fetch media details:", getMediaResult.error);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const { signedUrlForDownload } = getMediaResult.data;
|
|
129
|
+
|
|
130
|
+
window.location.href = signedUrlForDownload;
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Permissions
|
|
134
|
+
|
|
135
|
+
Media have permissions. By default, only the API user that created the media can update or delete the media.
|
|
136
|
+
You can use the `permissions` property to allow other API users with that permission to modify or delete the media.
|
|
137
|
+
|
|
138
|
+
```ts
|
|
139
|
+
const media: CreateMediaInput = {
|
|
140
|
+
filename: file.name,
|
|
141
|
+
contentType: file.type as CreateMediaInput["contentType"],
|
|
142
|
+
isPublic: false,
|
|
143
|
+
permissions: ["customer:customer"],
|
|
144
|
+
};
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
This example allows any user with `customer:customer` entity grant to access the media. This access is global, it doesn't know that the media belongs to a specific customer, for example. [This feature may be improved later on].
|
|
148
|
+
|
|
149
|
+
### Update Media
|
|
150
|
+
|
|
151
|
+
You can update a media's permissions, associatedEntities and expiresAfter using `updatedMediaById`. Your user must have created the media, or have the `write` operation for one of the permissions on the media.
|
|
152
|
+
|
|
153
|
+
### Delete media
|
|
154
|
+
|
|
155
|
+
You can delete a media using `deleteMediaById`. Your user must have created the media, or have the `delete` operation for one of the permissions on the media.
|
|
@@ -0,0 +1,554 @@
|
|
|
1
|
+
export interface paths {
|
|
2
|
+
"/api/health": {
|
|
3
|
+
parameters: {
|
|
4
|
+
query?: never;
|
|
5
|
+
header?: never;
|
|
6
|
+
path?: never;
|
|
7
|
+
cookie?: never;
|
|
8
|
+
};
|
|
9
|
+
get: operations["HealthController_getHealth"];
|
|
10
|
+
put?: never;
|
|
11
|
+
post?: never;
|
|
12
|
+
delete?: never;
|
|
13
|
+
options?: never;
|
|
14
|
+
head?: never;
|
|
15
|
+
patch?: never;
|
|
16
|
+
trace?: never;
|
|
17
|
+
};
|
|
18
|
+
"/api/media": {
|
|
19
|
+
parameters: {
|
|
20
|
+
query?: never;
|
|
21
|
+
header?: never;
|
|
22
|
+
path?: never;
|
|
23
|
+
cookie?: never;
|
|
24
|
+
};
|
|
25
|
+
get?: never;
|
|
26
|
+
put?: never;
|
|
27
|
+
/** Create a new media */
|
|
28
|
+
post: operations["createMedia"];
|
|
29
|
+
delete?: never;
|
|
30
|
+
options?: never;
|
|
31
|
+
head?: never;
|
|
32
|
+
patch?: never;
|
|
33
|
+
trace?: never;
|
|
34
|
+
};
|
|
35
|
+
"/api/media/{id}": {
|
|
36
|
+
parameters: {
|
|
37
|
+
query?: never;
|
|
38
|
+
header?: never;
|
|
39
|
+
path?: never;
|
|
40
|
+
cookie?: never;
|
|
41
|
+
};
|
|
42
|
+
/** Get a media by ID */
|
|
43
|
+
get: operations["getMediaById"];
|
|
44
|
+
put?: never;
|
|
45
|
+
post?: never;
|
|
46
|
+
/** Delete a media by ID */
|
|
47
|
+
delete: operations["deleteMediaById"];
|
|
48
|
+
options?: never;
|
|
49
|
+
head?: never;
|
|
50
|
+
/** Update a media by ID */
|
|
51
|
+
patch: operations["updateMediaById"];
|
|
52
|
+
trace?: never;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export type webhooks = Record<string, never>;
|
|
56
|
+
export interface components {
|
|
57
|
+
schemas: {
|
|
58
|
+
InternalServerErrorDto: {
|
|
59
|
+
/**
|
|
60
|
+
* @example InternalServerError
|
|
61
|
+
* @constant
|
|
62
|
+
*/
|
|
63
|
+
error: "InternalServerError";
|
|
64
|
+
/**
|
|
65
|
+
* @example 500
|
|
66
|
+
* @constant
|
|
67
|
+
*/
|
|
68
|
+
statusCode: 500;
|
|
69
|
+
/** @example An unexpected service error occurred */
|
|
70
|
+
message: string;
|
|
71
|
+
/** @example Technical error description */
|
|
72
|
+
reason: string;
|
|
73
|
+
};
|
|
74
|
+
HealthStatusDto: {
|
|
75
|
+
ok: boolean;
|
|
76
|
+
checks: {
|
|
77
|
+
database: boolean;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
UnauthorizedErrorDto: {
|
|
81
|
+
/**
|
|
82
|
+
* @example Unauthorized
|
|
83
|
+
* @constant
|
|
84
|
+
*/
|
|
85
|
+
error: "Unauthorized";
|
|
86
|
+
/**
|
|
87
|
+
* @example 401
|
|
88
|
+
* @constant
|
|
89
|
+
*/
|
|
90
|
+
statusCode: 401;
|
|
91
|
+
/** @example You must log in to perform that action */
|
|
92
|
+
message: string;
|
|
93
|
+
/** @example Technical error description */
|
|
94
|
+
reason: string;
|
|
95
|
+
};
|
|
96
|
+
CreateMediaDto: {
|
|
97
|
+
/** @description The name of the attachment file. */
|
|
98
|
+
filename: string;
|
|
99
|
+
/** @description Indicates whether the media is publicly accessible. */
|
|
100
|
+
isPublic: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* @description The MIME type of the attachment content.
|
|
103
|
+
* @enum {string}
|
|
104
|
+
*/
|
|
105
|
+
contentType: "application/pdf" | "image/png" | "image/jpeg" | "image/gif" | "image/svg+xml" | "video/mp4";
|
|
106
|
+
/** @description A list of entities associated with the media, specifying the type and ID of each associated entity. This field is optional and can be used to link the media to other entities in the system. */
|
|
107
|
+
associatedEntities?: {
|
|
108
|
+
/** @description The type of the associated entity */
|
|
109
|
+
type: string;
|
|
110
|
+
/** @description The id of the associated entity */
|
|
111
|
+
id: string;
|
|
112
|
+
}[];
|
|
113
|
+
/** @description The permissions for the media, specifying which users permissions are required. (eg: ["customers:customer"]) */
|
|
114
|
+
permissions?: string[];
|
|
115
|
+
/**
|
|
116
|
+
* Format: date-time
|
|
117
|
+
* @description The date and time after which the media should expire and be automatically deleted. This field is optional and can be used to set a specific expiration time for the media.
|
|
118
|
+
*/
|
|
119
|
+
expiresAfter?: string;
|
|
120
|
+
};
|
|
121
|
+
CreatedMediaDto: {
|
|
122
|
+
filename: string;
|
|
123
|
+
contentType: string;
|
|
124
|
+
bucket: string;
|
|
125
|
+
bucketPath: string;
|
|
126
|
+
isPublic: boolean;
|
|
127
|
+
/** Format: uri */
|
|
128
|
+
publicUrl?: string;
|
|
129
|
+
owner: {
|
|
130
|
+
/** @description The type of the associated entity */
|
|
131
|
+
type: string;
|
|
132
|
+
/** @description The id of the associated entity */
|
|
133
|
+
id: string;
|
|
134
|
+
};
|
|
135
|
+
associatedEntities: {
|
|
136
|
+
/** @description The type of the associated entity */
|
|
137
|
+
type: string;
|
|
138
|
+
/** @description The id of the associated entity */
|
|
139
|
+
id: string;
|
|
140
|
+
}[];
|
|
141
|
+
/** @description The permissions for the media, specifying which users permissions are required. (eg: ["customers:customer"]) */
|
|
142
|
+
permissions: string[];
|
|
143
|
+
/**
|
|
144
|
+
* @description A MongoDB ObjectID
|
|
145
|
+
* @example 64f0cbbf2f4d3c6b8a1e9f0a
|
|
146
|
+
*/
|
|
147
|
+
id: string;
|
|
148
|
+
meta: {
|
|
149
|
+
/**
|
|
150
|
+
* Format: date-time
|
|
151
|
+
* @description Created at timestamp
|
|
152
|
+
* @example 2022-01-21T00:15:16.000Z
|
|
153
|
+
*/
|
|
154
|
+
createdAt: string;
|
|
155
|
+
createdBy: string;
|
|
156
|
+
/**
|
|
157
|
+
* Format: date-time
|
|
158
|
+
* @description Updated at timestamp
|
|
159
|
+
* @example 2022-01-21T00:15:16.000Z
|
|
160
|
+
*/
|
|
161
|
+
updatedAt?: string;
|
|
162
|
+
updatedBy?: string;
|
|
163
|
+
/**
|
|
164
|
+
* Format: date-time
|
|
165
|
+
* @description Deleted at timestamp
|
|
166
|
+
* @example 2022-01-21T00:15:16.000Z
|
|
167
|
+
*/
|
|
168
|
+
deletedAt?: string;
|
|
169
|
+
deletedBy?: string;
|
|
170
|
+
};
|
|
171
|
+
/** Format: date-time */
|
|
172
|
+
expiresAfter?: string;
|
|
173
|
+
signedUrlForUpload: {
|
|
174
|
+
/** Format: uri */
|
|
175
|
+
url: string;
|
|
176
|
+
headers: {
|
|
177
|
+
[key: string]: string;
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
PermissionErrorDto: {
|
|
182
|
+
/**
|
|
183
|
+
* @example Forbidden
|
|
184
|
+
* @constant
|
|
185
|
+
*/
|
|
186
|
+
error: "Forbidden";
|
|
187
|
+
/**
|
|
188
|
+
* @example 403
|
|
189
|
+
* @constant
|
|
190
|
+
*/
|
|
191
|
+
statusCode: 403;
|
|
192
|
+
/** @example You are not allowed to perform that action */
|
|
193
|
+
message: string;
|
|
194
|
+
/** @example Technical error description */
|
|
195
|
+
reason: string;
|
|
196
|
+
grants: {
|
|
197
|
+
entity: string;
|
|
198
|
+
operation: string;
|
|
199
|
+
/** @enum {string} */
|
|
200
|
+
scope: "@self" | "@org" | "@admin";
|
|
201
|
+
}[];
|
|
202
|
+
};
|
|
203
|
+
MediaResponseDto: {
|
|
204
|
+
filename: string;
|
|
205
|
+
contentType: string;
|
|
206
|
+
bucket: string;
|
|
207
|
+
bucketPath: string;
|
|
208
|
+
isPublic: boolean;
|
|
209
|
+
/** Format: uri */
|
|
210
|
+
publicUrl?: string;
|
|
211
|
+
owner: {
|
|
212
|
+
/** @description The type of the associated entity */
|
|
213
|
+
type: string;
|
|
214
|
+
/** @description The id of the associated entity */
|
|
215
|
+
id: string;
|
|
216
|
+
};
|
|
217
|
+
associatedEntities: {
|
|
218
|
+
/** @description The type of the associated entity */
|
|
219
|
+
type: string;
|
|
220
|
+
/** @description The id of the associated entity */
|
|
221
|
+
id: string;
|
|
222
|
+
}[];
|
|
223
|
+
/** @description The permissions for the media, specifying which users permissions are required. (eg: ["customers:customer"]) */
|
|
224
|
+
permissions: string[];
|
|
225
|
+
/**
|
|
226
|
+
* @description A MongoDB ObjectID
|
|
227
|
+
* @example 64f0cbbf2f4d3c6b8a1e9f0a
|
|
228
|
+
*/
|
|
229
|
+
id: string;
|
|
230
|
+
meta: {
|
|
231
|
+
/**
|
|
232
|
+
* Format: date-time
|
|
233
|
+
* @description Created at timestamp
|
|
234
|
+
* @example 2022-01-21T00:15:16.000Z
|
|
235
|
+
*/
|
|
236
|
+
createdAt: string;
|
|
237
|
+
createdBy: string;
|
|
238
|
+
/**
|
|
239
|
+
* Format: date-time
|
|
240
|
+
* @description Updated at timestamp
|
|
241
|
+
* @example 2022-01-21T00:15:16.000Z
|
|
242
|
+
*/
|
|
243
|
+
updatedAt?: string;
|
|
244
|
+
updatedBy?: string;
|
|
245
|
+
/**
|
|
246
|
+
* Format: date-time
|
|
247
|
+
* @description Deleted at timestamp
|
|
248
|
+
* @example 2022-01-21T00:15:16.000Z
|
|
249
|
+
*/
|
|
250
|
+
deletedAt?: string;
|
|
251
|
+
deletedBy?: string;
|
|
252
|
+
};
|
|
253
|
+
/** Format: date-time */
|
|
254
|
+
expiresAfter?: string;
|
|
255
|
+
/**
|
|
256
|
+
* Format: uri
|
|
257
|
+
* @description A signed URL that can be used to download the attachment content. This field is optional and will only be included if the request asks for it.
|
|
258
|
+
*/
|
|
259
|
+
signedUrlForDownload?: string;
|
|
260
|
+
};
|
|
261
|
+
NotFoundErrorDto: {
|
|
262
|
+
/**
|
|
263
|
+
* @example NotFound
|
|
264
|
+
* @constant
|
|
265
|
+
*/
|
|
266
|
+
error: "NotFound";
|
|
267
|
+
/**
|
|
268
|
+
* @example 404
|
|
269
|
+
* @constant
|
|
270
|
+
*/
|
|
271
|
+
statusCode: 404;
|
|
272
|
+
/** @example The requested entity was not found */
|
|
273
|
+
message: string;
|
|
274
|
+
/** @example Technical error description */
|
|
275
|
+
reason: string;
|
|
276
|
+
};
|
|
277
|
+
PatchMediaDto: {
|
|
278
|
+
/** @description The permissions for the media, specifying which users permissions are required. (eg: ["customers:customer"]) */
|
|
279
|
+
permissions?: string[];
|
|
280
|
+
expiresAfter?: string | null;
|
|
281
|
+
/** @description A list of entities associated with the media, specifying the type and ID of each associated entity. This field is optional and can be used to link the media to other entities in the system. */
|
|
282
|
+
associatedEntities?: {
|
|
283
|
+
/** @description The type of the associated entity */
|
|
284
|
+
type: string;
|
|
285
|
+
/** @description The id of the associated entity */
|
|
286
|
+
id: string;
|
|
287
|
+
}[];
|
|
288
|
+
};
|
|
289
|
+
};
|
|
290
|
+
responses: never;
|
|
291
|
+
parameters: never;
|
|
292
|
+
requestBodies: never;
|
|
293
|
+
headers: never;
|
|
294
|
+
pathItems: never;
|
|
295
|
+
}
|
|
296
|
+
export type $defs = Record<string, never>;
|
|
297
|
+
export interface operations {
|
|
298
|
+
HealthController_getHealth: {
|
|
299
|
+
parameters: {
|
|
300
|
+
query?: never;
|
|
301
|
+
header?: never;
|
|
302
|
+
path?: never;
|
|
303
|
+
cookie?: never;
|
|
304
|
+
};
|
|
305
|
+
requestBody?: never;
|
|
306
|
+
responses: {
|
|
307
|
+
200: {
|
|
308
|
+
headers: {
|
|
309
|
+
[name: string]: unknown;
|
|
310
|
+
};
|
|
311
|
+
content: {
|
|
312
|
+
"application/json": components["schemas"]["HealthStatusDto"];
|
|
313
|
+
};
|
|
314
|
+
};
|
|
315
|
+
/** @description When the request is valid, but something goes wrong on the server */
|
|
316
|
+
500: {
|
|
317
|
+
headers: {
|
|
318
|
+
[name: string]: unknown;
|
|
319
|
+
};
|
|
320
|
+
content: {
|
|
321
|
+
"application/json": components["schemas"]["InternalServerErrorDto"];
|
|
322
|
+
};
|
|
323
|
+
};
|
|
324
|
+
};
|
|
325
|
+
};
|
|
326
|
+
createMedia: {
|
|
327
|
+
parameters: {
|
|
328
|
+
query?: never;
|
|
329
|
+
header?: never;
|
|
330
|
+
path?: never;
|
|
331
|
+
cookie?: never;
|
|
332
|
+
};
|
|
333
|
+
requestBody: {
|
|
334
|
+
content: {
|
|
335
|
+
"application/json": components["schemas"]["CreateMediaDto"];
|
|
336
|
+
};
|
|
337
|
+
};
|
|
338
|
+
responses: {
|
|
339
|
+
201: {
|
|
340
|
+
headers: {
|
|
341
|
+
[name: string]: unknown;
|
|
342
|
+
};
|
|
343
|
+
content: {
|
|
344
|
+
"application/json": components["schemas"]["CreatedMediaDto"];
|
|
345
|
+
};
|
|
346
|
+
};
|
|
347
|
+
/** @description When authentication fails */
|
|
348
|
+
401: {
|
|
349
|
+
headers: {
|
|
350
|
+
[name: string]: unknown;
|
|
351
|
+
};
|
|
352
|
+
content: {
|
|
353
|
+
"application/json": components["schemas"]["UnauthorizedErrorDto"];
|
|
354
|
+
};
|
|
355
|
+
};
|
|
356
|
+
/** @description When the requesting user is not allowed to perform this action */
|
|
357
|
+
403: {
|
|
358
|
+
headers: {
|
|
359
|
+
[name: string]: unknown;
|
|
360
|
+
};
|
|
361
|
+
content: {
|
|
362
|
+
"application/json": components["schemas"]["PermissionErrorDto"];
|
|
363
|
+
};
|
|
364
|
+
};
|
|
365
|
+
/** @description When the request is valid, but something goes wrong on the server */
|
|
366
|
+
500: {
|
|
367
|
+
headers: {
|
|
368
|
+
[name: string]: unknown;
|
|
369
|
+
};
|
|
370
|
+
content: {
|
|
371
|
+
"application/json": components["schemas"]["InternalServerErrorDto"];
|
|
372
|
+
};
|
|
373
|
+
};
|
|
374
|
+
};
|
|
375
|
+
};
|
|
376
|
+
getMediaById: {
|
|
377
|
+
parameters: {
|
|
378
|
+
query?: {
|
|
379
|
+
/** @description Whether to include a signed URL for downloading the media in the response. Defaults to false. */
|
|
380
|
+
includeSignedUrl?: boolean;
|
|
381
|
+
/** @description Whether the signed URL for downloading the media should be for inline display (true) or for attachment download (false). Defaults to false. */
|
|
382
|
+
inline?: boolean;
|
|
383
|
+
};
|
|
384
|
+
header?: never;
|
|
385
|
+
path: {
|
|
386
|
+
id: string;
|
|
387
|
+
};
|
|
388
|
+
cookie?: never;
|
|
389
|
+
};
|
|
390
|
+
requestBody?: never;
|
|
391
|
+
responses: {
|
|
392
|
+
200: {
|
|
393
|
+
headers: {
|
|
394
|
+
[name: string]: unknown;
|
|
395
|
+
};
|
|
396
|
+
content: {
|
|
397
|
+
"application/json": components["schemas"]["MediaResponseDto"];
|
|
398
|
+
};
|
|
399
|
+
};
|
|
400
|
+
/** @description When authentication fails */
|
|
401
|
+
401: {
|
|
402
|
+
headers: {
|
|
403
|
+
[name: string]: unknown;
|
|
404
|
+
};
|
|
405
|
+
content: {
|
|
406
|
+
"application/json": components["schemas"]["UnauthorizedErrorDto"];
|
|
407
|
+
};
|
|
408
|
+
};
|
|
409
|
+
/** @description When the requesting user is not allowed to perform this action */
|
|
410
|
+
403: {
|
|
411
|
+
headers: {
|
|
412
|
+
[name: string]: unknown;
|
|
413
|
+
};
|
|
414
|
+
content: {
|
|
415
|
+
"application/json": components["schemas"]["PermissionErrorDto"];
|
|
416
|
+
};
|
|
417
|
+
};
|
|
418
|
+
/** @description When the media is not found */
|
|
419
|
+
404: {
|
|
420
|
+
headers: {
|
|
421
|
+
[name: string]: unknown;
|
|
422
|
+
};
|
|
423
|
+
content: {
|
|
424
|
+
"application/json": components["schemas"]["NotFoundErrorDto"];
|
|
425
|
+
};
|
|
426
|
+
};
|
|
427
|
+
/** @description When the request is valid, but something goes wrong on the server */
|
|
428
|
+
500: {
|
|
429
|
+
headers: {
|
|
430
|
+
[name: string]: unknown;
|
|
431
|
+
};
|
|
432
|
+
content: {
|
|
433
|
+
"application/json": components["schemas"]["InternalServerErrorDto"];
|
|
434
|
+
};
|
|
435
|
+
};
|
|
436
|
+
};
|
|
437
|
+
};
|
|
438
|
+
deleteMediaById: {
|
|
439
|
+
parameters: {
|
|
440
|
+
query?: never;
|
|
441
|
+
header?: never;
|
|
442
|
+
path: {
|
|
443
|
+
id: string;
|
|
444
|
+
};
|
|
445
|
+
cookie?: never;
|
|
446
|
+
};
|
|
447
|
+
requestBody?: never;
|
|
448
|
+
responses: {
|
|
449
|
+
204: {
|
|
450
|
+
headers: {
|
|
451
|
+
[name: string]: unknown;
|
|
452
|
+
};
|
|
453
|
+
content?: never;
|
|
454
|
+
};
|
|
455
|
+
/** @description When authentication fails */
|
|
456
|
+
401: {
|
|
457
|
+
headers: {
|
|
458
|
+
[name: string]: unknown;
|
|
459
|
+
};
|
|
460
|
+
content: {
|
|
461
|
+
"application/json": components["schemas"]["UnauthorizedErrorDto"];
|
|
462
|
+
};
|
|
463
|
+
};
|
|
464
|
+
/** @description When the requesting user is not allowed to perform this action */
|
|
465
|
+
403: {
|
|
466
|
+
headers: {
|
|
467
|
+
[name: string]: unknown;
|
|
468
|
+
};
|
|
469
|
+
content: {
|
|
470
|
+
"application/json": components["schemas"]["PermissionErrorDto"];
|
|
471
|
+
};
|
|
472
|
+
};
|
|
473
|
+
/** @description When the media is not found */
|
|
474
|
+
404: {
|
|
475
|
+
headers: {
|
|
476
|
+
[name: string]: unknown;
|
|
477
|
+
};
|
|
478
|
+
content: {
|
|
479
|
+
"application/json": components["schemas"]["NotFoundErrorDto"];
|
|
480
|
+
};
|
|
481
|
+
};
|
|
482
|
+
/** @description When the request is valid, but something goes wrong on the server */
|
|
483
|
+
500: {
|
|
484
|
+
headers: {
|
|
485
|
+
[name: string]: unknown;
|
|
486
|
+
};
|
|
487
|
+
content: {
|
|
488
|
+
"application/json": components["schemas"]["InternalServerErrorDto"];
|
|
489
|
+
};
|
|
490
|
+
};
|
|
491
|
+
};
|
|
492
|
+
};
|
|
493
|
+
updateMediaById: {
|
|
494
|
+
parameters: {
|
|
495
|
+
query?: never;
|
|
496
|
+
header?: never;
|
|
497
|
+
path: {
|
|
498
|
+
id: string;
|
|
499
|
+
};
|
|
500
|
+
cookie?: never;
|
|
501
|
+
};
|
|
502
|
+
requestBody: {
|
|
503
|
+
content: {
|
|
504
|
+
"application/json": components["schemas"]["PatchMediaDto"];
|
|
505
|
+
};
|
|
506
|
+
};
|
|
507
|
+
responses: {
|
|
508
|
+
200: {
|
|
509
|
+
headers: {
|
|
510
|
+
[name: string]: unknown;
|
|
511
|
+
};
|
|
512
|
+
content: {
|
|
513
|
+
"application/json": components["schemas"]["CreatedMediaDto"];
|
|
514
|
+
};
|
|
515
|
+
};
|
|
516
|
+
/** @description When authentication fails */
|
|
517
|
+
401: {
|
|
518
|
+
headers: {
|
|
519
|
+
[name: string]: unknown;
|
|
520
|
+
};
|
|
521
|
+
content: {
|
|
522
|
+
"application/json": components["schemas"]["UnauthorizedErrorDto"];
|
|
523
|
+
};
|
|
524
|
+
};
|
|
525
|
+
/** @description When the requesting user is not allowed to perform this action */
|
|
526
|
+
403: {
|
|
527
|
+
headers: {
|
|
528
|
+
[name: string]: unknown;
|
|
529
|
+
};
|
|
530
|
+
content: {
|
|
531
|
+
"application/json": components["schemas"]["PermissionErrorDto"];
|
|
532
|
+
};
|
|
533
|
+
};
|
|
534
|
+
/** @description When the media is not found */
|
|
535
|
+
404: {
|
|
536
|
+
headers: {
|
|
537
|
+
[name: string]: unknown;
|
|
538
|
+
};
|
|
539
|
+
content: {
|
|
540
|
+
"application/json": components["schemas"]["NotFoundErrorDto"];
|
|
541
|
+
};
|
|
542
|
+
};
|
|
543
|
+
/** @description When the request is valid, but something goes wrong on the server */
|
|
544
|
+
500: {
|
|
545
|
+
headers: {
|
|
546
|
+
[name: string]: unknown;
|
|
547
|
+
};
|
|
548
|
+
content: {
|
|
549
|
+
"application/json": components["schemas"]["InternalServerErrorDto"];
|
|
550
|
+
};
|
|
551
|
+
};
|
|
552
|
+
};
|
|
553
|
+
};
|
|
554
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/__generated__/schema.ts"],"names":[],"mappings":""}
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ApiInput, BaseSdkClient, CreateSdkClientInput, RequestOptions, SdkResult } from "@palmetto/base-sdk-client";
|
|
2
|
+
import { ExtractResultData } from "@palmetto/result";
|
|
3
|
+
import type { paths } from "./__generated__/schema.ts";
|
|
4
|
+
export type CreateMediaClientInput = Omit<CreateSdkClientInput, "sdkVersion">;
|
|
5
|
+
export declare class MediaClient extends BaseSdkClient<paths> {
|
|
6
|
+
constructor(input: CreateMediaClientInput);
|
|
7
|
+
createMedia(input: CreateMediaInput, options?: RequestOptions): Promise<CreateMediaResult>;
|
|
8
|
+
getMediaById({ id, ...query }: GetMediaByIdInput, options?: RequestOptions): Promise<GetMediaByIdResult>;
|
|
9
|
+
deleteMediaById(input: DeleteMediaByIdInput, options?: RequestOptions): Promise<DeleteMediaByIdResult>;
|
|
10
|
+
updateMediaById({ id, ...input }: UpdateMediaByIdInput, options?: RequestOptions): Promise<UpdateMediaByIdResult>;
|
|
11
|
+
healthCheck(_input?: HealthCheckInput, options?: RequestOptions): Promise<HealthCheckResult>;
|
|
12
|
+
}
|
|
13
|
+
export type HealthCheckInput = ApiInput<paths["/api/health"]["get"]>;
|
|
14
|
+
export type HealthCheckResult = SdkResult<paths["/api/health"]["get"]>;
|
|
15
|
+
export type HealthCheckResponse = ExtractResultData<HealthCheckResult>;
|
|
16
|
+
export type CreateMediaInput = ApiInput<paths["/api/media"]["post"]>;
|
|
17
|
+
export type CreateMediaResult = SdkResult<paths["/api/media"]["post"]>;
|
|
18
|
+
export type CreateMediaResponse = ExtractResultData<CreateMediaResult>;
|
|
19
|
+
export type GetMediaByIdInput = ApiInput<paths["/api/media/{id}"]["get"]>;
|
|
20
|
+
export type GetMediaByIdResult = SdkResult<paths["/api/media/{id}"]["get"]>;
|
|
21
|
+
export type GetMediaByIdResponse = ExtractResultData<GetMediaByIdResult>;
|
|
22
|
+
export type DeleteMediaByIdInput = ApiInput<paths["/api/media/{id}"]["delete"]>;
|
|
23
|
+
export type DeleteMediaByIdResult = SdkResult<paths["/api/media/{id}"]["delete"]>;
|
|
24
|
+
export type UpdateMediaByIdInput = ApiInput<paths["/api/media/{id}"]["patch"]>;
|
|
25
|
+
export type UpdateMediaByIdResult = SdkResult<paths["/api/media/{id}"]["patch"]>;
|
|
26
|
+
export type UpdateMediaByIdResponse = ExtractResultData<UpdateMediaByIdResult>;
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
+
t[p[i]] = s[p[i]];
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.MediaClient = void 0;
|
|
24
|
+
const base_sdk_client_1 = require("@palmetto/base-sdk-client");
|
|
25
|
+
const result_1 = require("@palmetto/result");
|
|
26
|
+
const SDK_VERSION_SLUG = "palmetto-media-sdk/0.1.0";
|
|
27
|
+
class MediaClient extends base_sdk_client_1.BaseSdkClient {
|
|
28
|
+
constructor(input) {
|
|
29
|
+
super(Object.assign(Object.assign({}, input), { sdkVersion: SDK_VERSION_SLUG }));
|
|
30
|
+
}
|
|
31
|
+
createMedia(input, options) {
|
|
32
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
const { data, error, response } = yield this.client.POST("/api/media", {
|
|
34
|
+
headers: this.generateHeaders(options),
|
|
35
|
+
body: input,
|
|
36
|
+
});
|
|
37
|
+
if (data) {
|
|
38
|
+
return (0, result_1.Ok)(data);
|
|
39
|
+
}
|
|
40
|
+
return this.handleErrorResponse(error, response);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
getMediaById(_a, options) {
|
|
44
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
var { id } = _a, query = __rest(_a, ["id"]);
|
|
46
|
+
const { data, error, response } = yield this.client.GET(`/api/media/{id}`, {
|
|
47
|
+
params: {
|
|
48
|
+
path: { id },
|
|
49
|
+
query,
|
|
50
|
+
},
|
|
51
|
+
headers: this.generateHeaders(options),
|
|
52
|
+
});
|
|
53
|
+
if (data) {
|
|
54
|
+
return (0, result_1.Ok)(data);
|
|
55
|
+
}
|
|
56
|
+
return this.handleErrorResponse(error, response);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
deleteMediaById(input, options) {
|
|
60
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
const { error, response } = yield this.client.DELETE(`/api/media/{id}`, {
|
|
62
|
+
params: { path: { id: input.id } },
|
|
63
|
+
headers: this.generateHeaders(options),
|
|
64
|
+
});
|
|
65
|
+
if (!error) {
|
|
66
|
+
return (0, result_1.Ok)(undefined);
|
|
67
|
+
}
|
|
68
|
+
return this.handleErrorResponse(error, response);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
updateMediaById(_a, options) {
|
|
72
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
var { id } = _a, input = __rest(_a, ["id"]);
|
|
74
|
+
const { data, error, response } = yield this.client.PATCH(`/api/media/{id}`, {
|
|
75
|
+
params: { path: { id } },
|
|
76
|
+
headers: this.generateHeaders(options),
|
|
77
|
+
body: input,
|
|
78
|
+
});
|
|
79
|
+
if (data) {
|
|
80
|
+
return (0, result_1.Ok)(data);
|
|
81
|
+
}
|
|
82
|
+
return this.handleErrorResponse(error, response);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
healthCheck(_input, options) {
|
|
86
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
87
|
+
const { data, error, response } = yield this.client.GET("/api/health", {
|
|
88
|
+
headers: this.generateHeaders(options),
|
|
89
|
+
});
|
|
90
|
+
if (data) {
|
|
91
|
+
return (0, result_1.Ok)(data);
|
|
92
|
+
}
|
|
93
|
+
return this.handleErrorResponse(error, response);
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
exports.MediaClient = MediaClient;
|
|
98
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"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"}
|
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./client.js";
|
package/dist/main.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
__exportStar(require("./client.js"), exports);
|
|
18
|
+
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B"}
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@palmetto/media-sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"main": "./dist/main.js",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/palmetto/media"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist/**/*",
|
|
11
|
+
"README.md"
|
|
12
|
+
],
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=20"
|
|
15
|
+
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"lint": "yarn run -T eslint . --fix --cache",
|
|
18
|
+
"format": "yarn run -T prettier --write --list-different src/",
|
|
19
|
+
"format:check": "yarn run -T prettier --check --log-level=warn src/",
|
|
20
|
+
"tc": "yarn run -T tsc --noEmit",
|
|
21
|
+
"build": "yarn run -T tsc",
|
|
22
|
+
"generate": "node ./scripts/generateApiSchema.mjs",
|
|
23
|
+
"prepublishOnly": "yarn build",
|
|
24
|
+
"hook:lint": "yarn run -T eslint --cache --fix",
|
|
25
|
+
"hook:format": "yarn run -T prettier --write --log-level warn",
|
|
26
|
+
"hook:type-check": "yarn tc",
|
|
27
|
+
"ci:build": "yarn build",
|
|
28
|
+
"ci:lint": "yarn lint && yarn run -T prettier --check --log-level warn ./src",
|
|
29
|
+
"ci:tc": "yarn tc"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@palmetto/base-sdk-client": "^1.2.3",
|
|
33
|
+
"@palmetto/result": "^1.2.1",
|
|
34
|
+
"@types/node": "^25.9.1",
|
|
35
|
+
"openapi-typescript": "^7.13.0",
|
|
36
|
+
"openapi-typescript-helpers": "^0.1.0",
|
|
37
|
+
"typescript": "6.0.3"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"openapi-fetch": "^0.17.0"
|
|
41
|
+
},
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"@palmetto/base-sdk-client": "^1.2",
|
|
44
|
+
"@palmetto/result": "^1.2"
|
|
45
|
+
},
|
|
46
|
+
"publishConfig": {
|
|
47
|
+
"access": "public"
|
|
48
|
+
}
|
|
49
|
+
}
|