Skip to content

Commit 276c53d

Browse files
committed
Make all params optional
1 parent ed398e4 commit 276c53d

20 files changed

+96
-89
lines changed

generate-routes.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ interface Endpoint {
7878
resource: string | null
7979
method: Method
8080
requestFormat: 'params' | 'body'
81+
isRequestParamOptional: boolean
8182
}
8283

8384
type Method = 'GET' | 'POST'
@@ -147,6 +148,9 @@ const createEndpoint = (
147148
method,
148149
resource: deriveResource(endpointPath, method),
149150
requestFormat: ['GET', 'DELETE'].includes(method) ? 'params' : 'body',
151+
// UPSTREAM: This could be derived from the OpenAPI spec, however some endpoints require at least one param,
152+
// and in the spec this currently looks as if params are optional.
153+
isRequestParamOptional: true,
150154
}
151155
}
152156

@@ -298,11 +302,10 @@ const renderClassMethod = ({
298302
namespace,
299303
resource,
300304
path,
305+
isRequestParamOptional,
301306
}: Endpoint): string => `
302307
async ${camelCase(name)}(
303-
${requestFormat}${
304-
requestFormat === 'params' ? '?' : ''
305-
}: ${renderRequestType({
308+
${requestFormat}${isRequestParamOptional ? '?' : ''}: ${renderRequestType({
306309
name,
307310
namespace,
308311
})},

src/lib/seam/connect/routes/access-codes-unmanaged.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export class SeamHttpAccessCodesUnmanaged {
8383
}
8484

8585
async convertToManaged(
86-
body: AccessCodesUnmanagedConvertToManagedBody,
86+
body?: AccessCodesUnmanagedConvertToManagedBody,
8787
): Promise<void> {
8888
await this.client.request<AccessCodesUnmanagedConvertToManagedResponse>({
8989
url: '/access_codes/unmanaged/convert_to_managed',
@@ -92,7 +92,7 @@ export class SeamHttpAccessCodesUnmanaged {
9292
})
9393
}
9494

95-
async delete(body: AccessCodesUnmanagedDeleteBody): Promise<void> {
95+
async delete(body?: AccessCodesUnmanagedDeleteBody): Promise<void> {
9696
await this.client.request<AccessCodesUnmanagedDeleteResponse>({
9797
url: '/access_codes/unmanaged/delete',
9898
method: 'post',
@@ -101,7 +101,7 @@ export class SeamHttpAccessCodesUnmanaged {
101101
}
102102

103103
async get(
104-
body: AccessCodesUnmanagedGetParams,
104+
body?: AccessCodesUnmanagedGetParams,
105105
): Promise<AccessCodesUnmanagedGetResponse['access_code']> {
106106
const { data } = await this.client.request<AccessCodesUnmanagedGetResponse>(
107107
{
@@ -114,7 +114,7 @@ export class SeamHttpAccessCodesUnmanaged {
114114
}
115115

116116
async list(
117-
body: AccessCodesUnmanagedListParams,
117+
body?: AccessCodesUnmanagedListParams,
118118
): Promise<AccessCodesUnmanagedListResponse['access_codes']> {
119119
const { data } =
120120
await this.client.request<AccessCodesUnmanagedListResponse>({
@@ -125,7 +125,7 @@ export class SeamHttpAccessCodesUnmanaged {
125125
return data.access_codes
126126
}
127127

128-
async update(body: AccessCodesUnmanagedUpdateBody): Promise<void> {
128+
async update(body?: AccessCodesUnmanagedUpdateBody): Promise<void> {
129129
await this.client.request<AccessCodesUnmanagedUpdateResponse>({
130130
url: '/access_codes/unmanaged/update',
131131
method: 'post',

src/lib/seam/connect/routes/access-codes.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export class SeamHttpAccessCodes {
8888
}
8989

9090
async create(
91-
body: AccessCodesCreateBody,
91+
body?: AccessCodesCreateBody,
9292
): Promise<AccessCodesCreateResponse['access_code']> {
9393
const { data } = await this.client.request<AccessCodesCreateResponse>({
9494
url: '/access_codes/create',
@@ -99,7 +99,7 @@ export class SeamHttpAccessCodes {
9999
}
100100

101101
async createMultiple(
102-
body: AccessCodesCreateMultipleBody,
102+
body?: AccessCodesCreateMultipleBody,
103103
): Promise<AccessCodesCreateMultipleResponse['access_codes']> {
104104
const { data } =
105105
await this.client.request<AccessCodesCreateMultipleResponse>({
@@ -110,7 +110,7 @@ export class SeamHttpAccessCodes {
110110
return data.access_codes
111111
}
112112

113-
async delete(body: AccessCodesDeleteBody): Promise<void> {
113+
async delete(body?: AccessCodesDeleteBody): Promise<void> {
114114
await this.client.request<AccessCodesDeleteResponse>({
115115
url: '/access_codes/delete',
116116
method: 'post',
@@ -119,7 +119,7 @@ export class SeamHttpAccessCodes {
119119
}
120120

121121
async generateCode(
122-
body: AccessCodesGenerateCodeBody,
122+
body?: AccessCodesGenerateCodeBody,
123123
): Promise<AccessCodesGenerateCodeResponse['generated_code']> {
124124
const { data } = await this.client.request<AccessCodesGenerateCodeResponse>(
125125
{
@@ -132,7 +132,7 @@ export class SeamHttpAccessCodes {
132132
}
133133

134134
async get(
135-
body: AccessCodesGetParams,
135+
body?: AccessCodesGetParams,
136136
): Promise<AccessCodesGetResponse['access_code']> {
137137
const { data } = await this.client.request<AccessCodesGetResponse>({
138138
url: '/access_codes/get',
@@ -143,7 +143,7 @@ export class SeamHttpAccessCodes {
143143
}
144144

145145
async list(
146-
body: AccessCodesListParams,
146+
body?: AccessCodesListParams,
147147
): Promise<AccessCodesListResponse['access_codes']> {
148148
const { data } = await this.client.request<AccessCodesListResponse>({
149149
url: '/access_codes/list',
@@ -154,7 +154,7 @@ export class SeamHttpAccessCodes {
154154
}
155155

156156
async pullBackupAccessCode(
157-
body: AccessCodesPullBackupAccessCodeBody,
157+
body?: AccessCodesPullBackupAccessCodeBody,
158158
): Promise<AccessCodesPullBackupAccessCodeResponse['backup_access_code']> {
159159
const { data } =
160160
await this.client.request<AccessCodesPullBackupAccessCodeResponse>({
@@ -165,7 +165,7 @@ export class SeamHttpAccessCodes {
165165
return data.backup_access_code
166166
}
167167

168-
async update(body: AccessCodesUpdateBody): Promise<void> {
168+
async update(body?: AccessCodesUpdateBody): Promise<void> {
169169
await this.client.request<AccessCodesUpdateResponse>({
170170
url: '/access_codes/update',
171171
method: 'post',

src/lib/seam/connect/routes/acs-access-groups.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export class SeamHttpAcsAccessGroups {
8282
return SeamHttpAcsAccessGroups.fromClientSessionToken(token, options)
8383
}
8484

85-
async addUser(body: AcsAccessGroupsAddUserBody): Promise<void> {
85+
async addUser(body?: AcsAccessGroupsAddUserBody): Promise<void> {
8686
await this.client.request<AcsAccessGroupsAddUserResponse>({
8787
url: '/acs/access_groups/add_user',
8888
method: 'post',
@@ -91,7 +91,7 @@ export class SeamHttpAcsAccessGroups {
9191
}
9292

9393
async create(
94-
body: AcsAccessGroupsCreateBody,
94+
body?: AcsAccessGroupsCreateBody,
9595
): Promise<AcsAccessGroupsCreateResponse['acs_access_group']> {
9696
const { data } = await this.client.request<AcsAccessGroupsCreateResponse>({
9797
url: '/acs/access_groups/create',
@@ -101,7 +101,7 @@ export class SeamHttpAcsAccessGroups {
101101
return data.acs_access_group
102102
}
103103

104-
async delete(body: AcsAccessGroupsDeleteBody): Promise<void> {
104+
async delete(body?: AcsAccessGroupsDeleteBody): Promise<void> {
105105
await this.client.request<AcsAccessGroupsDeleteResponse>({
106106
url: '/acs/access_groups/delete',
107107
method: 'post',
@@ -110,7 +110,7 @@ export class SeamHttpAcsAccessGroups {
110110
}
111111

112112
async get(
113-
body: AcsAccessGroupsGetParams,
113+
body?: AcsAccessGroupsGetParams,
114114
): Promise<AcsAccessGroupsGetResponse['acs_access_group']> {
115115
const { data } = await this.client.request<AcsAccessGroupsGetResponse>({
116116
url: '/acs/access_groups/get',
@@ -121,7 +121,7 @@ export class SeamHttpAcsAccessGroups {
121121
}
122122

123123
async list(
124-
body: AcsAccessGroupsListParams,
124+
body?: AcsAccessGroupsListParams,
125125
): Promise<AcsAccessGroupsListResponse['acs_access_groups']> {
126126
const { data } = await this.client.request<AcsAccessGroupsListResponse>({
127127
url: '/acs/access_groups/list',
@@ -132,7 +132,7 @@ export class SeamHttpAcsAccessGroups {
132132
}
133133

134134
async listUsers(
135-
body: AcsAccessGroupsListUsersParams,
135+
body?: AcsAccessGroupsListUsersParams,
136136
): Promise<AcsAccessGroupsListUsersResponse['acs_users']> {
137137
const { data } =
138138
await this.client.request<AcsAccessGroupsListUsersResponse>({
@@ -143,15 +143,15 @@ export class SeamHttpAcsAccessGroups {
143143
return data.acs_users
144144
}
145145

146-
async removeUser(body: AcsAccessGroupsRemoveUserBody): Promise<void> {
146+
async removeUser(body?: AcsAccessGroupsRemoveUserBody): Promise<void> {
147147
await this.client.request<AcsAccessGroupsRemoveUserResponse>({
148148
url: '/acs/access_groups/remove_user',
149149
method: 'post',
150150
data: body,
151151
})
152152
}
153153

154-
async update(body: AcsAccessGroupsUpdateBody): Promise<void> {
154+
async update(body?: AcsAccessGroupsUpdateBody): Promise<void> {
155155
await this.client.request<AcsAccessGroupsUpdateResponse>({
156156
url: '/acs/access_groups/update',
157157
method: 'post',

src/lib/seam/connect/routes/acs-credentials.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export class SeamHttpAcsCredentials {
8383
}
8484

8585
async create(
86-
body: AcsCredentialsCreateBody,
86+
body?: AcsCredentialsCreateBody,
8787
): Promise<AcsCredentialsCreateResponse['acs_credential']> {
8888
const { data } = await this.client.request<AcsCredentialsCreateResponse>({
8989
url: '/acs/credentials/create',
@@ -93,7 +93,7 @@ export class SeamHttpAcsCredentials {
9393
return data.acs_credential
9494
}
9595

96-
async delete(body: AcsCredentialsDeleteBody): Promise<void> {
96+
async delete(body?: AcsCredentialsDeleteBody): Promise<void> {
9797
await this.client.request<AcsCredentialsDeleteResponse>({
9898
url: '/acs/credentials/delete',
9999
method: 'post',
@@ -102,7 +102,7 @@ export class SeamHttpAcsCredentials {
102102
}
103103

104104
async get(
105-
body: AcsCredentialsGetParams,
105+
body?: AcsCredentialsGetParams,
106106
): Promise<AcsCredentialsGetResponse['acs_credential']> {
107107
const { data } = await this.client.request<AcsCredentialsGetResponse>({
108108
url: '/acs/credentials/get',
@@ -113,7 +113,7 @@ export class SeamHttpAcsCredentials {
113113
}
114114

115115
async list(
116-
body: AcsCredentialsListParams,
116+
body?: AcsCredentialsListParams,
117117
): Promise<AcsCredentialsListResponse['acs_credentials']> {
118118
const { data } = await this.client.request<AcsCredentialsListResponse>({
119119
url: '/acs/credentials/list',

src/lib/seam/connect/routes/acs-systems.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export class SeamHttpAcsSystems {
8383
}
8484

8585
async get(
86-
body: AcsSystemsGetParams,
86+
body?: AcsSystemsGetParams,
8787
): Promise<AcsSystemsGetResponse['acs_system']> {
8888
const { data } = await this.client.request<AcsSystemsGetResponse>({
8989
url: '/acs/systems/get',
@@ -94,7 +94,7 @@ export class SeamHttpAcsSystems {
9494
}
9595

9696
async list(
97-
body: AcsSystemsListParams,
97+
body?: AcsSystemsListParams,
9898
): Promise<AcsSystemsListResponse['acs_systems']> {
9999
const { data } = await this.client.request<AcsSystemsListResponse>({
100100
url: '/acs/systems/list',

src/lib/seam/connect/routes/acs-users.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export class SeamHttpAcsUsers {
8282
return SeamHttpAcsUsers.fromClientSessionToken(token, options)
8383
}
8484

85-
async addToAccessGroup(body: AcsUsersAddToAccessGroupBody): Promise<void> {
85+
async addToAccessGroup(body?: AcsUsersAddToAccessGroupBody): Promise<void> {
8686
await this.client.request<AcsUsersAddToAccessGroupResponse>({
8787
url: '/acs/users/add_to_access_group',
8888
method: 'post',
@@ -91,7 +91,7 @@ export class SeamHttpAcsUsers {
9191
}
9292

9393
async create(
94-
body: AcsUsersCreateBody,
94+
body?: AcsUsersCreateBody,
9595
): Promise<AcsUsersCreateResponse['acs_user']> {
9696
const { data } = await this.client.request<AcsUsersCreateResponse>({
9797
url: '/acs/users/create',
@@ -101,15 +101,17 @@ export class SeamHttpAcsUsers {
101101
return data.acs_user
102102
}
103103

104-
async delete(body: AcsUsersDeleteBody): Promise<void> {
104+
async delete(body?: AcsUsersDeleteBody): Promise<void> {
105105
await this.client.request<AcsUsersDeleteResponse>({
106106
url: '/acs/users/delete',
107107
method: 'post',
108108
data: body,
109109
})
110110
}
111111

112-
async get(body: AcsUsersGetParams): Promise<AcsUsersGetResponse['acs_user']> {
112+
async get(
113+
body?: AcsUsersGetParams,
114+
): Promise<AcsUsersGetResponse['acs_user']> {
113115
const { data } = await this.client.request<AcsUsersGetResponse>({
114116
url: '/acs/users/get',
115117
method: 'post',
@@ -119,7 +121,7 @@ export class SeamHttpAcsUsers {
119121
}
120122

121123
async list(
122-
body: AcsUsersListParams,
124+
body?: AcsUsersListParams,
123125
): Promise<AcsUsersListResponse['acs_users']> {
124126
const { data } = await this.client.request<AcsUsersListResponse>({
125127
url: '/acs/users/list',
@@ -130,7 +132,7 @@ export class SeamHttpAcsUsers {
130132
}
131133

132134
async removeFromAccessGroup(
133-
body: AcsUsersRemoveFromAccessGroupBody,
135+
body?: AcsUsersRemoveFromAccessGroupBody,
134136
): Promise<void> {
135137
await this.client.request<AcsUsersRemoveFromAccessGroupResponse>({
136138
url: '/acs/users/remove_from_access_group',
@@ -139,23 +141,23 @@ export class SeamHttpAcsUsers {
139141
})
140142
}
141143

142-
async suspend(body: AcsUsersSuspendBody): Promise<void> {
144+
async suspend(body?: AcsUsersSuspendBody): Promise<void> {
143145
await this.client.request<AcsUsersSuspendResponse>({
144146
url: '/acs/users/suspend',
145147
method: 'post',
146148
data: body,
147149
})
148150
}
149151

150-
async unsuspend(body: AcsUsersUnsuspendBody): Promise<void> {
152+
async unsuspend(body?: AcsUsersUnsuspendBody): Promise<void> {
151153
await this.client.request<AcsUsersUnsuspendResponse>({
152154
url: '/acs/users/unsuspend',
153155
method: 'post',
154156
data: body,
155157
})
156158
}
157159

158-
async update(body: AcsUsersUpdateBody): Promise<void> {
160+
async update(body?: AcsUsersUpdateBody): Promise<void> {
159161
await this.client.request<AcsUsersUpdateResponse>({
160162
url: '/acs/users/update',
161163
method: 'post',

src/lib/seam/connect/routes/action-attempts.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export class SeamHttpActionAttempts {
8383
}
8484

8585
async get(
86-
body: ActionAttemptsGetParams,
86+
body?: ActionAttemptsGetParams,
8787
): Promise<ActionAttemptsGetResponse['action_attempt']> {
8888
const { data } = await this.client.request<ActionAttemptsGetResponse>({
8989
url: '/action_attempts/get',
@@ -94,7 +94,7 @@ export class SeamHttpActionAttempts {
9494
}
9595

9696
async list(
97-
body: ActionAttemptsListParams,
97+
body?: ActionAttemptsListParams,
9898
): Promise<ActionAttemptsListResponse['action_attempts']> {
9999
const { data } = await this.client.request<ActionAttemptsListResponse>({
100100
url: '/action_attempts/list',

0 commit comments

Comments
 (0)