import { RpcMethod } from './commonTypes'; export type AlertsService_List = RpcMethod; export type AlertsService_Send = RpcMethod; export type AlertsService_UpdateStatus = RpcMethod; export type AlertsService_GetHighestSeverity = RpcMethod; export type AlertsService_Delete = RpcMethod; export type AlertsService_Get = RpcMethod; export type AlertsService_ListGroup = RpcMethod; export type AlertsService_UpdateUnread = RpcMethod; export type AlertsService_Recall = RpcMethod; export type AlertsService_UpdateGroup = RpcMethod; export interface AlertsService { List: AlertsService_List; Send: AlertsService_Send; UpdateStatus: AlertsService_UpdateStatus; GetHighestSeverity: AlertsService_GetHighestSeverity; Delete: AlertsService_Delete; Get: AlertsService_Get; ListGroup: AlertsService_ListGroup; UpdateUnread: AlertsService_UpdateUnread; Recall: AlertsService_Recall; UpdateGroup: AlertsService_UpdateGroup; } export type AlertBanner = { type: AlertType; content?: string; actionLink?: string; actionLinkLabel?: string; imageUrl?: string; secondaryActionLink?: string; secondaryActionLinkLabel?: string; }; export type AlertEmail = { to: string[]; template: string; placeholders: Record; }; export type AlertType = 'ALERT_TYPE_UNSPECIFIED' | 'ALERT_TYPE_BLOCKING' | 'ALERT_TYPE_DISMISSABLE' | 'ALERT_TYPE_TOP_BANNER' | 'ALERT_TYPE_PRODUCT_UPDATE'; export type AlertStatus = 'ALERT_STATUS_UNSPECIFIED' | 'ALERT_STATUS_READ' | 'ALERT_STATUS_UNREAD'; export type AlertSeverity = 'ALERT_SEVERITY_UNSPECIFIED' | 'ALERT_SEVERITY_INFO' | 'ALERT_SEVERITY_WARNING' | 'ALERT_SEVERITY_CRITICAL'; export type OrderBy = 'ORDER_BY_CREATED' | 'ORDER_BY_SEVERITY'; export type OrderDirection = 'ORDER_DIRECTION_DESC' | 'ORDER_DIRECTION_ASC'; export type ListRequest = { type?: AlertType; status?: AlertStatus; severity?: AlertSeverity; page?: number; perPage?: number; orderBy?: OrderBy; orderDirection?: OrderDirection; accountId?: number; /** Read state is resolved for this user; 0 keeps the account-wide read flag. */ userId?: number; /** Drops alerts of these types from the result; `type` above still selects a single type. */ excludeTypes?: AlertType[]; }; export type ListResponse_Alert = { type: AlertType; status: AlertStatus; severity: AlertSeverity; title: string; content?: string; created?: Date; expiry?: Date; uuid: string; accountId: number; applicationId?: number; meta?: object; actionLink?: string; actionLinkLabel?: string; imageUrl?: string; secondaryActionLink?: string; secondaryActionLinkLabel?: string; }; export type ListResponse = { alerts: ListResponse_Alert[]; page: number; perPage: number; total: number; }; export type SendRequest = { accountId?: number; severity?: AlertSeverity; title?: string; expiry?: Date; banner?: AlertBanner; email?: AlertEmail; applicationId?: number; meta?: object; /** check unique alert within the `unique_key` in the provided request */ uniqueKey?: string; /** * When non-empty, takes precedence over `account_id` and one alert is created per id. * Server generates a shared `group_id` (UUID) so the batch can be patched / recalled later. */ accountIds?: number[]; /** * When true, the server enumerates all active accounts itself and creates one alert * per account (shared group_uuid), ignoring `account_id` and `account_ids`. */ allAccounts?: boolean; }; export type UpdateStatusRequest_Alert = { id: number; status: AlertStatus; }; export type UpdateStatusRequest = { alerts?: UpdateStatusRequest_Alert[]; /** Marks the alerts read/unread for this user; 0 keeps the account-wide read flag. */ userId?: number; }; export type UpdateStatusResponse = {}; export type SendResponse = { groupUuid: string; created: number; }; export type UpdateUnreadRequest = { groupUuid?: string; /** Patch fields. Only set fields are applied. */ title?: string; content?: string; actionLink?: string; actionLinkLabel?: string; severity?: AlertSeverity; expiry?: Date; imageUrl?: string; secondaryActionLink?: string; secondaryActionLinkLabel?: string; }; export type UpdateUnreadResponse = { updated: number; }; /** * UpdateGroup patches every alert of the group, read ones included, unlike UpdateUnread. * Content-only edits (picture, CTA, type) stay correct after a user has seen the card. */ export type UpdateGroupRequest = { groupUuid?: string; /** Patch fields. Only set fields are applied. */ title?: string; content?: string; actionLink?: string; actionLinkLabel?: string; severity?: AlertSeverity; expiry?: Date; imageUrl?: string; secondaryActionLink?: string; secondaryActionLinkLabel?: string; type?: AlertType; }; export type UpdateGroupResponse = { updated: number; }; export type ListGroupRequest = { status?: AlertStatus; titleSearch?: string; page?: number; perPage?: number; orderBy?: OrderBy; orderDirection?: OrderDirection; }; export type ListGroupResponse_AlertGroup = { groupUuid: string; type: AlertType; severity: AlertSeverity; title: string; content?: string; created?: Date; expiry?: Date; actionLink?: string; actionLinkLabel?: string; recipientsCount: number; unreadCount: number; readCount: number; }; export type ListGroupResponse = { groups: ListGroupResponse_AlertGroup[]; page: number; perPage: number; total: number; }; export type RecallRequest = { groupUuid?: string; }; export type RecallResponse = { recalled: number; }; export type GetHighestSeverityRequest = { accountId?: number; status?: AlertStatus; /** Read state is resolved for this user; 0 keeps the account-wide read flag. */ userId?: number; /** Drops alerts of these types before picking the highest severity. */ excludeTypes?: AlertType[]; }; export type GetHighestSeverityResponse = { severity: AlertSeverity; }; export type DeleteRequest = { /** one of identifiers allowed */ ids?: number[]; uniqueKeys?: string[]; accountId?: number; }; export type DeleteResponse = {}; export type GetRequest = { /** * any of identifier * uuid has highest prior */ uuid?: string; uniqueKey?: string; accountId?: number; }; export type GetResponse_Alert = { type: AlertType; status: AlertStatus; severity: AlertSeverity; title: string; content?: string; created?: Date; expiry?: Date; uuid: string; uniqueKey: string; accountId: number; applicationId?: number; meta?: object; actionLink?: string; actionLinkLabel?: string; imageUrl?: string; secondaryActionLink?: string; secondaryActionLinkLabel?: string; }; export type GetResponse = { alert: GetResponse_Alert; };