Skip to content

Commit

Permalink
fix: Use POST for all endpoints with params (#44)
Browse files Browse the repository at this point in the history
* Ensure post is used for all endpoints with parameters

* ci: Generate code

---------

Co-authored-by: Seam Bot <[email protected]>
  • Loading branch information
razor-x and seambot authored Jan 22, 2024
1 parent 41b56a0 commit 97f20b3
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 43 deletions.
9 changes: 7 additions & 2 deletions generate-routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,11 @@ const deriveResourceFromSchema = (properties: object): string | null =>
Object.keys(properties).filter((key) => key !== 'ok')[0] ?? null

const deriveSemanticMethod = (methods: string[]): Method => {
if (methods.includes('get')) return 'GET'
// UPSTREAM: This should return GET before POST.
// Blocked on https://github.com/seamapi/nextlove/issues/117
// and https://github.com/seamapi/javascript-http/issues/43
if (methods.includes('post')) return 'POST'
if (methods.includes('get')) return 'GET'
throw new Error(`Could not find valid method in ${methods.join(', ')}`)
}

Expand Down Expand Up @@ -458,7 +461,9 @@ const renderRequestType = ({
pascalCase(requestFormatToRequestType(name, namespace)),
].join('')

// UPSTREAM: Should be just requestFormat, but blocked on https://github.com/seamapi/nextlove/issues/117
// UPSTREAM: This function is a workaround, as the request type should always match the request format.
// Blocked on https://github.com/seamapi/nextlove/issues/117
// and https://github.com/seamapi/javascript-http/issues/43
const requestFormatToRequestType = (
name: string,
_namespace: string,
Expand Down
14 changes: 5 additions & 9 deletions src/lib/seam/connect/routes/connected-accounts.ts

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

15 changes: 5 additions & 10 deletions src/lib/seam/connect/routes/user-identities.ts

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

14 changes: 5 additions & 9 deletions src/lib/seam/connect/routes/webhooks.ts

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

22 changes: 9 additions & 13 deletions src/lib/seam/connect/routes/workspaces.ts

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

0 comments on commit 97f20b3

Please sign in to comment.