|
| 1 | +/** |
| 2 | + * Generated by orval v7.13.2 🍺 |
| 3 | + * Do not edit manually. |
| 4 | + * Collect Map API |
| 5 | + * Django backend for Collect Map API - Mountain and Path data management |
| 6 | + * OpenAPI spec version: 1.0.0 |
| 7 | + */ |
| 8 | + |
| 9 | +import { customFetch } from ".././custom-fetch"; |
| 10 | +import type { PaginatedPathList, Path, RouteListParams } from ".././models"; |
| 11 | + |
| 12 | +/** |
| 13 | + * ダイクストラ法でstartノードからdestノードまでの最短経路のPath一覧を取得 |
| 14 | + */ |
| 15 | +export type routeListResponse200 = { |
| 16 | + data: PaginatedPathList; |
| 17 | + status: 200; |
| 18 | +}; |
| 19 | + |
| 20 | +export type routeListResponseSuccess = routeListResponse200 & { |
| 21 | + headers: Headers; |
| 22 | +}; |
| 23 | + |
| 24 | +export type routeListResponse = routeListResponseSuccess; |
| 25 | + |
| 26 | +export const getRouteListUrl = (params: RouteListParams) => { |
| 27 | + const normalizedParams = new URLSearchParams(); |
| 28 | + |
| 29 | + Object.entries(params || {}).forEach(([key, value]) => { |
| 30 | + if (value !== undefined) { |
| 31 | + normalizedParams.append(key, value === null ? "null" : value.toString()); |
| 32 | + } |
| 33 | + }); |
| 34 | + |
| 35 | + const stringifiedParams = normalizedParams.toString(); |
| 36 | + |
| 37 | + return stringifiedParams.length > 0 |
| 38 | + ? `/route/?${stringifiedParams}` |
| 39 | + : `/route/`; |
| 40 | +}; |
| 41 | + |
| 42 | +export const routeList = async ( |
| 43 | + params: RouteListParams, |
| 44 | + options?: RequestInit, |
| 45 | +): Promise<routeListResponse> => { |
| 46 | + return customFetch<routeListResponse>(getRouteListUrl(params), { |
| 47 | + ...options, |
| 48 | + method: "GET", |
| 49 | + }); |
| 50 | +}; |
| 51 | + |
| 52 | +/** |
| 53 | + * PathGeometry API ViewSet (Read-only) - Dijkstra shortest path |
| 54 | + */ |
| 55 | +export type routeRetrieveResponse200 = { |
| 56 | + data: Path; |
| 57 | + status: 200; |
| 58 | +}; |
| 59 | + |
| 60 | +export type routeRetrieveResponseSuccess = routeRetrieveResponse200 & { |
| 61 | + headers: Headers; |
| 62 | +}; |
| 63 | + |
| 64 | +export type routeRetrieveResponse = routeRetrieveResponseSuccess; |
| 65 | + |
| 66 | +export const getRouteRetrieveUrl = (id: number) => { |
| 67 | + return `/route/${id}/`; |
| 68 | +}; |
| 69 | + |
| 70 | +export const routeRetrieve = async ( |
| 71 | + id: number, |
| 72 | + options?: RequestInit, |
| 73 | +): Promise<routeRetrieveResponse> => { |
| 74 | + return customFetch<routeRetrieveResponse>(getRouteRetrieveUrl(id), { |
| 75 | + ...options, |
| 76 | + method: "GET", |
| 77 | + }); |
| 78 | +}; |
0 commit comments