Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 5 additions & 25 deletions codegen/lib/layouts/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@ const getEndpointLayoutContext = (
): EndpointLayoutContext => {
const prefix = pascalCase([route.path.split('/'), endpoint.name].join('_'))

const methodParamName = getMethodParamName(endpoint.name, route.name)
const methodParamName = ['GET', 'DELETE'].includes(
endpoint.request.semanticMethod,
)
? 'params'
: 'body'

const requestFormat = ['GET', 'DELETE'].includes(
endpoint.request.preferredMethod,
Expand Down Expand Up @@ -127,27 +131,3 @@ const getResponseContext = (

const getClassName = (name: string | null): string =>
`SeamHttp${pascalCase(name ?? '')}`

const getMethodParamName = (
endpointName: string,
routeName: string,
): 'params' | 'body' => {
// UPSTREAM: This function implements a workaround, as the request format should always follow the semantic method.
// Blocked on https://github.com/seamapi/nextlove/issues/117
// and https://github.com/seamapi/javascript-http/issues/43
//
// The desired implementation:
//
// return ['GET', 'DELETE'].includes(endpoint.request.semanticMethod)
// ? 'params'
// : 'body'

if (routeName.includes('simulate')) return 'body'
if (['get', 'list', 'view'].includes(endpointName)) return 'params'
if (['delete'].includes(endpointName)) return 'params'
if (endpointName.includes('revoke')) return 'params'
if (endpointName.includes('remove')) return 'params'
if (endpointName.includes('deactivate')) return 'params'
if (endpointName.startsWith('list')) return 'params'
return 'body'
}
18 changes: 9 additions & 9 deletions package-lock.json

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

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"npm": ">=10.1.0"
},
"peerDependencies": {
"@seamapi/types": "^1.413.0"
"@seamapi/types": "^1.420.2"
},
"peerDependenciesMeta": {
"@seamapi/types": {
Expand All @@ -98,10 +98,10 @@
"axios-retry": "^4.4.2"
},
"devDependencies": {
"@seamapi/blueprint": "^0.48.1",
"@seamapi/blueprint": "^0.50.1",
"@seamapi/fake-seam-connect": "^1.77.0",
"@seamapi/smith": "^0.4.4",
"@seamapi/types": "1.413.0",
"@seamapi/types": "1.420.2",
"@swc/core": "^1.11.29",
"@types/eslint": "^8.44.2",
"@types/jsonwebtoken": "^9.0.6",
Expand Down
6 changes: 3 additions & 3 deletions src/lib/seam/connect/routes/access-codes/access-codes.ts

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

17 changes: 17 additions & 0 deletions src/lib/seam/connect/routes/access-grants/access-grants.ts

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

13 changes: 9 additions & 4 deletions src/lib/seam/connect/routes/acs/credentials/credentials.ts

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

12 changes: 8 additions & 4 deletions src/lib/seam/connect/routes/acs/encoders/encoders.ts

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

6 changes: 3 additions & 3 deletions src/lib/seam/connect/routes/acs/users/users.ts

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

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

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

8 changes: 5 additions & 3 deletions src/lib/seam/connect/routes/devices/simulate/simulate.ts

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

6 changes: 3 additions & 3 deletions src/lib/seam/connect/routes/phones/simulate/simulate.ts

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

6 changes: 3 additions & 3 deletions src/lib/seam/connect/routes/thermostats/thermostats.ts

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

Loading