@ermis-network/ermis-chat-sdk 1.0.7 → 1.0.9
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.browser.cjs +16 -2
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.full-bundle.min.js +2 -2
- package/dist/index.browser.full-bundle.min.js.map +1 -1
- package/dist/index.browser.mjs +16 -2
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.cjs +16 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.mjs +16 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +15 -0
package/package.json
CHANGED
package/src/client.ts
CHANGED
|
@@ -591,6 +591,21 @@ export class ErmisChat<ErmisChatGenerics extends ExtendableGenerics = DefaultGen
|
|
|
591
591
|
});
|
|
592
592
|
}
|
|
593
593
|
|
|
594
|
+
/**
|
|
595
|
+
* Downloads a media file as a Blob via the SDK's configured axiosInstance.
|
|
596
|
+
* This avoids CORS issues that arise when using `fetch()` directly from the browser,
|
|
597
|
+
* because axios is routed through the SDK's authenticated transport layer.
|
|
598
|
+
*
|
|
599
|
+
* @param url - The full URL of the media file to download.
|
|
600
|
+
* @returns A Blob of the file content.
|
|
601
|
+
*/
|
|
602
|
+
async downloadMedia(url: string): Promise<Blob> {
|
|
603
|
+
const response = await this.axiosInstance.get(url, {
|
|
604
|
+
responseType: 'blob',
|
|
605
|
+
});
|
|
606
|
+
return response.data as Blob;
|
|
607
|
+
}
|
|
608
|
+
|
|
594
609
|
errorFromResponse(response: AxiosResponse<APIErrorResponse>): ErrorFromResponse<APIErrorResponse> {
|
|
595
610
|
let err: ErrorFromResponse<APIErrorResponse>;
|
|
596
611
|
err = new ErrorFromResponse(`ErmisChat error HTTP code: ${response.status}`);
|