Skip to content

Commit

Permalink
feat: add new attributes to api key model (#857)
Browse files Browse the repository at this point in the history
* feat: add new attributes to api key model
J:ORG-666

* chore: apply pr comments

* chore: fix pr build

* Update ApiKeysInterfaces.ts

Co-authored-by: Frederic Beaudoin <[email protected]>

* Update ApiKeysInterfaces.ts

Co-authored-by: Frederic Beaudoin <[email protected]>

* Update ApiKeysInterfaces.ts

Co-authored-by: Frederic Beaudoin <[email protected]>

* Update Enums.ts

Co-authored-by: Frederic Beaudoin <[email protected]>

* chore: apply pr comments

---------

Co-authored-by: Frederic Beaudoin <[email protected]>
  • Loading branch information
schaoukicoveo and fbeaudoincoveo authored Sep 30, 2024
1 parent dcb61c1 commit d9fb78f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/resources/ApiKeys/ApiKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default class ApiKey extends Resource {
return this.api.get<ApiKeyModel[]>(ApiKey.baseUrl);
}

create(apiKey: New<ApiKeyModel, 'resourceId'>, options?: CreateApiKeyOptions) {
create(apiKey: New<ApiKeyModel, 'resourceId'| 'id'>, options?: CreateApiKeyOptions) {
return this.api.post<ApiKeyModel>(this.buildPath(ApiKey.baseUrl, options), apiKey);
}

Expand Down
18 changes: 15 additions & 3 deletions src/resources/ApiKeys/ApiKeysInterfaces.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {GranularResource, PrivilegeModel} from '../BaseInterfaces.js';

import { ApiKeyStatus } from '../Enums.js';
export interface ApiKeyModel extends GranularResource {
/**
* The unique identifier of the [organization](https://docs.coveo.com/en/222/) the API key was created for.
Expand All @@ -10,7 +10,7 @@ export interface ApiKeyModel extends GranularResource {
*
* **Example:** t4hk287bfj5sg6wskg64ckk5a
*/
id?: string;
id: string;
/**
* Whether the API key is enabled.
*/
Expand Down Expand Up @@ -84,6 +84,18 @@ export interface ApiKeyModel extends GranularResource {
* Additional configuration to be included in an API key. [to be revised]
*/
additionalConfiguration?: AdditionalConfigurationModel;
/**
* The expiration date of the API key.
*/
expirationDate?: number;
/**
* The status of the API key.
*/
status?: ApiKeyStatus;
/**
* The ID of the template to which the API key is bound.
*/
apiKeyTemplateId?: string
}

export interface CreateApiKeyOptions {
Expand Down Expand Up @@ -138,4 +150,4 @@ interface EnforceQueryPipelineConfigurationModel {

interface ImpersonationRestrictionsModel {
allowedUserIds: QueryAuthenticationModel[];
}
}
9 changes: 9 additions & 0 deletions src/resources/Enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1168,3 +1168,12 @@ export enum ProductsSortByType {
export enum FeedbackConsumerType {
SOURCE_MANAGEMENT_IMPROVEMENTS = 'SOURCE_MANAGEMENT_IMPROVEMENTS',
}

export enum ApiKeyStatus {
ENABLED='EXPIRED',
DISABLED='DISABLED',
DISABLED_FOR_INACTIVITY='DISABLED_FOR_INACTIVITY',
EXPIRED='EXPIRED',
SOON_TO_BE_EXPIRED='SOON_TO_BE_EXPIRED',
SOON_TO_BE_DISABLED='SOON_TO_BE_DISABLED'
}

0 comments on commit d9fb78f

Please sign in to comment.