| 
									
										
										
										
											2024-03-01 14:41:47 +01:00
										 |  |  | import { Modules, Data } from '@strapi/types'; | 
					
						
							| 
									
										
										
										
											2023-11-15 11:08:04 +00:00
										 |  |  | import { errors } from '@strapi/utils'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-01 14:41:47 +01:00
										 |  |  | type PaginationQuery = Modules.EntityService.Params.Pagination.PageNotation; | 
					
						
							| 
									
										
										
										
											2023-11-15 11:08:04 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-04 16:00:50 +00:00
										 |  |  | export interface RelationResult { | 
					
						
							| 
									
										
										
										
											2024-03-18 11:11:46 +01:00
										 |  |  |   documentId: Modules.Documents.ID; | 
					
						
							| 
									
										
										
										
											2024-03-13 10:25:47 +00:00
										 |  |  |   id: number; | 
					
						
							| 
									
										
										
										
											2024-03-20 08:51:37 +01:00
										 |  |  |   status?: Modules.Documents.Params.PublicationStatus.Kind; | 
					
						
							| 
									
										
										
										
											2024-05-10 18:20:35 +01:00
										 |  |  |   locale?: Modules.Documents.Params.Locale.StringNotation; | 
					
						
							| 
									
										
										
										
											2024-03-15 15:16:35 +00:00
										 |  |  |   [key: string]: any; | 
					
						
							| 
									
										
										
										
											2023-12-04 16:00:50 +00:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2023-11-15 11:08:04 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-22 09:32:03 +00:00
										 |  |  | export interface Pagination { | 
					
						
							|  |  |  |   page: NonNullable<PaginationQuery['page']>; | 
					
						
							|  |  |  |   pageSize: NonNullable<PaginationQuery['pageSize']>; | 
					
						
							|  |  |  |   pageCount: number; | 
					
						
							|  |  |  |   total: number; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-13 10:25:47 +00:00
										 |  |  | type RelationResponse = | 
					
						
							|  |  |  |   | { | 
					
						
							|  |  |  |       results: RelationResult[]; | 
					
						
							|  |  |  |       pagination: Pagination; | 
					
						
							|  |  |  |       error?: never; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   | { | 
					
						
							|  |  |  |       results?: never; | 
					
						
							|  |  |  |       pagination?: never; | 
					
						
							|  |  |  |       error: errors.ApplicationError | errors.YupValidationError; | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-15 11:08:04 +00:00
										 |  |  | /** | 
					
						
							|  |  |  |  * GET /relations/:model/:targetField | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | export declare namespace FindAvailable { | 
					
						
							|  |  |  |   export interface Params { | 
					
						
							|  |  |  |     model: string; | 
					
						
							|  |  |  |     targetField: string; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-13 10:25:47 +00:00
										 |  |  |   export interface Request { | 
					
						
							|  |  |  |     body: {}; | 
					
						
							|  |  |  |     query: Partial<Pick<Pagination, 'pageSize' | 'page'>> & { | 
					
						
							| 
									
										
										
										
											2024-03-18 11:11:46 +01:00
										 |  |  |       id?: Data.ID; | 
					
						
							| 
									
										
										
										
											2024-05-10 18:20:35 +01:00
										 |  |  |       locale?: Modules.Documents.Params.Locale.StringNotation; | 
					
						
							| 
									
										
										
										
											2024-03-13 10:25:47 +00:00
										 |  |  |       _filter?: string; | 
					
						
							|  |  |  |       _q?: string; | 
					
						
							| 
									
										
										
										
											2024-03-18 11:11:46 +01:00
										 |  |  |       idsToOmit?: Modules.Documents.ID[]; | 
					
						
							|  |  |  |       idsToInclude?: Modules.Documents.ID[]; | 
					
						
							| 
									
										
										
										
											2024-03-13 10:25:47 +00:00
										 |  |  |     }; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   export type Response = RelationResponse; | 
					
						
							| 
									
										
										
										
											2023-11-15 11:08:04 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * GET /relations/:model/:id/:targetField | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | export declare namespace FindExisting { | 
					
						
							|  |  |  |   export interface Params { | 
					
						
							|  |  |  |     model: string; | 
					
						
							|  |  |  |     targetField: string; | 
					
						
							| 
									
										
										
										
											2024-03-18 11:11:46 +01:00
										 |  |  |     id?: Data.ID; | 
					
						
							| 
									
										
										
										
											2024-03-13 10:25:47 +00:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   export interface Request { | 
					
						
							|  |  |  |     body: {}; | 
					
						
							|  |  |  |     query: Partial<Pick<Pagination, 'pageSize' | 'page'>> & { | 
					
						
							|  |  |  |       locale?: string | null; | 
					
						
							|  |  |  |       _filter?: string; | 
					
						
							|  |  |  |       _q?: string; | 
					
						
							| 
									
										
										
										
											2024-03-18 11:11:46 +01:00
										 |  |  |       status?: Modules.Documents.Params.PublicationStatus.Kind; | 
					
						
							|  |  |  |       idsToOmit?: Modules.Documents.ID[]; | 
					
						
							|  |  |  |       idsToInclude?: Modules.Documents.ID[]; | 
					
						
							| 
									
										
										
										
											2024-03-13 10:25:47 +00:00
										 |  |  |     }; | 
					
						
							| 
									
										
										
										
											2023-11-15 11:08:04 +00:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-13 10:25:47 +00:00
										 |  |  |   export type Response = RelationResponse; | 
					
						
							| 
									
										
										
										
											2023-11-15 11:08:04 +00:00
										 |  |  | } |