ugcinc 2.19.0 → 2.21.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/base.d.ts +3 -0
- package/dist/base.js +9 -0
- package/dist/media.d.ts +5 -6
- package/dist/media.js +9 -13
- package/dist/types.d.ts +4 -0
- package/package.json +1 -1
package/dist/base.d.ts
CHANGED
|
@@ -8,6 +8,9 @@ export declare class BaseClient {
|
|
|
8
8
|
protected orgId?: string;
|
|
9
9
|
protected readonly baseUrl = "https://api.ugc.inc";
|
|
10
10
|
constructor(config: ClientConfig);
|
|
11
|
+
protected getBaseUrl(): string;
|
|
12
|
+
protected getOrgId(): string | undefined;
|
|
13
|
+
protected getApiKey(): string;
|
|
11
14
|
protected request<T>(endpoint: string, options?: RequestInit): Promise<ApiResponse<T>>;
|
|
12
15
|
protected post<T>(endpoint: string, body?: unknown): Promise<ApiResponse<T>>;
|
|
13
16
|
protected get<T>(endpoint: string): Promise<ApiResponse<T>>;
|
package/dist/base.js
CHANGED
|
@@ -7,6 +7,15 @@ class BaseClient {
|
|
|
7
7
|
this.apiKey = config.apiKey;
|
|
8
8
|
this.orgId = config.orgId;
|
|
9
9
|
}
|
|
10
|
+
getBaseUrl() {
|
|
11
|
+
return this.baseUrl;
|
|
12
|
+
}
|
|
13
|
+
getOrgId() {
|
|
14
|
+
return this.orgId;
|
|
15
|
+
}
|
|
16
|
+
getApiKey() {
|
|
17
|
+
return this.apiKey;
|
|
18
|
+
}
|
|
10
19
|
async request(endpoint, options = {}) {
|
|
11
20
|
let url = `${this.baseUrl}${endpoint}`;
|
|
12
21
|
// If orgId is provided, treat apiKey as admin key and add orgId as query param
|
package/dist/media.d.ts
CHANGED
|
@@ -11,16 +11,15 @@ export declare class MediaClient extends BaseClient {
|
|
|
11
11
|
getMedia(params?: GetMediaParams): Promise<ApiResponse<Media[]>>;
|
|
12
12
|
/**
|
|
13
13
|
* Create media from URL(s)
|
|
14
|
-
*
|
|
15
|
-
* Supports both single url and multiple urls
|
|
14
|
+
* Creates media records from files already uploaded to blob storage
|
|
16
15
|
*/
|
|
17
16
|
create(params: CreateMediaFromUrlParams): Promise<ApiResponse<UploadMediaResponse>>;
|
|
18
17
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
18
|
+
* Get the URL to use for handleUploadUrl when using @vercel/blob/client upload
|
|
19
|
+
* Use this with the `upload` function from @vercel/blob/client
|
|
20
|
+
* After uploading, call create() with the resulting blob URLs
|
|
22
21
|
*/
|
|
23
|
-
|
|
22
|
+
getUploadHandlerUrl(): string;
|
|
24
23
|
/**
|
|
25
24
|
* Update the tag on a media item
|
|
26
25
|
* Works for both user_media and social_audio
|
package/dist/media.js
CHANGED
|
@@ -15,26 +15,22 @@ class MediaClient extends base_1.BaseClient {
|
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* Create media from URL(s)
|
|
18
|
-
*
|
|
19
|
-
* Supports both single url and multiple urls
|
|
18
|
+
* Creates media records from files already uploaded to blob storage
|
|
20
19
|
*/
|
|
21
20
|
async create(params) {
|
|
22
21
|
return this.post('/media/create', params);
|
|
23
22
|
}
|
|
24
23
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
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
|
|
28
27
|
*/
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
getUploadHandlerUrl() {
|
|
29
|
+
const url = `${this.getBaseUrl()}/media/create/url`;
|
|
30
|
+
if (this.getOrgId()) {
|
|
31
|
+
return `${url}?orgId=${encodeURIComponent(this.getOrgId())}`;
|
|
33
32
|
}
|
|
34
|
-
|
|
35
|
-
formData.append('tag', tag);
|
|
36
|
-
}
|
|
37
|
-
return this.postFormData('/media/create/upload', formData);
|
|
33
|
+
return url;
|
|
38
34
|
}
|
|
39
35
|
/**
|
|
40
36
|
* Update the tag on a media item
|
package/dist/types.d.ts
CHANGED
|
@@ -174,7 +174,9 @@ export interface GetPostsParams {
|
|
|
174
174
|
export interface CreateSlideshowParams {
|
|
175
175
|
accountId: string | null;
|
|
176
176
|
caption?: string;
|
|
177
|
+
/** @deprecated Use socialAudioId instead */
|
|
177
178
|
musicPostId?: string;
|
|
179
|
+
socialAudioId?: string;
|
|
178
180
|
postTime?: string;
|
|
179
181
|
imageUrls: string[];
|
|
180
182
|
strict?: boolean;
|
|
@@ -193,7 +195,9 @@ export interface GetPostStatusParams {
|
|
|
193
195
|
export interface CreateVideoParams {
|
|
194
196
|
accountId: string | null;
|
|
195
197
|
caption?: string;
|
|
198
|
+
/** @deprecated Use socialAudioId instead */
|
|
196
199
|
musicPostId?: string;
|
|
200
|
+
socialAudioId?: string;
|
|
197
201
|
postTime?: string;
|
|
198
202
|
videoUrl: string;
|
|
199
203
|
strict?: boolean;
|