import { RpcMethod } from './commonTypes'; import { FilterExpression as pushwoosh_objects_filters_v1_FilterExpression } from './pushwoosh_objects_filters_v1'; export type InAppMessagesService_List = RpcMethod; export type InAppMessagesService_Get = RpcMethod; export type InAppMessagesService_Delete = RpcMethod; export type InAppMessagesService_Create = RpcMethod; export type InAppMessagesService_Update = RpcMethod; export type InAppMessagesService_Stop = RpcMethod; export type InAppMessagesService_Publish = RpcMethod; export interface InAppMessagesService { /** Lists in-app messages for an application (format XXXXX-XXXXX), newest first, with paging, name/code search and an optional status filter. Use to browse in-app messages or find an in-app message code before fetching, editing or publishing one. */ List: InAppMessagesService_List; /** Returns a single in-app message by its code, including status, schedule, rich media, segment and tag/event/trigger filter expressions. Use after list_inapp_messages to inspect one in-app message. */ Get: InAppMessagesService_Get; /** Permanently deletes an in-app message by code within an application (format XXXXX-XXXXX), removing its record entirely. Use disable_inapp_message instead to stop an active one while keeping it. */ Delete: InAppMessagesService_Delete; /** Creates a new in-app message (a draft, or active when action is PUBLISH) with rich media, segment, schedule and trigger filter expression, returning its generated code. Use to add a new in-app message; use update_inapp_message to edit an existing one. */ Create: InAppMessagesService_Create; /** Updates an existing in-app message by code, overwriting name, rich media, segment, schedule and filter expressions and, per action, saving it as a draft or publishing it. Use to edit an in-app message; use create_inapp_message to add a new one. */ Update: InAppMessagesService_Update; /** Deactivates an active in-app message by code, setting its status to stopped so it no longer shows to devices. Reversible with enable_inapp_message; use delete_inapp_message to remove it entirely. */ Stop: InAppMessagesService_Stop; /** Activates a draft in-app message by code after validating it has a name, a trigger filter expression and rich media. Use to publish a prepared draft; the reverse is disable_inapp_message. */ Publish: InAppMessagesService_Publish; } export type ListInappMessagesRequest_OrderBy = 'CREATED' | 'NAME' | 'UPDATED'; export type ListInappMessagesRequest_OrderDirection = 'DESC' | 'ASC'; export type ListInappMessagesRequest = { /** Application code (format XXXXX-XXXXX) whose in-app messages to list. */ application?: string; /** Free-text search over in-app message name and code. */ search?: string; page?: number; perPage?: number; orderBy?: ListInappMessagesRequest_OrderBy; orderDirection?: ListInappMessagesRequest_OrderDirection; /** Restrict to these statuses; empty means all. */ statuses?: Inapp_Status[]; }; export type Inapp_Status = 'UNDEFINED' | 'ACTIVE' | 'SCHEDULED' | 'COMPLETED' | 'DRAFT' | 'STOPPED'; export type Inapp_MessageType = 'UNKNOWN' | 'MARKETING' | 'TRANSACTIONAL'; export type Inapp = { code: string; name: string; description: string; status: Inapp_Status; required: boolean; startDate: Date; endDate: Date; updated: Date; filterName: string; filterCode: string; segment: string; priority: number; richMediaCode: string; richMediaName: string; totalTriggered: number; impressions: number; interactions: number; audience: number; timezone: string; globalCappingEnabled: boolean; messageType: Inapp_MessageType; tagFilterExpression: pushwoosh_objects_filters_v1_FilterExpression; eventFilterExpression: pushwoosh_objects_filters_v1_FilterExpression; triggerFilterExpression: pushwoosh_objects_filters_v1_FilterExpression; }; export type ListInappMessagesResponse = { inapps: Inapp[]; page: number; perPage: number; totalPages: number; totalInappMessages: number; }; export type GetInappMessageRequest = { /** In-app message code of the message to fetch. */ code?: string; }; export type GetInappMessageResponse = { inapp: Inapp; }; export type DeleteInappMessageRequest = { /** In-app message code of the message to delete. */ code?: string; /** Application code (format XXXXX-XXXXX) the in-app message belongs to. */ application?: string; }; export type DeleteInappMessageResponse = {}; export type CreateInappRequest_Action = 'SAVE_DRAFT' | 'PUBLISH'; /** Create - create new inapp (draft or active based on action) */ export type CreateInappRequest = { /** Application code (format XXXXX-XXXXX) to create the in-app message in. */ application?: string; /** SAVE_DRAFT keeps it as a draft; PUBLISH creates it active and requires rich_media_code and trigger_filter_expression. */ action?: CreateInappRequest_Action; name?: string; description?: string; required?: boolean; /** Rich media code holding the in-app content; required for PUBLISH. */ richMediaCode?: string; /** Segment filter name to target (alternative to filter_code). */ filterName?: string; /** Segment filter code to target (alternative to filter_name). */ filterCode?: string; /** JSON (only capping is read/written server-side) */ segment?: string; startDate?: Date; endDate?: Date; timezone?: string; globalCappingEnabled?: boolean; messageType?: Inapp_MessageType; tagFilterExpression?: pushwoosh_objects_filters_v1_FilterExpression; eventFilterExpression?: pushwoosh_objects_filters_v1_FilterExpression; /** Trigger condition that fires the in-app message; required for PUBLISH. */ triggerFilterExpression?: pushwoosh_objects_filters_v1_FilterExpression; }; export type CreateInappResponse = { code: string; }; export type UpdateInappRequest_Action = 'UNKNOWN' | 'SAVE_DRAFT' | 'PUBLISH'; /** Update - update existing inapp (both draft and active) */ export type UpdateInappRequest = { /** In-app message code of the message to update. */ code?: string; name?: string; description?: string; required?: boolean; /** Rich media code holding the in-app content. */ richMediaCode?: string; /** Segment filter name to target (alternative to filter_code). */ filterName?: string; /** Segment filter code to target (alternative to filter_name). */ filterCode?: string; /** JSON */ segment?: string; startDate?: Date; endDate?: Date; priority?: number; /** SAVE_DRAFT stops (unpublishes) the message; PUBLISH activates it after validation. */ action?: UpdateInappRequest_Action; timezone?: string; globalCappingEnabled?: boolean; messageType?: Inapp_MessageType; tagFilterExpression?: pushwoosh_objects_filters_v1_FilterExpression; eventFilterExpression?: pushwoosh_objects_filters_v1_FilterExpression; /** Trigger condition that fires the in-app message. */ triggerFilterExpression?: pushwoosh_objects_filters_v1_FilterExpression; }; export type UpdateInappResponse = {}; /** Stop - convert active inapp to draft */ export type StopInappRequest = { /** In-app message code of the active message to stop. */ code?: string; }; export type StopInappResponse = { code: string; }; /** Publish - convert draft inapp to active with validation */ export type PublishInappRequest = { /** In-app message code of the draft message to publish. */ code?: string; }; export type PublishInappResponse = { code: string; };