diff --git a/package-lock.json b/package-lock.json index 0ea40d4..447e5e1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "11.0.1", "license": "MIT", "dependencies": { - "@netlify/open-api": "^2.9.0", + "@netlify/open-api": "^2.10.0", "lodash.camelcase": "^4.3.0", "micro-api-client": "^3.3.0", "node-fetch": "^3.0.0", @@ -1028,9 +1028,9 @@ } }, "node_modules/@netlify/open-api": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/@netlify/open-api/-/open-api-2.9.0.tgz", - "integrity": "sha512-XhGmVR8gldH9+3CzBg8C7aj7x/cThzlW/ob/o8ZAGMMJ7aVjs8WqzYpVsjdo4nulYi0zd0enlcuG9VwM1tsJyA==" + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/@netlify/open-api/-/open-api-2.10.0.tgz", + "integrity": "sha512-ZJF4nbLPfxsWrVgp2reCb23HMxsWl5+r+K0RtIhxcZ/RxbHVihRA9mwyzIcxPWrT5x9uAAxCr1aKGP7IdsDe+Q==" }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", @@ -8575,9 +8575,9 @@ } }, "@netlify/open-api": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/@netlify/open-api/-/open-api-2.9.0.tgz", - "integrity": "sha512-XhGmVR8gldH9+3CzBg8C7aj7x/cThzlW/ob/o8ZAGMMJ7aVjs8WqzYpVsjdo4nulYi0zd0enlcuG9VwM1tsJyA==" + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/@netlify/open-api/-/open-api-2.10.0.tgz", + "integrity": "sha512-ZJF4nbLPfxsWrVgp2reCb23HMxsWl5+r+K0RtIhxcZ/RxbHVihRA9mwyzIcxPWrT5x9uAAxCr1aKGP7IdsDe+Q==" }, "@nodelib/fs.scandir": { "version": "2.1.5", diff --git a/package.json b/package.json index 4d5ad09..d16eb08 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "node client" ], "dependencies": { - "@netlify/open-api": "^2.9.0", + "@netlify/open-api": "^2.10.0", "lodash.camelcase": "^4.3.0", "micro-api-client": "^3.3.0", "node-fetch": "^3.0.0", diff --git a/src/operations.test.js.md b/src/operations.test.js.md index d00b074..ca7434d 100644 --- a/src/operations.test.js.md +++ b/src/operations.test.js.md @@ -2536,6 +2536,863 @@ Generated by [AVA](https://avajs.dev). ], verb: 'get', }, + { + description: '[Beta] Returns all environment variables for an account or site. An account corresponds to a team in the Netlify UI.', + operationId: 'getEnvVars', + parameters: { + body: {}, + path: { + account_id: { + description: 'Scope response to account_id', + in: 'path', + name: 'account_id', + required: true, + type: 'string', + }, + }, + query: { + context_name: { + description: 'Filter by deploy context', + enum: [ + 'all', + 'dev', + 'branch-deploy', + 'deploy-preview', + 'production', + ], + in: 'query', + name: 'context_name', + required: false, + type: 'string', + }, + scope: { + description: 'Filter by scope', + enum: [ + 'builds', + 'functions', + 'runtime', + 'post_processing', + ], + in: 'query', + name: 'scope', + required: false, + type: 'string', + }, + site_id: { + description: 'If specified, only return environment variables set on this site', + in: 'query', + name: 'site_id', + required: false, + type: 'string', + }, + }, + }, + path: '/accounts/{account_id}/env', + responses: { + 200: { + description: 'OK', + schema: { + items: { + description: 'Environment variable model definition', + properties: { + key: { + description: 'The environment variable key, like ALGOLIA_ID (case-sensitive)', + type: 'string', + 'x-faker': 'commerce.productName', + }, + scopes: { + description: 'The scopes that this environment variable is set to', + items: { + enum: [ + 'builds', + 'functions', + 'runtime', + 'post_processing', + ], + type: 'string', + }, + type: 'array', + }, + updated_at: { + description: 'The timestamp of when the value was last updated', + format: 'date-time', + type: 'string', + 'x-faker': 'date.past', + }, + updated_by: { + properties: { + avatar_url: { + description: 'A URL pointing to the user\'s avatar', + type: 'string', + 'x-faker': 'internet.avatar', + }, + email: { + description: 'The user\'s email address', + type: 'string', + 'x-faker': 'internet.email', + }, + full_name: { + description: 'The user\'s full name (first and last)', + type: 'string', + 'x-faker': 'name.findName', + }, + id: { + description: 'The user\'s unique identifier', + type: 'string', + 'x-faker': 'datatype.number', + }, + }, + type: 'object', + }, + values: { + description: 'An array of Value objects containing values and metadata', + items: { + description: 'Environment variable value model definition', + properties: { + context: { + description: 'The deploy context in which this value will be used. `dev` refers to local development when running `netlify dev`.', + enum: [ + 'all', + 'dev', + 'branch-deploy', + 'deploy-preview', + 'production', + ], + type: 'string', + }, + id: { + description: 'The environment variable value\'s universally unique ID', + type: 'string', + 'x-faker': 'datatype.uuid', + }, + value: { + description: 'The environment variable\'s unencrypted value', + type: 'string', + 'x-faker': 'internet.password', + }, + }, + type: 'object', + }, + type: 'array', + 'x-faker': 'internet.password', + }, + }, + type: 'object', + }, + type: 'array', + }, + }, + default: { + description: 'error', + schema: { + properties: { + code: { + format: 'int64', + type: 'integer', + }, + message: { + type: 'string', + 'x-nullable': false, + }, + }, + required: [ + 'message', + ], + type: 'object', + }, + }, + }, + tags: [ + 'environmentVariables', + ], + verb: 'get', + }, + { + description: '[Beta] Creates new environment variables. Granular scopes are available on Pro plans and above.', + operationId: 'createEnvVars', + parameters: { + body: { + env_vars: { + in: 'body', + name: 'env_vars', + schema: { + items: { + properties: { + key: { + description: 'The existing or new name of the key, if you wish to rename it (case-sensitive)', + type: 'string', + }, + scopes: { + description: 'The scopes that this environment variable is set to (Pro plans and above)', + items: { + enum: [ + 'builds', + 'functions', + 'runtime', + 'post_processing', + ], + type: 'string', + }, + type: 'array', + }, + values: { + items: { + description: 'Environment variable value model definition', + properties: { + context: { + description: 'The deploy context in which this value will be used. `dev` refers to local development when running `netlify dev`.', + enum: [ + 'all', + 'dev', + 'branch-deploy', + 'deploy-preview', + 'production', + ], + type: 'string', + }, + id: { + description: 'The environment variable value\'s universally unique ID', + type: 'string', + 'x-faker': 'datatype.uuid', + }, + value: { + description: 'The environment variable\'s unencrypted value', + type: 'string', + 'x-faker': 'internet.password', + }, + }, + type: 'object', + }, + type: 'array', + }, + }, + type: 'object', + }, + type: 'array', + }, + }, + }, + path: { + account_id: { + description: 'Scope response to account_id', + in: 'path', + name: 'account_id', + required: true, + type: 'string', + }, + }, + query: { + site_id: { + description: 'If provided, create an environment variable on the site level, not the account level', + in: 'query', + name: 'site_id', + required: false, + type: 'string', + }, + }, + }, + path: '/accounts/{account_id}/env', + responses: { + 201: { + description: 'OK', + schema: { + items: { + description: 'Environment variable model definition', + properties: { + key: { + description: 'The environment variable key, like ALGOLIA_ID (case-sensitive)', + type: 'string', + 'x-faker': 'commerce.productName', + }, + scopes: { + description: 'The scopes that this environment variable is set to', + items: { + enum: [ + 'builds', + 'functions', + 'runtime', + 'post_processing', + ], + type: 'string', + }, + type: 'array', + }, + updated_at: { + description: 'The timestamp of when the value was last updated', + format: 'date-time', + type: 'string', + 'x-faker': 'date.past', + }, + updated_by: { + properties: { + avatar_url: { + description: 'A URL pointing to the user\'s avatar', + type: 'string', + 'x-faker': 'internet.avatar', + }, + email: { + description: 'The user\'s email address', + type: 'string', + 'x-faker': 'internet.email', + }, + full_name: { + description: 'The user\'s full name (first and last)', + type: 'string', + 'x-faker': 'name.findName', + }, + id: { + description: 'The user\'s unique identifier', + type: 'string', + 'x-faker': 'datatype.number', + }, + }, + type: 'object', + }, + values: { + description: 'An array of Value objects containing values and metadata', + items: { + description: 'Environment variable value model definition', + properties: { + context: { + description: 'The deploy context in which this value will be used. `dev` refers to local development when running `netlify dev`.', + enum: [ + 'all', + 'dev', + 'branch-deploy', + 'deploy-preview', + 'production', + ], + type: 'string', + }, + id: { + description: 'The environment variable value\'s universally unique ID', + type: 'string', + 'x-faker': 'datatype.uuid', + }, + value: { + description: 'The environment variable\'s unencrypted value', + type: 'string', + 'x-faker': 'internet.password', + }, + }, + type: 'object', + }, + type: 'array', + 'x-faker': 'internet.password', + }, + }, + type: 'object', + }, + type: 'array', + }, + }, + default: { + description: 'error', + schema: { + properties: { + code: { + format: 'int64', + type: 'integer', + }, + message: { + type: 'string', + 'x-nullable': false, + }, + }, + required: [ + 'message', + ], + type: 'object', + }, + }, + }, + tags: [ + 'environmentVariables', + ], + verb: 'post', + }, + { + description: '[Beta] Returns an individual environment variable.', + operationId: 'getEnvVar', + parameters: { + body: {}, + path: { + account_id: { + description: 'Scope response to account_id', + in: 'path', + name: 'account_id', + required: true, + type: 'string', + }, + key: { + description: 'The environment variable key (case-sensitive)', + in: 'path', + name: 'key', + required: true, + type: 'string', + }, + }, + query: { + site_id: { + description: 'If provided, return the environment variable for a specific site (no merging is performed)', + in: 'query', + name: 'site_id', + required: false, + type: 'string', + }, + }, + }, + path: '/accounts/{account_id}/env/{key}', + responses: { + 200: { + description: 'OK', + schema: { + description: 'Environment variable model definition', + properties: { + key: { + description: 'The environment variable key, like ALGOLIA_ID (case-sensitive)', + type: 'string', + 'x-faker': 'commerce.productName', + }, + scopes: { + description: 'The scopes that this environment variable is set to', + items: { + enum: [ + 'builds', + 'functions', + 'runtime', + 'post_processing', + ], + type: 'string', + }, + type: 'array', + }, + updated_at: { + description: 'The timestamp of when the value was last updated', + format: 'date-time', + type: 'string', + 'x-faker': 'date.past', + }, + updated_by: { + properties: { + avatar_url: { + description: 'A URL pointing to the user\'s avatar', + type: 'string', + 'x-faker': 'internet.avatar', + }, + email: { + description: 'The user\'s email address', + type: 'string', + 'x-faker': 'internet.email', + }, + full_name: { + description: 'The user\'s full name (first and last)', + type: 'string', + 'x-faker': 'name.findName', + }, + id: { + description: 'The user\'s unique identifier', + type: 'string', + 'x-faker': 'datatype.number', + }, + }, + type: 'object', + }, + values: { + description: 'An array of Value objects containing values and metadata', + items: { + description: 'Environment variable value model definition', + properties: { + context: { + description: 'The deploy context in which this value will be used. `dev` refers to local development when running `netlify dev`.', + enum: [ + 'all', + 'dev', + 'branch-deploy', + 'deploy-preview', + 'production', + ], + type: 'string', + }, + id: { + description: 'The environment variable value\'s universally unique ID', + type: 'string', + 'x-faker': 'datatype.uuid', + }, + value: { + description: 'The environment variable\'s unencrypted value', + type: 'string', + 'x-faker': 'internet.password', + }, + }, + type: 'object', + }, + type: 'array', + 'x-faker': 'internet.password', + }, + }, + type: 'object', + }, + }, + default: { + description: 'error', + schema: { + properties: { + code: { + format: 'int64', + type: 'integer', + }, + message: { + type: 'string', + 'x-nullable': false, + }, + }, + required: [ + 'message', + ], + type: 'object', + }, + }, + }, + tags: [ + 'environmentVariables', + ], + verb: 'get', + }, + { + description: '[Beta] Updates an existing environment variable and all of its values. Existing values will be replaced by values provided.', + operationId: 'updateEnvVar', + parameters: { + body: { + env_var: { + in: 'body', + name: 'env_var', + schema: { + properties: { + key: { + description: 'The existing or new name of the key, if you wish to rename it (case-sensitive)', + type: 'string', + }, + scopes: { + description: 'The scopes that this environment variable is set to (Pro plans and above)', + items: { + enum: [ + 'builds', + 'functions', + 'runtime', + 'post_processing', + ], + type: 'string', + }, + type: 'array', + }, + values: { + items: { + description: 'Environment variable value model definition', + properties: { + context: { + description: 'The deploy context in which this value will be used. `dev` refers to local development when running `netlify dev`.', + enum: [ + 'all', + 'dev', + 'branch-deploy', + 'deploy-preview', + 'production', + ], + type: 'string', + }, + id: { + description: 'The environment variable value\'s universally unique ID', + type: 'string', + 'x-faker': 'datatype.uuid', + }, + value: { + description: 'The environment variable\'s unencrypted value', + type: 'string', + 'x-faker': 'internet.password', + }, + }, + type: 'object', + }, + type: 'array', + }, + }, + type: 'object', + }, + }, + }, + path: { + account_id: { + description: 'Scope response to account_id', + in: 'path', + name: 'account_id', + required: true, + type: 'string', + }, + key: { + description: 'The existing environment variable key name (case-sensitive)', + in: 'path', + name: 'key', + required: true, + type: 'string', + }, + }, + query: { + site_id: { + description: 'If provided, update an environment variable set on this site', + in: 'query', + name: 'site_id', + required: false, + type: 'string', + }, + }, + }, + path: '/accounts/{account_id}/env/{key}', + responses: { + 200: { + description: 'OK', + schema: { + description: 'Environment variable model definition', + properties: { + key: { + description: 'The environment variable key, like ALGOLIA_ID (case-sensitive)', + type: 'string', + 'x-faker': 'commerce.productName', + }, + scopes: { + description: 'The scopes that this environment variable is set to', + items: { + enum: [ + 'builds', + 'functions', + 'runtime', + 'post_processing', + ], + type: 'string', + }, + type: 'array', + }, + updated_at: { + description: 'The timestamp of when the value was last updated', + format: 'date-time', + type: 'string', + 'x-faker': 'date.past', + }, + updated_by: { + properties: { + avatar_url: { + description: 'A URL pointing to the user\'s avatar', + type: 'string', + 'x-faker': 'internet.avatar', + }, + email: { + description: 'The user\'s email address', + type: 'string', + 'x-faker': 'internet.email', + }, + full_name: { + description: 'The user\'s full name (first and last)', + type: 'string', + 'x-faker': 'name.findName', + }, + id: { + description: 'The user\'s unique identifier', + type: 'string', + 'x-faker': 'datatype.number', + }, + }, + type: 'object', + }, + values: { + description: 'An array of Value objects containing values and metadata', + items: { + description: 'Environment variable value model definition', + properties: { + context: { + description: 'The deploy context in which this value will be used. `dev` refers to local development when running `netlify dev`.', + enum: [ + 'all', + 'dev', + 'branch-deploy', + 'deploy-preview', + 'production', + ], + type: 'string', + }, + id: { + description: 'The environment variable value\'s universally unique ID', + type: 'string', + 'x-faker': 'datatype.uuid', + }, + value: { + description: 'The environment variable\'s unencrypted value', + type: 'string', + 'x-faker': 'internet.password', + }, + }, + type: 'object', + }, + type: 'array', + 'x-faker': 'internet.password', + }, + }, + type: 'object', + }, + }, + default: { + description: 'error', + schema: { + properties: { + code: { + format: 'int64', + type: 'integer', + }, + message: { + type: 'string', + 'x-nullable': false, + }, + }, + required: [ + 'message', + ], + type: 'object', + }, + }, + }, + tags: [ + 'environmentVariables', + ], + verb: 'put', + }, + { + description: '[Beta] Deletes an environment variable.', + operationId: 'deleteEnvVar', + parameters: { + body: {}, + path: { + account_id: { + description: 'Scope response to account_id', + in: 'path', + name: 'account_id', + required: true, + type: 'string', + }, + key: { + description: 'The environment variable key (case-sensitive)', + in: 'path', + name: 'key', + required: true, + type: 'string', + }, + }, + query: { + site_id: { + description: 'If provided, delete the environment variable from this site', + in: 'query', + name: 'site_id', + required: false, + type: 'string', + }, + }, + }, + path: '/accounts/{account_id}/env/{key}', + responses: { + 204: { + description: 'No Content (success)', + }, + default: { + description: 'error', + schema: { + properties: { + code: { + format: 'int64', + type: 'integer', + }, + message: { + type: 'string', + 'x-nullable': false, + }, + }, + required: [ + 'message', + ], + type: 'object', + }, + }, + }, + tags: [ + 'environmentVariables', + ], + verb: 'delete', + }, + { + description: '[Beta] Deletes a specific environment variable value.', + operationId: 'deleteEnvVarValue', + parameters: { + body: {}, + path: { + account_id: { + description: 'Scope response to account_id', + in: 'path', + name: 'account_id', + required: true, + type: 'string', + }, + id: { + description: 'The environment variable value\'s ID', + in: 'path', + name: 'id', + required: true, + type: 'string', + }, + key: { + description: 'The environment variable key name (case-sensitive)', + in: 'path', + name: 'key', + required: true, + type: 'string', + }, + }, + query: { + site_id: { + description: 'If provided, delete the value from an environment variable on this site', + in: 'query', + name: 'site_id', + required: false, + type: 'string', + }, + }, + }, + path: '/accounts/{account_id}/env/{key}/value/{id}', + responses: { + 204: { + description: 'No Content (success)', + }, + default: { + description: 'error', + schema: { + properties: { + code: { + format: 'int64', + type: 'integer', + }, + message: { + type: 'string', + 'x-nullable': false, + }, + }, + required: [ + 'message', + ], + type: 'object', + }, + }, + }, + tags: [ + 'environmentVariables', + ], + verb: 'delete', + }, { operationId: 'listSiteForms', parameters: { diff --git a/src/operations.test.js.snap b/src/operations.test.js.snap index f4e6ede..0b66b2a 100644 Binary files a/src/operations.test.js.snap and b/src/operations.test.js.snap differ