feat: export option types

This commit is contained in:
Daniel Hougaard
2024-11-23 02:34:16 +04:00
parent 65ea9a0da6
commit 6a98a07cbd
2 changed files with 14 additions and 19 deletions

View File

@@ -14,9 +14,15 @@ import type {
import type { TDynamicSecretProvider } from "./schemas/dynamic-secrets"; import type { TDynamicSecretProvider } from "./schemas/dynamic-secrets";
import { newInfisicalError } from "./errors"; import { newInfisicalError } from "./errors";
type CreateDynamicSecretOptions = Omit<DefaultApiApiV1DynamicSecretsPostRequest["apiV1DynamicSecretsPostRequest"], "provider"> & { export type CreateDynamicSecretOptions = Omit<DefaultApiApiV1DynamicSecretsPostRequest["apiV1DynamicSecretsPostRequest"], "provider"> & {
provider: TDynamicSecretProvider; 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 CreateDynamicSecretResult = ApiV1DynamicSecretsGet200ResponseDynamicSecretsInner;
export type DeleteDynamicSecretResult = ApiV1DynamicSecretsGet200ResponseDynamicSecretsInner; export type DeleteDynamicSecretResult = ApiV1DynamicSecretsGet200ResponseDynamicSecretsInner;
@@ -47,10 +53,7 @@ export default class DynamicSecretsClient {
} }
} }
async delete( async delete(dynamicSecretName: string, options: DeleteDynamicSecretOptions): Promise<DeleteDynamicSecretResult> {
dynamicSecretName: string,
options: DefaultApiApiV1DynamicSecretsNameDeleteRequest["apiV1DynamicSecretsNameDeleteRequest"]
): Promise<DeleteDynamicSecretResult> {
try { try {
const res = await this.#apiInstance.apiV1DynamicSecretsNameDelete( const res = await this.#apiInstance.apiV1DynamicSecretsNameDelete(
{ {
@@ -67,9 +70,7 @@ export default class DynamicSecretsClient {
} }
leases = { leases = {
create: async ( create: async (options: CreateDynamicSecretLeaseOptions): Promise<CreateDynamicSecretLeaseResult> => {
options: DefaultApiApiV1DynamicSecretsLeasesPostRequest["apiV1DynamicSecretsLeasesPostRequest"]
): Promise<CreateDynamicSecretLeaseResult> => {
try { try {
const res = await this.#apiInstance.apiV1DynamicSecretsLeasesPost( const res = await this.#apiInstance.apiV1DynamicSecretsLeasesPost(
{ {
@@ -83,10 +84,7 @@ export default class DynamicSecretsClient {
throw newInfisicalError(err); throw newInfisicalError(err);
} }
}, },
delete: async ( delete: async (leaseId: string, options: DeleteDynamicSecretLeaseOptions): Promise<DeleteDynamicSecretLeaseResult> => {
leaseId: string,
options: DefaultApiApiV1DynamicSecretsLeasesLeaseIdDeleteRequest["apiV1DynamicSecretsLeasesLeaseIdDeleteRequest"]
): Promise<DeleteDynamicSecretLeaseResult> => {
try { try {
const res = await this.#apiInstance.apiV1DynamicSecretsLeasesLeaseIdDelete( const res = await this.#apiInstance.apiV1DynamicSecretsLeasesLeaseIdDelete(
{ {
@@ -102,10 +100,7 @@ export default class DynamicSecretsClient {
} }
}, },
renew: async ( renew: async (leaseId: string, options: RenewDynamicSecretLeaseOptions): Promise<RenewDynamicSecretLeaseResult> => {
leaseId: string,
options: DefaultApiApiV1DynamicSecretsLeasesLeaseIdRenewPostRequest["apiV1DynamicSecretsLeasesLeaseIdRenewPostRequest"]
): Promise<RenewDynamicSecretLeaseResult> => {
try { try {
const res = await this.#apiInstance.apiV1DynamicSecretsLeasesLeaseIdRenewPost( const res = await this.#apiInstance.apiV1DynamicSecretsLeasesLeaseIdRenewPost(
{ {

View File

@@ -33,15 +33,15 @@ type GetSecretOptions = {
projectId: string; projectId: string;
}; };
type UpdateSecretOptions = Omit<DefaultApiApiV3SecretsRawSecretNamePatchRequest["apiV3SecretsRawSecretNamePatchRequest"], "workspaceId"> & { export type UpdateSecretOptions = Omit<DefaultApiApiV3SecretsRawSecretNamePatchRequest["apiV3SecretsRawSecretNamePatchRequest"], "workspaceId"> & {
projectId: string; projectId: string;
}; };
type CreateSecretOptions = Omit<DefaultApiApiV3SecretsRawSecretNamePostRequest["apiV3SecretsRawSecretNamePostRequest"], "workspaceId"> & { export type CreateSecretOptions = Omit<DefaultApiApiV3SecretsRawSecretNamePostRequest["apiV3SecretsRawSecretNamePostRequest"], "workspaceId"> & {
projectId: string; projectId: string;
}; };
type DeleteSecretOptions = Omit<DefaultApiApiV3SecretsRawSecretNameDeleteRequest["apiV3SecretsRawSecretNameDeleteRequest"], "workspaceId"> & { export type DeleteSecretOptions = Omit<DefaultApiApiV3SecretsRawSecretNameDeleteRequest["apiV3SecretsRawSecretNameDeleteRequest"], "workspaceId"> & {
projectId: string; projectId: string;
}; };