/** * Generated by orval v8.19.0 🍺 * Do not edit manually. * Webitel API * OpenAPI spec version: 24.04.0 */ import { faker } from '@faker-js/faker'; import type { RequestHandlerOptions } from 'msw'; import { HttpResponse, http } from 'msw'; import type { StorageDeleteFilesResponse, StorageListFile, StorageRestoreFilesResponse, } from '../_models'; import { StorageUploadFileChannel } from '../_models'; export const getDeleteVideocallFilesResponseMock = (): StorageDeleteFilesResponse => ({}); export const getSearchFilesByCallResponseMock = ( overrideResponse: Partial> = {}, ): StorageListFile => ({ items: faker.helpers.arrayElement([ Array.from( { length: faker.number.int({ min: 1, max: 10, }), }, (_, i) => i + 1, ).map(() => ({ channel: faker.helpers.arrayElement([ faker.helpers.arrayElement(Object.values(StorageUploadFileChannel)), undefined, ]), id: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), mimeType: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), name: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), properties: faker.helpers.arrayElement([ { endTime: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), height: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), startTime: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), width: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), }, undefined, ]), referenceId: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), retentionUntil: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), sha256Sum: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), size: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), thumbnail: faker.helpers.arrayElement([ { mimeType: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), scale: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), size: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), }, undefined, ]), uploadedAt: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), uploadedBy: faker.helpers.arrayElement([ { id: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), name: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), }, undefined, ]), uuid: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), viewName: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), })), undefined, ]), next: faker.helpers.arrayElement([ faker.datatype.boolean(), undefined, ]), ...overrideResponse, }); export const getSearchScreenRecordingsByAgentResponseMock = ( overrideResponse: Partial> = {}, ): StorageListFile => ({ items: faker.helpers.arrayElement([ Array.from( { length: faker.number.int({ min: 1, max: 10, }), }, (_, i) => i + 1, ).map(() => ({ channel: faker.helpers.arrayElement([ faker.helpers.arrayElement(Object.values(StorageUploadFileChannel)), undefined, ]), id: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), mimeType: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), name: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), properties: faker.helpers.arrayElement([ { endTime: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), height: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), startTime: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), width: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), }, undefined, ]), referenceId: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), retentionUntil: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), sha256Sum: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), size: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), thumbnail: faker.helpers.arrayElement([ { mimeType: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), scale: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), size: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), }, undefined, ]), uploadedAt: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), uploadedBy: faker.helpers.arrayElement([ { id: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), name: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), }, undefined, ]), uuid: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), viewName: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), })), undefined, ]), next: faker.helpers.arrayElement([ faker.datatype.boolean(), undefined, ]), ...overrideResponse, }); export const getDeleteScreenRecordingsByAgentResponseMock = (): StorageDeleteFilesResponse => ({}); export const getDeleteFilesResponseMock = (): StorageDeleteFilesResponse => ({}); export const getSearchFilesResponseMock = ( overrideResponse: Partial> = {}, ): StorageListFile => ({ items: faker.helpers.arrayElement([ Array.from( { length: faker.number.int({ min: 1, max: 10, }), }, (_, i) => i + 1, ).map(() => ({ channel: faker.helpers.arrayElement([ faker.helpers.arrayElement(Object.values(StorageUploadFileChannel)), undefined, ]), id: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), mimeType: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), name: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), properties: faker.helpers.arrayElement([ { endTime: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), height: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), startTime: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), width: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), }, undefined, ]), referenceId: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), retentionUntil: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), sha256Sum: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), size: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), thumbnail: faker.helpers.arrayElement([ { mimeType: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), scale: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), size: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), }, undefined, ]), uploadedAt: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), uploadedBy: faker.helpers.arrayElement([ { id: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), name: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), }, undefined, ]), uuid: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), viewName: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), })), undefined, ]), next: faker.helpers.arrayElement([ faker.datatype.boolean(), undefined, ]), ...overrideResponse, }); export const getDeleteQuarantineFilesResponseMock = (): StorageDeleteFilesResponse => ({}); export const getRestoreFilesResponseMock = (): StorageRestoreFilesResponse => ({}); export const getSearchScreenRecordingsResponseMock = ( overrideResponse: Partial> = {}, ): StorageListFile => ({ items: faker.helpers.arrayElement([ Array.from( { length: faker.number.int({ min: 1, max: 10, }), }, (_, i) => i + 1, ).map(() => ({ channel: faker.helpers.arrayElement([ faker.helpers.arrayElement(Object.values(StorageUploadFileChannel)), undefined, ]), id: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), mimeType: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), name: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), properties: faker.helpers.arrayElement([ { endTime: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), height: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), startTime: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), width: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), }, undefined, ]), referenceId: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), retentionUntil: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), sha256Sum: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), size: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), thumbnail: faker.helpers.arrayElement([ { mimeType: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), scale: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), size: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), }, undefined, ]), uploadedAt: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), uploadedBy: faker.helpers.arrayElement([ { id: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), name: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), }, undefined, ]), uuid: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), viewName: faker.helpers.arrayElement([ faker.string.alpha({ length: { min: 10, max: 20, }, }), undefined, ]), })), undefined, ]), next: faker.helpers.arrayElement([ faker.datatype.boolean(), undefined, ]), ...overrideResponse, }); export const getDeleteScreenRecordingsResponseMock = (): StorageDeleteFilesResponse => ({}); export const getDeleteVideocallFilesMockHandler = ( overrideResponse?: | StorageDeleteFilesResponse | (( info: Parameters[1]>[0], ) => Promise | StorageDeleteFilesResponse), options?: RequestHandlerOptions, ) => { return http.delete( '*/calls/:callId/files', async (info: Parameters[1]>[0]) => { return HttpResponse.json( overrideResponse !== undefined ? typeof overrideResponse === 'function' ? await overrideResponse(info) : overrideResponse : getDeleteVideocallFilesResponseMock(), { status: 200, }, ); }, options, ); }; export const getSearchFilesByCallMockHandler = ( overrideResponse?: | StorageListFile | (( info: Parameters[1]>[0], ) => Promise | StorageListFile), options?: RequestHandlerOptions, ) => { return http.get( '*/calls/:callId/files', async (info: Parameters[1]>[0]) => { return HttpResponse.json( overrideResponse !== undefined ? typeof overrideResponse === 'function' ? await overrideResponse(info) : overrideResponse : getSearchFilesByCallResponseMock(), { status: 200, }, ); }, options, ); }; export const getSearchScreenRecordingsByAgentMockHandler = ( overrideResponse?: | StorageListFile | (( info: Parameters[1]>[0], ) => Promise | StorageListFile), options?: RequestHandlerOptions, ) => { return http.get( '*/storage/agent/:agentId', async (info: Parameters[1]>[0]) => { return HttpResponse.json( overrideResponse !== undefined ? typeof overrideResponse === 'function' ? await overrideResponse(info) : overrideResponse : getSearchScreenRecordingsByAgentResponseMock(), { status: 200, }, ); }, options, ); }; export const getDeleteScreenRecordingsByAgentMockHandler = ( overrideResponse?: | StorageDeleteFilesResponse | (( info: Parameters[1]>[0], ) => Promise | StorageDeleteFilesResponse), options?: RequestHandlerOptions, ) => { return http.delete( '*/storage/agent/:agentId/:id', async (info: Parameters[1]>[0]) => { return HttpResponse.json( overrideResponse !== undefined ? typeof overrideResponse === 'function' ? await overrideResponse(info) : overrideResponse : getDeleteScreenRecordingsByAgentResponseMock(), { status: 200, }, ); }, options, ); }; export const getDeleteFilesMockHandler = ( overrideResponse?: | StorageDeleteFilesResponse | (( info: Parameters[1]>[0], ) => Promise | StorageDeleteFilesResponse), options?: RequestHandlerOptions, ) => { return http.delete( '*/storage/file', async (info: Parameters[1]>[0]) => { return HttpResponse.json( overrideResponse !== undefined ? typeof overrideResponse === 'function' ? await overrideResponse(info) : overrideResponse : getDeleteFilesResponseMock(), { status: 200, }, ); }, options, ); }; export const getSearchFilesMockHandler = ( overrideResponse?: | StorageListFile | (( info: Parameters[1]>[0], ) => Promise | StorageListFile), options?: RequestHandlerOptions, ) => { return http.get( '*/storage/file', async (info: Parameters[1]>[0]) => { return HttpResponse.json( overrideResponse !== undefined ? typeof overrideResponse === 'function' ? await overrideResponse(info) : overrideResponse : getSearchFilesResponseMock(), { status: 200, }, ); }, options, ); }; export const getDeleteQuarantineFilesMockHandler = ( overrideResponse?: | StorageDeleteFilesResponse | (( info: Parameters[1]>[0], ) => Promise | StorageDeleteFilesResponse), options?: RequestHandlerOptions, ) => { return http.delete( '*/storage/file/quarantine', async (info: Parameters[1]>[0]) => { return HttpResponse.json( overrideResponse !== undefined ? typeof overrideResponse === 'function' ? await overrideResponse(info) : overrideResponse : getDeleteQuarantineFilesResponseMock(), { status: 200, }, ); }, options, ); }; export const getRestoreFilesMockHandler = ( overrideResponse?: | StorageRestoreFilesResponse | (( info: Parameters[1]>[0], ) => Promise | StorageRestoreFilesResponse), options?: RequestHandlerOptions, ) => { return http.patch( '*/storage/file/restore', async (info: Parameters[1]>[0]) => { return HttpResponse.json( overrideResponse !== undefined ? typeof overrideResponse === 'function' ? await overrideResponse(info) : overrideResponse : getRestoreFilesResponseMock(), { status: 200, }, ); }, options, ); }; export const getSearchScreenRecordingsMockHandler = ( overrideResponse?: | StorageListFile | (( info: Parameters[1]>[0], ) => Promise | StorageListFile), options?: RequestHandlerOptions, ) => { return http.get( '*/storage/users/:userId', async (info: Parameters[1]>[0]) => { return HttpResponse.json( overrideResponse !== undefined ? typeof overrideResponse === 'function' ? await overrideResponse(info) : overrideResponse : getSearchScreenRecordingsResponseMock(), { status: 200, }, ); }, options, ); }; export const getDeleteScreenRecordingsMockHandler = ( overrideResponse?: | StorageDeleteFilesResponse | (( info: Parameters[1]>[0], ) => Promise | StorageDeleteFilesResponse), options?: RequestHandlerOptions, ) => { return http.delete( '*/storage/users/:userId/:id', async (info: Parameters[1]>[0]) => { return HttpResponse.json( overrideResponse !== undefined ? typeof overrideResponse === 'function' ? await overrideResponse(info) : overrideResponse : getDeleteScreenRecordingsResponseMock(), { status: 200, }, ); }, options, ); }; export const getFileServiceMock = () => [ getDeleteVideocallFilesMockHandler(), getSearchFilesByCallMockHandler(), getSearchScreenRecordingsByAgentMockHandler(), getDeleteScreenRecordingsByAgentMockHandler(), getDeleteFilesMockHandler(), getSearchFilesMockHandler(), getDeleteQuarantineFilesMockHandler(), getRestoreFilesMockHandler(), getSearchScreenRecordingsMockHandler(), getDeleteScreenRecordingsMockHandler(), ];