import { RpcMethod } from './commonTypes'; import { FilterExpression as pushwoosh_objects_filters_v1_FilterExpression } from './pushwoosh_objects_filters_v1'; export type FiltersService_List = RpcMethod; export type FiltersService_Get = RpcMethod; export type FiltersService_Create = RpcMethod; export type FiltersService_Clone = RpcMethod; export type FiltersService_Update = RpcMethod; export type FiltersService_Delete = RpcMethod; export type FiltersService_DeleteV2 = RpcMethod; export type FiltersService_GetCountryCities = RpcMethod; export type FiltersService_GetCitiesByHashes = RpcMethod; export type FiltersService_CompileFilter = RpcMethod; export type FiltersService_GetSeglang = RpcMethod; export type FiltersService_SeglangToFilterExpression = RpcMethod; export type FiltersService_GetMatchedSegments = RpcMethod; export type FiltersService_GetFilterUsage = RpcMethod; export type FiltersService_SearchAddress = RpcMethod; export interface FiltersService { /** Lists an account's saved segments (filters) for an application, newest first, with paging, name/code search and a high-speed-only toggle. Use to browse segments or find a filter code before get_filter or compile_filter. */ List: FiltersService_List; /** Returns one segment (filter) by its filter code, including its filter expression, seglang, device-load policy and compiling stats. Use after list_filters to inspect a single segment. */ Get: FiltersService_Get; /** Creates a new segment (filter) from a filter expression under an application, optionally as a high-speed prepared filter with an expiration date. The name must be unique for the account; use clone_filter to copy an existing one. */ Create: FiltersService_Create; /** Duplicates an existing segment (filter), identified by source filter code, under a new unique name. High-speed filters cannot be cloned; use create_filter to build a segment from scratch. */ Clone: FiltersService_Clone; /** Overwrites a segment's (filter) name, filter expression and device-load policy by filter code. Use to edit an existing segment; the new name must stay unique within the account. */ Update: FiltersService_Update; /** Deletes a segment (filter) by filter code after verifying it is not used by any campaign, journey, preset, in-app or popup. Blocks instead of deleting if the filter is still in use; delete_filter_v2 auto-detaches journey/in-app usage first. */ Delete: FiltersService_Delete; /** Deletes a segment (filter) by filter code, first detaching it from journey split points and moving in-app messages that use it to draft. Use instead of delete_filter to force-remove a filter referenced by journeys or in-apps; still blocked by other filters or web popups using it. */ DeleteV2: FiltersService_DeleteV2; /** Returns cities (name, coordinates, subscriber count) matching a search string, from the account's City tag values enriched with geo data. Used by the Geo segment-filter builder to pick cities to target. */ GetCountryCities: FiltersService_GetCountryCities; /** Resolves a list of city hashes (country code, city name) to their coordinates and names. Use to hydrate cities already selected in a geo filter, e.g. after get_filter_country_cities. */ GetCitiesByHashes: FiltersService_GetCitiesByHashes; /** Recomputes a segment's (filter) reachable device count for an application, optionally producing a CSV export of matching devices. Use to refresh a filter's audience size; pass export_csv to also generate a download. */ CompileFilter: FiltersService_CompileFilter; /** Renders a filter expression into its seglang (segment-language) string representation. Pure conversion used by the segment editor; the inverse of get_filter_expression_from_seglang. */ GetSeglang: FiltersService_GetSeglang; /** Parses a seglang (segment-language) query string into a structured filter expression. Pure conversion used by the segment editor; the inverse of get_filter_seglang. */ SeglangToFilterExpression: FiltersService_SeglangToFilterExpression; /** Lists the account's segments (filters) that a given device (by HWID) currently matches, for an application, with paging and name search. Use to see which segments a specific device falls into. */ GetMatchedSegments: FiltersService_GetMatchedSegments; /** Lists where a segment (filter) is used across journeys, one-time messages, in-app messages, presets and web popups. Use before delete_filter to see what references a filter; set only_active_campaigns to skip finished ones. */ GetFilterUsage: FiltersService_GetFilterUsage; /** Geocodes a free-form address or place query into map candidates (name, lat/lon, bounding box) via an external geocoding provider. Used by the Geo segment-filter builder to drop a point or radius on the map. */ SearchAddress: FiltersService_SearchAddress; } export type ListFiltersRequest_OrderBy = 'NAME' | 'CREATED' | 'UPDATED'; export type ListFiltersRequest_OrderDirection = 'ASC' | 'DESC'; export type ListFiltersRequest = { /** application code (XXXXX-XXXXX); scopes the listing */ application?: string; /** like %name% */ searchByName?: string; /** return only high speed filters */ highSpeedOnly?: boolean; /** filter (segment) codes to fetch; empty returns all */ codes?: string[]; orderBy?: ListFiltersRequest_OrderBy; orderDirection?: ListFiltersRequest_OrderDirection; /** pagination */ page?: number; perPage?: number; }; export type DeviceLoadPolicy = 'FILTER' | 'ALL'; export type Filter_Compiling = { /** all devices count */ size: number; /** with push tokens */ reachable: number; calculationStatus: string; calculationProgress: number; csvPath: string; calculationDate: Date; totalMobile: number; totalWeb: number; totalEmail: number; totalSms: number; totalWhatsapp: number; totalLine: number; users: number; totalKakao: number; totalTelegram: number; totalViber: number; }; export type Filter_type_compiling = { type: 'compiling'; data: Filter_Compiling; }; export type Filter_type_empty = { type: 'empty'; data: {}; }; export type Filter_type = Filter_type_compiling | Filter_type_empty; export type Filter = { name: string; code: string; filterExpression: pushwoosh_objects_filters_v1_FilterExpression; seglang: string; /** application for highspeed filter */ highspeedApplication: string; /** whether highspeed filter is ready for use */ highspeedReady: boolean; /** total amount of push tokens in highspeed filter */ highspeedSubscribersTotal: number; hasRightAceModify: boolean; updated: Date; /** * what devices should be loaded while iterating over the filter * filter - only devices matching the filter * all - all user's devices */ deviceLoadPolicy: DeviceLoadPolicy; isSystem: boolean; type: Filter_type; }; export type ListFiltersResponse = { filters: Filter[]; page: number; perPage: number; totalPages: number; totalFilters: number; }; export type GetFilterRequest = { /** application code (XXXXX-XXXXX) */ application?: string; /** filter (segment) code to fetch */ filter?: string; }; export type CreateFilterRequest = { /** required when account has ApplicationSpecificFilters restriction, otherwise optional */ application?: string; name?: string; filterExpression?: pushwoosh_objects_filters_v1_FilterExpression; /** application for high speed filter */ highspeedApplication?: string; /** * expiration date. filter will be deleted after this date(in UTC time). * format: YYYY-MM-DD */ expirationDate?: string; /** * what devices should be loaded while iterating over the filter * filter - only devices matching the filter * all - all user's devices */ deviceLoadPolicy?: DeviceLoadPolicy; }; export type CreateFilterResponse = { filter: string; }; export type CloneFilterRequest = { /** required when account has ApplicationSpecificFilters restriction, otherwise optional */ application?: string; /** name for the new filter (segment); must be unique within the account */ newName?: string; /** source filter (segment) code to clone */ filter?: string; }; export type CloneFilterResponse = { filter: string; }; export type UpdateFilterRequest = { /** required when account has ApplicationSpecificFilters restriction, otherwise optional */ application?: string; /** filter (segment) code to update */ filter?: string; name?: string; filterExpression?: pushwoosh_objects_filters_v1_FilterExpression; deviceLoadPolicy?: DeviceLoadPolicy; }; export type UpdateFilterResponse = {}; export type DeleteFilterRequest = { /** required when account has ApplicationSpecificFilters restriction, otherwise optional */ application?: string; /** filter (segment) code to delete */ filter?: string; }; export type DeleteFilterResponse = {}; /** returns cities and their coordinates for the given country based on existing tag (City) values */ export type GetCountryCitiesRequest = { /** required when account has ApplicationSpecificFilters restriction, otherwise optional */ application?: string; /** like %search_by_name% */ searchByName?: string; }; export type GetCountryCitiesResponse_City = { /** country code, city name (ex: us,new york) */ hash: string; name: string; latitude: number; longitude: number; subscribers: number; }; export type GetCountryCitiesResponse = { cities: GetCountryCitiesResponse_City[]; }; /** returns cities coordinates by cities hashes (country code, city name) */ export type GetCitiesByHashesRequest = { /** required when account has ApplicationSpecificFilters restriction, otherwise optional */ application?: string; hashes?: string[]; }; export type GetCitiesByHashesResponse = { cities: GetCountryCitiesResponse_City[]; }; export type CompileFilterRequest = { /** application code (XXXXX-XXXXX) the filter is compiled against */ application?: string; /** filter (segment) code to (re)compile */ filter?: string; /** also generate a downloadable CSV export of matching devices */ exportCsv?: boolean; }; export type CompileFilterResponse = {}; export type GetSeglangRequest = { /** required when account has ApplicationSpecificFilters restriction, otherwise optional */ application?: string; /** filter expression to render as seglang */ filterExpression?: pushwoosh_objects_filters_v1_FilterExpression; }; export type GetSeglangResponse = { seglang: string; }; export type SeglangToFilterExpressionRequest = { /** required when account has ApplicationSpecificFilters restriction, otherwise optional */ application?: string; /** seglang (segment-language) query string to parse */ seglang?: string; }; export type SeglangToFilterExpressionResponse = { filterExpression: pushwoosh_objects_filters_v1_FilterExpression; }; export type GetMatchedSegmentsRequest = { /** application code (XXXXX-XXXXX) */ application?: string; /** device HWID to match against the account's segments */ hwid?: string; page?: number; perPage?: number; /** like %name% */ searchByName?: string; }; export type GetMatchedSegmentsResponse = { filters: Filter[]; page: number; perPage: number; totalPages: number; totalFilters: number; }; export type GetFilterUsageRequest = { /** required when account has ApplicationSpecificFilters restriction, otherwise optional */ application?: string; /** filter (segment) code to inspect usage for */ filter?: string; /** limit results to active/running usages, skipping finished ones */ onlyActiveCampaigns?: boolean; }; /** * SearchAddress resolves a free-form address query (e.g. "Coffee shop, Berlin", * "Tverskaya 1, Moscow") to a list of geocoded candidates the client can drop * on a map. Used by the Geo segment-filter builder. */ export type SearchAddressRequest = { /** required when account has ApplicationSpecificFilters restriction, otherwise optional */ application?: string; /** free-form address / place query, 3 chars minimum */ query?: string; /** optional ISO-3166 alpha-2 country code to bias results (e.g. "ru", "de") */ countryBias?: string; }; export type BoundingBox = { minLat: number; minLon: number; maxLat: number; maxLon: number; }; export type AddressCandidate = { displayName: string; lat: number; lon: number; bbox: BoundingBox; /** provider place classification (e.g. "city", "street", "house"); informative only */ placeType: string; }; export type SearchAddressResponse = { candidates: AddressCandidate[]; }; export type GetFilterUsageResponse_Journey = { uuid: string; title: string; status: number; pointsType: number[]; activationDate?: Date; }; export type GetFilterUsageResponse_OTM = { code: string; name: string; status: number; sendDate: Date; platform: number; }; export type GetFilterUsageResponse_Inapp = { code: string; name: string; status: string; activationDate?: Date; }; export type GetFilterUsageResponse_Preset = { code: string; name: string; creationDate: Date; }; export type GetFilterUsageResponse_Popup = { code: string; name: string; status: string; creationDate: Date; }; export type GetFilterUsageResponse = { journeys: GetFilterUsageResponse_Journey[]; otms: GetFilterUsageResponse_OTM[]; inapps: GetFilterUsageResponse_Inapp[]; presets: GetFilterUsageResponse_Preset[]; popups: GetFilterUsageResponse_Popup[]; };