@deadair/sdk 0.13.0 → 0.13.2

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.
@@ -4,7 +4,7 @@ export declare class ArtClient {
4
4
  constructor(fetch: SdkFetch);
5
5
  /**
6
6
  * @name Get art
7
- * @description The bytes of one cached image
7
+ * @description The bytes of one cached image, addressed by its id alone
8
8
  */
9
9
  getArt(id: string): Promise<{
10
10
  status: 200;
@@ -17,5 +17,20 @@ export declare class ArtClient {
17
17
  } | {
18
18
  status: 304;
19
19
  }>;
20
+ /**
21
+ * @name Get art file
22
+ * @description The bytes of one cached image, under any filename
23
+ */
24
+ getArtFile(id: string, filename: string): Promise<{
25
+ status: 200;
26
+ contentType: 'image/jpeg' | 'image/png' | 'image/webp' | 'image/gif';
27
+ data: Blob;
28
+ headers: {
29
+ cacheControl?: string;
30
+ etag?: string;
31
+ };
32
+ } | {
33
+ status: 304;
34
+ }>;
20
35
  }
21
36
  //# sourceMappingURL=art.client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"art.client.d.ts","sourceRoot":"","sources":["../../src/art/art.client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGlD,qBAAa,SAAS;IACN,OAAO,CAAC,KAAK;gBAAL,KAAK,EAAE,QAAQ;IAEnC;;;OAGG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAC3B;QACI,MAAM,EAAE,GAAG,CAAC;QACZ,WAAW,EAAE,YAAY,GAAG,WAAW,GAAG,YAAY,GAAG,WAAW,CAAC;QACrE,IAAI,EAAE,IAAI,CAAC;QACX,OAAO,EAAE;YAAE,YAAY,CAAC,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;KACrD,GACD;QAAE,MAAM,EAAE,GAAG,CAAA;KAAE,CACpB;CAiBJ"}
1
+ {"version":3,"file":"art.client.d.ts","sourceRoot":"","sources":["../../src/art/art.client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGlD,qBAAa,SAAS;IACN,OAAO,CAAC,KAAK;gBAAL,KAAK,EAAE,QAAQ;IAEnC;;;OAGG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAC3B;QACI,MAAM,EAAE,GAAG,CAAC;QACZ,WAAW,EAAE,YAAY,GAAG,WAAW,GAAG,YAAY,GAAG,WAAW,CAAC;QACrE,IAAI,EAAE,IAAI,CAAC;QACX,OAAO,EAAE;YAAE,YAAY,CAAC,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;KACrD,GACD;QAAE,MAAM,EAAE,GAAG,CAAA;KAAE,CACpB;IAkBD;;;OAGG;IACG,UAAU,CACZ,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,MAAM,GACjB,OAAO,CACJ;QACI,MAAM,EAAE,GAAG,CAAC;QACZ,WAAW,EAAE,YAAY,GAAG,WAAW,GAAG,YAAY,GAAG,WAAW,CAAC;QACrE,IAAI,EAAE,IAAI,CAAC;QACX,OAAO,EAAE;YAAE,YAAY,CAAC,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;KACrD,GACD;QAAE,MAAM,EAAE,GAAG,CAAA;KAAE,CACpB;CAiBJ"}
package/dist/index.js CHANGED
@@ -171,7 +171,7 @@ var ArtClient = class {
171
171
  }
172
172
  /**
173
173
  * @name Get art
174
- * @description The bytes of one cached image
174
+ * @description The bytes of one cached image, addressed by its id alone
175
175
  */
176
176
  async getArt(id) {
177
177
  const result = await this.fetch(`/art/${encodeURIComponent(id)}`, {
@@ -197,6 +197,34 @@ var ArtClient = class {
197
197
  };
198
198
  }
199
199
  }
200
+ /**
201
+ * @name Get art file
202
+ * @description The bytes of one cached image, under any filename
203
+ */
204
+ async getArtFile(id, filename) {
205
+ const result = await this.fetch(`/art/${encodeURIComponent(id)}/${encodeURIComponent(filename)}`, {
206
+ method: "GET",
207
+ expectStatuses: [
208
+ 304
209
+ ]
210
+ });
211
+ switch (result.status) {
212
+ case 304:
213
+ return {
214
+ status: 304
215
+ };
216
+ default:
217
+ return {
218
+ status: 200,
219
+ contentType: readContentType(result),
220
+ data: await result.blob(),
221
+ headers: {
222
+ cacheControl: result.headers.get("cache-control") ?? void 0,
223
+ etag: result.headers.get("etag") ?? void 0
224
+ }
225
+ };
226
+ }
227
+ }
200
228
  };
201
229
 
202
230
  // src/authentication/types/authentication.types.ts