@xpoz/xpoz 0.2.1 → 0.3.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/index.cjs +89 -17
- package/dist/index.d.cts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +89 -17
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -284,7 +284,7 @@ function coerce(value) {
|
|
|
284
284
|
}
|
|
285
285
|
|
|
286
286
|
// src/version.ts
|
|
287
|
-
var VERSION = "0.
|
|
287
|
+
var VERSION = "0.3.0";
|
|
288
288
|
|
|
289
289
|
// src/mcp/transport.ts
|
|
290
290
|
var USER_AGENT = `xpoz-ts-sdk/${VERSION}`;
|
|
@@ -571,6 +571,7 @@ var GET_TWITTER_COMMENTS = "getTwitterPostComments";
|
|
|
571
571
|
var GET_TWITTER_POST_INTERACTING_USERS = "getTwitterPostInteractingUsers";
|
|
572
572
|
var COUNT_TWEETS = "countTweets";
|
|
573
573
|
var GET_TWITTER_USER = "getTwitterUser";
|
|
574
|
+
var GET_TWITTER_USERS = "getTwitterUsers";
|
|
574
575
|
var SEARCH_TWITTER_USERS = "searchTwitterUsers";
|
|
575
576
|
var GET_TWITTER_USER_CONNECTIONS = "getTwitterUserConnections";
|
|
576
577
|
var GET_TWITTER_USERS_BY_KEYWORDS = "getTwitterUsersByKeywords";
|
|
@@ -603,7 +604,10 @@ function parseUser(item) {
|
|
|
603
604
|
var TwitterNamespace = class extends BaseNamespace {
|
|
604
605
|
async getPostsByIds(postIds, options = {}) {
|
|
605
606
|
const args = this.buildArgs({ postIds, ...options });
|
|
606
|
-
const result = await this.callAndMaybePoll(
|
|
607
|
+
const result = await this.callAndMaybePoll(
|
|
608
|
+
GET_TWITTER_POSTS_BY_IDS,
|
|
609
|
+
args
|
|
610
|
+
);
|
|
607
611
|
return (result["results"] ?? []).map(parseTwitterPost);
|
|
608
612
|
}
|
|
609
613
|
async getPostsByAuthor(identifier, options = {}) {
|
|
@@ -616,8 +620,16 @@ var TwitterNamespace = class extends BaseNamespace {
|
|
|
616
620
|
responseType: options.responseType,
|
|
617
621
|
limit: options.limit
|
|
618
622
|
});
|
|
619
|
-
const result = await this.callAndMaybePoll(
|
|
620
|
-
|
|
623
|
+
const result = await this.callAndMaybePoll(
|
|
624
|
+
GET_TWITTER_POSTS_BY_AUTHOR,
|
|
625
|
+
args
|
|
626
|
+
);
|
|
627
|
+
return this.buildPaginatedResult(
|
|
628
|
+
result,
|
|
629
|
+
parseTwitterPost,
|
|
630
|
+
GET_TWITTER_POSTS_BY_AUTHOR,
|
|
631
|
+
args
|
|
632
|
+
);
|
|
621
633
|
}
|
|
622
634
|
async searchPosts(query, options = {}) {
|
|
623
635
|
const args = this.buildArgs({
|
|
@@ -628,6 +640,7 @@ var TwitterNamespace = class extends BaseNamespace {
|
|
|
628
640
|
authorUsername: options.authorUsername,
|
|
629
641
|
authorId: options.authorId,
|
|
630
642
|
language: options.language,
|
|
643
|
+
filterOutRetweets: options.filterOutRetweets,
|
|
631
644
|
forceLatest: options.forceLatest,
|
|
632
645
|
responseType: options.responseType,
|
|
633
646
|
limit: options.limit
|
|
@@ -635,30 +648,70 @@ var TwitterNamespace = class extends BaseNamespace {
|
|
|
635
648
|
if (options.responseType === "csv" /* Csv */) {
|
|
636
649
|
const raw = await this.callTool(SEARCH_TWITTER_POSTS, args);
|
|
637
650
|
const exportOpId = raw["operationId"] ?? raw["dataDumpExportOperationId"] ?? null;
|
|
638
|
-
const csvRaw = {
|
|
639
|
-
|
|
651
|
+
const csvRaw = {
|
|
652
|
+
results: [],
|
|
653
|
+
dataDumpExportOperationId: exportOpId
|
|
654
|
+
};
|
|
655
|
+
return this.buildPaginatedResult(
|
|
656
|
+
csvRaw,
|
|
657
|
+
parseTwitterPost,
|
|
658
|
+
SEARCH_TWITTER_POSTS,
|
|
659
|
+
args
|
|
660
|
+
);
|
|
640
661
|
}
|
|
641
|
-
const result = await this.callAndMaybePoll(
|
|
642
|
-
|
|
662
|
+
const result = await this.callAndMaybePoll(
|
|
663
|
+
SEARCH_TWITTER_POSTS,
|
|
664
|
+
args
|
|
665
|
+
);
|
|
666
|
+
return this.buildPaginatedResult(
|
|
667
|
+
result,
|
|
668
|
+
parseTwitterPost,
|
|
669
|
+
SEARCH_TWITTER_POSTS,
|
|
670
|
+
args
|
|
671
|
+
);
|
|
643
672
|
}
|
|
644
673
|
async getRetweets(postId, options = {}) {
|
|
645
674
|
const args = this.buildArgs({ postId, ...options });
|
|
646
|
-
const result = await this.callAndMaybePoll(
|
|
647
|
-
|
|
675
|
+
const result = await this.callAndMaybePoll(
|
|
676
|
+
GET_TWITTER_RETWEETS,
|
|
677
|
+
args
|
|
678
|
+
);
|
|
679
|
+
return this.buildPaginatedResult(
|
|
680
|
+
result,
|
|
681
|
+
parseTwitterPost,
|
|
682
|
+
GET_TWITTER_RETWEETS,
|
|
683
|
+
args
|
|
684
|
+
);
|
|
648
685
|
}
|
|
649
686
|
async getQuotes(postId, options = {}) {
|
|
650
687
|
const args = this.buildArgs({ postId, ...options });
|
|
651
688
|
const result = await this.callAndMaybePoll(GET_TWITTER_QUOTES, args);
|
|
652
|
-
return this.buildPaginatedResult(
|
|
689
|
+
return this.buildPaginatedResult(
|
|
690
|
+
result,
|
|
691
|
+
parseTwitterPost,
|
|
692
|
+
GET_TWITTER_QUOTES,
|
|
693
|
+
args
|
|
694
|
+
);
|
|
653
695
|
}
|
|
654
696
|
async getComments(postId, options = {}) {
|
|
655
697
|
const args = this.buildArgs({ postId, ...options });
|
|
656
|
-
const result = await this.callAndMaybePoll(
|
|
657
|
-
|
|
698
|
+
const result = await this.callAndMaybePoll(
|
|
699
|
+
GET_TWITTER_COMMENTS,
|
|
700
|
+
args
|
|
701
|
+
);
|
|
702
|
+
return this.buildPaginatedResult(
|
|
703
|
+
result,
|
|
704
|
+
parseTwitterPost,
|
|
705
|
+
GET_TWITTER_COMMENTS,
|
|
706
|
+
args
|
|
707
|
+
);
|
|
658
708
|
}
|
|
659
709
|
async getPostInteractingUsers(postId, interactionType, options = {}) {
|
|
660
710
|
const args = this.buildArgs({ postId, interactionType, ...options });
|
|
661
|
-
const result = await this.callAndMaybePoll(
|
|
711
|
+
const result = await this.callAndMaybePoll(
|
|
712
|
+
GET_TWITTER_POST_INTERACTING_USERS,
|
|
713
|
+
args
|
|
714
|
+
);
|
|
662
715
|
return this.buildPaginatedResult(
|
|
663
716
|
result,
|
|
664
717
|
parseUser,
|
|
@@ -680,6 +733,16 @@ var TwitterNamespace = class extends BaseNamespace {
|
|
|
680
733
|
}
|
|
681
734
|
return Number(count);
|
|
682
735
|
}
|
|
736
|
+
async getUsers(identifiers, options = {}) {
|
|
737
|
+
const args = this.buildArgs({
|
|
738
|
+
identifiers,
|
|
739
|
+
identifierType: options.identifierType ?? "username",
|
|
740
|
+
fields: options.fields,
|
|
741
|
+
forceLatest: options.forceLatest
|
|
742
|
+
});
|
|
743
|
+
const result = await this.callAndMaybePoll(GET_TWITTER_USERS, args);
|
|
744
|
+
return (result["results"] ?? []).map(parseUser);
|
|
745
|
+
}
|
|
683
746
|
async getUser(identifier, options = {}) {
|
|
684
747
|
const args = this.buildArgs({
|
|
685
748
|
identifier,
|
|
@@ -695,12 +758,18 @@ var TwitterNamespace = class extends BaseNamespace {
|
|
|
695
758
|
}
|
|
696
759
|
async searchUsers(name, options = {}) {
|
|
697
760
|
const args = this.buildArgs({ name, ...options });
|
|
698
|
-
const result = await this.callAndMaybePoll(
|
|
761
|
+
const result = await this.callAndMaybePoll(
|
|
762
|
+
SEARCH_TWITTER_USERS,
|
|
763
|
+
args
|
|
764
|
+
);
|
|
699
765
|
return (result["results"] ?? []).map(parseUser);
|
|
700
766
|
}
|
|
701
767
|
async getUserConnections(username, connectionType, options = {}) {
|
|
702
768
|
const args = this.buildArgs({ username, connectionType, ...options });
|
|
703
|
-
const result = await this.callAndMaybePoll(
|
|
769
|
+
const result = await this.callAndMaybePoll(
|
|
770
|
+
GET_TWITTER_USER_CONNECTIONS,
|
|
771
|
+
args
|
|
772
|
+
);
|
|
704
773
|
return this.buildPaginatedResult(
|
|
705
774
|
result,
|
|
706
775
|
parseUser,
|
|
@@ -710,7 +779,10 @@ var TwitterNamespace = class extends BaseNamespace {
|
|
|
710
779
|
}
|
|
711
780
|
async getUsersByKeywords(query, options = {}) {
|
|
712
781
|
const args = this.buildArgs({ query, ...options });
|
|
713
|
-
const result = await this.callAndMaybePoll(
|
|
782
|
+
const result = await this.callAndMaybePoll(
|
|
783
|
+
GET_TWITTER_USERS_BY_KEYWORDS,
|
|
784
|
+
args
|
|
785
|
+
);
|
|
714
786
|
return this.buildPaginatedResult(
|
|
715
787
|
result,
|
|
716
788
|
parseUser,
|
package/dist/index.d.cts
CHANGED
|
@@ -170,6 +170,7 @@ declare class TwitterNamespace extends BaseNamespace {
|
|
|
170
170
|
authorUsername?: string;
|
|
171
171
|
authorId?: string;
|
|
172
172
|
language?: string;
|
|
173
|
+
filterOutRetweets?: boolean;
|
|
173
174
|
forceLatest?: boolean;
|
|
174
175
|
responseType?: ResponseType;
|
|
175
176
|
limit?: number;
|
|
@@ -196,6 +197,11 @@ declare class TwitterNamespace extends BaseNamespace {
|
|
|
196
197
|
startDate?: string;
|
|
197
198
|
endDate?: string;
|
|
198
199
|
}): Promise<number>;
|
|
200
|
+
getUsers(identifiers: string[], options?: {
|
|
201
|
+
identifierType?: string;
|
|
202
|
+
fields?: string[];
|
|
203
|
+
forceLatest?: boolean;
|
|
204
|
+
}): Promise<TwitterUser[]>;
|
|
199
205
|
getUser(identifier: string, options?: {
|
|
200
206
|
identifierType?: string;
|
|
201
207
|
fields?: string[];
|
|
@@ -594,7 +600,7 @@ declare class OperationCancelledError extends XpozError {
|
|
|
594
600
|
constructor(operationId: string);
|
|
595
601
|
}
|
|
596
602
|
|
|
597
|
-
declare const VERSION = "0.
|
|
603
|
+
declare const VERSION = "0.3.0";
|
|
598
604
|
|
|
599
605
|
declare function checkForUpdates(): Promise<void>;
|
|
600
606
|
|
package/dist/index.d.ts
CHANGED
|
@@ -170,6 +170,7 @@ declare class TwitterNamespace extends BaseNamespace {
|
|
|
170
170
|
authorUsername?: string;
|
|
171
171
|
authorId?: string;
|
|
172
172
|
language?: string;
|
|
173
|
+
filterOutRetweets?: boolean;
|
|
173
174
|
forceLatest?: boolean;
|
|
174
175
|
responseType?: ResponseType;
|
|
175
176
|
limit?: number;
|
|
@@ -196,6 +197,11 @@ declare class TwitterNamespace extends BaseNamespace {
|
|
|
196
197
|
startDate?: string;
|
|
197
198
|
endDate?: string;
|
|
198
199
|
}): Promise<number>;
|
|
200
|
+
getUsers(identifiers: string[], options?: {
|
|
201
|
+
identifierType?: string;
|
|
202
|
+
fields?: string[];
|
|
203
|
+
forceLatest?: boolean;
|
|
204
|
+
}): Promise<TwitterUser[]>;
|
|
199
205
|
getUser(identifier: string, options?: {
|
|
200
206
|
identifierType?: string;
|
|
201
207
|
fields?: string[];
|
|
@@ -594,7 +600,7 @@ declare class OperationCancelledError extends XpozError {
|
|
|
594
600
|
constructor(operationId: string);
|
|
595
601
|
}
|
|
596
602
|
|
|
597
|
-
declare const VERSION = "0.
|
|
603
|
+
declare const VERSION = "0.3.0";
|
|
598
604
|
|
|
599
605
|
declare function checkForUpdates(): Promise<void>;
|
|
600
606
|
|
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.
|
|
251
|
+
var VERSION = "0.3.0";
|
|
252
252
|
|
|
253
253
|
// src/mcp/transport.ts
|
|
254
254
|
var USER_AGENT = `xpoz-ts-sdk/${VERSION}`;
|
|
@@ -535,6 +535,7 @@ var GET_TWITTER_COMMENTS = "getTwitterPostComments";
|
|
|
535
535
|
var GET_TWITTER_POST_INTERACTING_USERS = "getTwitterPostInteractingUsers";
|
|
536
536
|
var COUNT_TWEETS = "countTweets";
|
|
537
537
|
var GET_TWITTER_USER = "getTwitterUser";
|
|
538
|
+
var GET_TWITTER_USERS = "getTwitterUsers";
|
|
538
539
|
var SEARCH_TWITTER_USERS = "searchTwitterUsers";
|
|
539
540
|
var GET_TWITTER_USER_CONNECTIONS = "getTwitterUserConnections";
|
|
540
541
|
var GET_TWITTER_USERS_BY_KEYWORDS = "getTwitterUsersByKeywords";
|
|
@@ -567,7 +568,10 @@ function parseUser(item) {
|
|
|
567
568
|
var TwitterNamespace = class extends BaseNamespace {
|
|
568
569
|
async getPostsByIds(postIds, options = {}) {
|
|
569
570
|
const args = this.buildArgs({ postIds, ...options });
|
|
570
|
-
const result = await this.callAndMaybePoll(
|
|
571
|
+
const result = await this.callAndMaybePoll(
|
|
572
|
+
GET_TWITTER_POSTS_BY_IDS,
|
|
573
|
+
args
|
|
574
|
+
);
|
|
571
575
|
return (result["results"] ?? []).map(parseTwitterPost);
|
|
572
576
|
}
|
|
573
577
|
async getPostsByAuthor(identifier, options = {}) {
|
|
@@ -580,8 +584,16 @@ var TwitterNamespace = class extends BaseNamespace {
|
|
|
580
584
|
responseType: options.responseType,
|
|
581
585
|
limit: options.limit
|
|
582
586
|
});
|
|
583
|
-
const result = await this.callAndMaybePoll(
|
|
584
|
-
|
|
587
|
+
const result = await this.callAndMaybePoll(
|
|
588
|
+
GET_TWITTER_POSTS_BY_AUTHOR,
|
|
589
|
+
args
|
|
590
|
+
);
|
|
591
|
+
return this.buildPaginatedResult(
|
|
592
|
+
result,
|
|
593
|
+
parseTwitterPost,
|
|
594
|
+
GET_TWITTER_POSTS_BY_AUTHOR,
|
|
595
|
+
args
|
|
596
|
+
);
|
|
585
597
|
}
|
|
586
598
|
async searchPosts(query, options = {}) {
|
|
587
599
|
const args = this.buildArgs({
|
|
@@ -592,6 +604,7 @@ var TwitterNamespace = class extends BaseNamespace {
|
|
|
592
604
|
authorUsername: options.authorUsername,
|
|
593
605
|
authorId: options.authorId,
|
|
594
606
|
language: options.language,
|
|
607
|
+
filterOutRetweets: options.filterOutRetweets,
|
|
595
608
|
forceLatest: options.forceLatest,
|
|
596
609
|
responseType: options.responseType,
|
|
597
610
|
limit: options.limit
|
|
@@ -599,30 +612,70 @@ var TwitterNamespace = class extends BaseNamespace {
|
|
|
599
612
|
if (options.responseType === "csv" /* Csv */) {
|
|
600
613
|
const raw = await this.callTool(SEARCH_TWITTER_POSTS, args);
|
|
601
614
|
const exportOpId = raw["operationId"] ?? raw["dataDumpExportOperationId"] ?? null;
|
|
602
|
-
const csvRaw = {
|
|
603
|
-
|
|
615
|
+
const csvRaw = {
|
|
616
|
+
results: [],
|
|
617
|
+
dataDumpExportOperationId: exportOpId
|
|
618
|
+
};
|
|
619
|
+
return this.buildPaginatedResult(
|
|
620
|
+
csvRaw,
|
|
621
|
+
parseTwitterPost,
|
|
622
|
+
SEARCH_TWITTER_POSTS,
|
|
623
|
+
args
|
|
624
|
+
);
|
|
604
625
|
}
|
|
605
|
-
const result = await this.callAndMaybePoll(
|
|
606
|
-
|
|
626
|
+
const result = await this.callAndMaybePoll(
|
|
627
|
+
SEARCH_TWITTER_POSTS,
|
|
628
|
+
args
|
|
629
|
+
);
|
|
630
|
+
return this.buildPaginatedResult(
|
|
631
|
+
result,
|
|
632
|
+
parseTwitterPost,
|
|
633
|
+
SEARCH_TWITTER_POSTS,
|
|
634
|
+
args
|
|
635
|
+
);
|
|
607
636
|
}
|
|
608
637
|
async getRetweets(postId, options = {}) {
|
|
609
638
|
const args = this.buildArgs({ postId, ...options });
|
|
610
|
-
const result = await this.callAndMaybePoll(
|
|
611
|
-
|
|
639
|
+
const result = await this.callAndMaybePoll(
|
|
640
|
+
GET_TWITTER_RETWEETS,
|
|
641
|
+
args
|
|
642
|
+
);
|
|
643
|
+
return this.buildPaginatedResult(
|
|
644
|
+
result,
|
|
645
|
+
parseTwitterPost,
|
|
646
|
+
GET_TWITTER_RETWEETS,
|
|
647
|
+
args
|
|
648
|
+
);
|
|
612
649
|
}
|
|
613
650
|
async getQuotes(postId, options = {}) {
|
|
614
651
|
const args = this.buildArgs({ postId, ...options });
|
|
615
652
|
const result = await this.callAndMaybePoll(GET_TWITTER_QUOTES, args);
|
|
616
|
-
return this.buildPaginatedResult(
|
|
653
|
+
return this.buildPaginatedResult(
|
|
654
|
+
result,
|
|
655
|
+
parseTwitterPost,
|
|
656
|
+
GET_TWITTER_QUOTES,
|
|
657
|
+
args
|
|
658
|
+
);
|
|
617
659
|
}
|
|
618
660
|
async getComments(postId, options = {}) {
|
|
619
661
|
const args = this.buildArgs({ postId, ...options });
|
|
620
|
-
const result = await this.callAndMaybePoll(
|
|
621
|
-
|
|
662
|
+
const result = await this.callAndMaybePoll(
|
|
663
|
+
GET_TWITTER_COMMENTS,
|
|
664
|
+
args
|
|
665
|
+
);
|
|
666
|
+
return this.buildPaginatedResult(
|
|
667
|
+
result,
|
|
668
|
+
parseTwitterPost,
|
|
669
|
+
GET_TWITTER_COMMENTS,
|
|
670
|
+
args
|
|
671
|
+
);
|
|
622
672
|
}
|
|
623
673
|
async getPostInteractingUsers(postId, interactionType, options = {}) {
|
|
624
674
|
const args = this.buildArgs({ postId, interactionType, ...options });
|
|
625
|
-
const result = await this.callAndMaybePoll(
|
|
675
|
+
const result = await this.callAndMaybePoll(
|
|
676
|
+
GET_TWITTER_POST_INTERACTING_USERS,
|
|
677
|
+
args
|
|
678
|
+
);
|
|
626
679
|
return this.buildPaginatedResult(
|
|
627
680
|
result,
|
|
628
681
|
parseUser,
|
|
@@ -644,6 +697,16 @@ var TwitterNamespace = class extends BaseNamespace {
|
|
|
644
697
|
}
|
|
645
698
|
return Number(count);
|
|
646
699
|
}
|
|
700
|
+
async getUsers(identifiers, options = {}) {
|
|
701
|
+
const args = this.buildArgs({
|
|
702
|
+
identifiers,
|
|
703
|
+
identifierType: options.identifierType ?? "username",
|
|
704
|
+
fields: options.fields,
|
|
705
|
+
forceLatest: options.forceLatest
|
|
706
|
+
});
|
|
707
|
+
const result = await this.callAndMaybePoll(GET_TWITTER_USERS, args);
|
|
708
|
+
return (result["results"] ?? []).map(parseUser);
|
|
709
|
+
}
|
|
647
710
|
async getUser(identifier, options = {}) {
|
|
648
711
|
const args = this.buildArgs({
|
|
649
712
|
identifier,
|
|
@@ -659,12 +722,18 @@ var TwitterNamespace = class extends BaseNamespace {
|
|
|
659
722
|
}
|
|
660
723
|
async searchUsers(name, options = {}) {
|
|
661
724
|
const args = this.buildArgs({ name, ...options });
|
|
662
|
-
const result = await this.callAndMaybePoll(
|
|
725
|
+
const result = await this.callAndMaybePoll(
|
|
726
|
+
SEARCH_TWITTER_USERS,
|
|
727
|
+
args
|
|
728
|
+
);
|
|
663
729
|
return (result["results"] ?? []).map(parseUser);
|
|
664
730
|
}
|
|
665
731
|
async getUserConnections(username, connectionType, options = {}) {
|
|
666
732
|
const args = this.buildArgs({ username, connectionType, ...options });
|
|
667
|
-
const result = await this.callAndMaybePoll(
|
|
733
|
+
const result = await this.callAndMaybePoll(
|
|
734
|
+
GET_TWITTER_USER_CONNECTIONS,
|
|
735
|
+
args
|
|
736
|
+
);
|
|
668
737
|
return this.buildPaginatedResult(
|
|
669
738
|
result,
|
|
670
739
|
parseUser,
|
|
@@ -674,7 +743,10 @@ var TwitterNamespace = class extends BaseNamespace {
|
|
|
674
743
|
}
|
|
675
744
|
async getUsersByKeywords(query, options = {}) {
|
|
676
745
|
const args = this.buildArgs({ query, ...options });
|
|
677
|
-
const result = await this.callAndMaybePoll(
|
|
746
|
+
const result = await this.callAndMaybePoll(
|
|
747
|
+
GET_TWITTER_USERS_BY_KEYWORDS,
|
|
748
|
+
args
|
|
749
|
+
);
|
|
678
750
|
return this.buildPaginatedResult(
|
|
679
751
|
result,
|
|
680
752
|
parseUser,
|