Skip to content

Commit

Permalink
[OpenAPI] Spec updates for netlify-api (#562)
Browse files Browse the repository at this point in the history
Co-authored-by: SferaDev <[email protected]>
  • Loading branch information
SferaDev and SferaDev authored Nov 21, 2024
1 parent 09af568 commit a64ae61
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .changeset/oecsjg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"netlify-api": minor
---

Add getAllCertificates endpoint to fetch SSL certificates for a site
60 changes: 51 additions & 9 deletions packages/netlify-api/src/api/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<undefined>;

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
Expand Down Expand Up @@ -798,7 +840,7 @@ export type GetEnvVarsResponse = {
context_parameter?: string;
}[];
/**
* Secret values are only readable by code running on Netlifys 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;
/**
Expand Down Expand Up @@ -916,7 +958,7 @@ export type CreateEnvVarsResponse = {
context_parameter?: string;
}[];
/**
* Secret values are only readable by code running on Netlifys 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;
/**
Expand Down Expand Up @@ -986,7 +1028,7 @@ export type CreateEnvVarsRequestBody = {
context_parameter?: string;
}[];
/**
* Secret values are only readable by code running on Netlifys 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;
}[];
Expand Down Expand Up @@ -1078,7 +1120,7 @@ export type GetSiteEnvVarsResponse = {
context_parameter?: string;
}[];
/**
* Secret values are only readable by code running on Netlifys 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;
/**
Expand Down Expand Up @@ -1202,7 +1244,7 @@ export type GetEnvVarResponse = {
context_parameter?: string;
}[];
/**
* Secret values are only readable by code running on Netlifys 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;
/**
Expand Down Expand Up @@ -1324,7 +1366,7 @@ export type UpdateEnvVarResponse = {
context_parameter?: string;
}[];
/**
* Secret values are only readable by code running on Netlifys 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;
/**
Expand Down Expand Up @@ -1394,7 +1436,7 @@ export type UpdateEnvVarRequestBody = {
context_parameter?: string;
}[];
/**
* Secret values are only readable by code running on Netlifys 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;
};
Expand Down Expand Up @@ -1486,7 +1528,7 @@ export type SetEnvVarValueResponse = {
context_parameter?: string;
}[];
/**
* Secret values are only readable by code running on Netlifys 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;
/**
Expand Down Expand Up @@ -7557,7 +7599,7 @@ export const operationsByTag = {
createSiteInTeam,
listSitesForAccount
},
sniCertificate: { provisionSiteTLSCertificate, showSiteTLSCertificate },
sniCertificate: { provisionSiteTLSCertificate, showSiteTLSCertificate, getAllCertificates },
environmentVariables: {
getEnvVars,
createEnvVars,
Expand Down
2 changes: 2 additions & 0 deletions packages/netlify-api/src/api/extra.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
deleteSite,
provisionSiteTLSCertificate,
showSiteTLSCertificate,
getAllCertificates,
getEnvVars,
createEnvVars,
getSiteEnvVars,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion packages/netlify-api/src/api/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ export type EnvVar = {
context_parameter?: string;
}[];
/**
* Secret values are only readable by code running on Netlifys 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;
/**
Expand Down

0 comments on commit a64ae61

Please sign in to comment.