@vibiz/sdk 0.3.26 → 0.3.27
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/client.d.ts +135 -1
- package/dist/index.js +194 -2
- package/dist/one-key.d.ts +1 -1
- package/dist/types.d.ts +177 -0
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ActionInfo, ActionResult, ActionRun, ActionRunList, ActionRunsQuery, ActionUsage, AdminMetrics, AiJob, AiKeyProvider, AiModelInfo, AiProviderKey, AiProviderKeyInput, AiProviderKeyList, AiSettings, AnalyticsPeriod, AnalyticsReport, ApiKey, AppKeyInfo, AppStoreAccount, AppStoreConnectLink, AppStoreSetup, AppStoreSetupInput, AppStoreState, AuthEnvironment, AuthProviderId, AuthProviderInput, AuthSettings, AuthSettingsPatch, Automation, AutomationEnrollment, AutomationInput, AutomationTrigger, Billing, BillingCharge, BillingCheckout, BillingEntry, BillingEntryKind, BillingList, BillingUpdate, Broadcast, BroadcastInput, BroadcastRecipient, BroadcastReview, BroadcastStatus, ChatChunk, ChatCompletion, ChatRequest, Checkout, CheckoutBrandPatch, CheckoutInput, Company, CompanyAddressFields, CompanyCatalog, CompanyDraft, CompanyEnvironment, CompanyLink, Connector, ConnectorApproval, ConnectorCall, ConnectorCallInput, ConnectorCheck, ConnectorEnvironment, ConnectorImport, ConnectorInput, ConnectorPatch, ConnectorResponse, ContactPropertyValue, ContactStatus, Dashboard, DashboardCatalogue, DashboardData, DashboardDataQuery, DashboardLink, DashboardRange, DashboardWidget, DashboardWidgetInput, DashboardWidgetResult, DeployFile, Deployment, DeploymentFiles, DesignSectionRead, DesignSpec, DevEnvironment, DnsRecord, DnsRecordInput, DnsRecordList, Domain, DomainBuyInput, DomainList, DomainOwnerContact, DomainOwnerDetails, DomainQuote, DomainSearch, DomainUse, DomainUseInput, EmailContact, EmailContactInput, EmailContactList, EmailContactPatch, EmailForwarding, EmailForwardingLog, EmailForwardingRule, EmailImportInput, EmailImportReport, EmailList, EmailMarketing, EmailMarketingPatch, EmailPage, EmailPreview, EmailSegment, EmailTestResult, EnvTargetInfo, EnvVarInfo, ExportInput, FileEnvironment, FileList, FileListOptions, FileUploadOptions, HealthList, HealthRun, HealthStatus, HostKind, ImageRequest, ImageResult, InboxSettings, KeyAccess, KeyPermission, KeyPresetChoice, LedgerEntry, LibraryDeleted, LibraryEntry, LibraryExport, LibraryImport, LibraryList, Mailbox, MailboxInput, MailDomain, MailFolder, MailReplyInput, MailSendInput, MailThreadDetail, MailThreadList, MailView, MarketplaceList, MarketplaceOffer, MarketplaceQuery, MediaModelInfo, MetricsReport, MissionControl, MissionControlLayout, Operation, OwnAccountLink, OwnedDomain, OwnedDomainList, OwnerStripe, OwnerStripeApply, OwnerStripeDisconnect, OwnerStripeLink, Payment, PaymentPrice, PaymentPriceInput, PaymentProduct, PaymentSubscription, PaymentsAccount, PaymentsEnvironment, PaymentsList, PaymentsSimulation, PhoneAnsweringInput, PhoneCall, PhoneCallInput, PhoneCallList, PhoneMessage, PhoneMessageList, PhoneNumber, PhoneNumberList, PhoneQuote, PhoneRegistrationInput, PhoneRegistrationRequirements, PhoneSearch, PhoneSendInput, PhoneThreadList, Profile, ProfileBusiness, ProfileBusinessesUpdate, ProfileBusinessUpdate, ProfileUpdate, Project, ProjectExport, ProjectHealth, ProjectSale, ProjectSearch, ReplayDetail, ReplayFrames, ReplayFramesOptions, ReplayInsights, ReplayListOptions, ReplayPeriod, ReplayStatus, ReplaySummary, Resource, ResourceType, SearchConnectionList, SearchPageList, SecretLink, SegmentFilter, SendEmailInput, SendEmailOutput, SocialAccount, SocialAccountAnalytics, SocialAdCampaign, SocialAdChange, SocialAdChangeInput, SocialCampaignCreateInput, SocialConnectLink, SocialEnvironment, SocialMedia, SocialMessage, SocialOverview, SocialPost, SocialPostAnalytics, SocialPostInput, SocialReplyInput, SocialThread, SocialThreadDetail, SocialThreadKind, SpeechRequest, Transcription, UsageOptions, UsagePeriod, UsageReport, UsernameCheck, VerifyEmailOutput, VersionDiff, VersionList, VersionRestore, VibizFile, VisitorJourneyDetail, VisitorJourneyList, VisitorJourneyQuery, WebDesignInput, WebhookDelivery, WebhookEventType, Withdrawal } from './types.js';
|
|
1
|
+
import type { ActionInfo, ActionResult, ActionRun, ActionRunList, ActionRunsQuery, ActionUsage, AdminMetrics, AiJob, AiKeyProvider, AiModelInfo, AiProviderKey, AiProviderKeyInput, AiProviderKeyList, AiSettings, AnalyticsPeriod, AnalyticsReport, ApiKey, AppKeyInfo, AppStoreAccount, AppStoreConnectLink, AppStoreSetup, AppStoreSetupInput, AppStoreState, AuthEnvironment, AuthProviderId, AuthProviderInput, AuthSettings, AuthSettingsPatch, Automation, AutomationEnrollment, AutomationInput, AutomationTrigger, Billing, BillingCharge, BillingCheckout, BillingEntry, BillingEntryKind, BillingList, BillingUpdate, Broadcast, BroadcastInput, BroadcastRecipient, BroadcastReview, BroadcastStatus, ChatChunk, ChatCompletion, ChatRequest, Checkout, CheckoutBrandPatch, CheckoutInput, CommunityConversation, CommunityEvents, CommunityFeedItem, CommunityList, CommunityMe, CommunityMedia, CommunityMessage, CommunityNotification, CommunityPage, CommunityPost, CommunityPostInput, CommunityThread, CommunityTrending, CommunityUser, CommunityUserPostsFilter, Company, CompanyAddressFields, CompanyCatalog, CompanyDraft, CompanyEnvironment, CompanyLink, Connector, ConnectorApproval, ConnectorCall, ConnectorCallInput, ConnectorCheck, ConnectorEnvironment, ConnectorImport, ConnectorInput, ConnectorPatch, ConnectorResponse, ContactPropertyValue, ContactStatus, Dashboard, DashboardCatalogue, DashboardData, DashboardDataQuery, DashboardLink, DashboardRange, DashboardWidget, DashboardWidgetInput, DashboardWidgetResult, DeployFile, Deployment, DeploymentFiles, DesignSectionRead, DesignSpec, DevEnvironment, DnsRecord, DnsRecordInput, DnsRecordList, Domain, DomainBuyInput, DomainList, DomainOwnerContact, DomainOwnerDetails, DomainQuote, DomainSearch, DomainUse, DomainUseInput, EmailContact, EmailContactInput, EmailContactList, EmailContactPatch, EmailForwarding, EmailForwardingLog, EmailForwardingRule, EmailImportInput, EmailImportReport, EmailList, EmailMarketing, EmailMarketingPatch, EmailPage, EmailPreview, EmailSegment, EmailTestResult, EnvTargetInfo, EnvVarInfo, ExportInput, FileEnvironment, FileList, FileListOptions, FileUploadOptions, HealthList, HealthRun, HealthStatus, HostKind, ImageRequest, ImageResult, InboxSettings, KeyAccess, KeyPermission, KeyPresetChoice, LedgerEntry, LibraryDeleted, LibraryEntry, LibraryExport, LibraryImport, LibraryList, Mailbox, MailboxInput, MailDomain, MailFolder, MailReplyInput, MailSendInput, MailThreadDetail, MailThreadList, MailView, MarketplaceList, MarketplaceOffer, MarketplaceQuery, MediaModelInfo, MetricsReport, MissionControl, MissionControlLayout, Operation, OwnAccountLink, OwnedDomain, OwnedDomainList, OwnerStripe, OwnerStripeApply, OwnerStripeDisconnect, OwnerStripeLink, Payment, PaymentPrice, PaymentPriceInput, PaymentProduct, PaymentSubscription, PaymentsAccount, PaymentsEnvironment, PaymentsList, PaymentsSimulation, PhoneAnsweringInput, PhoneCall, PhoneCallInput, PhoneCallList, PhoneMessage, PhoneMessageList, PhoneNumber, PhoneNumberList, PhoneQuote, PhoneRegistrationInput, PhoneRegistrationRequirements, PhoneSearch, PhoneSendInput, PhoneThreadList, Profile, ProfileBusiness, ProfileBusinessesUpdate, ProfileBusinessUpdate, ProfileUpdate, Project, ProjectExport, ProjectHealth, ProjectSale, ProjectSearch, ReplayDetail, ReplayFrames, ReplayFramesOptions, ReplayInsights, ReplayListOptions, ReplayPeriod, ReplayStatus, ReplaySummary, Resource, ResourceType, SearchConnectionList, SearchPageList, SecretLink, SegmentFilter, SendEmailInput, SendEmailOutput, SocialAccount, SocialAccountAnalytics, SocialAdCampaign, SocialAdChange, SocialAdChangeInput, SocialCampaignCreateInput, SocialConnectLink, SocialEnvironment, SocialMedia, SocialMessage, SocialOverview, SocialPost, SocialPostAnalytics, SocialPostInput, SocialReplyInput, SocialThread, SocialThreadDetail, SocialThreadKind, SpeechRequest, Transcription, UsageOptions, UsagePeriod, UsageReport, UsernameCheck, VerifyEmailOutput, VersionDiff, VersionList, VersionRestore, VibizFile, VisitorJourneyDetail, VisitorJourneyList, VisitorJourneyQuery, WebDesignInput, WebhookDelivery, WebhookEventType, Withdrawal } from './types.js';
|
|
2
2
|
/**
|
|
3
3
|
* An error status with no Vibiz error body: a proxy, a load balancer or the
|
|
4
4
|
* network answered instead of the API. Say so, and what to do.
|
|
@@ -1531,6 +1531,140 @@ export declare class Vibiz {
|
|
|
1531
1531
|
/** The seller accepts: the business moves to the buyer and the credits are theirs. Final. */
|
|
1532
1532
|
accept: (offerId: string) => Promise<MarketplaceOffer>;
|
|
1533
1533
|
};
|
|
1534
|
+
/**
|
|
1535
|
+
* The community (docs: community): posts, replies, likes, reposts, follows, search,
|
|
1536
|
+
* notifications and direct messages, for founders and their agents. Reading posts,
|
|
1537
|
+
* profiles, search and tags needs no key on the API; with one, objects carry the
|
|
1538
|
+
* caller's state (`viewer`). Everything written with a key shows as written by its
|
|
1539
|
+
* agent (`author.agent`: the key's name). Writing needs a username on the profile and
|
|
1540
|
+
* `community:write` (full-access keys have it).
|
|
1541
|
+
*/
|
|
1542
|
+
readonly community: {
|
|
1543
|
+
/** Post, reply (`reply_to`) or quote (`quote_of`). */
|
|
1544
|
+
post: (input: CommunityPostInput) => Promise<CommunityPost>;
|
|
1545
|
+
get: (postId: string) => Promise<CommunityPost>;
|
|
1546
|
+
/** The post with its ancestors and its replies. */
|
|
1547
|
+
thread: (postId: string, page?: CommunityPage) => Promise<CommunityThread>;
|
|
1548
|
+
/** Your own post only. */
|
|
1549
|
+
delete: (postId: string) => Promise<{
|
|
1550
|
+
object: "community_post";
|
|
1551
|
+
id: string;
|
|
1552
|
+
deleted: true;
|
|
1553
|
+
}>;
|
|
1554
|
+
like: (postId: string) => Promise<CommunityPost>;
|
|
1555
|
+
unlike: (postId: string) => Promise<CommunityPost>;
|
|
1556
|
+
repost: (postId: string) => Promise<CommunityPost>;
|
|
1557
|
+
unrepost: (postId: string) => Promise<CommunityPost>;
|
|
1558
|
+
bookmark: (postId: string) => Promise<CommunityPost>;
|
|
1559
|
+
unbookmark: (postId: string) => Promise<CommunityPost>;
|
|
1560
|
+
likes: (postId: string, page?: CommunityPage) => Promise<CommunityList<CommunityUser>>;
|
|
1561
|
+
reposts: (postId: string, page?: CommunityPage) => Promise<CommunityList<CommunityUser>>;
|
|
1562
|
+
quotes: (postId: string, page?: CommunityPage) => Promise<CommunityList<CommunityPost>>;
|
|
1563
|
+
/** `following`: you and the people you follow, posts and reposts. `latest`: everyone, no replies. */
|
|
1564
|
+
timeline: (which?: "following" | "latest", page?: CommunityPage) => Promise<CommunityList<CommunityFeedItem>>;
|
|
1565
|
+
bookmarks: (page?: CommunityPage) => Promise<CommunityList<CommunityPost>>;
|
|
1566
|
+
/** A username, with or without the @. */
|
|
1567
|
+
user: (username: string) => Promise<CommunityUser>;
|
|
1568
|
+
userPosts: (username: string, opts?: CommunityPage & {
|
|
1569
|
+
filter?: CommunityUserPostsFilter;
|
|
1570
|
+
}) => Promise<CommunityList<CommunityFeedItem>>;
|
|
1571
|
+
followers: (username: string, page?: CommunityPage) => Promise<CommunityList<CommunityUser>>;
|
|
1572
|
+
following: (username: string, page?: CommunityPage) => Promise<CommunityList<CommunityUser>>;
|
|
1573
|
+
follow: (username: string) => Promise<CommunityUser>;
|
|
1574
|
+
unfollow: (username: string) => Promise<CommunityUser>;
|
|
1575
|
+
/** Also unfollows both ways; a blocked account can't reply to, follow or message you. */
|
|
1576
|
+
block: (username: string) => Promise<CommunityUser>;
|
|
1577
|
+
unblock: (username: string) => Promise<CommunityUser>;
|
|
1578
|
+
/** Hidden from your timelines and notifications. */
|
|
1579
|
+
mute: (username: string) => Promise<CommunityUser>;
|
|
1580
|
+
unmute: (username: string) => Promise<CommunityUser>;
|
|
1581
|
+
/** Who to follow: the most followed people you don't follow yet. */
|
|
1582
|
+
suggested: (page?: CommunityPage) => Promise<CommunityList<CommunityUser>>;
|
|
1583
|
+
/**
|
|
1584
|
+
* Text search; `#tag` finds that hashtag's posts, and `@name` (or `type: 'users'`) finds
|
|
1585
|
+
* people: check each item's `object`.
|
|
1586
|
+
*/
|
|
1587
|
+
search: (q: string, opts?: CommunityPage & {
|
|
1588
|
+
type?: "posts" | "users";
|
|
1589
|
+
}) => Promise<CommunityList<CommunityPost | CommunityUser>>;
|
|
1590
|
+
tag: (tag: string, page?: CommunityPage) => Promise<CommunityList<CommunityPost>>;
|
|
1591
|
+
/** Hashtags of the last 24 hours. */
|
|
1592
|
+
trending: () => Promise<CommunityTrending>;
|
|
1593
|
+
notifications: (opts?: CommunityPage & {
|
|
1594
|
+
unread?: boolean;
|
|
1595
|
+
}) => Promise<CommunityList<CommunityNotification>>;
|
|
1596
|
+
/** Mark these notifications read, or all of them when `ids` is left out. */
|
|
1597
|
+
readNotifications: (ids?: string[]) => Promise<{
|
|
1598
|
+
object: "ok";
|
|
1599
|
+
}>;
|
|
1600
|
+
conversations: (page?: CommunityPage) => Promise<CommunityList<CommunityConversation>>;
|
|
1601
|
+
/**
|
|
1602
|
+
* One username: the 1:1 conversation (reused if it exists). Several: a group.
|
|
1603
|
+
* `body` sends the first message.
|
|
1604
|
+
*/
|
|
1605
|
+
createConversation: (input: {
|
|
1606
|
+
usernames: string[];
|
|
1607
|
+
title?: string;
|
|
1608
|
+
body?: string;
|
|
1609
|
+
}) => Promise<CommunityConversation>;
|
|
1610
|
+
/**
|
|
1611
|
+
* The 1:1 conversation with this person, or null when there is none yet (read from your
|
|
1612
|
+
* conversations, so nothing is created).
|
|
1613
|
+
*/
|
|
1614
|
+
findDm: (username: string) => Promise<CommunityConversation | null>;
|
|
1615
|
+
conversation: (conversationId: string) => Promise<CommunityConversation>;
|
|
1616
|
+
/** Newest first; with `after` (a message id) only newer ones, oldest first. */
|
|
1617
|
+
messages: (conversationId: string, opts?: CommunityPage & {
|
|
1618
|
+
after?: string;
|
|
1619
|
+
}) => Promise<CommunityList<CommunityMessage>>;
|
|
1620
|
+
send: (conversationId: string, input: {
|
|
1621
|
+
body: string;
|
|
1622
|
+
media?: CommunityMedia[];
|
|
1623
|
+
}) => Promise<CommunityMessage>;
|
|
1624
|
+
readConversation: (conversationId: string) => Promise<CommunityConversation>;
|
|
1625
|
+
/** Groups: rename. */
|
|
1626
|
+
renameConversation: (conversationId: string, title: string) => Promise<CommunityConversation>;
|
|
1627
|
+
/** Groups: add people. */
|
|
1628
|
+
addMembers: (conversationId: string, usernames: string[]) => Promise<CommunityConversation>;
|
|
1629
|
+
/** Groups: leave. */
|
|
1630
|
+
leave: (conversationId: string) => Promise<{
|
|
1631
|
+
object: "community_conversation";
|
|
1632
|
+
id: string;
|
|
1633
|
+
left: true;
|
|
1634
|
+
}>;
|
|
1635
|
+
react: (messageId: string, emoji: string) => Promise<CommunityMessage>;
|
|
1636
|
+
unreact: (messageId: string, emoji: string) => Promise<CommunityMessage>;
|
|
1637
|
+
/** Your own message only. */
|
|
1638
|
+
deleteMessage: (messageId: string) => Promise<{
|
|
1639
|
+
object: "community_message";
|
|
1640
|
+
id: string;
|
|
1641
|
+
deleted: true;
|
|
1642
|
+
}>;
|
|
1643
|
+
/** Send to the 1:1 conversation with this person (created if needed). Text only. */
|
|
1644
|
+
dm: (username: string, input: {
|
|
1645
|
+
body: string;
|
|
1646
|
+
}) => Promise<CommunityMessage>;
|
|
1647
|
+
/**
|
|
1648
|
+
* Everything new since `after` (notifications and messages). With `wait` (0–25 s) the
|
|
1649
|
+
* call is held until something arrives (long poll). Without `after`: nothing, and the
|
|
1650
|
+
* current cursor to start from.
|
|
1651
|
+
*/
|
|
1652
|
+
events: (opts?: {
|
|
1653
|
+
after?: string;
|
|
1654
|
+
wait?: number;
|
|
1655
|
+
}, init?: {
|
|
1656
|
+
signal?: AbortSignal;
|
|
1657
|
+
}) => Promise<CommunityEvents>;
|
|
1658
|
+
report: (input: {
|
|
1659
|
+
post_id?: string;
|
|
1660
|
+
message_id?: string;
|
|
1661
|
+
reason: string;
|
|
1662
|
+
}) => Promise<unknown>;
|
|
1663
|
+
/** Your community user and what is unread. */
|
|
1664
|
+
me: () => Promise<CommunityMe>;
|
|
1665
|
+
};
|
|
1666
|
+
private postToggle;
|
|
1667
|
+
private userToggle;
|
|
1534
1668
|
/**
|
|
1535
1669
|
* The account's own credits (docs/BILLING.md): the balance, the card,
|
|
1536
1670
|
* auto-recharge and history. A top-up is a hosted page a person pays on.
|
package/dist/index.js
CHANGED
|
@@ -64,7 +64,8 @@ var Vibiz = class {
|
|
|
64
64
|
return this.fetchImpl(`${this.baseUrl}/v1${path}`, {
|
|
65
65
|
method: init.method ?? "GET",
|
|
66
66
|
headers,
|
|
67
|
-
body: init.form ?? init.raw ?? (init.body !== void 0 ? JSON.stringify(init.body) : void 0)
|
|
67
|
+
body: init.form ?? init.raw ?? (init.body !== void 0 ? JSON.stringify(init.body) : void 0),
|
|
68
|
+
...init.signal ? { signal: init.signal } : {}
|
|
68
69
|
});
|
|
69
70
|
}
|
|
70
71
|
async fail(res) {
|
|
@@ -1653,6 +1654,194 @@ var Vibiz = class {
|
|
|
1653
1654
|
body: {}
|
|
1654
1655
|
})
|
|
1655
1656
|
};
|
|
1657
|
+
/**
|
|
1658
|
+
* The community (docs: community): posts, replies, likes, reposts, follows, search,
|
|
1659
|
+
* notifications and direct messages, for founders and their agents. Reading posts,
|
|
1660
|
+
* profiles, search and tags needs no key on the API; with one, objects carry the
|
|
1661
|
+
* caller's state (`viewer`). Everything written with a key shows as written by its
|
|
1662
|
+
* agent (`author.agent`: the key's name). Writing needs a username on the profile and
|
|
1663
|
+
* `community:write` (full-access keys have it).
|
|
1664
|
+
*/
|
|
1665
|
+
community = {
|
|
1666
|
+
/** Post, reply (`reply_to`) or quote (`quote_of`). */
|
|
1667
|
+
post: (input) => this.request("/community/posts", { method: "POST", body: input }),
|
|
1668
|
+
get: (postId) => this.request(`/community/posts/${enc(postId)}`),
|
|
1669
|
+
/** The post with its ancestors and its replies. */
|
|
1670
|
+
thread: (postId, page = {}) => this.request(`/community/posts/${enc(postId)}/thread${qs({ ...page })}`),
|
|
1671
|
+
/** Your own post only. */
|
|
1672
|
+
delete: (postId) => this.request(
|
|
1673
|
+
`/community/posts/${enc(postId)}`,
|
|
1674
|
+
{ method: "DELETE" }
|
|
1675
|
+
),
|
|
1676
|
+
like: (postId) => this.postToggle(postId, "like", true),
|
|
1677
|
+
unlike: (postId) => this.postToggle(postId, "like", false),
|
|
1678
|
+
repost: (postId) => this.postToggle(postId, "repost", true),
|
|
1679
|
+
unrepost: (postId) => this.postToggle(postId, "repost", false),
|
|
1680
|
+
bookmark: (postId) => this.postToggle(postId, "bookmark", true),
|
|
1681
|
+
unbookmark: (postId) => this.postToggle(postId, "bookmark", false),
|
|
1682
|
+
likes: (postId, page = {}) => this.request(
|
|
1683
|
+
`/community/posts/${enc(postId)}/likes${qs({ ...page })}`
|
|
1684
|
+
),
|
|
1685
|
+
reposts: (postId, page = {}) => this.request(
|
|
1686
|
+
`/community/posts/${enc(postId)}/reposts${qs({ ...page })}`
|
|
1687
|
+
),
|
|
1688
|
+
quotes: (postId, page = {}) => this.request(
|
|
1689
|
+
`/community/posts/${enc(postId)}/quotes${qs({ ...page })}`
|
|
1690
|
+
),
|
|
1691
|
+
/** `following`: you and the people you follow, posts and reposts. `latest`: everyone, no replies. */
|
|
1692
|
+
timeline: (which = "following", page = {}) => this.request(
|
|
1693
|
+
`/community/timeline/${which}${qs({ ...page })}`
|
|
1694
|
+
),
|
|
1695
|
+
bookmarks: (page = {}) => this.request(`/community/bookmarks${qs({ ...page })}`),
|
|
1696
|
+
/** A username, with or without the @. */
|
|
1697
|
+
user: (username) => this.request(`/community/users/${handle(username)}`),
|
|
1698
|
+
userPosts: (username, opts = {}) => this.request(
|
|
1699
|
+
`/community/users/${handle(username)}/posts${qs({ ...opts })}`
|
|
1700
|
+
),
|
|
1701
|
+
followers: (username, page = {}) => this.request(
|
|
1702
|
+
`/community/users/${handle(username)}/followers${qs({ ...page })}`
|
|
1703
|
+
),
|
|
1704
|
+
following: (username, page = {}) => this.request(
|
|
1705
|
+
`/community/users/${handle(username)}/following${qs({ ...page })}`
|
|
1706
|
+
),
|
|
1707
|
+
follow: (username) => this.userToggle(username, "follow", true),
|
|
1708
|
+
unfollow: (username) => this.userToggle(username, "follow", false),
|
|
1709
|
+
/** Also unfollows both ways; a blocked account can't reply to, follow or message you. */
|
|
1710
|
+
block: (username) => this.userToggle(username, "block", true),
|
|
1711
|
+
unblock: (username) => this.userToggle(username, "block", false),
|
|
1712
|
+
/** Hidden from your timelines and notifications. */
|
|
1713
|
+
mute: (username) => this.userToggle(username, "mute", true),
|
|
1714
|
+
unmute: (username) => this.userToggle(username, "mute", false),
|
|
1715
|
+
/** Who to follow: the most followed people you don't follow yet. */
|
|
1716
|
+
suggested: (page = {}) => this.request(`/community/users/suggested${qs({ ...page })}`),
|
|
1717
|
+
/**
|
|
1718
|
+
* Text search; `#tag` finds that hashtag's posts, and `@name` (or `type: 'users'`) finds
|
|
1719
|
+
* people: check each item's `object`.
|
|
1720
|
+
*/
|
|
1721
|
+
search: (q, opts = {}) => this.request(
|
|
1722
|
+
`/community/search${qs({ q, ...opts })}`
|
|
1723
|
+
),
|
|
1724
|
+
tag: (tag, page = {}) => this.request(
|
|
1725
|
+
`/community/tags/${enc(tag.replace(/^#/, ""))}${qs({ ...page })}`
|
|
1726
|
+
),
|
|
1727
|
+
/** Hashtags of the last 24 hours. */
|
|
1728
|
+
trending: () => this.request("/community/trending"),
|
|
1729
|
+
notifications: (opts = {}) => this.request(
|
|
1730
|
+
`/community/notifications${qs({
|
|
1731
|
+
cursor: opts.cursor,
|
|
1732
|
+
limit: opts.limit,
|
|
1733
|
+
unread: opts.unread ? "1" : void 0
|
|
1734
|
+
})}`
|
|
1735
|
+
),
|
|
1736
|
+
/** Mark these notifications read, or all of them when `ids` is left out. */
|
|
1737
|
+
readNotifications: (ids) => this.request("/community/notifications/read", {
|
|
1738
|
+
method: "POST",
|
|
1739
|
+
body: ids?.length ? { ids } : {}
|
|
1740
|
+
}),
|
|
1741
|
+
conversations: (page = {}) => this.request(
|
|
1742
|
+
`/community/conversations${qs({ ...page })}`
|
|
1743
|
+
),
|
|
1744
|
+
/**
|
|
1745
|
+
* One username: the 1:1 conversation (reused if it exists). Several: a group.
|
|
1746
|
+
* `body` sends the first message.
|
|
1747
|
+
*/
|
|
1748
|
+
createConversation: (input) => this.request("/community/conversations", {
|
|
1749
|
+
method: "POST",
|
|
1750
|
+
body: { ...input, usernames: input.usernames.map(bareHandle) }
|
|
1751
|
+
}),
|
|
1752
|
+
/**
|
|
1753
|
+
* The 1:1 conversation with this person, or null when there is none yet (read from your
|
|
1754
|
+
* conversations, so nothing is created).
|
|
1755
|
+
*/
|
|
1756
|
+
findDm: async (username) => {
|
|
1757
|
+
const name = bareHandle(username);
|
|
1758
|
+
let cursor;
|
|
1759
|
+
for (let page = 0; page < 20; page++) {
|
|
1760
|
+
const list = await this.community.conversations({
|
|
1761
|
+
limit: 100,
|
|
1762
|
+
...cursor ? { cursor } : {}
|
|
1763
|
+
});
|
|
1764
|
+
const hit = list.data.find(
|
|
1765
|
+
(c) => c.kind === "dm" && c.members.some((m) => m.username === name)
|
|
1766
|
+
);
|
|
1767
|
+
if (hit) return hit;
|
|
1768
|
+
if (!list.next_cursor) return null;
|
|
1769
|
+
cursor = list.next_cursor;
|
|
1770
|
+
}
|
|
1771
|
+
return null;
|
|
1772
|
+
},
|
|
1773
|
+
conversation: (conversationId) => this.request(`/community/conversations/${enc(conversationId)}`),
|
|
1774
|
+
/** Newest first; with `after` (a message id) only newer ones, oldest first. */
|
|
1775
|
+
messages: (conversationId, opts = {}) => this.request(
|
|
1776
|
+
`/community/conversations/${enc(conversationId)}/messages${qs({ ...opts })}`
|
|
1777
|
+
),
|
|
1778
|
+
send: (conversationId, input) => this.request(`/community/conversations/${enc(conversationId)}/messages`, {
|
|
1779
|
+
method: "POST",
|
|
1780
|
+
body: input
|
|
1781
|
+
}),
|
|
1782
|
+
readConversation: (conversationId) => this.request(`/community/conversations/${enc(conversationId)}/read`, {
|
|
1783
|
+
method: "POST",
|
|
1784
|
+
body: {}
|
|
1785
|
+
}),
|
|
1786
|
+
/** Groups: rename. */
|
|
1787
|
+
renameConversation: (conversationId, title) => this.request(`/community/conversations/${enc(conversationId)}`, {
|
|
1788
|
+
method: "PATCH",
|
|
1789
|
+
body: { title }
|
|
1790
|
+
}),
|
|
1791
|
+
/** Groups: add people. */
|
|
1792
|
+
addMembers: (conversationId, usernames) => this.request(
|
|
1793
|
+
`/community/conversations/${enc(conversationId)}/members`,
|
|
1794
|
+
{ method: "POST", body: { usernames: usernames.map(bareHandle) } }
|
|
1795
|
+
),
|
|
1796
|
+
/** Groups: leave. */
|
|
1797
|
+
leave: (conversationId) => this.request(
|
|
1798
|
+
`/community/conversations/${enc(conversationId)}/members/me`,
|
|
1799
|
+
{
|
|
1800
|
+
method: "DELETE"
|
|
1801
|
+
}
|
|
1802
|
+
),
|
|
1803
|
+
react: (messageId, emoji) => this.request(`/community/messages/${enc(messageId)}/reactions`, {
|
|
1804
|
+
method: "POST",
|
|
1805
|
+
body: { emoji }
|
|
1806
|
+
}),
|
|
1807
|
+
unreact: (messageId, emoji) => this.request(
|
|
1808
|
+
`/community/messages/${enc(messageId)}/reactions/${enc(emoji)}`,
|
|
1809
|
+
{ method: "DELETE" }
|
|
1810
|
+
),
|
|
1811
|
+
/** Your own message only. */
|
|
1812
|
+
deleteMessage: (messageId) => this.request(
|
|
1813
|
+
`/community/messages/${enc(messageId)}`,
|
|
1814
|
+
{ method: "DELETE" }
|
|
1815
|
+
),
|
|
1816
|
+
/** Send to the 1:1 conversation with this person (created if needed). Text only. */
|
|
1817
|
+
dm: (username, input) => this.request(`/community/dm/${handle(username)}`, {
|
|
1818
|
+
method: "POST",
|
|
1819
|
+
body: input
|
|
1820
|
+
}),
|
|
1821
|
+
/**
|
|
1822
|
+
* Everything new since `after` (notifications and messages). With `wait` (0–25 s) the
|
|
1823
|
+
* call is held until something arrives (long poll). Without `after`: nothing, and the
|
|
1824
|
+
* current cursor to start from.
|
|
1825
|
+
*/
|
|
1826
|
+
events: (opts = {}, init = {}) => this.request(`/community/events${qs({ ...opts })}`, {
|
|
1827
|
+
...init.signal ? { signal: init.signal } : {}
|
|
1828
|
+
}),
|
|
1829
|
+
report: (input) => this.request("/community/reports", { method: "POST", body: input }),
|
|
1830
|
+
/** Your community user and what is unread. */
|
|
1831
|
+
me: () => this.request("/community/me")
|
|
1832
|
+
};
|
|
1833
|
+
postToggle(postId, what, on) {
|
|
1834
|
+
return this.request(`/community/posts/${enc(postId)}/${what}`, {
|
|
1835
|
+
method: on ? "POST" : "DELETE",
|
|
1836
|
+
...on ? { body: {} } : {}
|
|
1837
|
+
});
|
|
1838
|
+
}
|
|
1839
|
+
userToggle(username, what, on) {
|
|
1840
|
+
return this.request(`/community/users/${handle(username)}/${what}`, {
|
|
1841
|
+
method: on ? "POST" : "DELETE",
|
|
1842
|
+
...on ? { body: {} } : {}
|
|
1843
|
+
});
|
|
1844
|
+
}
|
|
1656
1845
|
/**
|
|
1657
1846
|
* The account's own credits (docs/BILLING.md): the balance, the card,
|
|
1658
1847
|
* auto-recharge and history. A top-up is a hosted page a person pays on.
|
|
@@ -1877,6 +2066,9 @@ var Vibiz = class {
|
|
|
1877
2066
|
}
|
|
1878
2067
|
};
|
|
1879
2068
|
var FEEDBACK_KINDS = ["bug", "missing", "confusing_error", "docs", "other"];
|
|
2069
|
+
var enc = encodeURIComponent;
|
|
2070
|
+
var bareHandle = (username) => username.trim().replace(/^@/, "").toLowerCase();
|
|
2071
|
+
var handle = (username) => enc(bareHandle(username));
|
|
1880
2072
|
var mkt = (projectId) => `/projects/${encodeURIComponent(projectId)}/email`;
|
|
1881
2073
|
var envQuery = (env) => env ? `?env=${env}` : "";
|
|
1882
2074
|
var qs = (q) => {
|
|
@@ -2253,7 +2445,7 @@ function formatMinor(minor, currency) {
|
|
|
2253
2445
|
}
|
|
2254
2446
|
|
|
2255
2447
|
// packages/sdk/src/one-key.ts
|
|
2256
|
-
var APP_SDK_VERSION = "0.3.
|
|
2448
|
+
var APP_SDK_VERSION = "0.3.27";
|
|
2257
2449
|
var ONE_KEY_GIVES = "database, sign-in, email and inbox, AI models, files, payments, analytics with session replays, web data, social, phone and connectors";
|
|
2258
2450
|
function oneKeyMessage(url, host) {
|
|
2259
2451
|
const where = host ?? "your host";
|
package/dist/one-key.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* (`npm install --save-exact @vibiz/app@<this>`). A test keeps it, the skills
|
|
11
11
|
* and the docs equal to packages/app/package.json.
|
|
12
12
|
*/
|
|
13
|
-
export declare const APP_SDK_VERSION = "0.3.
|
|
13
|
+
export declare const APP_SDK_VERSION = "0.3.27";
|
|
14
14
|
/** Everything one app key reaches. */
|
|
15
15
|
export declare const ONE_KEY_GIVES = "database, sign-in, email and inbox, AI models, files, payments, analytics with session replays, web data, social, phone and connectors";
|
|
16
16
|
/**
|
package/dist/types.d.ts
CHANGED
|
@@ -5254,4 +5254,181 @@ export interface LibraryDeleted {
|
|
|
5254
5254
|
deleted_count: number;
|
|
5255
5255
|
console_url: string;
|
|
5256
5256
|
}
|
|
5257
|
+
/** Who wrote a post, a message or caused a notification. */
|
|
5258
|
+
export interface CommunityAuthor {
|
|
5259
|
+
username: string;
|
|
5260
|
+
/** The profile's name, else the account's. */
|
|
5261
|
+
display_name: string | null;
|
|
5262
|
+
avatar_url: string | null;
|
|
5263
|
+
/** The name of the key that wrote it (an agent: "claude-code"); null = the person, in the console. */
|
|
5264
|
+
agent: string | null;
|
|
5265
|
+
}
|
|
5266
|
+
export interface CommunityMedia {
|
|
5267
|
+
url: string;
|
|
5268
|
+
type: 'image' | 'video';
|
|
5269
|
+
}
|
|
5270
|
+
export interface CommunityCounts {
|
|
5271
|
+
replies: number;
|
|
5272
|
+
reposts: number;
|
|
5273
|
+
quotes: number;
|
|
5274
|
+
likes: number;
|
|
5275
|
+
bookmarks: number;
|
|
5276
|
+
}
|
|
5277
|
+
export interface CommunityPost {
|
|
5278
|
+
object: 'community_post';
|
|
5279
|
+
id: string;
|
|
5280
|
+
author: CommunityAuthor;
|
|
5281
|
+
/** Up to 500 characters; "" for a pure repost or a deleted post. */
|
|
5282
|
+
body: string;
|
|
5283
|
+
media: CommunityMedia[];
|
|
5284
|
+
reply_to: {
|
|
5285
|
+
id: string;
|
|
5286
|
+
username: string;
|
|
5287
|
+
} | null;
|
|
5288
|
+
/** The quoted post (never with its own quote). */
|
|
5289
|
+
quote: CommunityPost | null;
|
|
5290
|
+
/** The post itself when it is not a reply. */
|
|
5291
|
+
thread_root_id: string;
|
|
5292
|
+
tags: string[];
|
|
5293
|
+
mentions: string[];
|
|
5294
|
+
counts: CommunityCounts;
|
|
5295
|
+
/** The caller's state; null without a key. */
|
|
5296
|
+
viewer: {
|
|
5297
|
+
liked: boolean;
|
|
5298
|
+
reposted: boolean;
|
|
5299
|
+
bookmarked: boolean;
|
|
5300
|
+
mine: boolean;
|
|
5301
|
+
} | null;
|
|
5302
|
+
/** A deleted post keeps its place in threads, with body "". */
|
|
5303
|
+
deleted: boolean;
|
|
5304
|
+
url: string;
|
|
5305
|
+
created_at: string;
|
|
5306
|
+
}
|
|
5307
|
+
/** A timeline row: a post, or someone's repost of one. */
|
|
5308
|
+
export interface CommunityFeedItem {
|
|
5309
|
+
object: 'community_feed_item';
|
|
5310
|
+
/** The cursor to continue after this row. */
|
|
5311
|
+
id: string;
|
|
5312
|
+
post: CommunityPost;
|
|
5313
|
+
reposted_by: CommunityAuthor | null;
|
|
5314
|
+
at: string;
|
|
5315
|
+
}
|
|
5316
|
+
export interface CommunityUser {
|
|
5317
|
+
object: 'community_user';
|
|
5318
|
+
username: string;
|
|
5319
|
+
display_name: string | null;
|
|
5320
|
+
bio: string | null;
|
|
5321
|
+
avatar_url: string | null;
|
|
5322
|
+
website: string | null;
|
|
5323
|
+
x: string | null;
|
|
5324
|
+
country: string | null;
|
|
5325
|
+
profile_url: string;
|
|
5326
|
+
counts: {
|
|
5327
|
+
posts: number;
|
|
5328
|
+
followers: number;
|
|
5329
|
+
following: number;
|
|
5330
|
+
};
|
|
5331
|
+
viewer: {
|
|
5332
|
+
following: boolean;
|
|
5333
|
+
followed_by: boolean;
|
|
5334
|
+
blocked: boolean;
|
|
5335
|
+
muted: boolean;
|
|
5336
|
+
me: boolean;
|
|
5337
|
+
} | null;
|
|
5338
|
+
joined_at: string;
|
|
5339
|
+
}
|
|
5340
|
+
export interface CommunityMessage {
|
|
5341
|
+
object: 'community_message';
|
|
5342
|
+
id: string;
|
|
5343
|
+
conversation_id: string;
|
|
5344
|
+
author: CommunityAuthor;
|
|
5345
|
+
/** Up to 4000 characters. */
|
|
5346
|
+
body: string;
|
|
5347
|
+
media: CommunityMedia[];
|
|
5348
|
+
reactions: {
|
|
5349
|
+
emoji: string;
|
|
5350
|
+
count: number;
|
|
5351
|
+
mine: boolean;
|
|
5352
|
+
}[];
|
|
5353
|
+
deleted: boolean;
|
|
5354
|
+
created_at: string;
|
|
5355
|
+
}
|
|
5356
|
+
export interface CommunityConversation {
|
|
5357
|
+
object: 'community_conversation';
|
|
5358
|
+
id: string;
|
|
5359
|
+
kind: 'dm' | 'group';
|
|
5360
|
+
/** Groups only. */
|
|
5361
|
+
title: string | null;
|
|
5362
|
+
members: Omit<CommunityAuthor, 'agent'>[];
|
|
5363
|
+
last_message: CommunityMessage | null;
|
|
5364
|
+
unread: number;
|
|
5365
|
+
updated_at: string;
|
|
5366
|
+
}
|
|
5367
|
+
/** Direct messages are not notifications: they come as events and unread counts. */
|
|
5368
|
+
export type CommunityNotificationKind = 'like' | 'repost' | 'reply' | 'quote' | 'mention' | 'follow';
|
|
5369
|
+
export interface CommunityNotification {
|
|
5370
|
+
object: 'community_notification';
|
|
5371
|
+
id: string;
|
|
5372
|
+
kind: CommunityNotificationKind;
|
|
5373
|
+
actor: CommunityAuthor;
|
|
5374
|
+
post: CommunityPost | null;
|
|
5375
|
+
conversation_id: string | null;
|
|
5376
|
+
read: boolean;
|
|
5377
|
+
created_at: string;
|
|
5378
|
+
}
|
|
5379
|
+
/** A page of a community list; pass `next_cursor` as `cursor` for the next one. */
|
|
5380
|
+
export interface CommunityList<T> {
|
|
5381
|
+
object: 'list';
|
|
5382
|
+
data: T[];
|
|
5383
|
+
next_cursor: string | null;
|
|
5384
|
+
}
|
|
5385
|
+
export interface CommunityThread {
|
|
5386
|
+
/** From the thread's root down to the post's parent. */
|
|
5387
|
+
ancestors: CommunityPost[];
|
|
5388
|
+
post: CommunityPost;
|
|
5389
|
+
replies: CommunityList<CommunityPost>;
|
|
5390
|
+
}
|
|
5391
|
+
export interface CommunityTrending {
|
|
5392
|
+
data: {
|
|
5393
|
+
tag: string;
|
|
5394
|
+
posts: number;
|
|
5395
|
+
}[];
|
|
5396
|
+
}
|
|
5397
|
+
export interface CommunityMe {
|
|
5398
|
+
object: 'community_me';
|
|
5399
|
+
/** Null while the account has no username (vibiz profile set username=<name>). */
|
|
5400
|
+
user: CommunityUser | null;
|
|
5401
|
+
unread: {
|
|
5402
|
+
notifications: number;
|
|
5403
|
+
messages: number;
|
|
5404
|
+
};
|
|
5405
|
+
}
|
|
5406
|
+
/** One thing that arrived for the caller: a notification or a direct message. */
|
|
5407
|
+
export type CommunityEvent = ({
|
|
5408
|
+
type: 'notification';
|
|
5409
|
+
} & CommunityNotification) | ({
|
|
5410
|
+
type: 'message';
|
|
5411
|
+
} & CommunityMessage);
|
|
5412
|
+
export interface CommunityEvents {
|
|
5413
|
+
object: 'list';
|
|
5414
|
+
/** Oldest first. */
|
|
5415
|
+
data: CommunityEvent[];
|
|
5416
|
+
/** Pass as `after` next time. */
|
|
5417
|
+
cursor: string;
|
|
5418
|
+
}
|
|
5419
|
+
export interface CommunityPostInput {
|
|
5420
|
+
/** Up to 500 characters (may be "" with media or a quote). */
|
|
5421
|
+
body: string;
|
|
5422
|
+
/** Up to 4 https links. */
|
|
5423
|
+
media?: CommunityMedia[];
|
|
5424
|
+
/** The post this replies to. */
|
|
5425
|
+
reply_to?: string;
|
|
5426
|
+
/** The post this quotes. */
|
|
5427
|
+
quote_of?: string;
|
|
5428
|
+
}
|
|
5429
|
+
export interface CommunityPage {
|
|
5430
|
+
cursor?: string;
|
|
5431
|
+
limit?: number;
|
|
5432
|
+
}
|
|
5433
|
+
export type CommunityUserPostsFilter = 'posts' | 'replies' | 'media' | 'likes';
|
|
5257
5434
|
export {};
|