Skip to content

Commit 5d45385

Browse files
authored
fix: allow options (#151)
- treat `OPTIONS` as a valid http method - stronger typing of http methods
1 parent cce87ba commit 5d45385

File tree

8 files changed

+515
-7
lines changed

8 files changed

+515
-7
lines changed

integration-tests/typescript-angular/src/generated/okta.oauth.yaml/client.service.ts

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,28 @@ export class ApiClient {
452452
)
453453
}
454454

455+
parOptions(
456+
p: {
457+
origin?: string
458+
} = {},
459+
): Observable<
460+
| (HttpResponse<void> & { status: 204 })
461+
| (HttpResponse<t_Error> & { status: 429 })
462+
| HttpResponse<unknown>
463+
> {
464+
const headers = this._headers({ Origin: p["origin"] })
465+
466+
return this.httpClient.request<any>(
467+
"OPTIONS",
468+
this.config.basePath + `/oauth2/v1/par`,
469+
{
470+
headers,
471+
observe: "response",
472+
reportProgress: false,
473+
},
474+
)
475+
}
476+
455477
par(p: {
456478
requestBody: t_ParRequest
457479
}): Observable<
@@ -501,6 +523,28 @@ export class ApiClient {
501523
)
502524
}
503525

526+
tokenOptions(
527+
p: {
528+
origin?: string
529+
} = {},
530+
): Observable<
531+
| (HttpResponse<void> & { status: 204 })
532+
| (HttpResponse<t_Error> & { status: 429 })
533+
| HttpResponse<unknown>
534+
> {
535+
const headers = this._headers({ Origin: p["origin"] })
536+
537+
return this.httpClient.request<any>(
538+
"OPTIONS",
539+
this.config.basePath + `/oauth2/v1/token`,
540+
{
541+
headers,
542+
observe: "response",
543+
reportProgress: false,
544+
},
545+
)
546+
}
547+
504548
token(p: {
505549
requestBody: t_TokenRequest
506550
}): Observable<
@@ -774,6 +818,27 @@ export class ApiClient {
774818
)
775819
}
776820

821+
parOptionsCustomAs(p: {
822+
authorizationServerId: string
823+
origin?: string
824+
}): Observable<
825+
| (HttpResponse<void> & { status: 204 })
826+
| (HttpResponse<t_Error> & { status: 429 })
827+
| HttpResponse<unknown>
828+
> {
829+
const headers = this._headers({ Origin: p["origin"] })
830+
831+
return this.httpClient.request<any>(
832+
"OPTIONS",
833+
this.config.basePath + `/oauth2/${p["authorizationServerId"]}/v1/par`,
834+
{
835+
headers,
836+
observe: "response",
837+
reportProgress: false,
838+
},
839+
)
840+
}
841+
777842
parCustomAs(p: {
778843
authorizationServerId: string
779844
requestBody: t_ParRequest
@@ -825,6 +890,27 @@ export class ApiClient {
825890
)
826891
}
827892

893+
tokenOptionsCustomAs(p: {
894+
authorizationServerId: string
895+
origin?: string
896+
}): Observable<
897+
| (HttpResponse<void> & { status: 204 })
898+
| (HttpResponse<t_Error> & { status: 429 })
899+
| HttpResponse<unknown>
900+
> {
901+
const headers = this._headers({ Origin: p["origin"] })
902+
903+
return this.httpClient.request<any>(
904+
"OPTIONS",
905+
this.config.basePath + `/oauth2/${p["authorizationServerId"]}/v1/token`,
906+
{
907+
headers,
908+
observe: "response",
909+
reportProgress: false,
910+
},
911+
)
912+
}
913+
828914
tokenCustomAs(p: {
829915
authorizationServerId: string
830916
requestBody: t_TokenRequest

integration-tests/typescript-axios/src/generated/okta.oauth.yaml/client.ts

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,26 @@ export class ApiClient extends AbstractAxiosClient {
353353
})
354354
}
355355

356+
async parOptions(
357+
p: {
358+
origin?: string
359+
} = {},
360+
timeout?: number,
361+
opts?: AxiosRequestConfig,
362+
): Promise<AxiosResponse<void>> {
363+
const url = `/oauth2/v1/par`
364+
const headers = this._headers({ Origin: p["origin"] })
365+
366+
return this.axios.request({
367+
url: url,
368+
baseURL: this.basePath,
369+
method: "OPTIONS",
370+
headers,
371+
...(timeout ? { timeout } : {}),
372+
...(opts ?? {}),
373+
})
374+
}
375+
356376
async par(
357377
p: {
358378
requestBody: t_ParRequest
@@ -397,6 +417,26 @@ export class ApiClient extends AbstractAxiosClient {
397417
})
398418
}
399419

420+
async tokenOptions(
421+
p: {
422+
origin?: string
423+
} = {},
424+
timeout?: number,
425+
opts?: AxiosRequestConfig,
426+
): Promise<AxiosResponse<void>> {
427+
const url = `/oauth2/v1/token`
428+
const headers = this._headers({ Origin: p["origin"] })
429+
430+
return this.axios.request({
431+
url: url,
432+
baseURL: this.basePath,
433+
method: "OPTIONS",
434+
headers,
435+
...(timeout ? { timeout } : {}),
436+
...(opts ?? {}),
437+
})
438+
}
439+
400440
async token(
401441
p: {
402442
requestBody: t_TokenRequest
@@ -653,6 +693,27 @@ export class ApiClient extends AbstractAxiosClient {
653693
})
654694
}
655695

696+
async parOptionsCustomAs(
697+
p: {
698+
authorizationServerId: string
699+
origin?: string
700+
},
701+
timeout?: number,
702+
opts?: AxiosRequestConfig,
703+
): Promise<AxiosResponse<void>> {
704+
const url = `/oauth2/${p["authorizationServerId"]}/v1/par`
705+
const headers = this._headers({ Origin: p["origin"] })
706+
707+
return this.axios.request({
708+
url: url,
709+
baseURL: this.basePath,
710+
method: "OPTIONS",
711+
headers,
712+
...(timeout ? { timeout } : {}),
713+
...(opts ?? {}),
714+
})
715+
}
716+
656717
async parCustomAs(
657718
p: {
658719
authorizationServerId: string
@@ -699,6 +760,27 @@ export class ApiClient extends AbstractAxiosClient {
699760
})
700761
}
701762

763+
async tokenOptionsCustomAs(
764+
p: {
765+
authorizationServerId: string
766+
origin?: string
767+
},
768+
timeout?: number,
769+
opts?: AxiosRequestConfig,
770+
): Promise<AxiosResponse<void>> {
771+
const url = `/oauth2/${p["authorizationServerId"]}/v1/token`
772+
const headers = this._headers({ Origin: p["origin"] })
773+
774+
return this.axios.request({
775+
url: url,
776+
baseURL: this.basePath,
777+
method: "OPTIONS",
778+
headers,
779+
...(timeout ? { timeout } : {}),
780+
...(opts ?? {}),
781+
})
782+
}
783+
702784
async tokenCustomAs(
703785
p: {
704786
authorizationServerId: string

integration-tests/typescript-fetch/src/generated/okta.oauth.yaml/client.ts

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,23 @@ export class ApiClient extends AbstractFetchClient {
349349
return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout)
350350
}
351351

352+
async parOptions(
353+
p: {
354+
origin?: string
355+
} = {},
356+
timeout?: number,
357+
opts?: RequestInit,
358+
): Promise<TypedFetchResponse<Res<204, void> | Res<429, t_Error>>> {
359+
const url = this.basePath + `/oauth2/v1/par`
360+
const headers = this._headers({ Origin: p["origin"] })
361+
362+
return this._fetch(
363+
url,
364+
{ method: "OPTIONS", headers, ...(opts ?? {}) },
365+
timeout,
366+
)
367+
}
368+
352369
async par(
353370
p: {
354371
requestBody: t_ParRequest
@@ -400,6 +417,23 @@ export class ApiClient extends AbstractFetchClient {
400417
)
401418
}
402419

420+
async tokenOptions(
421+
p: {
422+
origin?: string
423+
} = {},
424+
timeout?: number,
425+
opts?: RequestInit,
426+
): Promise<TypedFetchResponse<Res<204, void> | Res<429, t_Error>>> {
427+
const url = this.basePath + `/oauth2/v1/token`
428+
const headers = this._headers({ Origin: p["origin"] })
429+
430+
return this._fetch(
431+
url,
432+
{ method: "OPTIONS", headers, ...(opts ?? {}) },
433+
timeout,
434+
)
435+
}
436+
403437
async token(
404438
p: {
405439
requestBody: t_TokenRequest
@@ -654,6 +688,24 @@ export class ApiClient extends AbstractFetchClient {
654688
return this._fetch(url + query, { method: "GET", ...(opts ?? {}) }, timeout)
655689
}
656690

691+
async parOptionsCustomAs(
692+
p: {
693+
authorizationServerId: string
694+
origin?: string
695+
},
696+
timeout?: number,
697+
opts?: RequestInit,
698+
): Promise<TypedFetchResponse<Res<204, void> | Res<429, t_Error>>> {
699+
const url = this.basePath + `/oauth2/${p["authorizationServerId"]}/v1/par`
700+
const headers = this._headers({ Origin: p["origin"] })
701+
702+
return this._fetch(
703+
url,
704+
{ method: "OPTIONS", headers, ...(opts ?? {}) },
705+
timeout,
706+
)
707+
}
708+
657709
async parCustomAs(
658710
p: {
659711
authorizationServerId: string
@@ -708,6 +760,24 @@ export class ApiClient extends AbstractFetchClient {
708760
)
709761
}
710762

763+
async tokenOptionsCustomAs(
764+
p: {
765+
authorizationServerId: string
766+
origin?: string
767+
},
768+
timeout?: number,
769+
opts?: RequestInit,
770+
): Promise<TypedFetchResponse<Res<204, void> | Res<429, t_Error>>> {
771+
const url = this.basePath + `/oauth2/${p["authorizationServerId"]}/v1/token`
772+
const headers = this._headers({ Origin: p["origin"] })
773+
774+
return this._fetch(
775+
url,
776+
{ method: "OPTIONS", headers, ...(opts ?? {}) },
777+
timeout,
778+
)
779+
}
780+
711781
async tokenCustomAs(
712782
p: {
713783
authorizationServerId: string

0 commit comments

Comments
 (0)