Skip to content

Commit ea3d9ee

Browse files
feat: use new generator (#977)
Co-authored-by: Nathanael DEMACON <ndemacon@scaleway.com>
1 parent c37ab66 commit ea3d9ee

File tree

120 files changed

+17720
-17530
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+17720
-17530
lines changed

.github/workflows/deploy-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
- run: echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > .npmrc
3434
env:
3535
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
36-
- run: pnpm lerna publish -y --create-release github
36+
- run: pnpm lerna publish -y --bump major --create-release github
3737
env:
3838
HUSKY: 0
3939
GH_TOKEN: ${{ secrets.GH_TOKEN }}

packages/clients/src/api/account/v2/api.gen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export class API extends ParentAPI {
6363
path: `/account/v2/projects`,
6464
urlParams: urlParams(
6565
['name', request.name],
66-
['order_by', request.orderBy ?? 'created_at_asc'],
66+
['order_by', request.orderBy],
6767
[
6868
'organization_id',
6969
request.organizationId ??

packages/clients/src/api/account/v2/marshalling.gen.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import type {
1414
UpdateProjectRequest,
1515
} from './types.gen'
1616

17-
export const unmarshalProject = (data: unknown) => {
17+
export const unmarshalProject = (data: unknown): Project => {
1818
if (!isJSONObject(data)) {
1919
throw new TypeError(
2020
`Unmarshalling the type 'Project' failed as data isn't a dictionary.`,
@@ -31,7 +31,9 @@ export const unmarshalProject = (data: unknown) => {
3131
} as Project
3232
}
3333

34-
export const unmarshalListProjectsResponse = (data: unknown) => {
34+
export const unmarshalListProjectsResponse = (
35+
data: unknown,
36+
): ListProjectsResponse => {
3537
if (!isJSONObject(data)) {
3638
throw new TypeError(
3739
`Unmarshalling the type 'ListProjectsResponse' failed as data isn't a dictionary.`,

packages/clients/src/api/account/v2/types.gen.ts

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,6 @@ export type ListProjectsRequestOrderBy =
77
| 'name_asc'
88
| 'name_desc'
99

10-
/** List projects response. */
11-
export interface ListProjectsResponse {
12-
/** Total number of Projects. */
13-
totalCount: number
14-
/** Paginated returned Projects. */
15-
projects: Project[]
16-
}
17-
18-
/** Project. */
1910
export interface Project {
2011
/** ID of the Project. */
2112
id: string
@@ -40,6 +31,16 @@ export type CreateProjectRequest = {
4031
description?: string
4132
}
4233

34+
export type DeleteProjectRequest = {
35+
/** Project ID of the Project. */
36+
projectId?: string
37+
}
38+
39+
export type GetProjectRequest = {
40+
/** Project ID of the Project. */
41+
projectId?: string
42+
}
43+
4344
export type ListProjectsRequest = {
4445
/** Organization ID of the Project. */
4546
organizationId?: string
@@ -58,14 +59,11 @@ export type ListProjectsRequest = {
5859
projectIds?: string[]
5960
}
6061

61-
export type GetProjectRequest = {
62-
/** Project ID of the Project. */
63-
projectId?: string
64-
}
65-
66-
export type DeleteProjectRequest = {
67-
/** Project ID of the Project. */
68-
projectId?: string
62+
export interface ListProjectsResponse {
63+
/** Total number of Projects. */
64+
totalCount: number
65+
/** Paginated returned Projects. */
66+
projects: Project[]
6967
}
7068

7169
export type UpdateProjectRequest = {

packages/clients/src/api/account/v3/api.gen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export class ProjectAPI extends ParentAPI {
6161
path: `/account/v3/projects`,
6262
urlParams: urlParams(
6363
['name', request.name],
64-
['order_by', request.orderBy ?? 'created_at_asc'],
64+
['order_by', request.orderBy],
6565
[
6666
'organization_id',
6767
request.organizationId ??

packages/clients/src/api/account/v3/marshalling.gen.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import type {
1414
ProjectApiUpdateProjectRequest,
1515
} from './types.gen'
1616

17-
export const unmarshalProject = (data: unknown) => {
17+
export const unmarshalProject = (data: unknown): Project => {
1818
if (!isJSONObject(data)) {
1919
throw new TypeError(
2020
`Unmarshalling the type 'Project' failed as data isn't a dictionary.`,
@@ -31,7 +31,9 @@ export const unmarshalProject = (data: unknown) => {
3131
} as Project
3232
}
3333

34-
export const unmarshalListProjectsResponse = (data: unknown) => {
34+
export const unmarshalListProjectsResponse = (
35+
data: unknown,
36+
): ListProjectsResponse => {
3537
if (!isJSONObject(data)) {
3638
throw new TypeError(
3739
`Unmarshalling the type 'ListProjectsResponse' failed as data isn't a dictionary.`,

packages/clients/src/api/account/v3/types.gen.ts

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,6 @@ export type ListProjectsRequestOrderBy =
77
| 'name_asc'
88
| 'name_desc'
99

10-
/** List projects response. */
11-
export interface ListProjectsResponse {
12-
/** Total number of Projects. */
13-
totalCount: number
14-
/** Paginated returned Projects. */
15-
projects: Project[]
16-
}
17-
18-
/** Project. */
1910
export interface Project {
2011
/** ID of the Project. */
2112
id: string
@@ -31,6 +22,13 @@ export interface Project {
3122
description: string
3223
}
3324

25+
export interface ListProjectsResponse {
26+
/** Total number of Projects. */
27+
totalCount: number
28+
/** Paginated returned Projects. */
29+
projects: Project[]
30+
}
31+
3432
export type ProjectApiCreateProjectRequest = {
3533
/** Name of the Project. */
3634
name?: string
@@ -40,6 +38,16 @@ export type ProjectApiCreateProjectRequest = {
4038
description: string
4139
}
4240

41+
export type ProjectApiDeleteProjectRequest = {
42+
/** Project ID of the Project. */
43+
projectId?: string
44+
}
45+
46+
export type ProjectApiGetProjectRequest = {
47+
/** Project ID of the Project. */
48+
projectId?: string
49+
}
50+
4351
export type ProjectApiListProjectsRequest = {
4452
/** Organization ID of the Project. */
4553
organizationId?: string
@@ -58,16 +66,6 @@ export type ProjectApiListProjectsRequest = {
5866
projectIds?: string[]
5967
}
6068

61-
export type ProjectApiGetProjectRequest = {
62-
/** Project ID of the Project. */
63-
projectId?: string
64-
}
65-
66-
export type ProjectApiDeleteProjectRequest = {
67-
/** Project ID of the Project. */
68-
projectId?: string
69-
}
70-
7169
export type ProjectApiUpdateProjectRequest = {
7270
/** Project ID of the Project. */
7371
projectId?: string

packages/clients/src/api/applesilicon/v1alpha1/api.gen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export class API extends ParentAPI {
119119
request.zone ?? this.client.settings.defaultZone,
120120
)}/servers`,
121121
urlParams: urlParams(
122-
['order_by', request.orderBy ?? 'created_at_asc'],
122+
['order_by', request.orderBy],
123123
['organization_id', request.organizationId],
124124
['page', request.page],
125125
[

packages/clients/src/api/applesilicon/v1alpha1/marshalling.gen.ts

Lines changed: 47 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -21,53 +21,79 @@ import type {
2121
UpdateServerRequest,
2222
} from './types.gen'
2323

24-
const unmarshalServerTypeCPU = (data: unknown) => {
24+
export const unmarshalOS = (data: unknown): OS => {
25+
if (!isJSONObject(data)) {
26+
throw new TypeError(
27+
`Unmarshalling the type 'OS' failed as data isn't a dictionary.`,
28+
)
29+
}
30+
31+
return {
32+
compatibleServerTypes: data.compatible_server_types,
33+
id: data.id,
34+
imageUrl: data.image_url,
35+
label: data.label,
36+
name: data.name,
37+
} as OS
38+
}
39+
40+
const unmarshalServerTypeCPU = (data: unknown): ServerTypeCPU => {
2541
if (!isJSONObject(data)) {
2642
throw new TypeError(
2743
`Unmarshalling the type 'ServerTypeCPU' failed as data isn't a dictionary.`,
2844
)
2945
}
3046

31-
return { coreCount: data.core_count, name: data.name } as ServerTypeCPU
47+
return {
48+
coreCount: data.core_count,
49+
name: data.name,
50+
} as ServerTypeCPU
3251
}
3352

34-
const unmarshalServerTypeDisk = (data: unknown) => {
53+
const unmarshalServerTypeDisk = (data: unknown): ServerTypeDisk => {
3554
if (!isJSONObject(data)) {
3655
throw new TypeError(
3756
`Unmarshalling the type 'ServerTypeDisk' failed as data isn't a dictionary.`,
3857
)
3958
}
4059

41-
return { capacity: data.capacity, type: data.type } as ServerTypeDisk
60+
return {
61+
capacity: data.capacity,
62+
type: data.type,
63+
} as ServerTypeDisk
4264
}
4365

44-
const unmarshalServerTypeMemory = (data: unknown) => {
66+
const unmarshalServerTypeMemory = (data: unknown): ServerTypeMemory => {
4567
if (!isJSONObject(data)) {
4668
throw new TypeError(
4769
`Unmarshalling the type 'ServerTypeMemory' failed as data isn't a dictionary.`,
4870
)
4971
}
5072

51-
return { capacity: data.capacity, type: data.type } as ServerTypeMemory
73+
return {
74+
capacity: data.capacity,
75+
type: data.type,
76+
} as ServerTypeMemory
5277
}
5378

54-
export const unmarshalOS = (data: unknown) => {
79+
export const unmarshalServerType = (data: unknown): ServerType => {
5580
if (!isJSONObject(data)) {
5681
throw new TypeError(
57-
`Unmarshalling the type 'OS' failed as data isn't a dictionary.`,
82+
`Unmarshalling the type 'ServerType' failed as data isn't a dictionary.`,
5883
)
5984
}
6085

6186
return {
62-
compatibleServerTypes: data.compatible_server_types,
63-
id: data.id,
64-
imageUrl: data.image_url,
65-
label: data.label,
87+
cpu: data.cpu ? unmarshalServerTypeCPU(data.cpu) : undefined,
88+
disk: data.disk ? unmarshalServerTypeDisk(data.disk) : undefined,
89+
memory: data.memory ? unmarshalServerTypeMemory(data.memory) : undefined,
90+
minimumLeaseDuration: data.minimum_lease_duration,
6691
name: data.name,
67-
} as OS
92+
stock: data.stock,
93+
} as ServerType
6894
}
6995

70-
export const unmarshalServer = (data: unknown) => {
96+
export const unmarshalServer = (data: unknown): Server => {
7197
if (!isJSONObject(data)) {
7298
throw new TypeError(
7399
`Unmarshalling the type 'Server' failed as data isn't a dictionary.`,
@@ -90,24 +116,7 @@ export const unmarshalServer = (data: unknown) => {
90116
} as Server
91117
}
92118

93-
export const unmarshalServerType = (data: unknown) => {
94-
if (!isJSONObject(data)) {
95-
throw new TypeError(
96-
`Unmarshalling the type 'ServerType' failed as data isn't a dictionary.`,
97-
)
98-
}
99-
100-
return {
101-
cpu: data.cpu ? unmarshalServerTypeCPU(data.cpu) : undefined,
102-
disk: data.disk ? unmarshalServerTypeDisk(data.disk) : undefined,
103-
memory: data.memory ? unmarshalServerTypeMemory(data.memory) : undefined,
104-
minimumLeaseDuration: data.minimum_lease_duration,
105-
name: data.name,
106-
stock: data.stock,
107-
} as ServerType
108-
}
109-
110-
export const unmarshalListOSResponse = (data: unknown) => {
119+
export const unmarshalListOSResponse = (data: unknown): ListOSResponse => {
111120
if (!isJSONObject(data)) {
112121
throw new TypeError(
113122
`Unmarshalling the type 'ListOSResponse' failed as data isn't a dictionary.`,
@@ -120,7 +129,9 @@ export const unmarshalListOSResponse = (data: unknown) => {
120129
} as ListOSResponse
121130
}
122131

123-
export const unmarshalListServerTypesResponse = (data: unknown) => {
132+
export const unmarshalListServerTypesResponse = (
133+
data: unknown,
134+
): ListServerTypesResponse => {
124135
if (!isJSONObject(data)) {
125136
throw new TypeError(
126137
`Unmarshalling the type 'ListServerTypesResponse' failed as data isn't a dictionary.`,
@@ -132,7 +143,9 @@ export const unmarshalListServerTypesResponse = (data: unknown) => {
132143
} as ListServerTypesResponse
133144
}
134145

135-
export const unmarshalListServersResponse = (data: unknown) => {
146+
export const unmarshalListServersResponse = (
147+
data: unknown,
148+
): ListServersResponse => {
136149
if (!isJSONObject(data)) {
137150
throw new TypeError(
138151
`Unmarshalling the type 'ListServersResponse' failed as data isn't a dictionary.`,

0 commit comments

Comments
 (0)