diff --git a/.changeset/oecsjg.md b/.changeset/oecsjg.md new file mode 100644 index 00000000..e8c8c749 --- /dev/null +++ b/.changeset/oecsjg.md @@ -0,0 +1,5 @@ +--- +"netlify-api": minor +--- + +Add getAllCertificates endpoint to fetch SSL certificates for a site \ No newline at end of file diff --git a/packages/netlify-api/src/api/components.ts b/packages/netlify-api/src/api/components.ts index 4ec64f28..aef3ab02 100644 --- a/packages/netlify-api/src/api/components.ts +++ b/packages/netlify-api/src/api/components.ts @@ -726,6 +726,48 @@ export const showSiteTLSCertificate = (variables: ShowSiteTLSCertificateVariable ShowSiteTLSCertificatePathParams >({ url: '/sites/{siteId}/ssl', method: 'get', ...variables, signal }); +export type GetAllCertificatesPathParams = { + siteId: string; +}; + +export type GetAllCertificatesQueryParams = { + domain: string; +}; + +export type GetAllCertificatesError = Fetcher.ErrorWrapper; + +export type GetAllCertificatesResponse = { + state?: string; + domains?: string[]; + /** + * @format dateTime + */ + created_at?: string; + /** + * @format dateTime + */ + updated_at?: string; + /** + * @format dateTime + */ + expires_at?: string; +}[]; + +export type GetAllCertificatesVariables = { + pathParams: GetAllCertificatesPathParams; + queryParams: GetAllCertificatesQueryParams; +} & FetcherExtraProps; + +export const getAllCertificates = (variables: GetAllCertificatesVariables, signal?: AbortSignal) => + fetch< + GetAllCertificatesResponse, + GetAllCertificatesError, + undefined, + {}, + GetAllCertificatesQueryParams, + GetAllCertificatesPathParams + >({ url: '/sites/{siteId}/ssl/certificates', method: 'get', ...variables, signal }); + export type GetEnvVarsPathParams = { /** * Scope response to account_id @@ -798,7 +840,7 @@ export type GetEnvVarsResponse = { context_parameter?: string; }[]; /** - * Secret values are only readable by code running on Netlify’s systems. With secrets, only the local development context values are readable from the UI, API, and CLI. By default, environment variable values are not secret. + * Secret values are only readable by code running on Netlify's systems. With secrets, only the local development context values are readable from the UI, API, and CLI. By default, environment variable values are not secret. */ is_secret?: boolean; /** @@ -916,7 +958,7 @@ export type CreateEnvVarsResponse = { context_parameter?: string; }[]; /** - * Secret values are only readable by code running on Netlify’s systems. With secrets, only the local development context values are readable from the UI, API, and CLI. By default, environment variable values are not secret. + * Secret values are only readable by code running on Netlify's systems. With secrets, only the local development context values are readable from the UI, API, and CLI. By default, environment variable values are not secret. */ is_secret?: boolean; /** @@ -986,7 +1028,7 @@ export type CreateEnvVarsRequestBody = { context_parameter?: string; }[]; /** - * Secret values are only readable by code running on Netlify’s systems. With secrets, only the local development context values are readable from the UI, API, and CLI. By default, environment variable values are not secret. + * Secret values are only readable by code running on Netlify's systems. With secrets, only the local development context values are readable from the UI, API, and CLI. By default, environment variable values are not secret. */ is_secret?: boolean; }[]; @@ -1078,7 +1120,7 @@ export type GetSiteEnvVarsResponse = { context_parameter?: string; }[]; /** - * Secret values are only readable by code running on Netlify’s systems. With secrets, only the local development context values are readable from the UI, API, and CLI. By default, environment variable values are not secret. + * Secret values are only readable by code running on Netlify's systems. With secrets, only the local development context values are readable from the UI, API, and CLI. By default, environment variable values are not secret. */ is_secret?: boolean; /** @@ -1202,7 +1244,7 @@ export type GetEnvVarResponse = { context_parameter?: string; }[]; /** - * Secret values are only readable by code running on Netlify’s systems. With secrets, only the local development context values are readable from the UI, API, and CLI. By default, environment variable values are not secret. + * Secret values are only readable by code running on Netlify's systems. With secrets, only the local development context values are readable from the UI, API, and CLI. By default, environment variable values are not secret. */ is_secret?: boolean; /** @@ -1324,7 +1366,7 @@ export type UpdateEnvVarResponse = { context_parameter?: string; }[]; /** - * Secret values are only readable by code running on Netlify’s systems. With secrets, only the local development context values are readable from the UI, API, and CLI. By default, environment variable values are not secret. + * Secret values are only readable by code running on Netlify's systems. With secrets, only the local development context values are readable from the UI, API, and CLI. By default, environment variable values are not secret. */ is_secret?: boolean; /** @@ -1394,7 +1436,7 @@ export type UpdateEnvVarRequestBody = { context_parameter?: string; }[]; /** - * Secret values are only readable by code running on Netlify’s systems. With secrets, only the local development context values are readable from the UI, API, and CLI. By default, environment variable values are not secret. + * Secret values are only readable by code running on Netlify's systems. With secrets, only the local development context values are readable from the UI, API, and CLI. By default, environment variable values are not secret. */ is_secret?: boolean; }; @@ -1486,7 +1528,7 @@ export type SetEnvVarValueResponse = { context_parameter?: string; }[]; /** - * Secret values are only readable by code running on Netlify’s systems. With secrets, only the local development context values are readable from the UI, API, and CLI. By default, environment variable values are not secret. + * Secret values are only readable by code running on Netlify's systems. With secrets, only the local development context values are readable from the UI, API, and CLI. By default, environment variable values are not secret. */ is_secret?: boolean; /** @@ -7557,7 +7599,7 @@ export const operationsByTag = { createSiteInTeam, listSitesForAccount }, - sniCertificate: { provisionSiteTLSCertificate, showSiteTLSCertificate }, + sniCertificate: { provisionSiteTLSCertificate, showSiteTLSCertificate, getAllCertificates }, environmentVariables: { getEnvVars, createEnvVars, diff --git a/packages/netlify-api/src/api/extra.ts b/packages/netlify-api/src/api/extra.ts index 31e86e34..8a5218ad 100644 --- a/packages/netlify-api/src/api/extra.ts +++ b/packages/netlify-api/src/api/extra.ts @@ -6,6 +6,7 @@ import { deleteSite, provisionSiteTLSCertificate, showSiteTLSCertificate, + getAllCertificates, getEnvVars, createEnvVars, getSiteEnvVars, @@ -142,6 +143,7 @@ export const operationsByPath = { 'DELETE /sites/{site_id}': deleteSite, 'POST /sites/{site_id}/ssl': provisionSiteTLSCertificate, 'GET /sites/{site_id}/ssl': showSiteTLSCertificate, + 'GET /sites/{site_id}/ssl/certificates': getAllCertificates, 'GET /accounts/{account_id}/env': getEnvVars, 'POST /accounts/{account_id}/env': createEnvVars, 'GET /api/v1/sites/{site_id}/env': getSiteEnvVars, diff --git a/packages/netlify-api/src/api/schemas.ts b/packages/netlify-api/src/api/schemas.ts index 0e9d9e24..d3433984 100644 --- a/packages/netlify-api/src/api/schemas.ts +++ b/packages/netlify-api/src/api/schemas.ts @@ -422,7 +422,7 @@ export type EnvVar = { context_parameter?: string; }[]; /** - * Secret values are only readable by code running on Netlify’s systems. With secrets, only the local development context values are readable from the UI, API, and CLI. By default, environment variable values are not secret. + * Secret values are only readable by code running on Netlify's systems. With secrets, only the local development context values are readable from the UI, API, and CLI. By default, environment variable values are not secret. */ is_secret?: boolean; /**