import { RpcMethod } from './commonTypes'; export type EmailCategoriesService_Create = RpcMethod; export type EmailCategoriesService_CreateMany = RpcMethod; export type EmailCategoriesService_Get = RpcMethod; export type EmailCategoriesService_Update = RpcMethod; export type EmailCategoriesService_Delete = RpcMethod; export type EmailCategoriesService_List = RpcMethod; export type EmailCategoriesService_Enable = RpcMethod; export type EmailCategoriesService_Info = RpcMethod; export interface EmailCategoriesService { /** Creates one email subscription category for an application (max 20 per app), optionally back-subscribing existing recipients. Use create_email_categories to add several at once. */ Create: EmailCategoriesService_Create; /** Creates several email subscription categories for an application in one call, rejecting duplicate or existing names and enforcing the 20-per-app limit. Use create_email_category to add just one. */ CreateMany: EmailCategoriesService_CreateMany; /** Returns a single email subscription category by its category code. Use after list_email_categories to inspect one category's name, description and subscribe settings. */ Get: EmailCategoriesService_Get; /** Updates an email subscription category (name, description, subscribe_new/subscribe_old flags) by category code, overwriting the current values. Enabling subscribe_old back-subscribes existing recipients. */ Update: EmailCategoriesService_Update; /** Soft-deletes an email subscription category by category code so it no longer applies to the application. Deleting an already-deleted or unknown category is a no-op success. */ Delete: EmailCategoriesService_Delete; /** Lists all email subscription categories for an application plus whether the feature is enabled and available. Use to browse categories or find a category code. */ List: EmailCategoriesService_List; /** Enables or disables the email categories feature for an application by setting an application property. Pass value=true to turn it on, value=false to turn it off; setting the current value again is a no-op. */ Enable: EmailCategoriesService_Enable; /** Returns per-category subscribed-user counts for an application plus the progress of the back-subscribe (subscribe_old) background job. Use to see how many recipients are subscribed to each email category. */ Info: EmailCategoriesService_Info; } export type Category = { /** Email category code */ code: string; /** Application code XXXXX-XXXXX */ application: string; /** Category display name (unique within the application) */ name: string; description: string; /** Auto-subscribe newly registered email recipients to this category */ subscribeNew: boolean; /** Back-subscribe existing email recipients to this category */ subscribeOld: boolean; subscribeOldUpdated: Date; }; export type CreateRequest = { /** Application code XXXXX-XXXXX */ application?: string; /** Category display name (unique within the application) */ name?: string; description?: string; /** Auto-subscribe newly registered email recipients to this category */ subscribeNew?: boolean; /** Back-subscribe existing email recipients to this category */ subscribeOld?: boolean; }; export type CreateResponse = { category: Category; }; export type CreateManyRequest = { /** Application code XXXXX-XXXXX */ application?: string; /** Categories to create; names must be unique and not already exist */ categories?: Category[]; }; export type CreateManyResponse = { categories: Category[]; }; export type GetRequest = { /** Email category code */ code?: string; }; export type GetResponse = { category: Category; }; export type UpdateRequest = { /** Email category code */ code?: string; /** Category display name (unique within the application) */ name?: string; description?: string; /** Auto-subscribe newly registered email recipients to this category */ subscribeNew?: boolean; /** Back-subscribe existing email recipients to this category */ subscribeOld?: boolean; }; export type UpdateResponse = {}; export type DeleteRequest = { /** Email category code */ code?: string; }; export type DeleteResponse = {}; /** only 20 categories is allowed per application */ export type ListRequest = { /** Application code XXXXX-XXXXX */ application?: string; }; export type ListResponse = { categories: Category[]; isEnabled: boolean; isAvailable: boolean; }; export type EnableRequest = { /** Application code XXXXX-XXXXX */ application?: string; /** true to enable the email categories feature, false to disable */ value?: boolean; }; export type EnableResponse = {}; export type InfoRequest = { /** Application code XXXXX-XXXXX */ application?: string; }; export type InfoResponse = { subscribedUsers: Record; isSubscribeOldInProgress: boolean; subscribeOldInProgressPercent: number; };