Vintage RPC メソッド
VintageWorker は連絡先・グループ・ラベル・ブラックリスト管理を担当するサービスです。WorkerEntrypoint<Env> を継承し、37の RPC メソッドを公開します。
連絡先 CRUD
Section titled “連絡先 CRUD”listContacts
Section titled “listContacts”連絡先一覧をカーソルページネーションで取得します。各種フィルタリングに対応。
async listContacts(params: { readonly shopId: string; readonly index?: string; readonly userType?: string; readonly tag?: string; readonly groupId?: string; readonly search?: string; readonly cursor?: string; readonly limit?: number;}): Promise<{ readonly contacts: readonly Contact[]; readonly nextCursor: string | null; readonly hasMore: boolean;}>getContact
Section titled “getContact”連絡先の詳細を取得します。purelovers 情報、チャットNG状態、マージ候補を含みます。
async getContact(params: { readonly id: string; readonly shopId: string;}): Promise<{ readonly contact: ContactDetail }>getContactAvatar
Section titled “getContactAvatar”連絡先のアバター画像を取得します。
async getContactAvatar(params: { readonly id: string; readonly shopId: string;}): Promise<{ readonly image: string | null; readonly isPurelovers: boolean;}>getContactTags
Section titled “getContactTags”店舗の全連絡先で使用されているタグ一覧を取得します。
async getContactTags(params: { readonly shopId: string;}): Promise<{ readonly tags: readonly string[] }>createContact
Section titled “createContact”連絡先を作成します。purelovers 未連携の場合は自動的に NO_PURELOVERS_USER チャットNG を設定します。
async createContact(params: { readonly shopId: string; readonly name: string; readonly index: string; readonly phones?: readonly string[]; readonly emails?: readonly string[]; readonly tags?: readonly string[]; readonly userType: string; readonly groupIds?: readonly string[]; readonly memo?: string;}): Promise<{ readonly contact: Contact }>updateContact
Section titled “updateContact”連絡先を更新します。
async updateContact(params: { readonly id: string; readonly shopId: string; readonly name?: string; readonly index?: string; readonly memo?: string; readonly phones?: readonly string[]; readonly emails?: readonly string[]; readonly tags?: readonly string[]; readonly userType?: string; readonly groupIds?: readonly string[];}): Promise<{ readonly contact: Contact }>deleteContact
Section titled “deleteContact”連絡先を削除します。
async deleteContact(params: { readonly id: string; readonly shopId: string;}): Promise<{ readonly success: boolean }>mergeContacts
Section titled “mergeContacts”2つの連絡先をマージします。電話番号・メール・タグ・グループ・メモが統合されます。
async mergeContacts(params: { readonly id: string; readonly targetContactId: string; readonly shopId: string;}): Promise<{ readonly contact: Contact }>グループ操作
Section titled “グループ操作”addContactToGroup / removeContactFromGroup
Section titled “addContactToGroup / removeContactFromGroup”連絡先をグループに追加/削除します。
async addContactToGroup(params: { readonly id: string; readonly groupId: string; readonly shopId: string;}): Promise<{ readonly success: boolean; readonly groupIds: readonly string[] }>
async removeContactFromGroup(params: { readonly id: string; readonly groupId: string; readonly shopId: string;}): Promise<{ readonly success: boolean; readonly groupIds: readonly string[] }>チャットNG
Section titled “チャットNG”updateContactChatNg
Section titled “updateContactChatNg”連絡先のチャットNGステータスを更新/作成し、履歴を記録します。
async updateContactChatNg(params: { readonly id: string; readonly shopId: string; readonly ngType: string; readonly isActive: boolean; readonly reason?: string;}): Promise<{ readonly chatNg: ContactChatNg }>getContactChatNgHistory
Section titled “getContactChatNgHistory”チャットNGの変更履歴を取得します。
async getContactChatNgHistory(params: { readonly id: string; readonly shopId: string;}): Promise<{ readonly history: readonly ChatNgHistory[] }>グループ管理(KV Storage)
Section titled “グループ管理(KV Storage)”グループ定義は KV (CONTACT_GROUPS) に保存されます。
listGroups / getGroup
Section titled “listGroups / getGroup”async listGroups(params: { readonly shopId: string }): Promise<{ readonly groups: readonly Group[] }>async getGroup(params: { readonly id: string; readonly shopId: string }): Promise<{ readonly group: Group }>createGroup
Section titled “createGroup”async createGroup(params: { readonly shopId: string; readonly name: string; readonly icon: string; readonly color: string; readonly textColor?: string; readonly criteria?: Record<string, unknown>; readonly order: number;}): Promise<{ readonly group: Group }>updateGroup
Section titled “updateGroup”async updateGroup(params: { readonly id: string; readonly shopId: string; readonly name?: string; readonly icon?: string; readonly color?: string; readonly textColor?: string; readonly criteria?: Record<string, unknown>; readonly order?: number;}): Promise<{ readonly group: Group }>deleteGroup
Section titled “deleteGroup”async deleteGroup(params: { readonly id: string; readonly shopId: string }): Promise<{ readonly success: boolean }>reorderGroups
Section titled “reorderGroups”async reorderGroups(params: { readonly shopId: string; readonly groupIds: readonly string[];}): Promise<{ readonly success: boolean }>listLabels
Section titled “listLabels”async listLabels(params: { readonly shopId: string }): Promise<{ readonly labels: readonly Label[] }>createLabel
Section titled “createLabel”ラベルを作成または更新(UPSERT)します。
async createLabel(params: { readonly id: string; readonly shopId: string; readonly name: string; readonly color?: string; readonly description?: string; readonly logic?: 'AND' | 'OR'; readonly tags?: readonly string[]; readonly labels?: readonly string[];}): Promise<{ readonly label: Label }>deleteLabel
Section titled “deleteLabel”async deleteLabel(params: { readonly id: string; readonly shopId: string }): Promise<{ readonly success: boolean }>チャットルーム(Vintage 経由)
Section titled “チャットルーム(Vintage 経由)”Vintage は独自のチャットルーム操作メソッドも持ちます。Fizz のチャットとは独立して、連絡先管理の文脈でチャットデータにアクセスします。
listChatRooms / getChatRoom / createChatRoom
Section titled “listChatRooms / getChatRoom / createChatRoom”async listChatRooms(params: { readonly shopId: string; readonly userId: string; readonly userType: string; readonly cursor?: string; readonly limit?: number }): Promise<PaginatedResult>async getChatRoom(params: { readonly roomId: string }): Promise<{ readonly chatRoom: ChatRoom }>async createChatRoom(params: { readonly shopId: string; readonly contactId: string }): Promise<{ readonly chatRoom: ChatRoom }>sendMessage / getMessages / markAsRead
Section titled “sendMessage / getMessages / markAsRead”async sendMessage(params: { readonly roomId: string; readonly senderId: string; readonly senderType: string; readonly content: string; readonly messageType?: string; readonly displayDays?: number; readonly metadata?: Record<string, unknown> }): Promise<{ readonly message: ChatMessage }>async getMessages(params: { readonly roomId: string; readonly cursor?: string; readonly limit?: number }): Promise<PaginatedResult>async markAsRead(params: { readonly roomId: string; readonly userId: string; readonly userType: string }): Promise<{ readonly success: boolean; readonly lastReadAt: Date }>broadcastMessages
Section titled “broadcastMessages”指定した連絡先リストにメッセージを一括送信します。
async broadcastMessages(params: { readonly shopId: string; readonly content: string; readonly contactIds: readonly string[]; readonly messageType?: string; readonly displayDays?: number;}): Promise<{ readonly success: boolean; readonly sentCount: number; readonly sentAt: string;}>deleteChatRoom
Section titled “deleteChatRoom”async deleteChatRoom(params: { readonly roomId: string }): Promise<{ readonly success: boolean }>ドメインブラックリスト
Section titled “ドメインブラックリスト”listDomainBlacklist
Section titled “listDomainBlacklist”店舗固有とグローバルの両方のブラックリストを返します。
async listDomainBlacklist(params: { readonly shopId: string;}): Promise<{ readonly domains: readonly DomainBlacklist[]; readonly globalDomains: readonly GlobalDomainBlacklist[];}>createDomainBlacklist / deleteDomainBlacklist
Section titled “createDomainBlacklist / deleteDomainBlacklist”async createDomainBlacklist(params: { readonly shopId: string; readonly domain: string; readonly createdBy: string }): Promise<{ readonly domain: DomainBlacklist }>async deleteDomainBlacklist(params: { readonly id: string; readonly shopId: string }): Promise<{ readonly success: boolean }>listGlobalDomainBlacklist / createGlobalDomainBlacklist / deleteGlobalDomainBlacklist
Section titled “listGlobalDomainBlacklist / createGlobalDomainBlacklist / deleteGlobalDomainBlacklist”async listGlobalDomainBlacklist(): Promise<{ readonly domains: readonly GlobalDomainBlacklist[] }>async createGlobalDomainBlacklist(params: { readonly domain: string; readonly reason?: string; readonly createdBy: string }): Promise<{ readonly domain: GlobalDomainBlacklist }>async deleteGlobalDomainBlacklist(params: { readonly id: string }): Promise<{ readonly success: boolean }>getShop
Section titled “getShop”async getShop(params: { readonly shopId: string }): Promise<{ readonly shop: Shop }>updateWelcomeMessage
Section titled “updateWelcomeMessage”async updateWelcomeMessage(params: { readonly shopId: string; readonly welcomeMessage: string | null;}): Promise<{ readonly success: boolean }>