ugcinc 2.26.0 → 2.27.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/dist/media.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { BaseClient } from './base';
2
- import type { Media, UserMedia, SocialAudio, GetMediaParams, GetSocialAudioParams, UploadMediaResponse, UpdateMediaTagParams, DeleteMediaParams, DeleteMediaResponse, CreateSocialAudioParams, CreateMediaFromUrlParams, ApiResponse } from './types';
2
+ import type { Media, UserMedia, SocialAudio, GetMediaParams, GetSocialAudioParams, UploadMediaResponse, UpdateMediaTagParams, DeleteMediaParams, DeleteMediaResponse, CreateSocialAudioParams, CreateMediaFromUrlParams, GetUploadTokenParams, UploadTokenResponse, ApiResponse } from './types';
3
3
  /**
4
4
  * Client for managing media files
5
5
  */
@@ -21,11 +21,11 @@ export declare class MediaClient extends BaseClient {
21
21
  */
22
22
  create(params: CreateMediaFromUrlParams): Promise<ApiResponse<UploadMediaResponse>>;
23
23
  /**
24
- * Get the URL to use for handleUploadUrl when using @vercel/blob/client upload
25
- * Use this with the `upload` function from @vercel/blob/client
26
- * After uploading, call create() with the resulting blob URLs
24
+ * Get a client token for direct upload to Vercel Blob storage
25
+ * Use this with the `put` function from @vercel/blob/client
26
+ * After uploading, call create() with the resulting blob URL
27
27
  */
28
- getUploadHandlerUrl(): string;
28
+ getUploadToken(params: GetUploadTokenParams): Promise<ApiResponse<UploadTokenResponse>>;
29
29
  /**
30
30
  * Update the tag on a media item
31
31
  * Works for both user_media and social_audio
package/dist/media.js CHANGED
@@ -29,16 +29,12 @@ class MediaClient extends base_1.BaseClient {
29
29
  return this.post('/media/create', params);
30
30
  }
31
31
  /**
32
- * Get the URL to use for handleUploadUrl when using @vercel/blob/client upload
33
- * Use this with the `upload` function from @vercel/blob/client
34
- * After uploading, call create() with the resulting blob URLs
32
+ * Get a client token for direct upload to Vercel Blob storage
33
+ * Use this with the `put` function from @vercel/blob/client
34
+ * After uploading, call create() with the resulting blob URL
35
35
  */
36
- getUploadHandlerUrl() {
37
- const url = `${this.getBaseUrl()}/media/create/url`;
38
- if (this.getOrgId()) {
39
- return `${url}?orgId=${encodeURIComponent(this.getOrgId())}`;
40
- }
41
- return url;
36
+ async getUploadToken(params) {
37
+ return this.post('/media/create/url', params);
42
38
  }
43
39
  /**
44
40
  * Update the tag on a media item
package/dist/types.d.ts CHANGED
@@ -713,4 +713,12 @@ export interface CreateMediaFromUrlParams {
713
713
  names?: string[];
714
714
  tag?: string;
715
715
  }
716
+ export interface GetUploadTokenParams {
717
+ filename: string;
718
+ contentType?: string;
719
+ }
720
+ export interface UploadTokenResponse {
721
+ clientToken: string;
722
+ pathname: string;
723
+ }
716
724
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ugcinc",
3
- "version": "2.26.0",
3
+ "version": "2.27.0",
4
4
  "description": "TypeScript/JavaScript client for the UGC Inc API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",