Skip to content

Commit 254f299

Browse files
committed
fix: remove redundant delete api key by id method
1 parent d0146c7 commit 254f299

3 files changed

Lines changed: 40 additions & 121 deletions

File tree

‎src/internal/apis/AuthApi.ts‎

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,6 @@ export interface AuthControllerDeleteApiKeyRequest {
5656
authorization: string;
5757
}
5858

59-
export interface AuthControllerDeleteApiKeyByIdRequest {
60-
id: string;
61-
}
62-
6359
export interface AuthControllerGetAllAccountRequestsRequest {
6460
xUserPassword: string;
6561
xUserEmail: string;
@@ -340,61 +336,6 @@ export class AuthApi extends runtime.BaseAPI {
340336
await this.authControllerDeleteApiKeyRaw(requestParameters, initOverrides);
341337
}
342338

343-
/**
344-
* Deletes an API key by ID.
345-
*/
346-
async authControllerDeleteApiKeyByIdRaw(
347-
requestParameters: AuthControllerDeleteApiKeyByIdRequest,
348-
initOverrides?: RequestInit | runtime.InitOverrideFunction
349-
): Promise<runtime.ApiResponse<void>> {
350-
if (requestParameters['id'] == null) {
351-
throw new runtime.RequiredError(
352-
'id',
353-
'Required parameter "id" was null or undefined when calling authControllerDeleteApiKeyById().'
354-
);
355-
}
356-
357-
const queryParameters: any = {};
358-
359-
const headerParameters: runtime.HTTPHeaders = {};
360-
361-
if (this.configuration && this.configuration.accessToken) {
362-
const token = this.configuration.accessToken;
363-
const tokenString = await token('API_Key', []);
364-
365-
if (tokenString) {
366-
headerParameters['Authorization'] = `Bearer ${tokenString}`;
367-
}
368-
}
369-
const response = await this.request(
370-
{
371-
path: `/auth/key/{id}`.replace(
372-
`{${'id'}}`,
373-
encodeURIComponent(String(requestParameters['id']))
374-
),
375-
method: 'DELETE',
376-
headers: headerParameters,
377-
query: queryParameters,
378-
},
379-
initOverrides
380-
);
381-
382-
return new runtime.VoidApiResponse(response);
383-
}
384-
385-
/**
386-
* Deletes an API key by ID.
387-
*/
388-
async authControllerDeleteApiKeyById(
389-
requestParameters: AuthControllerDeleteApiKeyByIdRequest,
390-
initOverrides?: RequestInit | runtime.InitOverrideFunction
391-
): Promise<void> {
392-
await this.authControllerDeleteApiKeyByIdRaw(
393-
requestParameters,
394-
initOverrides
395-
);
396-
}
397-
398339
/**
399340
* Returns all pending account requests. Requires admin or superadmin credentials.
400341
* Retrieve all account requests

‎src/internal/models/getAllApiKeysResponse.ts‎

Lines changed: 39 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Juno Public API Docs
66
*
77
* The version of the OpenAPI document: 1.0
8-
*
8+
*
99
*
1010
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
1111
* https://openapi-generator.tech
@@ -15,54 +15,60 @@
1515
import { mapValues } from '../runtime';
1616
import type { IssueApiKeyResponse } from './IssueApiKeyResponse';
1717
import {
18-
IssueApiKeyResponseFromJSON,
19-
IssueApiKeyResponseFromJSONTyped,
20-
IssueApiKeyResponseToJSON,
18+
IssueApiKeyResponseFromJSON,
19+
IssueApiKeyResponseFromJSONTyped,
20+
IssueApiKeyResponseToJSON,
2121
} from './IssueApiKeyResponse';
2222

2323
/**
24-
*
24+
*
2525
* @export
2626
* @interface GetAllApiKeysResponse
2727
*/
2828
export interface GetAllApiKeysResponse {
29-
/**
30-
* List of API keys belonging to a project
31-
* @type {Array<IssueApiKeyResponse>}
32-
* @memberof GetAllApiKeysResponse
33-
*/
34-
keys: Array<IssueApiKeyResponse>;
29+
/**
30+
* List of API keys belonging to a project
31+
* @type {Array<IssueApiKeyResponse>}
32+
* @memberof GetAllApiKeysResponse
33+
*/
34+
keys: Array<IssueApiKeyResponse>;
3535
}
3636

3737
/**
3838
* Check if a given object implements the GetAllApiKeysResponse interface.
3939
*/
40-
export function instanceOfGetAllApiKeysResponse(value: object): value is GetAllApiKeysResponse {
41-
if (!('keys' in value) || value['keys'] === undefined) return false;
42-
return true;
40+
export function instanceOfGetAllApiKeysResponse(
41+
value: object
42+
): value is GetAllApiKeysResponse {
43+
if (!('keys' in value) || value['keys'] === undefined) return false;
44+
return true;
4345
}
4446

45-
export function GetAllApiKeysResponseFromJSON(json: any): GetAllApiKeysResponse {
46-
return GetAllApiKeysResponseFromJSONTyped(json, false);
47+
export function GetAllApiKeysResponseFromJSON(
48+
json: any
49+
): GetAllApiKeysResponse {
50+
return GetAllApiKeysResponseFromJSONTyped(json, false);
4751
}
4852

49-
export function GetAllApiKeysResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): GetAllApiKeysResponse {
50-
if (json == null) {
51-
return json;
52-
}
53-
return {
54-
55-
'keys': ((json['keys'] as Array<any>).map(IssueApiKeyResponseFromJSON)),
56-
};
53+
export function GetAllApiKeysResponseFromJSONTyped(
54+
json: any,
55+
ignoreDiscriminator: boolean
56+
): GetAllApiKeysResponse {
57+
if (json == null) {
58+
return json;
59+
}
60+
return {
61+
keys: (json['keys'] as Array<any>).map(IssueApiKeyResponseFromJSON),
62+
};
5763
}
5864

59-
export function GetAllApiKeysResponseToJSON(value?: GetAllApiKeysResponse | null): any {
60-
if (value == null) {
61-
return value;
62-
}
63-
return {
64-
65-
'keys': ((value['keys'] as Array<any>).map(IssueApiKeyResponseToJSON)),
66-
};
65+
export function GetAllApiKeysResponseToJSON(
66+
value?: GetAllApiKeysResponse | null
67+
): any {
68+
if (value == null) {
69+
return value;
70+
}
71+
return {
72+
keys: (value['keys'] as Array<any>).map(IssueApiKeyResponseToJSON),
73+
};
6774
}
68-

‎src/lib/auth.ts‎

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ export class AuthAPI {
7777
throw e;
7878
}
7979
}
80+
8081
async revokeKey(options: { apiKey: string }): Promise<any> {
8182
let { apiKey } = options;
8283

@@ -186,35 +187,6 @@ export class AuthAPI {
186187
return response;
187188
}
188189

189-
async deleteApiKeyById(options: {
190-
keyId: string;
191-
credentials: UserCredentials;
192-
}): Promise<{ success: boolean }> {
193-
const { keyId, credentials } = options;
194-
validateUserCredentials(credentials);
195-
validateString(keyId, 'The key ID must be nonempty');
196-
197-
const headers: Record<string, string> = {};
198-
if (typeof credentials === 'string') {
199-
headers['Authorization'] = `Bearer ${credentials}`;
200-
} else {
201-
headers['X-User-Email'] = credentials.email;
202-
headers['X-User-Password'] = credentials.password;
203-
}
204-
205-
try {
206-
await this.internalApi.authControllerDeleteApiKeyById(
207-
{ id: keyId },
208-
async ({ init }) => ({
209-
headers: { ...(init.headers as Record<string, string>), ...headers },
210-
})
211-
);
212-
return { success: true };
213-
} catch (e) {
214-
throw e;
215-
}
216-
}
217-
218190
async deleteAccountRequest(options: {
219191
id: string;
220192
email: string;

0 commit comments

Comments
 (0)