diff --git a/src/custom/dynamic-secrets.ts b/src/custom/dynamic-secrets.ts index c6cb9b4..2bfe2d3 100644 --- a/src/custom/dynamic-secrets.ts +++ b/src/custom/dynamic-secrets.ts @@ -14,9 +14,15 @@ import type { import type { TDynamicSecretProvider } from "./schemas/dynamic-secrets"; import { newInfisicalError } from "./errors"; -type CreateDynamicSecretOptions = Omit & { +export type CreateDynamicSecretOptions = Omit & { provider: TDynamicSecretProvider; }; +export type DeleteDynamicSecretOptions = DefaultApiApiV1DynamicSecretsNameDeleteRequest["apiV1DynamicSecretsNameDeleteRequest"]; +export type CreateDynamicSecretLeaseOptions = DefaultApiApiV1DynamicSecretsLeasesPostRequest["apiV1DynamicSecretsLeasesPostRequest"]; +export type DeleteDynamicSecretLeaseOptions = + DefaultApiApiV1DynamicSecretsLeasesLeaseIdDeleteRequest["apiV1DynamicSecretsLeasesLeaseIdDeleteRequest"]; +export type RenewDynamicSecretLeaseOptions = + DefaultApiApiV1DynamicSecretsLeasesLeaseIdRenewPostRequest["apiV1DynamicSecretsLeasesLeaseIdRenewPostRequest"]; export type CreateDynamicSecretResult = ApiV1DynamicSecretsGet200ResponseDynamicSecretsInner; export type DeleteDynamicSecretResult = ApiV1DynamicSecretsGet200ResponseDynamicSecretsInner; @@ -47,10 +53,7 @@ export default class DynamicSecretsClient { } } - async delete( - dynamicSecretName: string, - options: DefaultApiApiV1DynamicSecretsNameDeleteRequest["apiV1DynamicSecretsNameDeleteRequest"] - ): Promise { + async delete(dynamicSecretName: string, options: DeleteDynamicSecretOptions): Promise { try { const res = await this.#apiInstance.apiV1DynamicSecretsNameDelete( { @@ -67,9 +70,7 @@ export default class DynamicSecretsClient { } leases = { - create: async ( - options: DefaultApiApiV1DynamicSecretsLeasesPostRequest["apiV1DynamicSecretsLeasesPostRequest"] - ): Promise => { + create: async (options: CreateDynamicSecretLeaseOptions): Promise => { try { const res = await this.#apiInstance.apiV1DynamicSecretsLeasesPost( { @@ -83,10 +84,7 @@ export default class DynamicSecretsClient { throw newInfisicalError(err); } }, - delete: async ( - leaseId: string, - options: DefaultApiApiV1DynamicSecretsLeasesLeaseIdDeleteRequest["apiV1DynamicSecretsLeasesLeaseIdDeleteRequest"] - ): Promise => { + delete: async (leaseId: string, options: DeleteDynamicSecretLeaseOptions): Promise => { try { const res = await this.#apiInstance.apiV1DynamicSecretsLeasesLeaseIdDelete( { @@ -102,10 +100,7 @@ export default class DynamicSecretsClient { } }, - renew: async ( - leaseId: string, - options: DefaultApiApiV1DynamicSecretsLeasesLeaseIdRenewPostRequest["apiV1DynamicSecretsLeasesLeaseIdRenewPostRequest"] - ): Promise => { + renew: async (leaseId: string, options: RenewDynamicSecretLeaseOptions): Promise => { try { const res = await this.#apiInstance.apiV1DynamicSecretsLeasesLeaseIdRenewPost( { diff --git a/src/custom/secrets.ts b/src/custom/secrets.ts index aac0005..eeb75a2 100644 --- a/src/custom/secrets.ts +++ b/src/custom/secrets.ts @@ -33,15 +33,15 @@ type GetSecretOptions = { projectId: string; }; -type UpdateSecretOptions = Omit & { +export type UpdateSecretOptions = Omit & { projectId: string; }; -type CreateSecretOptions = Omit & { +export type CreateSecretOptions = Omit & { projectId: string; }; -type DeleteSecretOptions = Omit & { +export type DeleteSecretOptions = Omit & { projectId: string; };