export type GetApiActivitiesArgs = {offset?: number | undefined, limit?: number | undefined, countLimit?: number | undefined, taskId?: string | undefined, contextId?: string | undefined, involvedPeopleIds?: Array | undefined, involvedRoleIds?: Array | undefined, performedByUserId?: string | undefined, performedByRoleIds?: Array | undefined, activityType?: ('ADD' | 'UPDATE' | 'DELETE') | undefined, callId?: string | undefined, categories?: (Array<'ATTRIBUTE' | 'ATTACHMENT' | 'RELATION' | 'COMMENT' | 'RATING' | 'STATUS' | 'WORKFLOW' | 'RESPONSIBILITY' | 'USER' | 'USER_GROUP' | 'ROLE' | 'TAGS' | 'OTHERS' | 'USER_PASSWORD' | 'VIEW_PERMISSION'>) | undefined, resourceTypes?: (Array<'View' | 'Asset' | 'Community' | 'Domain' | 'AssetType' | 'DomainType' | 'Status' | 'User' | 'ClassificationMatch' | 'UserGroup' | 'Attribute' | 'StringAttribute' | 'ScriptAttribute' | 'BooleanAttribute' | 'DateAttribute' | 'NumericAttribute' | 'SingleValueListAttribute' | 'MultiValueListAttribute' | 'Comment' | 'Attachment' | 'Responsibility' | 'Workflow' | 'Job' | 'Relation' | 'RelationType' | 'ComplexRelation' | 'ComplexRelationType' | 'ArticulationRule' | 'Assignment' | 'Scope' | 'RelationTrace' | 'ValidationRule' | 'DataQualityRule' | 'DataQualityMetric' | 'Address' | 'InstantMessagingAccount' | 'Email' | 'PhoneNumber' | 'Website' | 'Activity' | 'FormProperty' | 'WorkflowTask' | 'ActivityChange' | 'WorkflowInstance' | 'Role' | 'AttributeType' | 'BooleanAttributeType' | 'DateAttributeType' | 'DateTimeAttributeType' | 'MultiValueListAttributeType' | 'NumericAttributeType' | 'ScriptAttributeType' | 'SingleValueListAttributeType' | 'StringAttributeType' | 'ViewSharingRule' | 'ViewAssignmentRule' | 'JdbcDriverFile' | 'JdbcDriver' | 'JdbcIngestionProperties' | 'CsvIngestionProperties' | 'ExcelIngestionProperties' | 'ConnectionStringParameter' | 'AssignedCharacteristicType' | 'Notification' | 'Tag' | 'ComplexRelationLegType' | 'ComplexRelationAttributeType' | 'ComplexRelationLeg' | 'BaseDataType' | 'AdvancedDataType' | 'DiagramPicture' | 'DiagramPictureSharingRule' | 'DiagramPictureAssignmentRule' | 'Rating' | 'Classification' | 'PhysicalDataConnector' | 'Context'>) | undefined, resourceDiscriminators?: Array | undefined, startDate?: number | undefined, endDate?: number | undefined, callCountEnabled?: boolean | undefined}; export type GetApiActivitiesOptions = {baseUrl: string, basicAuth?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Returns activities matching the given search criteria. * * GET /activities * * Also accepts auth: jwtAuth, oauth2, oauth2 */ export const getApiActivities = async (args: GetApiActivitiesArgs, options: GetApiActivitiesOptions) => { const {baseUrl, fetch: fetchFn = fetch, basicAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.offset != null) query.append("offset", String(args.offset)) if (args.limit != null) query.append("limit", String(args.limit)) if (args.countLimit != null) query.append("countLimit", String(args.countLimit)) if (args.taskId != null) query.append("taskId", String(args.taskId)) if (args.contextId != null) query.append("contextId", String(args.contextId)) for (const item of args.involvedPeopleIds ?? []) query.append("involvedPeopleIds", String(item)) for (const item of args.involvedRoleIds ?? []) query.append("involvedRoleIds", String(item)) if (args.performedByUserId != null) query.append("performedByUserId", String(args.performedByUserId)) for (const item of args.performedByRoleIds ?? []) query.append("performedByRoleIds", String(item)) if (args.activityType != null) query.append("activityType", String(args.activityType)) if (args.callId != null) query.append("callId", String(args.callId)) for (const item of args.categories ?? []) query.append("categories", String(item)) for (const item of args.resourceTypes ?? []) query.append("resourceTypes", String(item)) for (const item of args.resourceDiscriminators ?? []) query.append("resourceDiscriminators", String(item)) if (args.startDate != null) query.append("startDate", String(args.startDate)) if (args.endDate != null) query.append("endDate", String(args.endDate)) if (args.callCountEnabled != null) query.append("callCountEnabled", String(args.callCountEnabled)) if (basicAuth !== undefined) headers.set('authorization', `Basic ${btoa(`${basicAuth.username}:${basicAuth.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/activities${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };