@redseat/api 0.4.4 → 0.4.6

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/library.d.ts CHANGED
@@ -127,6 +127,8 @@ export declare class LibraryApi {
127
127
  tagMerge(fromId: string, intoId: string): Promise<ITag>;
128
128
  tagAddAlt(tagId: string, alt: string): Promise<ITag>;
129
129
  tagRemoveAlt(tagId: string, alt: string): Promise<ITag>;
130
+ tagAddOtherId(tagId: string, otherId: string): Promise<ITag>;
131
+ tagRemoveOtherId(tagId: string, otherId: string): Promise<ITag>;
130
132
  mediaTransfer(formData: FormData): Promise<void>;
131
133
  mediaTransferMany(medias: string[], deleteOriginal: boolean, toLibraryId: string): Promise<void>;
132
134
  mediaTransferSingle(mediaId: string, toLibraryId: string, formData: FormData, params?: Map<string, string>): Promise<void>;
@@ -287,6 +289,14 @@ export declare class LibraryApi {
287
289
  * @returns Raw axios response with stream data - use response.data for the stream
288
290
  */
289
291
  processRequestStream(request: RsRequest): Promise<AxiosResponse>;
292
+ /**
293
+ * Process a request and return the response as a Blob.
294
+ * Use this in environments where ReadableStream is not supported (e.g. React Native).
295
+ * Same endpoint as processRequestStream but with responseType 'blob'.
296
+ * @param request - The request to process and retrieve as a blob
297
+ * @returns The response blob (e.g. image data)
298
+ */
299
+ processRequestBlob(request: RsRequest): Promise<Blob>;
290
300
  /**
291
301
  * Add a request to the processing queue.
292
302
  * @param request - The request to add for processing
package/dist/library.js CHANGED
@@ -102,6 +102,13 @@ export class LibraryApi {
102
102
  ...params,
103
103
  token: this.client.getAuthToken()
104
104
  });
105
+ let finished = false;
106
+ const finish = () => {
107
+ if (!finished) {
108
+ finished = true;
109
+ callbacks.onFinished?.();
110
+ }
111
+ };
105
112
  return openFetchSSEStream(url, (eventType, data) => {
106
113
  if (eventType === 'results') {
107
114
  try {
@@ -113,9 +120,9 @@ export class LibraryApi {
113
120
  }
114
121
  }
115
122
  else if (eventType === 'finished') {
116
- callbacks.onFinished?.();
123
+ finish();
117
124
  }
118
- }, undefined, (error) => callbacks.onError?.(error));
125
+ }, finish, (error) => callbacks.onError?.(error));
119
126
  }
120
127
  async getTags(query) {
121
128
  const params = {};
@@ -288,6 +295,14 @@ export class LibraryApi {
288
295
  const res = await this.client.patch(this.getUrl(`/tags/${tagId}`), { removeAlts: [alt] });
289
296
  return res.data;
290
297
  }
298
+ async tagAddOtherId(tagId, otherId) {
299
+ const res = await this.client.patch(this.getUrl(`/tags/${tagId}`), { addOtherids: [otherId] });
300
+ return res.data;
301
+ }
302
+ async tagRemoveOtherId(tagId, otherId) {
303
+ const res = await this.client.patch(this.getUrl(`/tags/${tagId}`), { removeOtherids: [otherId] });
304
+ return res.data;
305
+ }
291
306
  async mediaTransfer(formData) {
292
307
  await this.client.put(this.getUrl('/medias/transfert'), formData);
293
308
  }
@@ -701,6 +716,17 @@ export class LibraryApi {
701
716
  async processRequestStream(request) {
702
717
  return this.client.post(this.getUrl('/plugins/requests/process/stream'), request, { responseType: 'stream' });
703
718
  }
719
+ /**
720
+ * Process a request and return the response as a Blob.
721
+ * Use this in environments where ReadableStream is not supported (e.g. React Native).
722
+ * Same endpoint as processRequestStream but with responseType 'blob'.
723
+ * @param request - The request to process and retrieve as a blob
724
+ * @returns The response blob (e.g. image data)
725
+ */
726
+ async processRequestBlob(request) {
727
+ const res = await this.client.post(this.getUrl('/plugins/requests/process/stream'), request, { responseType: 'blob' });
728
+ return res.data;
729
+ }
704
730
  /**
705
731
  * Add a request to the processing queue.
706
732
  * @param request - The request to add for processing
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redseat/api",
3
- "version": "0.4.4",
3
+ "version": "0.4.6",
4
4
  "description": "TypeScript API client library for interacting with Redseat servers",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",