Skip to content

Commit

Permalink
refactor: httpMethod
Browse files Browse the repository at this point in the history
  • Loading branch information
openint-bot committed Dec 23, 2024
1 parent cacb280 commit 89479ae
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 21 deletions.
24 changes: 14 additions & 10 deletions packages/fetch-links/link.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
/** TODO: Leverage typescript helper instead. */
export type HTTPMethod =
| 'GET'
| 'PUT'
| 'POST'
| 'DELETE'
| 'OPTIONS'
| 'HEAD'
| 'PATCH'
| 'TRACE'
import type {HttpMethod} from 'openapi-typescript-helpers'

export const HTTP_METHODS = [
'GET',
'PUT',
'POST',
'DELETE',
'OPTIONS',
'HEAD',
'PATCH',
'TRACE',
] satisfies ReadonlyArray<Uppercase<HttpMethod>>

export type HTTPMethod = (typeof HTTP_METHODS)[number]

/**
* The BetterRequest object is an extension of the native [Request](https://developer.mozilla.org/en-US/docs/Web/API/Request)
Expand Down
1 change: 1 addition & 0 deletions packages/fetch-links/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"devDependencies": {
"axios": "^1.6.2",
"concurrently": "^8.2.2",
"openapi-typescript-helpers": "^0.0.15",
"type-fest": "^4.28.0"
},
"publishConfig": {
Expand Down
12 changes: 1 addition & 11 deletions packages/runtime/createClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
applyLinks,
authLink,
fetchLink,
HTTP_METHODS,
// type HTTPMethod,
type Link,
} from '@opensdks/fetch-links'
Expand All @@ -39,17 +40,6 @@ export type OpenAPIClient<Paths extends {}> = ReturnType<
// to get a list of servers and all that?
// Really do feel that they should be generated as well..

const HTTP_METHODS = [
'GET',
'PUT',
'POST',
'DELETE',
'OPTIONS',
'HEAD',
'PATCH',
'TRACE',
] satisfies ReadonlyArray<Uppercase<HttpMethod>>

export function createClient<
Paths extends {},
Media extends MediaType = MediaType,
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 89479ae

Please sign in to comment.