@amityco/ts-sdk 0.0.1-beta.18 → 0.0.1-beta.19
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/@types/domains/comment.d.ts +1 -0
- package/dist/@types/domains/comment.d.ts.map +1 -1
- package/dist/channel/api/queryChannels.d.ts +2 -0
- package/dist/channel/api/queryChannels.d.ts.map +1 -1
- package/dist/external/api/createUserToken.d.ts +23 -0
- package/dist/external/api/createUserToken.d.ts.map +1 -0
- package/dist/external/api/index.d.ts +2 -0
- package/dist/external/api/index.d.ts.map +1 -0
- package/dist/file/api/createImage.d.ts +17 -0
- package/dist/file/api/createImage.d.ts.map +1 -0
- package/dist/file/api/index.d.ts +1 -0
- package/dist/file/api/index.d.ts.map +1 -1
- package/dist/index.cjs.js +65 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +64 -1
- package/dist/index.umd.js +5 -5
- package/dist/poll/api/createPoll.d.ts +3 -1
- package/dist/poll/api/createPoll.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/@types/domains/comment.ts +1 -0
- package/src/channel/api/queryChannels.ts +2 -0
- package/src/external/api/createUserToken.ts +43 -0
- package/src/external/api/index.ts +1 -0
- package/src/file/api/createImage.ts +58 -0
- package/src/file/api/index.ts +1 -0
- package/src/index.ts +3 -0
- package/src/poll/api/createPoll.ts +3 -1
|
@@ -11,6 +11,7 @@ declare global {
|
|
|
11
11
|
childrenNumber: number;
|
|
12
12
|
children: Comment['commentId'][];
|
|
13
13
|
segmentNumber: number;
|
|
14
|
+
editedAt: Amity.timestamp;
|
|
14
15
|
} & Amity.Relationship<CommentReferenceType> & Amity.Content<T> & Amity.Metadata & Amity.Flaggable & Amity.Reactable & Amity.Timestamps & Amity.SoftDelete & Amity.Subscribable & Amity.Mentionable<'user'>;
|
|
15
16
|
}
|
|
16
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"comment.d.ts","sourceRoot":"","sources":["../../../src/@types/domains/comment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC;AAEV,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,KAAK,CAAC;QACd,KAAK,kBAAkB,GAAG,MAAM,CAAC;QACjC,KAAK,oBAAoB,GAAG,SAAS,GAAG,MAAM,CAAC;QAE/C,KAAK,OAAO,CAAC,CAAC,SAAS,kBAAkB,GAAG,GAAG,IAAI;YACjD,SAAS,EAAE,MAAM,CAAC;YAClB,MAAM,EAAE,MAAM,CAAC;YACf,QAAQ,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;YAChC,MAAM,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;YAC7B,cAAc,EAAE,MAAM,CAAC;YACvB,QAAQ,EAAE,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;YACjC,aAAa,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"comment.d.ts","sourceRoot":"","sources":["../../../src/@types/domains/comment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC;AAEV,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,KAAK,CAAC;QACd,KAAK,kBAAkB,GAAG,MAAM,CAAC;QACjC,KAAK,oBAAoB,GAAG,SAAS,GAAG,MAAM,CAAC;QAE/C,KAAK,OAAO,CAAC,CAAC,SAAS,kBAAkB,GAAG,GAAG,IAAI;YACjD,SAAS,EAAE,MAAM,CAAC;YAClB,MAAM,EAAE,MAAM,CAAC;YACf,QAAQ,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;YAChC,MAAM,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;YAC7B,cAAc,EAAE,MAAM,CAAC;YACvB,QAAQ,EAAE,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;YACjC,aAAa,EAAE,MAAM,CAAC;YACtB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;SAC3B,GAAG,KAAK,CAAC,YAAY,CAAC,oBAAoB,CAAC,GAC1C,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,GAChB,KAAK,CAAC,QAAQ,GACd,KAAK,CAAC,SAAS,GACf,KAAK,CAAC,SAAS,GACf,KAAK,CAAC,UAAU,GAChB,KAAK,CAAC,UAAU,GAChB,KAAK,CAAC,YAAY,GAClB,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;KAC7B;CACF"}
|
|
@@ -19,6 +19,8 @@ export declare const queryChannels: {
|
|
|
19
19
|
membership?: "all" | "member" | "notMember" | undefined;
|
|
20
20
|
sortBy?: "displayName" | "firstCreated" | "lastCreated" | undefined;
|
|
21
21
|
types?: Amity.ChannelType | undefined;
|
|
22
|
+
tags?: Amity.Taggable['tags'];
|
|
23
|
+
excludeTags?: Amity.Taggable['tags'];
|
|
22
24
|
page?: Amity.Page | undefined;
|
|
23
25
|
} | undefined): Promise<Amity.Cached<Amity.Paged<Amity.Channel>>>;
|
|
24
26
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queryChannels.d.ts","sourceRoot":"","sources":["../../../src/channel/api/queryChannels.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"queryChannels.d.ts","sourceRoot":"","sources":["../../../src/channel/api/queryChannels.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,aAAa;;;;;;eAKjB,MAAM,QAAQ,CAAC,MAAM,CAAC;sBACf,MAAM,QAAQ,CAAC,MAAM,CAAC;;oBAElC,QAAQ,MAAM,MAAM,CAAC,MAAM,KAAK,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC;IA8CrD;;;;;;;;;;;;OAYG;mBAC6B,WAAW,oBAAoB,CAAC,CAAC,CAAC,CAAC;CAflE,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { API_REGIONS } from '~/client/utils/endpoints';
|
|
2
|
+
/**
|
|
3
|
+
* Retrieves accessToken info to use in Beta services
|
|
4
|
+
*
|
|
5
|
+
* @param apiKey for the Http Client instance
|
|
6
|
+
* @param apiRegion endpoint to connect to
|
|
7
|
+
* @param params The token parameters
|
|
8
|
+
* @param params.userId The userId to use to issue a token
|
|
9
|
+
* @param params.displayName The user's displayName
|
|
10
|
+
* @param params.authToken The authentication token - necessary when network option is set to secure
|
|
11
|
+
* @return An accessToken info object for the given userId
|
|
12
|
+
*
|
|
13
|
+
* @category External API
|
|
14
|
+
* @hidden
|
|
15
|
+
*/
|
|
16
|
+
export declare const createUserToken: (apiKey: string, apiRegion: typeof API_REGIONS[keyof typeof API_REGIONS], params: {
|
|
17
|
+
userId: Amity.User['userId'];
|
|
18
|
+
displayName?: Amity.User['displayName'];
|
|
19
|
+
authToken?: string;
|
|
20
|
+
}) => Promise<{
|
|
21
|
+
accessToken: string;
|
|
22
|
+
}>;
|
|
23
|
+
//# sourceMappingURL=createUserToken.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createUserToken.d.ts","sourceRoot":"","sources":["../../../src/external/api/createUserToken.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAc,MAAM,0BAA0B,CAAC;AAEnE;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,eAAe,WAClB,MAAM,aACH,kBAAkB,CAAC,MAAM,kBAAkB,CAAC,UAC/C;IACN,MAAM,EAAE,MAAM,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC,aAAa,CAAC,CAAC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;;EAiBF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/external/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ```js
|
|
3
|
+
* import { createImage } from '@amityco/ts-sdk'
|
|
4
|
+
* const created = await createImage(formData)
|
|
5
|
+
* ```
|
|
6
|
+
*
|
|
7
|
+
* Creates an {@link Amity.File<'image'>}
|
|
8
|
+
*
|
|
9
|
+
* @param formData The data necessary to create a new {@link Amity.File<'image'>}
|
|
10
|
+
* @param onProgress The callback to track the upload progress
|
|
11
|
+
* @returns The newly created {@link Amity.File<'image'>}
|
|
12
|
+
*
|
|
13
|
+
* @category File API
|
|
14
|
+
* @async
|
|
15
|
+
*/
|
|
16
|
+
export declare const createImage: (formData: FormData, onProgress?: ((percent: number) => void) | undefined) => Promise<Amity.Cached<Amity.File<'image'>[]>>;
|
|
17
|
+
//# sourceMappingURL=createImage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createImage.d.ts","sourceRoot":"","sources":["../../../src/file/api/createImage.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,WAAW,aACZ,QAAQ,0BACK,MAAM,KAAK,IAAI,kBACrC,QAAQ,MAAM,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC,CAiC7C,CAAC"}
|
package/dist/file/api/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/file/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/file/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -16179,6 +16179,47 @@ const createVideo = async (formData, onProgress) => {
|
|
|
16179
16179
|
};
|
|
16180
16180
|
// TODO: consider doing local creation with URL.createObjectURL()
|
|
16181
16181
|
|
|
16182
|
+
/**
|
|
16183
|
+
* ```js
|
|
16184
|
+
* import { createImage } from '@amityco/ts-sdk'
|
|
16185
|
+
* const created = await createImage(formData)
|
|
16186
|
+
* ```
|
|
16187
|
+
*
|
|
16188
|
+
* Creates an {@link Amity.File<'image'>}
|
|
16189
|
+
*
|
|
16190
|
+
* @param formData The data necessary to create a new {@link Amity.File<'image'>}
|
|
16191
|
+
* @param onProgress The callback to track the upload progress
|
|
16192
|
+
* @returns The newly created {@link Amity.File<'image'>}
|
|
16193
|
+
*
|
|
16194
|
+
* @category File API
|
|
16195
|
+
* @async
|
|
16196
|
+
*/
|
|
16197
|
+
const createImage = async (formData, onProgress) => {
|
|
16198
|
+
const client = getActiveClient();
|
|
16199
|
+
client.log('file/createImage', formData);
|
|
16200
|
+
if (!formData.getAll('files').length)
|
|
16201
|
+
throw new Error('The formData object must have a `files` key.');
|
|
16202
|
+
const headers = 'getHeaders' in formData
|
|
16203
|
+
? formData.getHeaders()
|
|
16204
|
+
: { 'content-type': 'multipart/form-data' };
|
|
16205
|
+
const { data } = await client.http.post('/api/v4/images', formData, {
|
|
16206
|
+
headers,
|
|
16207
|
+
onUploadProgress({ loaded, total }) {
|
|
16208
|
+
onProgress && onProgress(Math.round((loaded * 100) / total));
|
|
16209
|
+
},
|
|
16210
|
+
});
|
|
16211
|
+
// API-FIX: payload should be serialized properly
|
|
16212
|
+
// const { files } = data
|
|
16213
|
+
const cachedAt = client.cache && Date.now();
|
|
16214
|
+
if (client.cache)
|
|
16215
|
+
ingestInCache({ files: data }, { cachedAt });
|
|
16216
|
+
return {
|
|
16217
|
+
data,
|
|
16218
|
+
cachedAt,
|
|
16219
|
+
};
|
|
16220
|
+
};
|
|
16221
|
+
// TODO: consider doing local creation with URL.createObjectURL()
|
|
16222
|
+
|
|
16182
16223
|
/**
|
|
16183
16224
|
* ```js
|
|
16184
16225
|
* import { observeFile } from '@amityco/ts-sdk'
|
|
@@ -21172,6 +21213,28 @@ const onStreamRecorded = (callback) => {
|
|
|
21172
21213
|
return createEventSubscriber(client, 'stream/onStreamRecorded', 'video-streaming.didRecord', filter);
|
|
21173
21214
|
};
|
|
21174
21215
|
|
|
21216
|
+
/**
|
|
21217
|
+
* Retrieves accessToken info to use in Beta services
|
|
21218
|
+
*
|
|
21219
|
+
* @param apiKey for the Http Client instance
|
|
21220
|
+
* @param apiRegion endpoint to connect to
|
|
21221
|
+
* @param params The token parameters
|
|
21222
|
+
* @param params.userId The userId to use to issue a token
|
|
21223
|
+
* @param params.displayName The user's displayName
|
|
21224
|
+
* @param params.authToken The authentication token - necessary when network option is set to secure
|
|
21225
|
+
* @return An accessToken info object for the given userId
|
|
21226
|
+
*
|
|
21227
|
+
* @category External API
|
|
21228
|
+
* @hidden
|
|
21229
|
+
*/
|
|
21230
|
+
const createUserToken = async (apiKey, apiRegion, params) => {
|
|
21231
|
+
const deviceId = getDeviceId();
|
|
21232
|
+
const deviceInfo = await getDeviceInfo();
|
|
21233
|
+
const http = createHttpTransport(computeUrl('http', apiRegion));
|
|
21234
|
+
const { data } = await http.post('/api/v3/sessions', Object.assign(Object.assign({}, params), { deviceId, deviceInfo: Object.assign(Object.assign({}, deviceInfo), { model: 'token management API on TS-SDK' }) }), { headers: { 'X-API-Key': apiKey } });
|
|
21235
|
+
return { accessToken: data.accessToken };
|
|
21236
|
+
};
|
|
21237
|
+
|
|
21175
21238
|
exports.API_REGIONS = API_REGIONS;
|
|
21176
21239
|
exports.VERSION = VERSION$1;
|
|
21177
21240
|
exports.acceptFollower = acceptFollower;
|
|
@@ -21188,12 +21251,14 @@ exports.createClient = createClient;
|
|
|
21188
21251
|
exports.createComment = createComment;
|
|
21189
21252
|
exports.createCommunity = createCommunity;
|
|
21190
21253
|
exports.createFile = createFile;
|
|
21254
|
+
exports.createImage = createImage;
|
|
21191
21255
|
exports.createMessage = createMessage;
|
|
21192
21256
|
exports.createPoll = createPoll;
|
|
21193
21257
|
exports.createPost = createPost;
|
|
21194
21258
|
exports.createQuery = createQuery;
|
|
21195
21259
|
exports.createReport = createReport;
|
|
21196
21260
|
exports.createStream = createStream;
|
|
21261
|
+
exports.createUserToken = createUserToken;
|
|
21197
21262
|
exports.createVideo = createVideo;
|
|
21198
21263
|
exports.declineFollower = declineFollower;
|
|
21199
21264
|
exports.deleteChannel = deleteChannel;
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,UAAU,CAAC;AAElB,cAAc,WAAW,CAAC;AAG1B,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAE5B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AAEjC,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AAEjC,cAAc,YAAY,CAAC;AAG3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAElC,cAAc,cAAc,CAAC;AAG7B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AAEpC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AAGpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AAEtC,cAAc,gBAAgB,CAAC;AAE/B,cAAc,YAAY,CAAC;AAE3B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AAEnC,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AAEjC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AAEpC,cAAc,YAAY,CAAC;AAE3B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,UAAU,CAAC;AAElB,cAAc,WAAW,CAAC;AAG1B,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAE5B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AAEjC,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AAEjC,cAAc,YAAY,CAAC;AAG3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAElC,cAAc,cAAc,CAAC;AAG7B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AAEpC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AAGpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AAEtC,cAAc,gBAAgB,CAAC;AAE/B,cAAc,YAAY,CAAC;AAE3B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AAEnC,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AAEjC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AAEpC,cAAc,YAAY,CAAC;AAE3B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAGhC,cAAc,gBAAgB,CAAC"}
|
package/dist/index.esm.js
CHANGED
|
@@ -16166,6 +16166,47 @@ const createVideo = async (formData, onProgress) => {
|
|
|
16166
16166
|
};
|
|
16167
16167
|
// TODO: consider doing local creation with URL.createObjectURL()
|
|
16168
16168
|
|
|
16169
|
+
/**
|
|
16170
|
+
* ```js
|
|
16171
|
+
* import { createImage } from '@amityco/ts-sdk'
|
|
16172
|
+
* const created = await createImage(formData)
|
|
16173
|
+
* ```
|
|
16174
|
+
*
|
|
16175
|
+
* Creates an {@link Amity.File<'image'>}
|
|
16176
|
+
*
|
|
16177
|
+
* @param formData The data necessary to create a new {@link Amity.File<'image'>}
|
|
16178
|
+
* @param onProgress The callback to track the upload progress
|
|
16179
|
+
* @returns The newly created {@link Amity.File<'image'>}
|
|
16180
|
+
*
|
|
16181
|
+
* @category File API
|
|
16182
|
+
* @async
|
|
16183
|
+
*/
|
|
16184
|
+
const createImage = async (formData, onProgress) => {
|
|
16185
|
+
const client = getActiveClient();
|
|
16186
|
+
client.log('file/createImage', formData);
|
|
16187
|
+
if (!formData.getAll('files').length)
|
|
16188
|
+
throw new Error('The formData object must have a `files` key.');
|
|
16189
|
+
const headers = 'getHeaders' in formData
|
|
16190
|
+
? formData.getHeaders()
|
|
16191
|
+
: { 'content-type': 'multipart/form-data' };
|
|
16192
|
+
const { data } = await client.http.post('/api/v4/images', formData, {
|
|
16193
|
+
headers,
|
|
16194
|
+
onUploadProgress({ loaded, total }) {
|
|
16195
|
+
onProgress && onProgress(Math.round((loaded * 100) / total));
|
|
16196
|
+
},
|
|
16197
|
+
});
|
|
16198
|
+
// API-FIX: payload should be serialized properly
|
|
16199
|
+
// const { files } = data
|
|
16200
|
+
const cachedAt = client.cache && Date.now();
|
|
16201
|
+
if (client.cache)
|
|
16202
|
+
ingestInCache({ files: data }, { cachedAt });
|
|
16203
|
+
return {
|
|
16204
|
+
data,
|
|
16205
|
+
cachedAt,
|
|
16206
|
+
};
|
|
16207
|
+
};
|
|
16208
|
+
// TODO: consider doing local creation with URL.createObjectURL()
|
|
16209
|
+
|
|
16169
16210
|
/**
|
|
16170
16211
|
* ```js
|
|
16171
16212
|
* import { observeFile } from '@amityco/ts-sdk'
|
|
@@ -21159,4 +21200,26 @@ const onStreamRecorded = (callback) => {
|
|
|
21159
21200
|
return createEventSubscriber(client, 'stream/onStreamRecorded', 'video-streaming.didRecord', filter);
|
|
21160
21201
|
};
|
|
21161
21202
|
|
|
21162
|
-
|
|
21203
|
+
/**
|
|
21204
|
+
* Retrieves accessToken info to use in Beta services
|
|
21205
|
+
*
|
|
21206
|
+
* @param apiKey for the Http Client instance
|
|
21207
|
+
* @param apiRegion endpoint to connect to
|
|
21208
|
+
* @param params The token parameters
|
|
21209
|
+
* @param params.userId The userId to use to issue a token
|
|
21210
|
+
* @param params.displayName The user's displayName
|
|
21211
|
+
* @param params.authToken The authentication token - necessary when network option is set to secure
|
|
21212
|
+
* @return An accessToken info object for the given userId
|
|
21213
|
+
*
|
|
21214
|
+
* @category External API
|
|
21215
|
+
* @hidden
|
|
21216
|
+
*/
|
|
21217
|
+
const createUserToken = async (apiKey, apiRegion, params) => {
|
|
21218
|
+
const deviceId = getDeviceId();
|
|
21219
|
+
const deviceInfo = await getDeviceInfo();
|
|
21220
|
+
const http = createHttpTransport(computeUrl('http', apiRegion));
|
|
21221
|
+
const { data } = await http.post('/api/v3/sessions', Object.assign(Object.assign({}, params), { deviceId, deviceInfo: Object.assign(Object.assign({}, deviceInfo), { model: 'token management API on TS-SDK' }) }), { headers: { 'X-API-Key': apiKey } });
|
|
21222
|
+
return { accessToken: data.accessToken };
|
|
21223
|
+
};
|
|
21224
|
+
|
|
21225
|
+
export { API_REGIONS, SubscriptionLevels, VERSION$1 as VERSION, acceptFollower, addChannelMembers, addChannelMembersRole, addCommunityMembers, addCommunityMembersRoles, addReaction, backupCache, closePoll, connectClient, createChannel, createClient, createComment, createCommunity, createFile, createImage, createMessage, createPoll, createPost, createQuery, createReport, createStream, createUserToken, createVideo, declineFollower, deleteChannel, deleteComment, deleteCommunity, deleteFile, deleteMessage, deletePoll, deletePost, deleteReport, deleteStream, disableCache, disconnectClient, disposeStream, dropFromCache, enableCache, fileUrlWithSize, filterByPropEquality, follow, getActiveClient, getCategory, getChannel, getChannels, getComment, getCommentTopic, getComments, getCommunities, getCommunity, getCommunityTopic, getFile, getFollowInfo, getMessage, getMessages, getMyFollowersTopic, getMyFollowingsTopic, getPoll, getPost, getPostTopic, getPosts, getRecommendedCommunities, getRole, getStream, getTopTrendingCommunities, getUser, getUserTopic, getUsers, isAfterBefore, isAfterBeforeRaw, isCachable, isConnected, isFetcher, isFresh, isLocal, isMutator, isOffline, isPaged, isReportedByMe, isSkipLimit, joinChannel, joinCommunity, leaveChannel, leaveCommunity, mergeInCache, observeChannel, observeComment, observeComments, observeCommunity, observeFile, observeFollowInfo, observeFollowers, observeFollowings, observeMessage, observeMessages, observePost, observePosts, observeUser, onChannelDeleted, onChannelJoined, onChannelLeft, onChannelUpdated, onClientBanned, onClientDisconnected, onCommentCreated, onCommentDeleted, onCommentFlagged, onCommentReactionAdded, onCommentReactionRemoved, onCommentUnflagged, onCommentUpdated, onCommunityCreated, onCommunityDeleted, onCommunityJoined, onCommunityLeft, onCommunityUpdated, onCommunityUserAdded, onCommunityUserBanned, onCommunityUserRemoved, onCommunityUserUnbanned, onConnectionError, onFollowInfoUpdated, onFollowRequestAccepted, onFollowRequestCanceled, onFollowRequestDeclined, onFollowerDeleted, onFollowerRequested, onMemberAdded, onMemberRemoved, onMessageCreated, onMessageDeleted, onMessageUpdated, onPostApproved, onPostCreated, onPostDeclined, onPostDeleted, onPostFlagged, onPostReactionAdded, onPostReactionRemoved, onPostUnflagged, onPostUpdated, onReactionRemoved, onStreamRecorded, onStreamStarted, onStreamStopped, onUserFlagCleared, onUserFlagged, onUserFollowed, onUserUnflagged, onUserUnfollowed, onUserUpdated, pullFromCache, pushToCache, queryCache, queryCategories, queryChannelMembers, queryChannels, queryComments, queryCommunities, queryCommunityMembers, queryFollowers, queryFollowings, queryGlobalFeed, queryMessages, queryOptions, queryPosts, queryRoles, queryStreams, queryUsers, removeChannelMembers, removeChannelMembersRole, removeCommunityMembers, removeCommunityMembersRoles, removeReaction, restoreCache, runQuery, sortByChannelSegment, sortByDisplayName, sortByFirstCreated, sortByLastActivity, sortByLastCreated, sortBySegmentNumber, subscribeTopic, toPage, toPageRaw, toToken, unfollow, updateChannel, updateComment, updateCommunity, updateMessage, updatePost, updateStream, updateUser, upsertInCache, votePoll, wipeCache };
|