@xpoz/xpoz 0.6.8 → 0.6.10
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/README.md +128 -4
- package/dist/index.cjs +22 -1
- package/dist/index.d.cts +41 -2
- package/dist/index.d.ts +41 -2
- package/dist/index.js +22 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ The SDK wraps Xpoz's [MCP](https://modelcontextprotocol.io) server, abstracting
|
|
|
30
30
|
|
|
31
31
|
## Features
|
|
32
32
|
|
|
33
|
-
- **
|
|
33
|
+
- **42 data methods** across Twitter, Instagram, Reddit, and TikTok
|
|
34
34
|
- **Fully async** — all methods return `Promise<T>`
|
|
35
35
|
- **Automatic operation polling** — long-running queries are abstracted away
|
|
36
36
|
- **Response types** — choose between fast (immediate), paging (full pagination), or CSV export
|
|
@@ -84,10 +84,14 @@ const client = new XpozClient({ apiKey: "your-api-key", timeoutMs: 600_000 });
|
|
|
84
84
|
Want to try the SDK before signing up? Mint a free trial token (no account needed, valid for 5 days):
|
|
85
85
|
|
|
86
86
|
```bash
|
|
87
|
-
curl -X POST https://api.xpoz.ai/api/trial/token
|
|
87
|
+
curl -X POST https://api.xpoz.ai/api/trial/token \
|
|
88
|
+
-H "Content-Type: application/json" \
|
|
89
|
+
-d '{"source": "sdk"}'
|
|
88
90
|
# -> { "success": true, "data": { "accessKey": "TRIAL...", "expiresInSeconds": 432000 }, ... }
|
|
89
91
|
```
|
|
90
92
|
|
|
93
|
+
The `source` field is required — it identifies where the trial token request came from (e.g. `skills`, a specific page, `sdk`, `cli`).
|
|
94
|
+
|
|
91
95
|
Then use the returned token (it starts with `TRIAL`) as your API key:
|
|
92
96
|
|
|
93
97
|
```typescript
|
|
@@ -229,12 +233,12 @@ The following methods accept both `responseType` and `limit`:
|
|
|
229
233
|
- `twitter.getPostsByAuthor()`, `twitter.searchPosts()`, `twitter.getUsersByKeywords()`
|
|
230
234
|
- `instagram.getPostsByUser()`, `instagram.searchPosts()`, `instagram.getUsersByKeywords()`
|
|
231
235
|
- `reddit.searchPosts()`
|
|
232
|
-
- `tiktok.getPostsByUser()`, `tiktok.searchPosts()`, `tiktok.getUsersByKeywords()`, `tiktok.getPostsByHashtags()`, `tiktok.getUsersByHashtags()`
|
|
236
|
+
- `tiktok.getPostsByUser()`, `tiktok.searchPosts()`, `tiktok.getUsersByKeywords()`, `tiktok.getPostsByHashtags()`, `tiktok.getUsersByHashtags()`, `tiktok.getPostsBySound()`
|
|
233
237
|
|
|
234
238
|
These methods accept `limit` only:
|
|
235
239
|
|
|
236
240
|
- `twitter.searchUsers()`, `instagram.searchUsers()`, `reddit.searchUsers()`, `reddit.searchSubreddits()`
|
|
237
|
-
- `tiktok.searchUsers()`
|
|
241
|
+
- `tiktok.searchUsers()`, `tiktok.searchSounds()`
|
|
238
242
|
|
|
239
243
|
## Query Syntax
|
|
240
244
|
|
|
@@ -691,6 +695,26 @@ const users = await client.tiktok.getUsersByHashtags(["sustainable_fashion"], {
|
|
|
691
695
|
});
|
|
692
696
|
```
|
|
693
697
|
|
|
698
|
+
#### `searchSounds(keyword, options?) -> Promise<TiktokSound[]>`
|
|
699
|
+
|
|
700
|
+
Search sound/music objects by keyword (title or artist). Pass the returned `id` to `getPostsBySound`.
|
|
701
|
+
|
|
702
|
+
```typescript
|
|
703
|
+
const sounds = await client.tiktok.searchSounds("dance monkey");
|
|
704
|
+
const soundId = sounds[0].id;
|
|
705
|
+
```
|
|
706
|
+
|
|
707
|
+
#### `getPostsBySound(soundId, options?) -> Promise<PaginatedResult<TiktokPost>>`
|
|
708
|
+
|
|
709
|
+
Find posts that use a specific sound via the indexed `music_id` column. Pass a single numeric `soundId` from `searchSounds`.
|
|
710
|
+
|
|
711
|
+
```typescript
|
|
712
|
+
const results = await client.tiktok.getPostsBySound("7016548364456789012", {
|
|
713
|
+
responseType: ResponseType.Fast,
|
|
714
|
+
limit: 50,
|
|
715
|
+
});
|
|
716
|
+
```
|
|
717
|
+
|
|
694
718
|
#### `getComments(postId, options?) -> Promise<PaginatedResult<TiktokComment>>`
|
|
695
719
|
|
|
696
720
|
```typescript
|
|
@@ -743,6 +767,32 @@ console.log(`Removed ${result.removedCount} items`);
|
|
|
743
767
|
|
|
744
768
|
---
|
|
745
769
|
|
|
770
|
+
### Account — `client.account`
|
|
771
|
+
|
|
772
|
+
Read-only account, plan, and usage information for the authenticated user.
|
|
773
|
+
|
|
774
|
+
#### `getAccountDetails() -> Promise<AccountDetails>`
|
|
775
|
+
|
|
776
|
+
Returns the plan (name + feature limits), billing (period + next renewal; `billing` is `null` on the Free plan), and current usage (remaining subscription/extra credits, extra tracked items).
|
|
777
|
+
|
|
778
|
+
```typescript
|
|
779
|
+
const details = await client.account.getAccountDetails();
|
|
780
|
+
console.log(details.plan.name, details.usage.subscriptionCreditsRemaining);
|
|
781
|
+
```
|
|
782
|
+
|
|
783
|
+
#### `getCreditsUsageHistory(range?, granularity?) -> Promise<CreditsUsageHistory>`
|
|
784
|
+
|
|
785
|
+
Returns time-series usage for credits and export rows. `range` is one of `"today"`, `"7d"`, `"current_month"` (default), `"lifetime"`; `granularity` is `"hour"` or `"day"` (default). For current remaining balances, use `getAccountDetails()`.
|
|
786
|
+
|
|
787
|
+
```typescript
|
|
788
|
+
const history = await client.account.getCreditsUsageHistory("7d", "day");
|
|
789
|
+
for (const bucket of history.credits) {
|
|
790
|
+
console.log(bucket.bucket, bucket.totalUsed);
|
|
791
|
+
}
|
|
792
|
+
```
|
|
793
|
+
|
|
794
|
+
---
|
|
795
|
+
|
|
746
796
|
## Type Models
|
|
747
797
|
|
|
748
798
|
All fields are optional and typed as their respective TypeScript types. Unknown fields are preserved on the object.
|
|
@@ -962,6 +1012,80 @@ All fields are optional and typed as their respective TypeScript types. Unknown
|
|
|
962
1012
|
| `createdAt` | `string` | Creation timestamp |
|
|
963
1013
|
| `createdAtDate` | `string` | Creation date (YYYY-MM-DD) |
|
|
964
1014
|
|
|
1015
|
+
### TiktokSound
|
|
1016
|
+
|
|
1017
|
+
| Field | Type | Description |
|
|
1018
|
+
| ------------------ | --------- | --------------------------------- |
|
|
1019
|
+
| `id` | `string` | Sound/music ID |
|
|
1020
|
+
| `title` | `string` | Sound title |
|
|
1021
|
+
| `author` | `string` | Sound artist/author |
|
|
1022
|
+
| `album` | `string` | Album name |
|
|
1023
|
+
| `duration` | `number` | Duration in seconds |
|
|
1024
|
+
| `userCount` | `number` | Number of posts using the sound |
|
|
1025
|
+
| `isOriginal` | `boolean` | Whether the sound is original |
|
|
1026
|
+
| `isCommerceMusic` | `boolean` | Whether the sound is commercial |
|
|
1027
|
+
| `isOriginalSound` | `boolean` | Whether it is an original sound |
|
|
1028
|
+
|
|
1029
|
+
### AccountDetails
|
|
1030
|
+
|
|
1031
|
+
Returned by `getAccountDetails()`.
|
|
1032
|
+
|
|
1033
|
+
| Field | Type | Description |
|
|
1034
|
+
| --------- | ------------------------------------- | ------------------------------------ |
|
|
1035
|
+
| `plan` | `{ name: string; features: PlanFeatures }` | Plan name and feature limits |
|
|
1036
|
+
| `billing` | `AccountBilling \| null` | Billing info (`null` on Free plan) |
|
|
1037
|
+
| `usage` | `AccountUsage` | Current usage balances |
|
|
1038
|
+
|
|
1039
|
+
### PlanFeatures
|
|
1040
|
+
|
|
1041
|
+
| Field | Type | Description |
|
|
1042
|
+
| ------------------------ | ---------------------- | ------------------------------- |
|
|
1043
|
+
| `credits` | `number` | Subscription credits per period |
|
|
1044
|
+
| `creditResetFrequency` | `CreditResetFrequency` | `"monthly"` or `"never"` |
|
|
1045
|
+
| `extraCreditPrice` | `number` | Price per extra credit |
|
|
1046
|
+
| `trackedItems` | `number` | Tracked-item allowance |
|
|
1047
|
+
| `csvRowExportLimit` | `number` | CSV row export limit |
|
|
1048
|
+
| `extraCsvRowPrice` | `number` | Price per extra CSV row |
|
|
1049
|
+
| `extraTrackedItemPrice` | `number` | Price per extra tracked item |
|
|
1050
|
+
| `maxRowsPerExport` | `number` | Max rows per single export |
|
|
1051
|
+
|
|
1052
|
+
### AccountBilling
|
|
1053
|
+
|
|
1054
|
+
| Field | Type | Description |
|
|
1055
|
+
| ----------------- | --------------- | ------------------------- |
|
|
1056
|
+
| `billingPeriod` | `BillingPeriod` | `"monthly"` or `"annual"` |
|
|
1057
|
+
| `nextRenewalDate` | `string \| null` | Next renewal date |
|
|
1058
|
+
|
|
1059
|
+
### AccountUsage
|
|
1060
|
+
|
|
1061
|
+
| Field | Type | Description |
|
|
1062
|
+
| ------------------------------ | -------- | ------------------------------ |
|
|
1063
|
+
| `subscriptionCreditsRemaining` | `number` | Subscription credits remaining |
|
|
1064
|
+
| `extraCreditsRemaining` | `number` | Extra credits remaining |
|
|
1065
|
+
| `extraTrackedItems` | `number` | Extra tracked items purchased |
|
|
1066
|
+
|
|
1067
|
+
### CreditsUsageHistory
|
|
1068
|
+
|
|
1069
|
+
Returned by `getCreditsUsageHistory()`.
|
|
1070
|
+
|
|
1071
|
+
| Field | Type | Description |
|
|
1072
|
+
| ------------- | ---------------------- | ----------------------------------- |
|
|
1073
|
+
| `range` | `string` | Requested range |
|
|
1074
|
+
| `granularity` | `string` | Requested granularity |
|
|
1075
|
+
| `generatedAt` | `string` | Timestamp the report was generated |
|
|
1076
|
+
| `credits` | `UsageHistoryBucket[]` | Credit usage buckets over time |
|
|
1077
|
+
| `exportRows` | `UsageHistoryBucket[]` | Export-rows usage buckets over time |
|
|
1078
|
+
|
|
1079
|
+
### UsageHistoryBucket
|
|
1080
|
+
|
|
1081
|
+
| Field | Type | Description |
|
|
1082
|
+
| ------------------ | -------- | ------------------------------------- |
|
|
1083
|
+
| `bucket` | `string` | Bucket timestamp (hour or day) |
|
|
1084
|
+
| `subscriptionUsed` | `number` | Subscription units used in the bucket |
|
|
1085
|
+
| `extraUsed` | `number` | Extra units used in the bucket |
|
|
1086
|
+
| `totalUsed` | `number` | Total units used in the bucket |
|
|
1087
|
+
| `extraPurchased` | `number` | Extra units purchased in the bucket |
|
|
1088
|
+
|
|
965
1089
|
### TrackedItem
|
|
966
1090
|
|
|
967
1091
|
| Field | Type | Description |
|
package/dist/index.cjs
CHANGED
|
@@ -298,7 +298,7 @@ function coerce(value) {
|
|
|
298
298
|
}
|
|
299
299
|
|
|
300
300
|
// src/version.ts
|
|
301
|
-
var VERSION = "0.6.
|
|
301
|
+
var VERSION = "0.6.10";
|
|
302
302
|
|
|
303
303
|
// src/mcp/transport.ts
|
|
304
304
|
var USER_AGENT = `xpoz-ts-sdk/${VERSION}`;
|
|
@@ -637,10 +637,13 @@ var GET_TIKTOK_USER = "getTiktokUser";
|
|
|
637
637
|
var SEARCH_TIKTOK_USERS = "searchTiktokUsers";
|
|
638
638
|
var GET_TIKTOK_USERS_BY_KEYWORDS = "getTiktokUsersByKeywords";
|
|
639
639
|
var GET_TIKTOK_USERS_BY_HASHTAGS = "getTiktokUsersByHashtags";
|
|
640
|
+
var SEARCH_TIKTOK_SOUNDS = "searchTiktokSounds";
|
|
641
|
+
var GET_TIKTOK_POSTS_BY_SOUND = "getTiktokPostsBySound";
|
|
640
642
|
var GET_TRACKED_ITEMS = "getTrackedItems";
|
|
641
643
|
var ADD_TRACKED_ITEMS = "addTrackedItems";
|
|
642
644
|
var REMOVE_TRACKED_ITEMS = "removeTrackedItems";
|
|
643
645
|
var GET_ACCOUNT_DETAILS = "getAccountDetails";
|
|
646
|
+
var GET_CREDITS_USAGE_HISTORY = "getCreditsUsageHistory";
|
|
644
647
|
|
|
645
648
|
// src/namespaces/twitter.ts
|
|
646
649
|
function parseTwitterPost(item) {
|
|
@@ -1063,6 +1066,9 @@ function parseUser4(item) {
|
|
|
1063
1066
|
function parseComment3(item) {
|
|
1064
1067
|
return item;
|
|
1065
1068
|
}
|
|
1069
|
+
function parseSound(item) {
|
|
1070
|
+
return item;
|
|
1071
|
+
}
|
|
1066
1072
|
var TiktokNamespace = class extends BaseNamespace {
|
|
1067
1073
|
async getPostsByIds(postIds, options = {}) {
|
|
1068
1074
|
const args = this.buildArgs({ postIds, ...options });
|
|
@@ -1155,6 +1161,16 @@ var TiktokNamespace = class extends BaseNamespace {
|
|
|
1155
1161
|
args
|
|
1156
1162
|
);
|
|
1157
1163
|
}
|
|
1164
|
+
async searchSounds(keyword, options = {}) {
|
|
1165
|
+
const args = this.buildArgs({ keyword, ...options });
|
|
1166
|
+
const result = await this.callAndMaybePoll(SEARCH_TIKTOK_SOUNDS, args);
|
|
1167
|
+
return (result["results"] ?? []).map(parseSound);
|
|
1168
|
+
}
|
|
1169
|
+
async getPostsBySound(soundId, options = {}) {
|
|
1170
|
+
const args = this.buildArgs({ soundId, ...options });
|
|
1171
|
+
const result = await this.callAndMaybePoll(GET_TIKTOK_POSTS_BY_SOUND, args);
|
|
1172
|
+
return this.buildPaginatedResult(result, parsePost3, GET_TIKTOK_POSTS_BY_SOUND, args);
|
|
1173
|
+
}
|
|
1158
1174
|
};
|
|
1159
1175
|
|
|
1160
1176
|
// src/namespaces/tracking.ts
|
|
@@ -1181,6 +1197,11 @@ var AccountNamespace = class extends BaseNamespace {
|
|
|
1181
1197
|
const result = await this.callTool(GET_ACCOUNT_DETAILS, {});
|
|
1182
1198
|
return result["data"];
|
|
1183
1199
|
}
|
|
1200
|
+
async getCreditsUsageHistory(range, granularity) {
|
|
1201
|
+
const args = this.buildArgs({ range, granularity });
|
|
1202
|
+
const result = await this.callTool(GET_CREDITS_USAGE_HISTORY, args);
|
|
1203
|
+
return result["data"];
|
|
1204
|
+
}
|
|
1184
1205
|
};
|
|
1185
1206
|
|
|
1186
1207
|
// src/versionCheck.ts
|
package/dist/index.d.cts
CHANGED
|
@@ -593,6 +593,18 @@ interface TiktokComment {
|
|
|
593
593
|
createdAtDate?: string | null;
|
|
594
594
|
[key: string]: unknown;
|
|
595
595
|
}
|
|
596
|
+
interface TiktokSound {
|
|
597
|
+
id?: string | null;
|
|
598
|
+
title?: string | null;
|
|
599
|
+
author?: string | null;
|
|
600
|
+
album?: string | null;
|
|
601
|
+
duration?: number | null;
|
|
602
|
+
userCount?: number | null;
|
|
603
|
+
isOriginal?: boolean | null;
|
|
604
|
+
isCommerceMusic?: boolean | null;
|
|
605
|
+
isOriginalSound?: boolean | null;
|
|
606
|
+
[key: string]: unknown;
|
|
607
|
+
}
|
|
596
608
|
|
|
597
609
|
declare class TiktokNamespace extends BaseNamespace {
|
|
598
610
|
getPostsByIds(postIds: string[], options?: {
|
|
@@ -655,6 +667,18 @@ declare class TiktokNamespace extends BaseNamespace {
|
|
|
655
667
|
responseType?: ResponseType;
|
|
656
668
|
limit?: number;
|
|
657
669
|
}): Promise<PaginatedResult<TiktokUser>>;
|
|
670
|
+
searchSounds(keyword: string, options?: {
|
|
671
|
+
limit?: number;
|
|
672
|
+
fields?: string[];
|
|
673
|
+
}): Promise<TiktokSound[]>;
|
|
674
|
+
getPostsBySound(soundId: string, options?: {
|
|
675
|
+
fields?: string[];
|
|
676
|
+
startDate?: string;
|
|
677
|
+
endDate?: string;
|
|
678
|
+
forceLatest?: boolean;
|
|
679
|
+
responseType?: ResponseType;
|
|
680
|
+
limit?: number;
|
|
681
|
+
}): Promise<PaginatedResult<TiktokPost>>;
|
|
658
682
|
}
|
|
659
683
|
|
|
660
684
|
declare enum TrackedItemType {
|
|
@@ -729,9 +753,24 @@ interface AccountDetails {
|
|
|
729
753
|
billing: AccountBilling | null;
|
|
730
754
|
usage: AccountUsage;
|
|
731
755
|
}
|
|
756
|
+
interface UsageHistoryBucket {
|
|
757
|
+
bucket: string;
|
|
758
|
+
subscriptionUsed: number;
|
|
759
|
+
extraUsed: number;
|
|
760
|
+
totalUsed: number;
|
|
761
|
+
extraPurchased: number;
|
|
762
|
+
}
|
|
763
|
+
interface CreditsUsageHistory {
|
|
764
|
+
range: string;
|
|
765
|
+
granularity: string;
|
|
766
|
+
generatedAt: string;
|
|
767
|
+
credits: UsageHistoryBucket[];
|
|
768
|
+
exportRows: UsageHistoryBucket[];
|
|
769
|
+
}
|
|
732
770
|
|
|
733
771
|
declare class AccountNamespace extends BaseNamespace {
|
|
734
772
|
getAccountDetails(): Promise<AccountDetails>;
|
|
773
|
+
getCreditsUsageHistory(range?: string, granularity?: string): Promise<CreditsUsageHistory>;
|
|
735
774
|
}
|
|
736
775
|
|
|
737
776
|
declare class XpozClient {
|
|
@@ -778,8 +817,8 @@ declare class OperationCancelledError extends XpozError {
|
|
|
778
817
|
constructor(operationId: string);
|
|
779
818
|
}
|
|
780
819
|
|
|
781
|
-
declare const VERSION = "0.6.
|
|
820
|
+
declare const VERSION = "0.6.10";
|
|
782
821
|
|
|
783
822
|
declare function checkForUpdates(): Promise<void>;
|
|
784
823
|
|
|
785
|
-
export { type AccountBilling, type AccountDetails, type AccountUsage, type AddTrackedItemsResult, AuthenticationError, BillingPeriod, CreditResetFrequency, type InstagramComment, type InstagramPost, type InstagramUser, OperationCancelledError, OperationFailedError, OperationTimeoutError, PaginatedResult, type PaginationInfo, type PlanFeatures, type RedditComment, type RedditPost, type RedditPostWithComments, type RedditSubreddit, type RedditUser, type RemoveTrackedItemsResult, ResponseType, type SubredditWithPosts, type TiktokComment, type TiktokPost, type TiktokUser, type TrackedItem, TrackedItemPlatform, TrackedItemType, type TwitterPost, type TwitterUser, VERSION, XpozClient, XpozConnectionError, XpozError, checkForUpdates };
|
|
824
|
+
export { type AccountBilling, type AccountDetails, type AccountUsage, type AddTrackedItemsResult, AuthenticationError, BillingPeriod, CreditResetFrequency, type CreditsUsageHistory, type InstagramComment, type InstagramPost, type InstagramUser, OperationCancelledError, OperationFailedError, OperationTimeoutError, PaginatedResult, type PaginationInfo, type PlanFeatures, type RedditComment, type RedditPost, type RedditPostWithComments, type RedditSubreddit, type RedditUser, type RemoveTrackedItemsResult, ResponseType, type SubredditWithPosts, type TiktokComment, type TiktokPost, type TiktokUser, type TrackedItem, TrackedItemPlatform, TrackedItemType, type TwitterPost, type TwitterUser, type UsageHistoryBucket, VERSION, XpozClient, XpozConnectionError, XpozError, checkForUpdates };
|
package/dist/index.d.ts
CHANGED
|
@@ -593,6 +593,18 @@ interface TiktokComment {
|
|
|
593
593
|
createdAtDate?: string | null;
|
|
594
594
|
[key: string]: unknown;
|
|
595
595
|
}
|
|
596
|
+
interface TiktokSound {
|
|
597
|
+
id?: string | null;
|
|
598
|
+
title?: string | null;
|
|
599
|
+
author?: string | null;
|
|
600
|
+
album?: string | null;
|
|
601
|
+
duration?: number | null;
|
|
602
|
+
userCount?: number | null;
|
|
603
|
+
isOriginal?: boolean | null;
|
|
604
|
+
isCommerceMusic?: boolean | null;
|
|
605
|
+
isOriginalSound?: boolean | null;
|
|
606
|
+
[key: string]: unknown;
|
|
607
|
+
}
|
|
596
608
|
|
|
597
609
|
declare class TiktokNamespace extends BaseNamespace {
|
|
598
610
|
getPostsByIds(postIds: string[], options?: {
|
|
@@ -655,6 +667,18 @@ declare class TiktokNamespace extends BaseNamespace {
|
|
|
655
667
|
responseType?: ResponseType;
|
|
656
668
|
limit?: number;
|
|
657
669
|
}): Promise<PaginatedResult<TiktokUser>>;
|
|
670
|
+
searchSounds(keyword: string, options?: {
|
|
671
|
+
limit?: number;
|
|
672
|
+
fields?: string[];
|
|
673
|
+
}): Promise<TiktokSound[]>;
|
|
674
|
+
getPostsBySound(soundId: string, options?: {
|
|
675
|
+
fields?: string[];
|
|
676
|
+
startDate?: string;
|
|
677
|
+
endDate?: string;
|
|
678
|
+
forceLatest?: boolean;
|
|
679
|
+
responseType?: ResponseType;
|
|
680
|
+
limit?: number;
|
|
681
|
+
}): Promise<PaginatedResult<TiktokPost>>;
|
|
658
682
|
}
|
|
659
683
|
|
|
660
684
|
declare enum TrackedItemType {
|
|
@@ -729,9 +753,24 @@ interface AccountDetails {
|
|
|
729
753
|
billing: AccountBilling | null;
|
|
730
754
|
usage: AccountUsage;
|
|
731
755
|
}
|
|
756
|
+
interface UsageHistoryBucket {
|
|
757
|
+
bucket: string;
|
|
758
|
+
subscriptionUsed: number;
|
|
759
|
+
extraUsed: number;
|
|
760
|
+
totalUsed: number;
|
|
761
|
+
extraPurchased: number;
|
|
762
|
+
}
|
|
763
|
+
interface CreditsUsageHistory {
|
|
764
|
+
range: string;
|
|
765
|
+
granularity: string;
|
|
766
|
+
generatedAt: string;
|
|
767
|
+
credits: UsageHistoryBucket[];
|
|
768
|
+
exportRows: UsageHistoryBucket[];
|
|
769
|
+
}
|
|
732
770
|
|
|
733
771
|
declare class AccountNamespace extends BaseNamespace {
|
|
734
772
|
getAccountDetails(): Promise<AccountDetails>;
|
|
773
|
+
getCreditsUsageHistory(range?: string, granularity?: string): Promise<CreditsUsageHistory>;
|
|
735
774
|
}
|
|
736
775
|
|
|
737
776
|
declare class XpozClient {
|
|
@@ -778,8 +817,8 @@ declare class OperationCancelledError extends XpozError {
|
|
|
778
817
|
constructor(operationId: string);
|
|
779
818
|
}
|
|
780
819
|
|
|
781
|
-
declare const VERSION = "0.6.
|
|
820
|
+
declare const VERSION = "0.6.10";
|
|
782
821
|
|
|
783
822
|
declare function checkForUpdates(): Promise<void>;
|
|
784
823
|
|
|
785
|
-
export { type AccountBilling, type AccountDetails, type AccountUsage, type AddTrackedItemsResult, AuthenticationError, BillingPeriod, CreditResetFrequency, type InstagramComment, type InstagramPost, type InstagramUser, OperationCancelledError, OperationFailedError, OperationTimeoutError, PaginatedResult, type PaginationInfo, type PlanFeatures, type RedditComment, type RedditPost, type RedditPostWithComments, type RedditSubreddit, type RedditUser, type RemoveTrackedItemsResult, ResponseType, type SubredditWithPosts, type TiktokComment, type TiktokPost, type TiktokUser, type TrackedItem, TrackedItemPlatform, TrackedItemType, type TwitterPost, type TwitterUser, VERSION, XpozClient, XpozConnectionError, XpozError, checkForUpdates };
|
|
824
|
+
export { type AccountBilling, type AccountDetails, type AccountUsage, type AddTrackedItemsResult, AuthenticationError, BillingPeriod, CreditResetFrequency, type CreditsUsageHistory, type InstagramComment, type InstagramPost, type InstagramUser, OperationCancelledError, OperationFailedError, OperationTimeoutError, PaginatedResult, type PaginationInfo, type PlanFeatures, type RedditComment, type RedditPost, type RedditPostWithComments, type RedditSubreddit, type RedditUser, type RemoveTrackedItemsResult, ResponseType, type SubredditWithPosts, type TiktokComment, type TiktokPost, type TiktokUser, type TrackedItem, TrackedItemPlatform, TrackedItemType, type TwitterPost, type TwitterUser, type UsageHistoryBucket, VERSION, XpozClient, XpozConnectionError, XpozError, checkForUpdates };
|
package/dist/index.js
CHANGED
|
@@ -248,7 +248,7 @@ function coerce(value) {
|
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
// src/version.ts
|
|
251
|
-
var VERSION = "0.6.
|
|
251
|
+
var VERSION = "0.6.10";
|
|
252
252
|
|
|
253
253
|
// src/mcp/transport.ts
|
|
254
254
|
var USER_AGENT = `xpoz-ts-sdk/${VERSION}`;
|
|
@@ -587,10 +587,13 @@ var GET_TIKTOK_USER = "getTiktokUser";
|
|
|
587
587
|
var SEARCH_TIKTOK_USERS = "searchTiktokUsers";
|
|
588
588
|
var GET_TIKTOK_USERS_BY_KEYWORDS = "getTiktokUsersByKeywords";
|
|
589
589
|
var GET_TIKTOK_USERS_BY_HASHTAGS = "getTiktokUsersByHashtags";
|
|
590
|
+
var SEARCH_TIKTOK_SOUNDS = "searchTiktokSounds";
|
|
591
|
+
var GET_TIKTOK_POSTS_BY_SOUND = "getTiktokPostsBySound";
|
|
590
592
|
var GET_TRACKED_ITEMS = "getTrackedItems";
|
|
591
593
|
var ADD_TRACKED_ITEMS = "addTrackedItems";
|
|
592
594
|
var REMOVE_TRACKED_ITEMS = "removeTrackedItems";
|
|
593
595
|
var GET_ACCOUNT_DETAILS = "getAccountDetails";
|
|
596
|
+
var GET_CREDITS_USAGE_HISTORY = "getCreditsUsageHistory";
|
|
594
597
|
|
|
595
598
|
// src/namespaces/twitter.ts
|
|
596
599
|
function parseTwitterPost(item) {
|
|
@@ -1013,6 +1016,9 @@ function parseUser4(item) {
|
|
|
1013
1016
|
function parseComment3(item) {
|
|
1014
1017
|
return item;
|
|
1015
1018
|
}
|
|
1019
|
+
function parseSound(item) {
|
|
1020
|
+
return item;
|
|
1021
|
+
}
|
|
1016
1022
|
var TiktokNamespace = class extends BaseNamespace {
|
|
1017
1023
|
async getPostsByIds(postIds, options = {}) {
|
|
1018
1024
|
const args = this.buildArgs({ postIds, ...options });
|
|
@@ -1105,6 +1111,16 @@ var TiktokNamespace = class extends BaseNamespace {
|
|
|
1105
1111
|
args
|
|
1106
1112
|
);
|
|
1107
1113
|
}
|
|
1114
|
+
async searchSounds(keyword, options = {}) {
|
|
1115
|
+
const args = this.buildArgs({ keyword, ...options });
|
|
1116
|
+
const result = await this.callAndMaybePoll(SEARCH_TIKTOK_SOUNDS, args);
|
|
1117
|
+
return (result["results"] ?? []).map(parseSound);
|
|
1118
|
+
}
|
|
1119
|
+
async getPostsBySound(soundId, options = {}) {
|
|
1120
|
+
const args = this.buildArgs({ soundId, ...options });
|
|
1121
|
+
const result = await this.callAndMaybePoll(GET_TIKTOK_POSTS_BY_SOUND, args);
|
|
1122
|
+
return this.buildPaginatedResult(result, parsePost3, GET_TIKTOK_POSTS_BY_SOUND, args);
|
|
1123
|
+
}
|
|
1108
1124
|
};
|
|
1109
1125
|
|
|
1110
1126
|
// src/namespaces/tracking.ts
|
|
@@ -1131,6 +1147,11 @@ var AccountNamespace = class extends BaseNamespace {
|
|
|
1131
1147
|
const result = await this.callTool(GET_ACCOUNT_DETAILS, {});
|
|
1132
1148
|
return result["data"];
|
|
1133
1149
|
}
|
|
1150
|
+
async getCreditsUsageHistory(range, granularity) {
|
|
1151
|
+
const args = this.buildArgs({ range, granularity });
|
|
1152
|
+
const result = await this.callTool(GET_CREDITS_USAGE_HISTORY, args);
|
|
1153
|
+
return result["data"];
|
|
1154
|
+
}
|
|
1134
1155
|
};
|
|
1135
1156
|
|
|
1136
1157
|
// src/versionCheck.ts
|