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
1 change: 1 addition & 0 deletions packages/clients/src/api/webhosting/v1/index.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export type {
CheckUserOwnsDomainResponse,
ControlPanel,
ControlPanelApiListControlPanelsRequest,
CreateDatabaseRequestUser,
CreateHostingRequestDomainConfiguration,
Database,
DatabaseApiAssignDatabaseUserRequest,
Expand Down
20 changes: 20 additions & 0 deletions packages/clients/src/api/webhosting/v1/marshalling.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// If you have any remark or suggestion do not hesitate to open an issue.
import {
isJSONObject,
resolveOneOf,
unmarshalArrayOfObject,
unmarshalDate,
unmarshalMoney,
Expand All @@ -10,6 +11,7 @@ import type { DefaultValues } from '../../../bridge'
import type {
CheckUserOwnsDomainResponse,
ControlPanel,
CreateDatabaseRequestUser,
CreateHostingRequestDomainConfiguration,
Database,
DatabaseApiAssignDatabaseUserRequest,
Expand Down Expand Up @@ -517,11 +519,29 @@ export const marshalDatabaseApiChangeDatabaseUserPasswordRequest = (
password: request.password,
})

const marshalCreateDatabaseRequestUser = (
request: CreateDatabaseRequestUser,
defaults: DefaultValues,
): Record<string, unknown> => ({
password: request.password,
username: request.username,
})

export const marshalDatabaseApiCreateDatabaseRequest = (
request: DatabaseApiCreateDatabaseRequest,
defaults: DefaultValues,
): Record<string, unknown> => ({
database_name: request.databaseName,
...resolveOneOf<Record<string, unknown> | string>([
{
param: 'new_user',
value:
request.newUser !== undefined
? marshalCreateDatabaseRequestUser(request.newUser, defaults)
: undefined,
},
{ param: 'existing_username', value: request.existingUsername },
]),
})

export const marshalDatabaseApiCreateDatabaseUserRequest = (
Expand Down
17 changes: 17 additions & 0 deletions packages/clients/src/api/webhosting/v1/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ export interface PlatformControlPanel {
urls?: PlatformControlPanelUrls
}

export interface CreateDatabaseRequestUser {
username: string
password: string
}

export interface CreateHostingRequestDomainConfiguration {
updateNameservers: boolean
updateWebRecord: boolean
Expand Down Expand Up @@ -316,6 +321,18 @@ export type DatabaseApiCreateDatabaseRequest = {
hostingId: string
/** Name of the database to be created. */
databaseName: string
/**
* (Optional) Username and password to create a user and link to the database.
*
* One-of ('user'): at most one of 'newUser', 'existingUsername' could be set.
*/
newUser?: CreateDatabaseRequestUser
/**
* (Optional) Username to link an existing user to the database.
*
* One-of ('user'): at most one of 'newUser', 'existingUsername' could be set.
*/
existingUsername?: string
}

export type DatabaseApiCreateDatabaseUserRequest = {
Expand Down
Loading