Skip to content

Commit 6a44060

Browse files
committed
chore: regenerate
1 parent 9f25d62 commit 6a44060

File tree

10 files changed

+2018
-0
lines changed

10 files changed

+2018
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/** AUTOGENERATED - DO NOT EDIT **/
2+
/* tslint:disable */
3+
/* eslint-disable */
4+
5+
import { ApiClient } from "./client.service"
6+
import { NgModule } from "@angular/core"
7+
8+
@NgModule({
9+
imports: [],
10+
declarations: [],
11+
exports: [],
12+
providers: [ApiClient],
13+
})
14+
export class ApiModule {}
Lines changed: 298 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,298 @@
1+
/** AUTOGENERATED - DO NOT EDIT **/
2+
/* tslint:disable */
3+
/* eslint-disable */
4+
5+
import {
6+
t_Booking,
7+
t_BookingPayment,
8+
t_Links_Booking,
9+
t_Links_Pagination,
10+
t_Links_Self,
11+
t_Problem,
12+
t_Station,
13+
t_Trip,
14+
t_Wrapper_Collection,
15+
} from "./models"
16+
import { HttpClient, HttpParams, HttpResponse } from "@angular/common/http"
17+
import { Injectable } from "@angular/core"
18+
import { Observable } from "rxjs"
19+
20+
export class ApiClientConfig {
21+
basePath: string = ""
22+
defaultHeaders: Record<string, string> = {}
23+
}
24+
25+
// from https://stackoverflow.com/questions/39494689/is-it-possible-to-restrict-number-to-a-certain-range
26+
type Enumerate<
27+
N extends number,
28+
Acc extends number[] = [],
29+
> = Acc["length"] extends N
30+
? Acc[number]
31+
: Enumerate<N, [...Acc, Acc["length"]]>
32+
33+
type IntRange<F extends number, T extends number> = F extends T
34+
? F
35+
: Exclude<Enumerate<T>, Enumerate<F>> extends never
36+
? never
37+
: Exclude<Enumerate<T>, Enumerate<F>> | T
38+
39+
export type StatusCode1xx = IntRange<100, 199>
40+
export type StatusCode2xx = IntRange<200, 299>
41+
export type StatusCode3xx = IntRange<300, 399>
42+
export type StatusCode4xx = IntRange<400, 499>
43+
export type StatusCode5xx = IntRange<500, 599>
44+
export type StatusCode =
45+
| StatusCode1xx
46+
| StatusCode2xx
47+
| StatusCode3xx
48+
| StatusCode4xx
49+
| StatusCode5xx
50+
51+
export type QueryParams = {
52+
[name: string]:
53+
| string
54+
| number
55+
| boolean
56+
| string[]
57+
| undefined
58+
| null
59+
| QueryParams
60+
| QueryParams[]
61+
}
62+
63+
@Injectable({
64+
providedIn: "root",
65+
})
66+
export class ApiClient {
67+
constructor(
68+
private readonly httpClient: HttpClient,
69+
private readonly config: ApiClientConfig,
70+
) {}
71+
72+
private _headers(
73+
headers: Record<string, string | undefined>,
74+
): Record<string, string> {
75+
return Object.fromEntries(
76+
Object.entries({ ...this.config.defaultHeaders, ...headers }).filter(
77+
(it): it is [string, string] => it[1] !== undefined,
78+
),
79+
)
80+
}
81+
82+
private _queryParams(queryParams: QueryParams): HttpParams {
83+
return Object.entries(queryParams).reduce((result, [name, value]) => {
84+
if (
85+
typeof value === "string" ||
86+
typeof value === "boolean" ||
87+
typeof value === "number"
88+
) {
89+
return result.set(name, value)
90+
} else if (value === null || value === undefined) {
91+
return result
92+
}
93+
throw new Error(
94+
`query parameter '${name}' with value '${value}' is not yet supported`,
95+
)
96+
}, new HttpParams())
97+
}
98+
99+
getStations(): Observable<
100+
| (HttpResponse<
101+
t_Wrapper_Collection & {
102+
data?: t_Station[]
103+
} & {
104+
links?: t_Links_Self & t_Links_Pagination
105+
}
106+
> & { status: 200 })
107+
| (HttpResponse<t_Problem> & { status: 400 })
108+
| (HttpResponse<t_Problem> & { status: 401 })
109+
| (HttpResponse<t_Problem> & { status: 403 })
110+
| (HttpResponse<t_Problem> & { status: 429 })
111+
| (HttpResponse<t_Problem> & { status: 500 })
112+
| HttpResponse<unknown>
113+
> {
114+
return this.httpClient.request<any>(
115+
"GET",
116+
this.config.basePath + `/stations`,
117+
{
118+
observe: "response",
119+
reportProgress: false,
120+
},
121+
)
122+
}
123+
124+
getTrips(p: {
125+
origin: string
126+
destination: string
127+
date: string
128+
bicycles?: boolean
129+
dogs?: boolean
130+
}): Observable<
131+
| (HttpResponse<
132+
t_Wrapper_Collection & {
133+
data?: t_Trip[]
134+
} & {
135+
links?: t_Links_Self & t_Links_Pagination
136+
}
137+
> & { status: 200 })
138+
| (HttpResponse<t_Problem> & { status: 400 })
139+
| (HttpResponse<t_Problem> & { status: 401 })
140+
| (HttpResponse<t_Problem> & { status: 403 })
141+
| (HttpResponse<t_Problem> & { status: 429 })
142+
| (HttpResponse<t_Problem> & { status: 500 })
143+
| HttpResponse<unknown>
144+
> {
145+
const params = this._queryParams({
146+
origin: p["origin"],
147+
destination: p["destination"],
148+
date: p["date"],
149+
bicycles: p["bicycles"],
150+
dogs: p["dogs"],
151+
})
152+
153+
return this.httpClient.request<any>(
154+
"GET",
155+
this.config.basePath + `/trips`,
156+
{
157+
params,
158+
observe: "response",
159+
reportProgress: false,
160+
},
161+
)
162+
}
163+
164+
getBookings(): Observable<
165+
| (HttpResponse<
166+
t_Wrapper_Collection & {
167+
data?: t_Booking[]
168+
} & {
169+
links?: t_Links_Self & t_Links_Pagination
170+
}
171+
> & { status: 200 })
172+
| (HttpResponse<t_Problem> & { status: 400 })
173+
| (HttpResponse<t_Problem> & { status: 401 })
174+
| (HttpResponse<t_Problem> & { status: 403 })
175+
| (HttpResponse<t_Problem> & { status: 429 })
176+
| (HttpResponse<t_Problem> & { status: 500 })
177+
| HttpResponse<unknown>
178+
> {
179+
return this.httpClient.request<any>(
180+
"GET",
181+
this.config.basePath + `/bookings`,
182+
{
183+
observe: "response",
184+
reportProgress: false,
185+
},
186+
)
187+
}
188+
189+
createBooking(p: {
190+
requestBody: t_Booking
191+
}): Observable<
192+
| (HttpResponse<
193+
t_Booking & {
194+
links?: t_Links_Self
195+
}
196+
> & { status: 201 })
197+
| (HttpResponse<t_Problem> & { status: 400 })
198+
| (HttpResponse<t_Problem> & { status: 401 })
199+
| (HttpResponse<t_Problem> & { status: 404 })
200+
| (HttpResponse<t_Problem> & { status: 409 })
201+
| (HttpResponse<t_Problem> & { status: 429 })
202+
| (HttpResponse<t_Problem> & { status: 500 })
203+
| HttpResponse<unknown>
204+
> {
205+
const headers = this._headers({ "Content-Type": "application/json" })
206+
const body = p["requestBody"]
207+
208+
return this.httpClient.request<any>(
209+
"POST",
210+
this.config.basePath + `/bookings`,
211+
{
212+
headers,
213+
body,
214+
observe: "response",
215+
reportProgress: false,
216+
},
217+
)
218+
}
219+
220+
getBooking(p: {
221+
bookingId: string
222+
}): Observable<
223+
| (HttpResponse<
224+
t_Booking & {
225+
links?: t_Links_Self
226+
}
227+
> & { status: 200 })
228+
| (HttpResponse<t_Problem> & { status: 400 })
229+
| (HttpResponse<t_Problem> & { status: 401 })
230+
| (HttpResponse<t_Problem> & { status: 403 })
231+
| (HttpResponse<t_Problem> & { status: 404 })
232+
| (HttpResponse<t_Problem> & { status: 429 })
233+
| (HttpResponse<t_Problem> & { status: 500 })
234+
| HttpResponse<unknown>
235+
> {
236+
return this.httpClient.request<any>(
237+
"GET",
238+
this.config.basePath + `/bookings/${p["bookingId"]}`,
239+
{
240+
observe: "response",
241+
reportProgress: false,
242+
},
243+
)
244+
}
245+
246+
deleteBooking(p: {
247+
bookingId: string
248+
}): Observable<
249+
| (HttpResponse<void> & { status: 204 })
250+
| (HttpResponse<t_Problem> & { status: 400 })
251+
| (HttpResponse<t_Problem> & { status: 401 })
252+
| (HttpResponse<t_Problem> & { status: 403 })
253+
| (HttpResponse<t_Problem> & { status: 404 })
254+
| (HttpResponse<t_Problem> & { status: 429 })
255+
| (HttpResponse<t_Problem> & { status: 500 })
256+
| HttpResponse<unknown>
257+
> {
258+
return this.httpClient.request<any>(
259+
"DELETE",
260+
this.config.basePath + `/bookings/${p["bookingId"]}`,
261+
{
262+
observe: "response",
263+
reportProgress: false,
264+
},
265+
)
266+
}
267+
268+
createBookingPayment(p: {
269+
bookingId: string
270+
requestBody: t_BookingPayment
271+
}): Observable<
272+
| (HttpResponse<
273+
t_BookingPayment & {
274+
links?: t_Links_Booking
275+
}
276+
> & { status: 200 })
277+
| (HttpResponse<t_Problem> & { status: 400 })
278+
| (HttpResponse<t_Problem> & { status: 401 })
279+
| (HttpResponse<t_Problem> & { status: 403 })
280+
| (HttpResponse<t_Problem> & { status: 429 })
281+
| (HttpResponse<t_Problem> & { status: 500 })
282+
| HttpResponse<unknown>
283+
> {
284+
const headers = this._headers({ "Content-Type": "application/json" })
285+
const body = p["requestBody"]
286+
287+
return this.httpClient.request<any>(
288+
"POST",
289+
this.config.basePath + `/bookings/${p["bookingId"]}/payment`,
290+
{
291+
headers,
292+
body,
293+
observe: "response",
294+
reportProgress: false,
295+
},
296+
)
297+
}
298+
}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
/** AUTOGENERATED - DO NOT EDIT **/
2+
/* tslint:disable */
3+
/* eslint-disable */
4+
5+
export type EmptyObject = { [key: string]: never }
6+
7+
export type t_Booking = {
8+
has_bicycle?: boolean
9+
has_dog?: boolean
10+
readonly id?: string
11+
passenger_name?: string
12+
trip_id?: string
13+
}
14+
15+
export type t_BookingPayment = {
16+
amount?: number
17+
currency?: "bam" | "bgn" | "chf" | "eur" | "gbp" | "nok" | "sek" | "try"
18+
readonly id?: string
19+
source?: {
20+
account_type: "individual" | "company"
21+
bank_name: string
22+
country: string
23+
name: string
24+
number: string
25+
object?: string
26+
sort_code?: string
27+
}
28+
readonly status?: "pending" | "succeeded" | "failed"
29+
}
30+
31+
export type t_Links_Booking = {
32+
booking?: string
33+
}
34+
35+
export type t_Links_Pagination = {
36+
next?: string
37+
prev?: string
38+
}
39+
40+
export type t_Links_Self = {
41+
self?: string
42+
}
43+
44+
export type t_Problem = {
45+
detail?: string
46+
instance?: string
47+
status?: number
48+
title?: string
49+
type?: string
50+
}
51+
52+
export type t_Station = {
53+
address: string
54+
country_code: string
55+
id: string
56+
name: string
57+
timezone?: string
58+
}
59+
60+
export type t_Trip = {
61+
arrival_time?: string
62+
bicycles_allowed?: boolean
63+
departure_time?: string
64+
destination?: string
65+
dogs_allowed?: boolean
66+
id?: string
67+
operator?: string
68+
origin?: string
69+
price?: number
70+
}
71+
72+
export type t_Wrapper_Collection = {
73+
data?: {
74+
[key: string]: unknown | undefined
75+
}[]
76+
readonly links?: EmptyObject
77+
}

0 commit comments

Comments
 (0)