rotur-sdk 1.0.2 → 1.0.3
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.d.mts +40 -6
- package/dist/index.d.ts +40 -6
- package/dist/index.js +33 -8
- package/dist/index.mjs +33 -8
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -615,6 +615,8 @@ declare class ProfilesNamespace extends Namespace {
|
|
|
615
615
|
subscription: string;
|
|
616
616
|
}>>;
|
|
617
617
|
getAvatarUrl(username: Username, cache?: string): string;
|
|
618
|
+
getOverlayUrl(username: Username, cache?: string): string;
|
|
619
|
+
getBannerUrl(username: Username, cache?: string): string;
|
|
618
620
|
}
|
|
619
621
|
declare class MeNamespace extends Namespace {
|
|
620
622
|
get(): Promise<Record<string, any>>;
|
|
@@ -654,6 +656,9 @@ declare class MeNamespace extends Namespace {
|
|
|
654
656
|
requests(): Promise<{
|
|
655
657
|
requests: Username[];
|
|
656
658
|
}>;
|
|
659
|
+
outgoing(): Promise<{
|
|
660
|
+
outgoing: Username[];
|
|
661
|
+
}>;
|
|
657
662
|
transactions(): Promise<any[]>;
|
|
658
663
|
subscription(): Promise<{
|
|
659
664
|
active: boolean;
|
|
@@ -684,14 +689,43 @@ declare class FriendsNamespace extends Namespace {
|
|
|
684
689
|
list(): Promise<{
|
|
685
690
|
friends: Username[];
|
|
686
691
|
}>;
|
|
687
|
-
request(username: Username): Promise<
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
692
|
+
request(username: Username): Promise<{
|
|
693
|
+
ok: boolean;
|
|
694
|
+
message?: string;
|
|
695
|
+
error?: string;
|
|
696
|
+
}>;
|
|
697
|
+
accept(username: Username): Promise<{
|
|
698
|
+
ok: boolean;
|
|
699
|
+
message?: string;
|
|
700
|
+
error?: string;
|
|
701
|
+
}>;
|
|
702
|
+
reject(username: Username): Promise<{
|
|
703
|
+
ok: boolean;
|
|
704
|
+
message?: string;
|
|
705
|
+
error?: string;
|
|
706
|
+
}>;
|
|
707
|
+
remove(username: Username): Promise<{
|
|
708
|
+
ok: boolean;
|
|
709
|
+
message?: string;
|
|
710
|
+
error?: string;
|
|
711
|
+
}>;
|
|
712
|
+
cancel(username: Username): Promise<{
|
|
713
|
+
ok: boolean;
|
|
714
|
+
message?: string;
|
|
715
|
+
error?: string;
|
|
716
|
+
}>;
|
|
691
717
|
}
|
|
692
718
|
declare class FollowingNamespace extends Namespace {
|
|
693
|
-
follow(username: Username): Promise<
|
|
694
|
-
|
|
719
|
+
follow(username: Username): Promise<{
|
|
720
|
+
ok: boolean;
|
|
721
|
+
message?: string;
|
|
722
|
+
error?: string;
|
|
723
|
+
}>;
|
|
724
|
+
unfollow(username: Username): Promise<{
|
|
725
|
+
ok: boolean;
|
|
726
|
+
message?: string;
|
|
727
|
+
error?: string;
|
|
728
|
+
}>;
|
|
695
729
|
followers(username: Username): Promise<{
|
|
696
730
|
followers: Username[];
|
|
697
731
|
}>;
|
package/dist/index.d.ts
CHANGED
|
@@ -615,6 +615,8 @@ declare class ProfilesNamespace extends Namespace {
|
|
|
615
615
|
subscription: string;
|
|
616
616
|
}>>;
|
|
617
617
|
getAvatarUrl(username: Username, cache?: string): string;
|
|
618
|
+
getOverlayUrl(username: Username, cache?: string): string;
|
|
619
|
+
getBannerUrl(username: Username, cache?: string): string;
|
|
618
620
|
}
|
|
619
621
|
declare class MeNamespace extends Namespace {
|
|
620
622
|
get(): Promise<Record<string, any>>;
|
|
@@ -654,6 +656,9 @@ declare class MeNamespace extends Namespace {
|
|
|
654
656
|
requests(): Promise<{
|
|
655
657
|
requests: Username[];
|
|
656
658
|
}>;
|
|
659
|
+
outgoing(): Promise<{
|
|
660
|
+
outgoing: Username[];
|
|
661
|
+
}>;
|
|
657
662
|
transactions(): Promise<any[]>;
|
|
658
663
|
subscription(): Promise<{
|
|
659
664
|
active: boolean;
|
|
@@ -684,14 +689,43 @@ declare class FriendsNamespace extends Namespace {
|
|
|
684
689
|
list(): Promise<{
|
|
685
690
|
friends: Username[];
|
|
686
691
|
}>;
|
|
687
|
-
request(username: Username): Promise<
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
692
|
+
request(username: Username): Promise<{
|
|
693
|
+
ok: boolean;
|
|
694
|
+
message?: string;
|
|
695
|
+
error?: string;
|
|
696
|
+
}>;
|
|
697
|
+
accept(username: Username): Promise<{
|
|
698
|
+
ok: boolean;
|
|
699
|
+
message?: string;
|
|
700
|
+
error?: string;
|
|
701
|
+
}>;
|
|
702
|
+
reject(username: Username): Promise<{
|
|
703
|
+
ok: boolean;
|
|
704
|
+
message?: string;
|
|
705
|
+
error?: string;
|
|
706
|
+
}>;
|
|
707
|
+
remove(username: Username): Promise<{
|
|
708
|
+
ok: boolean;
|
|
709
|
+
message?: string;
|
|
710
|
+
error?: string;
|
|
711
|
+
}>;
|
|
712
|
+
cancel(username: Username): Promise<{
|
|
713
|
+
ok: boolean;
|
|
714
|
+
message?: string;
|
|
715
|
+
error?: string;
|
|
716
|
+
}>;
|
|
691
717
|
}
|
|
692
718
|
declare class FollowingNamespace extends Namespace {
|
|
693
|
-
follow(username: Username): Promise<
|
|
694
|
-
|
|
719
|
+
follow(username: Username): Promise<{
|
|
720
|
+
ok: boolean;
|
|
721
|
+
message?: string;
|
|
722
|
+
error?: string;
|
|
723
|
+
}>;
|
|
724
|
+
unfollow(username: Username): Promise<{
|
|
725
|
+
ok: boolean;
|
|
726
|
+
message?: string;
|
|
727
|
+
error?: string;
|
|
728
|
+
}>;
|
|
695
729
|
followers(username: Username): Promise<{
|
|
696
730
|
followers: Username[];
|
|
697
731
|
}>;
|
package/dist/index.js
CHANGED
|
@@ -482,6 +482,12 @@ var ProfilesNamespace = class extends Namespace {
|
|
|
482
482
|
getAvatarUrl(username, cache = "") {
|
|
483
483
|
return `https://avatars.rotur.dev/${username}?v=${cache}`;
|
|
484
484
|
}
|
|
485
|
+
getOverlayUrl(username, cache = "") {
|
|
486
|
+
return `https://avatars.rotur.dev/.overlay/${username}?v=${cache}`;
|
|
487
|
+
}
|
|
488
|
+
getBannerUrl(username, cache = "") {
|
|
489
|
+
return `https://avatars.rotur.dev/.banners/${username}?v=${cache}`;
|
|
490
|
+
}
|
|
485
491
|
};
|
|
486
492
|
var MeNamespace = class extends Namespace {
|
|
487
493
|
async get() {
|
|
@@ -551,8 +557,13 @@ var MeNamespace = class extends Namespace {
|
|
|
551
557
|
return this.$get("/check_auth");
|
|
552
558
|
}
|
|
553
559
|
async requests() {
|
|
554
|
-
return this.$get("/
|
|
555
|
-
requests: u
|
|
560
|
+
return this.$get("/requests", void 0).then((u) => ({
|
|
561
|
+
requests: u.requests ?? []
|
|
562
|
+
}));
|
|
563
|
+
}
|
|
564
|
+
async outgoing() {
|
|
565
|
+
return this.$get("/requests_out", void 0).then((u) => ({
|
|
566
|
+
outgoing: u.requests_out ?? []
|
|
556
567
|
}));
|
|
557
568
|
}
|
|
558
569
|
async transactions() {
|
|
@@ -607,29 +618,43 @@ var PostsNamespace = class extends Namespace {
|
|
|
607
618
|
return this.$get("/limits", void 0, false);
|
|
608
619
|
}
|
|
609
620
|
};
|
|
621
|
+
function handleMessageOrError(res) {
|
|
622
|
+
return res.then((r) => {
|
|
623
|
+
if (r.ok) {
|
|
624
|
+
return { ok: true };
|
|
625
|
+
} else if (r.error) {
|
|
626
|
+
return { ok: false, error: r.error };
|
|
627
|
+
} else {
|
|
628
|
+
return { ok: false, message: r.message };
|
|
629
|
+
}
|
|
630
|
+
});
|
|
631
|
+
}
|
|
610
632
|
var FriendsNamespace = class extends Namespace {
|
|
611
633
|
async list() {
|
|
612
634
|
return this.$get("/friends");
|
|
613
635
|
}
|
|
614
636
|
async request(username) {
|
|
615
|
-
return this.$post(`/friends/request/${username}`);
|
|
637
|
+
return handleMessageOrError(this.$post(`/friends/request/${username}`));
|
|
616
638
|
}
|
|
617
639
|
async accept(username) {
|
|
618
|
-
return this.$post(`/friends/accept/${username}`);
|
|
640
|
+
return handleMessageOrError(this.$post(`/friends/accept/${username}`));
|
|
619
641
|
}
|
|
620
642
|
async reject(username) {
|
|
621
|
-
return this.$post(`/friends/reject/${username}`);
|
|
643
|
+
return handleMessageOrError(this.$post(`/friends/reject/${username}`));
|
|
622
644
|
}
|
|
623
645
|
async remove(username) {
|
|
624
|
-
return this.$post(`/friends/remove/${username}`);
|
|
646
|
+
return handleMessageOrError(this.$post(`/friends/remove/${username}`));
|
|
647
|
+
}
|
|
648
|
+
async cancel(username) {
|
|
649
|
+
return handleMessageOrError(this.$post(`/friends/cancel/${username}`));
|
|
625
650
|
}
|
|
626
651
|
};
|
|
627
652
|
var FollowingNamespace = class extends Namespace {
|
|
628
653
|
async follow(username) {
|
|
629
|
-
return this.$get("/follow", { username });
|
|
654
|
+
return handleMessageOrError(this.$get("/follow", { username }));
|
|
630
655
|
}
|
|
631
656
|
async unfollow(username) {
|
|
632
|
-
return this.$get("/unfollow", { username });
|
|
657
|
+
return handleMessageOrError(this.$get("/unfollow", { username }));
|
|
633
658
|
}
|
|
634
659
|
async followers(username) {
|
|
635
660
|
return this.$get("/followers", { username }, false);
|
package/dist/index.mjs
CHANGED
|
@@ -452,6 +452,12 @@ var ProfilesNamespace = class extends Namespace {
|
|
|
452
452
|
getAvatarUrl(username, cache = "") {
|
|
453
453
|
return `https://avatars.rotur.dev/${username}?v=${cache}`;
|
|
454
454
|
}
|
|
455
|
+
getOverlayUrl(username, cache = "") {
|
|
456
|
+
return `https://avatars.rotur.dev/.overlay/${username}?v=${cache}`;
|
|
457
|
+
}
|
|
458
|
+
getBannerUrl(username, cache = "") {
|
|
459
|
+
return `https://avatars.rotur.dev/.banners/${username}?v=${cache}`;
|
|
460
|
+
}
|
|
455
461
|
};
|
|
456
462
|
var MeNamespace = class extends Namespace {
|
|
457
463
|
async get() {
|
|
@@ -521,8 +527,13 @@ var MeNamespace = class extends Namespace {
|
|
|
521
527
|
return this.$get("/check_auth");
|
|
522
528
|
}
|
|
523
529
|
async requests() {
|
|
524
|
-
return this.$get("/
|
|
525
|
-
requests: u
|
|
530
|
+
return this.$get("/requests", void 0).then((u) => ({
|
|
531
|
+
requests: u.requests ?? []
|
|
532
|
+
}));
|
|
533
|
+
}
|
|
534
|
+
async outgoing() {
|
|
535
|
+
return this.$get("/requests_out", void 0).then((u) => ({
|
|
536
|
+
outgoing: u.requests_out ?? []
|
|
526
537
|
}));
|
|
527
538
|
}
|
|
528
539
|
async transactions() {
|
|
@@ -577,29 +588,43 @@ var PostsNamespace = class extends Namespace {
|
|
|
577
588
|
return this.$get("/limits", void 0, false);
|
|
578
589
|
}
|
|
579
590
|
};
|
|
591
|
+
function handleMessageOrError(res) {
|
|
592
|
+
return res.then((r) => {
|
|
593
|
+
if (r.ok) {
|
|
594
|
+
return { ok: true };
|
|
595
|
+
} else if (r.error) {
|
|
596
|
+
return { ok: false, error: r.error };
|
|
597
|
+
} else {
|
|
598
|
+
return { ok: false, message: r.message };
|
|
599
|
+
}
|
|
600
|
+
});
|
|
601
|
+
}
|
|
580
602
|
var FriendsNamespace = class extends Namespace {
|
|
581
603
|
async list() {
|
|
582
604
|
return this.$get("/friends");
|
|
583
605
|
}
|
|
584
606
|
async request(username) {
|
|
585
|
-
return this.$post(`/friends/request/${username}`);
|
|
607
|
+
return handleMessageOrError(this.$post(`/friends/request/${username}`));
|
|
586
608
|
}
|
|
587
609
|
async accept(username) {
|
|
588
|
-
return this.$post(`/friends/accept/${username}`);
|
|
610
|
+
return handleMessageOrError(this.$post(`/friends/accept/${username}`));
|
|
589
611
|
}
|
|
590
612
|
async reject(username) {
|
|
591
|
-
return this.$post(`/friends/reject/${username}`);
|
|
613
|
+
return handleMessageOrError(this.$post(`/friends/reject/${username}`));
|
|
592
614
|
}
|
|
593
615
|
async remove(username) {
|
|
594
|
-
return this.$post(`/friends/remove/${username}`);
|
|
616
|
+
return handleMessageOrError(this.$post(`/friends/remove/${username}`));
|
|
617
|
+
}
|
|
618
|
+
async cancel(username) {
|
|
619
|
+
return handleMessageOrError(this.$post(`/friends/cancel/${username}`));
|
|
595
620
|
}
|
|
596
621
|
};
|
|
597
622
|
var FollowingNamespace = class extends Namespace {
|
|
598
623
|
async follow(username) {
|
|
599
|
-
return this.$get("/follow", { username });
|
|
624
|
+
return handleMessageOrError(this.$get("/follow", { username }));
|
|
600
625
|
}
|
|
601
626
|
async unfollow(username) {
|
|
602
|
-
return this.$get("/unfollow", { username });
|
|
627
|
+
return handleMessageOrError(this.$get("/unfollow", { username }));
|
|
603
628
|
}
|
|
604
629
|
async followers(username) {
|
|
605
630
|
return this.$get("/followers", { username }, false);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rotur-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "The official SDK for the Rotur platform - auth, profiles, posts, credits, keys, groups, items, gifts, tokens, validators, status, files, cosmetics, push notifications, and more",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|