Skip to content

Commit 409836c

Browse files
Release v1.25.0
1 parent 889bca3 commit 409836c

9 files changed

Lines changed: 531 additions & 2 deletions

sdk/studio/sdk/api/testApi.ts

Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ else {
2828
FormData = undici.FormData;
2929
}
3030

31+
import { CreateTestUserRequest } from '../model/createTestUserRequest';
32+
import { CreateTestUserResponse } from '../model/createTestUserResponse';
33+
import { DeleteTestUserRequest } from '../model/deleteTestUserRequest';
34+
import { DeleteTestUserResponse } from '../model/deleteTestUserResponse';
3135
import { GenericApiResponse } from '../model/genericApiResponse';
3236
import { TestAddMockModelMonitoringDataRequest } from '../model/testAddMockModelMonitoringDataRequest';
3337

@@ -150,6 +154,188 @@ export class TestApi {
150154
}
151155

152156

157+
/**
158+
* Create a new user for testing/benchmarking purposes. Users created via this API are marked with `analytics_type = \'test\'`. If name/username/email are not provided, random values are generated.
159+
* @summary Create a test user
160+
* @param createTestUserRequest
161+
*/
162+
public async createTestUser (createTestUserRequest: CreateTestUserRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<CreateTestUserResponse> {
163+
const localVarPath = this.basePath + '/api/test/users';
164+
let localVarQueryParameters: Record<string, string> = {};
165+
let localVarHeaderParams: Record<string, string> = {
166+
'User-Agent': 'edgeimpulse-api nodejs',
167+
'Content-Type': 'application/json',
168+
...this.defaultHeaders,
169+
};
170+
const produces = ['application/json'];
171+
// give precedence to 'application/json'
172+
if (produces.indexOf('application/json') >= 0) {
173+
localVarHeaderParams.Accept = 'application/json';
174+
} else {
175+
localVarHeaderParams.Accept = produces.join(',');
176+
}
177+
let localVarFormParams: Record<string, string> | FormData | UndiciFormData | undefined;
178+
179+
// verify required parameter 'createTestUserRequest' is not null or undefined
180+
181+
182+
if (createTestUserRequest === null || createTestUserRequest === undefined) {
183+
throw new Error('Required parameter createTestUserRequest was null or undefined when calling createTestUser.');
184+
}
185+
186+
localVarHeaderParams = {
187+
...localVarHeaderParams,
188+
...options.headers,
189+
...this.opts.extraHeaders,
190+
};
191+
192+
const queryString = Object.entries(localVarQueryParameters)
193+
.filter(([, value]) => value !== undefined)
194+
.map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
195+
.join('&');
196+
197+
let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
198+
let localVarRequestOptions: RequestOptionsType = {
199+
method: 'POST',
200+
headers: { ...localVarHeaderParams },
201+
};
202+
203+
localVarRequestOptions.body = JSON.stringify(ObjectSerializer.serialize(createTestUserRequest, "CreateTestUserRequest"));
204+
205+
206+
let requestOptions = localVarRequestOptions;
207+
let url = localVarUrl;
208+
const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
209+
requestOptions = auth_ApiKeyAuthentication.requestOptions;
210+
url = auth_ApiKeyAuthentication.url;
211+
212+
const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
213+
requestOptions = auth_JWTAuthentication.requestOptions;
214+
url = auth_JWTAuthentication.url;
215+
216+
const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
217+
requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
218+
url = auth_JWTHttpHeaderAuthentication.url;
219+
220+
const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
221+
requestOptions = auth_OAuth2.requestOptions;
222+
url = auth_OAuth2.url;
223+
224+
const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
225+
requestOptions = authDefault.requestOptions;
226+
url = authDefault.url;
227+
228+
if (localVarFormParams) {
229+
delete requestOptions.headers['Content-Type'];
230+
if (localVarFormParams instanceof FormData) {
231+
// FormData: fetch will handle Content-Type automatically.
232+
requestOptions.body = localVarFormParams;
233+
}
234+
else if (Object.keys(localVarFormParams).length > 0) {
235+
// URL-encoded form
236+
requestOptions.body = new URLSearchParams(localVarFormParams as Record<string, string>).toString();
237+
requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
238+
}
239+
}
240+
241+
const response = await fetch(url, requestOptions);
242+
return this.handleResponse(
243+
response,
244+
'CreateTestUserResponse'
245+
);
246+
}
247+
248+
/**
249+
* Delete a user with `analytics_type = \'test\'` by user ID.
250+
* @summary Delete a test user
251+
* @param deleteTestUserRequest
252+
*/
253+
public async deleteTestUser (deleteTestUserRequest: DeleteTestUserRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<DeleteTestUserResponse> {
254+
const localVarPath = this.basePath + '/api/test/users';
255+
let localVarQueryParameters: Record<string, string> = {};
256+
let localVarHeaderParams: Record<string, string> = {
257+
'User-Agent': 'edgeimpulse-api nodejs',
258+
'Content-Type': 'application/json',
259+
...this.defaultHeaders,
260+
};
261+
const produces = ['application/json'];
262+
// give precedence to 'application/json'
263+
if (produces.indexOf('application/json') >= 0) {
264+
localVarHeaderParams.Accept = 'application/json';
265+
} else {
266+
localVarHeaderParams.Accept = produces.join(',');
267+
}
268+
let localVarFormParams: Record<string, string> | FormData | UndiciFormData | undefined;
269+
270+
// verify required parameter 'deleteTestUserRequest' is not null or undefined
271+
272+
273+
if (deleteTestUserRequest === null || deleteTestUserRequest === undefined) {
274+
throw new Error('Required parameter deleteTestUserRequest was null or undefined when calling deleteTestUser.');
275+
}
276+
277+
localVarHeaderParams = {
278+
...localVarHeaderParams,
279+
...options.headers,
280+
...this.opts.extraHeaders,
281+
};
282+
283+
const queryString = Object.entries(localVarQueryParameters)
284+
.filter(([, value]) => value !== undefined)
285+
.map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
286+
.join('&');
287+
288+
let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
289+
let localVarRequestOptions: RequestOptionsType = {
290+
method: 'DELETE',
291+
headers: { ...localVarHeaderParams },
292+
};
293+
294+
localVarRequestOptions.body = JSON.stringify(ObjectSerializer.serialize(deleteTestUserRequest, "DeleteTestUserRequest"));
295+
296+
297+
let requestOptions = localVarRequestOptions;
298+
let url = localVarUrl;
299+
const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
300+
requestOptions = auth_ApiKeyAuthentication.requestOptions;
301+
url = auth_ApiKeyAuthentication.url;
302+
303+
const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
304+
requestOptions = auth_JWTAuthentication.requestOptions;
305+
url = auth_JWTAuthentication.url;
306+
307+
const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
308+
requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
309+
url = auth_JWTHttpHeaderAuthentication.url;
310+
311+
const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
312+
requestOptions = auth_OAuth2.requestOptions;
313+
url = auth_OAuth2.url;
314+
315+
const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
316+
requestOptions = authDefault.requestOptions;
317+
url = authDefault.url;
318+
319+
if (localVarFormParams) {
320+
delete requestOptions.headers['Content-Type'];
321+
if (localVarFormParams instanceof FormData) {
322+
// FormData: fetch will handle Content-Type automatically.
323+
requestOptions.body = localVarFormParams;
324+
}
325+
else if (Object.keys(localVarFormParams).length > 0) {
326+
// URL-encoded form
327+
requestOptions.body = new URLSearchParams(localVarFormParams as Record<string, string>).toString();
328+
requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
329+
}
330+
}
331+
332+
const response = await fetch(url, requestOptions);
333+
return this.handleResponse(
334+
response,
335+
'DeleteTestUserResponse'
336+
);
337+
}
338+
153339
/**
154340
* Test-only API to insert mock aggregate data for model monitoring.
155341
* @summary Add mock summary data for model monitoring.
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/**
2+
* Edge Impulse API
3+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
4+
*
5+
* The version of the OpenAPI document: 1.0.0
6+
*
7+
*
8+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9+
* https://openapi-generator.tech
10+
* Do not edit the class manually.
11+
*/
12+
13+
14+
export class CreateTestUserRequest {
15+
/**
16+
* Email (default generates test-user-{random}@edgeimpulse.net)
17+
*/
18+
'email'?: string;
19+
/**
20+
* Password (default generates random)
21+
*/
22+
'password'?: string;
23+
/**
24+
* Username (default generates benchuser{random})
25+
*/
26+
'username'?: string;
27+
/**
28+
* Display name (default generates Bench User {random})
29+
*/
30+
'name'?: string;
31+
32+
static discriminator: string | undefined = undefined;
33+
34+
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
35+
{
36+
"name": "email",
37+
"baseName": "email",
38+
"type": "string"
39+
},
40+
{
41+
"name": "password",
42+
"baseName": "password",
43+
"type": "string"
44+
},
45+
{
46+
"name": "username",
47+
"baseName": "username",
48+
"type": "string"
49+
},
50+
{
51+
"name": "name",
52+
"baseName": "name",
53+
"type": "string"
54+
} ];
55+
56+
static getAttributeTypeMap() {
57+
return CreateTestUserRequest.attributeTypeMap;
58+
}
59+
}
60+
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/**
2+
* Edge Impulse API
3+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
4+
*
5+
* The version of the OpenAPI document: 1.0.0
6+
*
7+
*
8+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9+
* https://openapi-generator.tech
10+
* Do not edit the class manually.
11+
*/
12+
13+
import { CreateTestUserResponseAllOf } from './createTestUserResponseAllOf';
14+
import { GenericApiResponse } from './genericApiResponse';
15+
16+
export class CreateTestUserResponse {
17+
/**
18+
* Whether the operation succeeded
19+
*/
20+
'success': boolean;
21+
/**
22+
* Optional error description (set if \'success\' was false)
23+
*/
24+
'error'?: string;
25+
/**
26+
* User ID of the created test user
27+
*/
28+
'id': number;
29+
'email'?: string;
30+
'username'?: string;
31+
/**
32+
* Generated password (only returned if not provided in request)
33+
*/
34+
'password'?: string;
35+
/**
36+
* JWT token for immediate authentication
37+
*/
38+
'jwtToken'?: string;
39+
40+
static discriminator: string | undefined = undefined;
41+
42+
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
43+
{
44+
"name": "success",
45+
"baseName": "success",
46+
"type": "boolean"
47+
},
48+
{
49+
"name": "error",
50+
"baseName": "error",
51+
"type": "string"
52+
},
53+
{
54+
"name": "id",
55+
"baseName": "id",
56+
"type": "number"
57+
},
58+
{
59+
"name": "email",
60+
"baseName": "email",
61+
"type": "string"
62+
},
63+
{
64+
"name": "username",
65+
"baseName": "username",
66+
"type": "string"
67+
},
68+
{
69+
"name": "password",
70+
"baseName": "password",
71+
"type": "string"
72+
},
73+
{
74+
"name": "jwtToken",
75+
"baseName": "jwtToken",
76+
"type": "string"
77+
} ];
78+
79+
static getAttributeTypeMap() {
80+
return CreateTestUserResponse.attributeTypeMap;
81+
}
82+
}
83+

0 commit comments

Comments
 (0)