| 
									
										
										
										
											2022-10-22 11:51:07 -08:00
										 |  |  | import { BaseCRUDAPI } from "../base/base-clients"; | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  | import type { CreateWebhook, ReadWebhook } from "~/lib/api/types/household"; | 
					
						
							| 
									
										
										
										
											2021-09-01 21:39:40 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | const prefix = "/api"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const routes = { | 
					
						
							| 
									
										
										
										
											2024-08-22 10:14:32 -05:00
										 |  |  |   webhooks: `${prefix}/households/webhooks`, | 
					
						
							|  |  |  |   webhooksId: (id: string | number) => `${prefix}/households/webhooks/${id}`, | 
					
						
							|  |  |  |   webhooksIdTest: (id: string | number) => `${prefix}/households/webhooks/${id}/test`, | 
					
						
							| 
									
										
										
										
											2021-09-01 21:39:40 -08:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-21 21:22:02 +02:00
										 |  |  | export class WebhooksAPI extends BaseCRUDAPI<CreateWebhook, ReadWebhook> { | 
					
						
							| 
									
										
										
										
											2021-09-01 21:39:40 -08:00
										 |  |  |   baseRoute = routes.webhooks; | 
					
						
							|  |  |  |   itemRoute = routes.webhooksId; | 
					
						
							| 
									
										
										
										
											2024-07-06 14:10:01 -05:00
										 |  |  |   itemTestRoute = routes.webhooksIdTest; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   async testOne(itemId: string | number) { | 
					
						
							|  |  |  |     return await this.requests.post<null>(`${this.itemTestRoute(itemId)}`, {}); | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2021-09-01 21:39:40 -08:00
										 |  |  | } |