Skip to content

Commit ac4ef1a

Browse files
committed
auto-generated version 1.2.0
1 parent 6bfd07c commit ac4ef1a

71 files changed

Lines changed: 2744 additions & 86 deletions

Some content is hidden

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

api.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@
1616

1717
export * from './api/backups-api';
1818
export * from './api/clusters-api';
19+
export * from './api/databases-api';
1920
export * from './api/logs-api';
2021
export * from './api/metadata-api';
2122
export * from './api/restores-api';
23+
export * from './api/users-api';
2224

2325

2426
export * from './api/wait-for-request';

api/databases-api.ts

Lines changed: 560 additions & 0 deletions
Large diffs are not rendered by default.

api/users-api.ts

Lines changed: 717 additions & 0 deletions
Large diffs are not rendered by default.

common.ts

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@
1313
*/
1414

1515

16-
import { Configuration } from "./configuration";
17-
import { RequiredError, RequestArgs } from "./base";
18-
import { AxiosInstance } from 'axios';
16+
import type { Configuration } from "./configuration";
17+
import type { RequestArgs } from "./base";
18+
import type { AxiosInstance, AxiosResponse } from 'axios';
19+
import { RequiredError } from "./base";
1920

2021
/**
2122
*
@@ -83,24 +84,35 @@ export const setOAuthToObject = async function (object: any, name: string, scope
8384
}
8485
}
8586

87+
function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void {
88+
if (parameter == null) return;
89+
if (typeof parameter === "object") {
90+
if (Array.isArray(parameter)) {
91+
(parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key));
92+
}
93+
else {
94+
Object.keys(parameter).forEach(currentKey =>
95+
setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`)
96+
);
97+
}
98+
}
99+
else {
100+
if (urlSearchParams.has(key)) {
101+
urlSearchParams.append(key, parameter);
102+
}
103+
else {
104+
urlSearchParams.set(key, parameter);
105+
}
106+
}
107+
}
108+
86109
/**
87110
*
88111
* @export
89112
*/
90113
export const setSearchParams = function (url: URL, ...objects: any[]) {
91114
const searchParams = new URLSearchParams(url.search);
92-
for (const object of objects) {
93-
for (const key in object) {
94-
if (Array.isArray(object[key])) {
95-
searchParams.delete(key);
96-
for (const item of object[key]) {
97-
searchParams.append(key, item);
98-
}
99-
} else {
100-
searchParams.set(key, object[key]);
101-
}
102-
}
103-
}
115+
setFlattenedQueryParams(searchParams, objects);
104116
url.search = searchParams.toString();
105117
}
106118

@@ -131,8 +143,8 @@ export const toPathString = function (url: URL) {
131143
* @export
132144
*/
133145
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
134-
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
146+
return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
135147
const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url};
136-
return axios.request(axiosRequestArgs);
148+
return axios.request<T, R>(axiosRequestArgs);
137149
};
138150
}

configuration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export class Configuration {
120120
this.maxRetries = DEFAULT_MAX_RETRIES;
121121
this.maxWaitTime = DEFAULT_MAX_WAIT_TIME;
122122
this.debug = false;
123-
this.setUserAgent('ionos-cloud-sdk-node-dbaas-postgres/v1.1.1');
123+
this.setUserAgent('ionos-cloud-sdk-node-dbaas-postgres/v1.2.0');
124124
}
125125

126126
static fromEnv(): Configuration {

docs/api/BackupsApi.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const api_instance = new ionoscloud.BackupsApi(config);
3131
// List backups of cluster
3232
api_instance
3333
.clusterBackupsGet({
34-
clusterId: clusterId_example,
34+
clusterId: 498ae72f-411f-11eb-9d07-046c59cc737e,
3535
limit: 100,
3636
offset: 200,
3737
options: {}
@@ -84,7 +84,7 @@ const api_instance = new ionoscloud.BackupsApi(config);
8484
// Fetch a cluster backup
8585
api_instance
8686
.clustersBackupsFindById({
87-
backupId: backupId_example
87+
backupId: 498ae72f-411f-11eb-9d07-046c59cc737e-4oymiqu-12
8888
})
8989
.then((response) => console.log(response.data))
9090
.catch((error) => console.log(error.response.data));

docs/api/ClustersApi.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const api_instance = new ionoscloud.ClustersApi(config);
3535
// List PostgreSQL versions
3636
api_instance
3737
.clusterPostgresVersionsGet({
38-
clusterId: clusterId_example
38+
clusterId: 498ae72f-411f-11eb-9d07-046c59cc737e
3939
})
4040
.then((response) => console.log(response.data))
4141
.catch((error) => console.log(error.response.data));
@@ -83,7 +83,7 @@ const api_instance = new ionoscloud.ClustersApi(config);
8383
// Delete a cluster
8484
api_instance
8585
.clustersDelete({
86-
clusterId: clusterId_example
86+
clusterId: 498ae72f-411f-11eb-9d07-046c59cc737e
8787
})
8888
.then((response) => console.log(response.data))
8989
.catch((error) => console.log(error.response.data));
@@ -131,7 +131,7 @@ const api_instance = new ionoscloud.ClustersApi(config);
131131
// Fetch a cluster
132132
api_instance
133133
.clustersFindById({
134-
clusterId: clusterId_example
134+
clusterId: 498ae72f-411f-11eb-9d07-046c59cc737e
135135
})
136136
.then((response) => console.log(response.data))
137137
.catch((error) => console.log(error.response.data));
@@ -232,7 +232,7 @@ const api_instance = new ionoscloud.ClustersApi(config);
232232
// Patch a cluster
233233
api_instance
234234
.clustersPatch({
235-
clusterId: clusterId_example,
235+
clusterId: 498ae72f-411f-11eb-9d07-046c59cc737e,
236236
patchClusterRequest: patchClusterRequest_example
237237
})
238238
.then((response) => console.log(response.data))

docs/api/DatabasesApi.md

Lines changed: 214 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,214 @@
1+
# DatabasesApi
2+
3+
All URIs are relative to *https://api.ionos.com/databases/postgresql*
4+
5+
| Method | HTTP request | Description |
6+
| ------ | ------------ | ----------- |
7+
| [**databasesDelete**](DatabasesApi.md#databasesdelete) | **DELETE** /clusters/{clusterId}/databases/{databasename} | Delete database |
8+
| [**databasesGet**](DatabasesApi.md#databasesget) | **GET** /clusters/{clusterId}/databases/{databasename} | Get database |
9+
| [**databasesList**](DatabasesApi.md#databaseslist) | **GET** /clusters/{clusterId}/databases | List databases |
10+
| [**databasesPost**](DatabasesApi.md#databasespost) | **POST** /clusters/{clusterId}/databases | Create a database |
11+
12+
13+
## databasesDelete
14+
15+
> databasesDelete(clusterId, databasename)
16+
17+
Delete database
18+
19+
Deletes a single database
20+
21+
### Examples
22+
23+
```javascript
24+
const ionoscloud = require('@ionos-cloud/sdk-nodejs-dbaas-postgres');
25+
// setup authorization
26+
const config = new ionoscloud.Configuration({
27+
username: 'YOUR_USERNAME',
28+
password: 'YOUR_PASSWORD',
29+
apiKey: 'YOUR_API_KEY'
30+
});
31+
const api_instance = new ionoscloud.DatabasesApi(config);
32+
// Delete database
33+
api_instance
34+
.databasesDelete({
35+
clusterId: 498ae72f-411f-11eb-9d07-046c59cc737e,
36+
databasename: benjamindb
37+
})
38+
.then((response) => console.log(response.data))
39+
.catch((error) => console.log(error.response.data));
40+
```
41+
42+
### Parameters
43+
44+
| Name | Type | Description | Notes |
45+
| ---- | ---- | ----------- | ----- |
46+
| **clusterId** | **string** | The unique ID of the cluster. | [default to undefined] |
47+
| **databasename** | **string** | The database name. | [default to undefined] |
48+
49+
### Return type
50+
51+
nil (empty response body)
52+
53+
### Authorization
54+
55+
basicAuth, tokenAuth
56+
57+
### HTTP request headers
58+
59+
- **Content-Type**: Not defined
60+
- **Accept**: application/json
61+
62+
63+
## databasesGet
64+
65+
> <DatabaseResource> databasesGet(clusterId, databasename)
66+
67+
Get database
68+
69+
Retrieves a single database
70+
71+
### Examples
72+
73+
```javascript
74+
const ionoscloud = require('@ionos-cloud/sdk-nodejs-dbaas-postgres');
75+
// setup authorization
76+
const config = new ionoscloud.Configuration({
77+
username: 'YOUR_USERNAME',
78+
password: 'YOUR_PASSWORD',
79+
apiKey: 'YOUR_API_KEY'
80+
});
81+
const api_instance = new ionoscloud.DatabasesApi(config);
82+
// Get database
83+
api_instance
84+
.databasesGet({
85+
clusterId: 498ae72f-411f-11eb-9d07-046c59cc737e,
86+
databasename: benjamindb
87+
})
88+
.then((response) => console.log(response.data))
89+
.catch((error) => console.log(error.response.data));
90+
```
91+
92+
### Parameters
93+
94+
| Name | Type | Description | Notes |
95+
| ---- | ---- | ----------- | ----- |
96+
| **clusterId** | **string** | The unique ID of the cluster. | [default to undefined] |
97+
| **databasename** | **string** | The database name. | [default to undefined] |
98+
99+
### Return type
100+
101+
[**DatabaseResource**](../models/DatabaseResource.md)
102+
103+
### Authorization
104+
105+
basicAuth, tokenAuth
106+
107+
### HTTP request headers
108+
109+
- **Content-Type**: Not defined
110+
- **Accept**: application/json
111+
112+
113+
## databasesList
114+
115+
> <DatabaseList> databasesList(clusterId, opts)
116+
117+
List databases
118+
119+
Retrieves a list of databases
120+
121+
### Examples
122+
123+
```javascript
124+
const ionoscloud = require('@ionos-cloud/sdk-nodejs-dbaas-postgres');
125+
// setup authorization
126+
const config = new ionoscloud.Configuration({
127+
username: 'YOUR_USERNAME',
128+
password: 'YOUR_PASSWORD',
129+
apiKey: 'YOUR_API_KEY'
130+
});
131+
const api_instance = new ionoscloud.DatabasesApi(config);
132+
// List databases
133+
api_instance
134+
.databasesList({
135+
clusterId: 498ae72f-411f-11eb-9d07-046c59cc737e,
136+
limit: 100,
137+
offset: 200,
138+
options: {}
139+
})
140+
.then((response) => console.log(response.data))
141+
.catch((error) => console.log(error.response.data));
142+
```
143+
144+
### Parameters
145+
146+
| Name | Type | Description | Notes |
147+
| ---- | ---- | ----------- | ----- |
148+
| **clusterId** | **string** | The unique ID of the cluster. | [default to undefined] |
149+
| **limit** | **number** | The maximum number of elements to return. Use together with \&#39;offset\&#39; for pagination. | [optional][default to 100] |
150+
| **offset** | **number** | The first element to return. Use together with \&#39;limit\&#39; for pagination. | [optional][default to 0] |
151+
152+
### Return type
153+
154+
[**DatabaseList**](../models/DatabaseList.md)
155+
156+
### Authorization
157+
158+
basicAuth, tokenAuth
159+
160+
### HTTP request headers
161+
162+
- **Content-Type**: Not defined
163+
- **Accept**: application/json
164+
165+
166+
## databasesPost
167+
168+
> <DatabaseResource> databasesPost(clusterId, database)
169+
170+
Create a database
171+
172+
Create a new database
173+
174+
### Examples
175+
176+
```javascript
177+
const ionoscloud = require('@ionos-cloud/sdk-nodejs-dbaas-postgres');
178+
// setup authorization
179+
const config = new ionoscloud.Configuration({
180+
username: 'YOUR_USERNAME',
181+
password: 'YOUR_PASSWORD',
182+
apiKey: 'YOUR_API_KEY'
183+
});
184+
const api_instance = new ionoscloud.DatabasesApi(config);
185+
// Create a database
186+
api_instance
187+
.databasesPost({
188+
clusterId: 498ae72f-411f-11eb-9d07-046c59cc737e,
189+
database: database_example
190+
})
191+
.then((response) => console.log(response.data))
192+
.catch((error) => console.log(error.response.data));
193+
```
194+
195+
### Parameters
196+
197+
| Name | Type | Description | Notes |
198+
| ---- | ---- | ----------- | ----- |
199+
| **clusterId** | **string** | The unique ID of the cluster. | [default to undefined] |
200+
| **database** | [**Database**](../models/Database.md) | a database to create | |
201+
202+
### Return type
203+
204+
[**DatabaseResource**](../models/DatabaseResource.md)
205+
206+
### Authorization
207+
208+
basicAuth, tokenAuth
209+
210+
### HTTP request headers
211+
212+
- **Content-Type**: application/json
213+
- **Accept**: application/json
214+

docs/api/LogsApi.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const api_instance = new ionoscloud.LogsApi(config);
2929
// Get logs of your cluster
3030
api_instance
3131
.clusterLogsGet({
32-
clusterId: clusterId_example,
32+
clusterId: 498ae72f-411f-11eb-9d07-046c59cc737e,
3333
start: 2013-10-20T19:20:30+01:00,
3434
end: 2013-10-20T19:20:30+01:00,
3535
direction: direction_example,

docs/api/RestoresApi.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const api_instance = new ionoscloud.RestoresApi(config);
2929
// In-place restore of a cluster
3030
api_instance
3131
.clusterRestorePost({
32-
clusterId: clusterId_example,
32+
clusterId: 498ae72f-411f-11eb-9d07-046c59cc737e,
3333
createRestoreRequest: createRestoreRequest_example
3434
})
3535
.then((response) => console.log(response.data))

0 commit comments

Comments
 (0)