@degallery/sdk 0.2.1 → 0.2.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.
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var i=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var g=(n,e)=>{for(var t in e)i(n,t,{get:e[t],enumerable:!0})},y=(n,e,t,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of d(e))!c.call(n,s)&&s!==t&&i(n,s,{get:()=>e[s],enumerable:!(a=u(e,s))||a.enumerable});return n};var h=n=>y(i({},"__esModule",{value:!0}),n);var m={};g(m,{GalleryClient:()=>o});module.exports=h(m);var o=class{constructor(e){this.options=e}options;assets={complete:e=>this.post("/api/v1/assets",e),list:(e={})=>this.getList("/api/v1/assets",e),retrieve:e=>this.get(`/api/v1/assets/${encodeURIComponent(e)}`),update:(e,t)=>this.patch(`/api/v1/assets/${encodeURIComponent(e)}`,t),uploadImage:e=>this.createUpload(e)};galleries={attachAssets:(e,t)=>this.post(`/api/v1/galleries/${encodeURIComponent(e)}/assets`,{assetIds:t}),create:e=>this.post("/api/v1/galleries",e),link:e=>this.get(`/api/v1/galleries/${encodeURIComponent(e)}/link`),list:(e={})=>this.getList("/api/v1/galleries",e),retrieve:(e,t={})=>this.get(`/api/v1/galleries/${encodeURIComponent(e)}`,{...t,include:t.includeAssets?"assets":void 0,includeAssets:void 0}),update:(e,t)=>this.patch(`/api/v1/galleries/${encodeURIComponent(e)}`,t)};async createUpload(e){let t=await this.post("/api/v1/uploads",e);return{...t.upload,asset:t.asset,contentType:t.upload.contentType,expiresAt:t.upload.expiresAt,intentId:t.upload.intentId,uploadUrl:t.upload.uploadUrl}}async completeUpload(e){return this.assets.complete({uploadIntentId:e})}async getGallery(e){let t=await this.galleries.retrieve(e,{includeAssets:!0});return{access:t.visibility==="public"?"public":"private",description:t.description,id:t.id,items:t.items?.map(a=>({alt:a.asset.alt,downloadUrl:a.asset.delivery.downloadUrl,id:a.asset.id,src:a.asset.delivery.src}))??[],layout:t.layout,name:t.name,slug:t.slug}}async track(e){let t=await this.rawRequest("/api/v1/events",{body:JSON.stringify({...e,occurredAt:e.occurredAt??new Date().toISOString()}),keepalive:!0,method:"POST"});if(!t.ok)throw new Error(`Event ingestion failed: ${t.status}`)}get(e,t){return this.requestData(e,{method:"GET"},t)}getList(e,t){return this.requestList(e,{method:"GET"},t)}patch(e,t){return this.requestData(e,{body:JSON.stringify(t),method:"PATCH"})}post(e,t){return this.requestData(e,{body:JSON.stringify(t),method:"POST"})}async requestData(e,t={},a){let s=await this.rawRequest(e,t,a);if(!s.ok)throw await this.toError(s);return(await s.json()).data}async requestList(e,t={},a){let s=await this.rawRequest(e,t,a);if(!s.ok)throw await this.toError(s);return await s.json()}rawRequest(e,t={},a){let s=this.options.fetch??fetch,l=new URL(e,this.options.apiUrl);for(let[p,r]of Object.entries(a??{}))r!=null&&l.searchParams.set(p,String(r));return s(l,{...t,headers:{"content-type":"application/json",...this.authToken?{authorization:`Bearer ${this.authToken}`}:{},...t.headers}})}get authToken(){return this.options.apiKey??this.options.readToken??this.options.publishableKey}async toError(e){let t=await e.json().catch(()=>{}),a=t?.error?.message??`The Gallery API request failed: ${e.status}`,s=new Error(a);return s.name=t?.error?.code??"GalleryApiError",s}};0&&(module.exports={GalleryClient});
1
+ "use strict";var p=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var m=(r,t)=>{for(var e in t)p(r,e,{get:t[e],enumerable:!0})},I=(r,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of h(t))!g.call(r,n)&&n!==e&&p(r,n,{get:()=>t[n],enumerable:!(s=y(t,n))||s.enumerable});return r};var C=r=>I(p({},"__esModule",{value:!0}),r);var v={};m(v,{GalleryClient:()=>u});module.exports=C(v);var i=class{constructor(t){this.httpClient=t}httpClient;async complete(t){return this.httpClient.post("/api/v1/assets",t)}async list(t={}){return this.httpClient.getList("/api/v1/assets",t)}async retrieve(t){return this.httpClient.get(`/api/v1/assets/${encodeURIComponent(t)}`)}async update(t,e){return this.httpClient.patch(`/api/v1/assets/${encodeURIComponent(t)}`,e)}};var a=class{constructor(t){this.httpClient=t}httpClient;async attachAssets(t,e){return this.httpClient.post(`/api/v1/galleries/${encodeURIComponent(t)}/assets`,{assetIds:e})}async create(t){return this.httpClient.post("/api/v1/galleries",t)}async link(t){return this.httpClient.get(`/api/v1/galleries/${encodeURIComponent(t)}/link`)}async list(t={}){return this.httpClient.getList("/api/v1/galleries",t)}async retrieve(t,e={}){return this.httpClient.get(`/api/v1/galleries/${encodeURIComponent(t)}`,{...e,include:e.includeAssets?"assets":void 0,includeAssets:void 0})}async update(t,e){this.httpClient.patch(`/api/v1/galleries/${encodeURIComponent(t)}`,e)}};var o=class{constructor(t){this.options=t}options;async get(t,e){return this.requestData(t,{method:"GET"},e)}async getList(t,e){return this.requestList(t,{method:"GET"},e)}async patch(t,e){return this.requestData(t,{body:JSON.stringify(e),method:"PATCH"})}async post(t,e){return this.requestData(t,{body:JSON.stringify(e),method:"POST"})}async requestData(t,e={},s){let n=await this.rawRequest(t,e,s);if(!n.ok)throw await this.toError(n);return(await n.json()).data}async requestList(t,e={},s){let n=await this.rawRequest(t,e,s);if(!n.ok)throw await this.toError(n);return await n.json()}async rawRequest(t,e={},s){let n=this.options.fetch??fetch,c=new URL(t,this.options.apiUrl);for(let[d,l]of Object.entries(s??{}))l!=null&&c.searchParams.set(d,String(l));return n(c,{...e,headers:{"content-type":"application/json",...this.authToken?{authorization:`Bearer ${this.authToken}`}:{},...e.headers}})}get authToken(){return this.options.apiKey??this.options.readToken??this.options.publishableKey}async toError(t){let e=await t.json().catch(()=>{}),s=e?.error?.message??`The Gallery API request failed: ${t.status}`,n=new Error(s);return n.name=e?.error?.code??"GalleryApiError",n}};var u=class r{static DEFAULT_OPTIONS={apiUrl:"https://api.degallery.mpotulo.com",fetch};galleries;assets;httpClient;constructor(t={}){let e={...r.DEFAULT_OPTIONS,...t},s=new o(e);this.httpClient=s,this.galleries=new a(s),this.assets=new i(s)}async createUpload(t){let e=await this.httpClient.post("/api/v1/uploads",t);return{...e.upload,asset:e.asset,contentType:e.upload.contentType,expiresAt:e.upload.expiresAt,intentId:e.upload.intentId,uploadUrl:e.upload.uploadUrl}}async completeUpload(t){return this.assets.complete({uploadIntentId:t})}async getGallery(t){let e=await this.galleries.retrieve(t,{includeAssets:!0});return{access:e.visibility==="public"?"public":"private",description:e.description,id:e.id,items:e.items?.map(s=>({alt:s.asset.alt,downloadUrl:s.asset.delivery.downloadUrl,id:s.asset.id,src:s.asset.delivery.src}))??[],layout:e.layout,name:e.name,slug:e.slug}}async track(t){let e=await this.httpClient.rawRequest("/api/v1/events",{body:JSON.stringify({...t,occurredAt:t.occurredAt??new Date().toISOString()}),keepalive:!0,method:"POST"});if(!e.ok)throw new Error(`Event ingestion failed: ${e.status}`)}};0&&(module.exports={GalleryClient});
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- var i=class{constructor(e){this.options=e}options;assets={complete:e=>this.post("/api/v1/assets",e),list:(e={})=>this.getList("/api/v1/assets",e),retrieve:e=>this.get(`/api/v1/assets/${encodeURIComponent(e)}`),update:(e,t)=>this.patch(`/api/v1/assets/${encodeURIComponent(e)}`,t),uploadImage:e=>this.createUpload(e)};galleries={attachAssets:(e,t)=>this.post(`/api/v1/galleries/${encodeURIComponent(e)}/assets`,{assetIds:t}),create:e=>this.post("/api/v1/galleries",e),link:e=>this.get(`/api/v1/galleries/${encodeURIComponent(e)}/link`),list:(e={})=>this.getList("/api/v1/galleries",e),retrieve:(e,t={})=>this.get(`/api/v1/galleries/${encodeURIComponent(e)}`,{...t,include:t.includeAssets?"assets":void 0,includeAssets:void 0}),update:(e,t)=>this.patch(`/api/v1/galleries/${encodeURIComponent(e)}`,t)};async createUpload(e){let t=await this.post("/api/v1/uploads",e);return{...t.upload,asset:t.asset,contentType:t.upload.contentType,expiresAt:t.upload.expiresAt,intentId:t.upload.intentId,uploadUrl:t.upload.uploadUrl}}async completeUpload(e){return this.assets.complete({uploadIntentId:e})}async getGallery(e){let t=await this.galleries.retrieve(e,{includeAssets:!0});return{access:t.visibility==="public"?"public":"private",description:t.description,id:t.id,items:t.items?.map(s=>({alt:s.asset.alt,downloadUrl:s.asset.delivery.downloadUrl,id:s.asset.id,src:s.asset.delivery.src}))??[],layout:t.layout,name:t.name,slug:t.slug}}async track(e){let t=await this.rawRequest("/api/v1/events",{body:JSON.stringify({...e,occurredAt:e.occurredAt??new Date().toISOString()}),keepalive:!0,method:"POST"});if(!t.ok)throw new Error(`Event ingestion failed: ${t.status}`)}get(e,t){return this.requestData(e,{method:"GET"},t)}getList(e,t){return this.requestList(e,{method:"GET"},t)}patch(e,t){return this.requestData(e,{body:JSON.stringify(t),method:"PATCH"})}post(e,t){return this.requestData(e,{body:JSON.stringify(t),method:"POST"})}async requestData(e,t={},s){let a=await this.rawRequest(e,t,s);if(!a.ok)throw await this.toError(a);return(await a.json()).data}async requestList(e,t={},s){let a=await this.rawRequest(e,t,s);if(!a.ok)throw await this.toError(a);return await a.json()}rawRequest(e,t={},s){let a=this.options.fetch??fetch,r=new URL(e,this.options.apiUrl);for(let[o,n]of Object.entries(s??{}))n!=null&&r.searchParams.set(o,String(n));return a(r,{...t,headers:{"content-type":"application/json",...this.authToken?{authorization:`Bearer ${this.authToken}`}:{},...t.headers}})}get authToken(){return this.options.apiKey??this.options.readToken??this.options.publishableKey}async toError(e){let t=await e.json().catch(()=>{}),s=t?.error?.message??`The Gallery API request failed: ${e.status}`,a=new Error(s);return a.name=t?.error?.code??"GalleryApiError",a}};export{i as GalleryClient};
1
+ var i=class{constructor(t){this.httpClient=t}httpClient;async complete(t){return this.httpClient.post("/api/v1/assets",t)}async list(t={}){return this.httpClient.getList("/api/v1/assets",t)}async retrieve(t){return this.httpClient.get(`/api/v1/assets/${encodeURIComponent(t)}`)}async update(t,e){return this.httpClient.patch(`/api/v1/assets/${encodeURIComponent(t)}`,e)}};var a=class{constructor(t){this.httpClient=t}httpClient;async attachAssets(t,e){return this.httpClient.post(`/api/v1/galleries/${encodeURIComponent(t)}/assets`,{assetIds:e})}async create(t){return this.httpClient.post("/api/v1/galleries",t)}async link(t){return this.httpClient.get(`/api/v1/galleries/${encodeURIComponent(t)}/link`)}async list(t={}){return this.httpClient.getList("/api/v1/galleries",t)}async retrieve(t,e={}){return this.httpClient.get(`/api/v1/galleries/${encodeURIComponent(t)}`,{...e,include:e.includeAssets?"assets":void 0,includeAssets:void 0})}async update(t,e){this.httpClient.patch(`/api/v1/galleries/${encodeURIComponent(t)}`,e)}};var o=class{constructor(t){this.options=t}options;async get(t,e){return this.requestData(t,{method:"GET"},e)}async getList(t,e){return this.requestList(t,{method:"GET"},e)}async patch(t,e){return this.requestData(t,{body:JSON.stringify(e),method:"PATCH"})}async post(t,e){return this.requestData(t,{body:JSON.stringify(e),method:"POST"})}async requestData(t,e={},s){let n=await this.rawRequest(t,e,s);if(!n.ok)throw await this.toError(n);return(await n.json()).data}async requestList(t,e={},s){let n=await this.rawRequest(t,e,s);if(!n.ok)throw await this.toError(n);return await n.json()}async rawRequest(t,e={},s){let n=this.options.fetch??fetch,p=new URL(t,this.options.apiUrl);for(let[c,l]of Object.entries(s??{}))l!=null&&p.searchParams.set(c,String(l));return n(p,{...e,headers:{"content-type":"application/json",...this.authToken?{authorization:`Bearer ${this.authToken}`}:{},...e.headers}})}get authToken(){return this.options.apiKey??this.options.readToken??this.options.publishableKey}async toError(t){let e=await t.json().catch(()=>{}),s=e?.error?.message??`The Gallery API request failed: ${t.status}`,n=new Error(s);return n.name=e?.error?.code??"GalleryApiError",n}};var u=class r{static DEFAULT_OPTIONS={apiUrl:"https://api.degallery.mpotulo.com",fetch};galleries;assets;httpClient;constructor(t={}){let e={...r.DEFAULT_OPTIONS,...t},s=new o(e);this.httpClient=s,this.galleries=new a(s),this.assets=new i(s)}async createUpload(t){let e=await this.httpClient.post("/api/v1/uploads",t);return{...e.upload,asset:e.asset,contentType:e.upload.contentType,expiresAt:e.upload.expiresAt,intentId:e.upload.intentId,uploadUrl:e.upload.uploadUrl}}async completeUpload(t){return this.assets.complete({uploadIntentId:t})}async getGallery(t){let e=await this.galleries.retrieve(t,{includeAssets:!0});return{access:e.visibility==="public"?"public":"private",description:e.description,id:e.id,items:e.items?.map(s=>({alt:s.asset.alt,downloadUrl:s.asset.delivery.downloadUrl,id:s.asset.id,src:s.asset.delivery.src}))??[],layout:e.layout,name:e.name,slug:e.slug}}async track(t){let e=await this.httpClient.rawRequest("/api/v1/events",{body:JSON.stringify({...t,occurredAt:t.occurredAt??new Date().toISOString()}),keepalive:!0,method:"POST"});if(!e.ok)throw new Error(`Event ingestion failed: ${e.status}`)}};export{u as GalleryClient};
@@ -0,0 +1,39 @@
1
+ import { HttpClient } from './http.client.js';
2
+ import { CompleteAssetInput, Asset, ListAssetsInput } from './types.js';
3
+ /**
4
+ * Provides operations for creating, listing, retrieving, and updating assets.
5
+ */
6
+ export declare class Assets {
7
+ private readonly httpClient;
8
+ constructor(httpClient: HttpClient);
9
+ /**
10
+ * Completes the creation of an asset.
11
+ *
12
+ * @param input The asset completion details.
13
+ * @returns The newly created asset.
14
+ */
15
+ complete(input: CompleteAssetInput): Promise<Asset>;
16
+ /**
17
+ * Lists assets matching the supplied filters.
18
+ *
19
+ * @param input The optional filters and pagination parameters.
20
+ * @returns A paginated list of matching assets.
21
+ */
22
+ list(input?: ListAssetsInput): Promise<import("./types.js").ApiListResponse<Asset>>;
23
+ /**
24
+ * Retrieves an asset by its identifier.
25
+ *
26
+ * @param assetId The unique identifier of the asset.
27
+ * @returns The requested asset.
28
+ */
29
+ retrieve(assetId: string): Promise<Asset>;
30
+ /**
31
+ * Updates an asset by its identifier.
32
+ *
33
+ * @param assetId The unique identifier of the asset.
34
+ * @param input The asset fields to update.
35
+ * @returns The updated asset.
36
+ */
37
+ update(assetId: string, input: Partial<CompleteAssetInput>): Promise<Asset>;
38
+ }
39
+ //# sourceMappingURL=assets.client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assets.client.d.ts","sourceRoot":"","sources":["../../src/lib/assets.client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAExE;;GAEG;AACH,qBAAa,MAAM;IACL,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,UAAU;IAEnD;;;;;OAKG;IACG,QAAQ,CAAC,KAAK,EAAE,kBAAkB;IAIxC;;;;;OAKG;IACG,IAAI,CAAC,KAAK,GAAE,eAAoB;IAItC;;;;;OAKG;IACG,QAAQ,CAAC,OAAO,EAAE,MAAM;IAM9B;;;;;;OAMG;IACG,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,kBAAkB,CAAC;CAMjE"}
@@ -1,36 +1,71 @@
1
- import type { ApiListResponse, Asset, ClientOptions, CompleteAssetInput, Gallery, GalleryDetail, GalleryEvent, GalleryInput, GalleryLinkPayload, GallerySummary, ListAssetsInput, ListInput, UploadImageInput, UploadIntent } from './types.js';
1
+ import { Assets } from './assets.client.js';
2
+ import { Gallery } from './gallery.client.js';
3
+ import type { ClientOptions, GalleryEvent, Gallery as GalleryType, UploadImageInput, UploadIntent } from './types.js';
4
+ /**
5
+ * Client for interacting with the Gallery API.
6
+ *
7
+ * Provides access to gallery and asset operations, upload helpers, and
8
+ * event tracking.
9
+ *
10
+ * @param options Optional configuration overrides for the API URL and fetch
11
+ * implementation.
12
+ * @property galleries - Access to gallery operations.
13
+ * @property assets - Access to asset operations.
14
+ *
15
+ * @method createUpload Creates an upload intent and its associated asset.
16
+ * @method completeUpload Marks an upload intent as complete after the file has
17
+ * been uploaded.
18
+ * @method getGallery Retrieves a gallery and maps it to the client-facing
19
+ * gallery shape.
20
+ * @method track Sends an analytics event to the Gallery API.
21
+ */
2
22
  export declare class GalleryClient {
3
- private readonly options;
4
- readonly assets: {
5
- complete: (input: CompleteAssetInput) => Promise<Asset>;
6
- list: (input?: ListAssetsInput) => Promise<ApiListResponse<Asset>>;
7
- retrieve: (assetId: string) => Promise<Asset>;
8
- update: (assetId: string, input: Partial<CompleteAssetInput>) => Promise<Asset>;
9
- uploadImage: (input: UploadImageInput) => Promise<UploadIntent>;
10
- };
11
- readonly galleries: {
12
- attachAssets: (galleryIdOrSlug: string, assetIds: string[]) => Promise<GalleryDetail>;
13
- create: (input: GalleryInput) => Promise<GallerySummary>;
14
- link: (galleryIdOrSlug: string) => Promise<GalleryLinkPayload>;
15
- list: (input?: ListInput) => Promise<ApiListResponse<GallerySummary>>;
16
- retrieve: (galleryIdOrSlug: string, input?: ListInput & {
17
- includeAssets?: boolean;
18
- }) => Promise<GalleryDetail>;
19
- update: (galleryIdOrSlug: string, input: Partial<GalleryInput>) => Promise<GallerySummary>;
20
- };
21
- constructor(options: ClientOptions);
23
+ private static readonly DEFAULT_OPTIONS;
24
+ readonly galleries: Gallery;
25
+ readonly assets: Assets;
26
+ private readonly httpClient;
27
+ /**
28
+ * Creates a client configured to communicate with the Gallery API.
29
+ *
30
+ * @param options Optional client configuration. Supplied values override the
31
+ * default API URL and fetch implementation.
32
+ */
33
+ constructor(options?: Partial<ClientOptions>);
34
+ /**
35
+ * Creates an upload intent and its associated asset.
36
+ *
37
+ * @param input Image metadata and upload details required by the API.
38
+ * @returns The upload intent, including the asset and signed upload URL.
39
+ */
22
40
  createUpload(input: UploadImageInput): Promise<UploadIntent>;
23
- completeUpload(intentId: string): Promise<Asset>;
24
- getGallery(id: string): Promise<Gallery>;
41
+ /**
42
+ * Marks an upload intent as complete after the file has been uploaded.
43
+ *
44
+ * @param intentId The ID of the upload intent to complete.
45
+ * @returns The completed asset returned by the assets API.
46
+ */
47
+ completeUpload(intentId: string): Promise<import("./types.js").Asset>;
48
+ /**
49
+ * Retrieves a gallery and maps it to the client-facing gallery shape.
50
+ *
51
+ * Assets are included in the request and exposed as gallery items with
52
+ * their display and download URLs.
53
+ *
54
+ * @param id The gallery ID to retrieve.
55
+ * @returns The gallery metadata and its available items.
56
+ */
57
+ getGallery(id: string): Promise<GalleryType>;
58
+ /**
59
+ * Sends an analytics event to the Gallery API.
60
+ *
61
+ * If the event does not provide an occurrence time, the current time is
62
+ * added automatically. The request is sent with `keepalive` enabled so it
63
+ * can complete while a page is unloading.
64
+ *
65
+ * @param event The gallery event to record.
66
+ * @returns A promise that resolves when the event is accepted.
67
+ * @throws Error when the API does not return a successful response.
68
+ */
25
69
  track(event: GalleryEvent): Promise<void>;
26
- private get;
27
- private getList;
28
- private patch;
29
- private post;
30
- private requestData;
31
- private requestList;
32
- private rawRequest;
33
- private get authToken();
34
- private toError;
35
70
  }
36
71
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/lib/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EAEf,KAAK,EACL,aAAa,EACb,kBAAkB,EAClB,OAAO,EACP,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,SAAS,EACT,gBAAgB,EAChB,YAAY,EACb,MAAM,YAAY,CAAC;AAEpB,qBAAa,aAAa;IA8CZ,OAAO,CAAC,QAAQ,CAAC,OAAO;IA7CpC,QAAQ,CAAC,MAAM;0BACK,kBAAkB;uBAEtB,eAAe;4BAET,MAAM;0BAER,MAAM,SAAS,OAAO,CAAC,kBAAkB,CAAC;6BAEvC,gBAAgB;MACrC;IAEF,QAAQ,CAAC,SAAS;wCACgB,MAAM,YAAY,MAAM,EAAE;wBAK1C,YAAY;gCAEJ,MAAM;uBAIhB,SAAS;oCAGJ,MAAM,UAChB,SAAS,GAAG;YAAE,aAAa,CAAC,EAAE,OAAO,CAAA;SAAE;kCAUtB,MAAM,SAAS,OAAO,CAAC,YAAY,CAAC;MAK9D;gBAE2B,OAAO,EAAE,aAAa;IAE7C,YAAY,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,YAAY,CAAC;IAgB5D,cAAc,CAAC,QAAQ,EAAE,MAAM;IAI/B,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAmBxC,KAAK,CAAC,KAAK,EAAE,YAAY;IAa/B,OAAO,CAAC,GAAG;IAIX,OAAO,CAAC,OAAO;IAIf,OAAO,CAAC,KAAK;IAOb,OAAO,CAAC,IAAI;YAOE,WAAW;YAUX,WAAW;IAUzB,OAAO,CAAC,UAAU;IAwBlB,OAAO,KAAK,SAAS,GAMpB;YAEa,OAAO;CAWtB"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/lib/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACZ,OAAO,IAAI,WAAW,EACtB,gBAAgB,EAChB,YAAY,EACb,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAGrC;IAGF,SAAgB,SAAS,EAAE,OAAO,CAAC;IACnC,SAAgB,MAAM,EAAE,MAAM,CAAC;IAC/B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IAExC;;;;;OAKG;gBACS,OAAO,GAAE,OAAO,CAAC,aAAa,CAAM;IAahD;;;;;OAKG;IACG,YAAY,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,YAAY,CAAC;IAgBlE;;;;;OAKG;IACG,cAAc,CAAC,QAAQ,EAAE,MAAM;IAIrC;;;;;;;;OAQG;IACG,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAoBlD;;;;;;;;;;OAUG;IACG,KAAK,CAAC,KAAK,EAAE,YAAY;CAYhC"}
@@ -0,0 +1,35 @@
1
+ import { HttpClient } from './http.client.js';
2
+ import { GalleryDetail, GalleryInput, GalleryLinkPayload, GallerySummary, ListInput } from './types.js';
3
+ export declare class Gallery {
4
+ private readonly httpClient;
5
+ constructor(httpClient: HttpClient);
6
+ /**
7
+ * Attaches assets to a gallery.
8
+ * @param galleryIdOrSlug Gallery ID or slug.
9
+ * @param assetIds IDs of the assets to attach.
10
+ */
11
+ attachAssets(galleryIdOrSlug: string, assetIds: string[]): Promise<GalleryDetail>;
12
+ /** Creates a gallery. */
13
+ create(input: GalleryInput): Promise<GallerySummary>;
14
+ /** Retrieves a shareable link for a gallery.
15
+ * @param galleryIdOrSlug Gallery ID or slug.
16
+ */
17
+ link(galleryIdOrSlug: string): Promise<GalleryLinkPayload>;
18
+ /** Lists galleries matching the supplied filters and pagination options. */
19
+ list(input?: ListInput): Promise<import("./types.js").ApiListResponse<GallerySummary>>;
20
+ /**
21
+ * Retrieves a gallery by ID or slug.
22
+ * @param galleryIdOrSlug Gallery ID or slug.
23
+ * @param input Filters and pagination options; set `includeAssets` to include assets.
24
+ */
25
+ retrieve(galleryIdOrSlug: string, input?: ListInput & {
26
+ includeAssets?: boolean;
27
+ }): Promise<GalleryDetail>;
28
+ /**
29
+ * Updates a gallery.
30
+ * @param galleryIdOrSlug Gallery ID or slug.
31
+ * @param input Fields to update.
32
+ */
33
+ update(galleryIdOrSlug: string, input: Partial<GalleryInput>): Promise<void>;
34
+ }
35
+ //# sourceMappingURL=gallery.client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gallery.client.d.ts","sourceRoot":"","sources":["../../src/lib/gallery.client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EACL,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,SAAS,EACV,MAAM,YAAY,CAAC;AAEpB,qBAAa,OAAO;IACN,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,UAAU;IAEnD;;;;OAIG;IACG,YAAY,CAAC,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE;IAO9D,yBAAyB;IACnB,MAAM,CAAC,KAAK,EAAE,YAAY;IAIhC;;OAEG;IACG,IAAI,CAAC,eAAe,EAAE,MAAM;IAMlC,4EAA4E;IACtE,IAAI,CAAC,KAAK,GAAE,SAAc;IAIhC;;;;OAIG;IACG,QAAQ,CACZ,eAAe,EAAE,MAAM,EACvB,KAAK,GAAE,SAAS,GAAG;QAAE,aAAa,CAAC,EAAE,OAAO,CAAA;KAAO;IAYrD;;;;OAIG;IACG,MAAM,CAAC,eAAe,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,YAAY,CAAC;CAMnE"}
@@ -0,0 +1,15 @@
1
+ import { ApiListResponse, ClientOptions } from './types.js';
2
+ export declare class HttpClient {
3
+ private readonly options;
4
+ constructor(options: ClientOptions);
5
+ get<T>(path: string, query?: Record<string, unknown>): Promise<T>;
6
+ getList<T>(path: string, query?: Record<string, unknown>): Promise<ApiListResponse<T>>;
7
+ patch<T>(path: string, body: unknown): Promise<T>;
8
+ post<T>(path: string, body: unknown): Promise<T>;
9
+ private requestData;
10
+ private requestList;
11
+ rawRequest(path: string, init?: RequestInit, query?: Record<string, unknown>): Promise<Response>;
12
+ private get authToken();
13
+ private toError;
14
+ }
15
+ //# sourceMappingURL=http.client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.client.d.ts","sourceRoot":"","sources":["../../src/lib/http.client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAe,aAAa,EAAE,MAAM,YAAY,CAAC;AAEzE,qBAAa,UAAU;IACT,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,aAAa;IAE7C,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAIpD,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAIxD,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO;IAOpC,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO;YAO3B,WAAW;YAUX,WAAW;IAUnB,UAAU,CACd,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE,WAAgB,EACtB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAsBjC,OAAO,KAAK,SAAS,GAMpB;YAEa,OAAO;CAWtB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@degallery/sdk",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",