(project)
[EXPERIMENTAL] Endpoints related to creating and managing a project.
- createCheckoutKey - Create a new checkout key
- createEnvVar - Create an environment variable
- createProject - 🧪 Create a project
- deleteCheckoutKey - Delete a checkout key
- deleteEnvVar - Delete an environment variable
- getCheckoutKey - Get a checkout key
- getEnvVar - Get a masked environment variable
- getProjectBySlug - Get a project
- getProjectSettings - 🧪 Get project settings
- listCheckoutKeys - Get all checkout keys
- listEnvVars - List all environment variables
- patchProjectSettings - 🧪 Update project settings
Not available to projects that use GitLab or GitHub App. Creates a new checkout key. This API request is only usable with a user API token. Please ensure that you have authorized your account with GitHub before creating user keys. This is necessary to give CircleCI the permission to create a user key associated with your GitHub user account. You can find this page by visiting Project Settings > Checkout SSH Keys
import { Circleci } from "circleci-v2-sdk";
import { CheckoutKeyInputType } from "circleci-v2-sdk/dist/sdk/models/operations";
async function run() {
const sdk = new Circleci({
security: {
apiKeyHeader: "<YOUR_API_KEY_HERE>",
},
});
const res = await sdk.project.createCheckoutKey({
requestBody: {
type: CheckoutKeyInputType.DeployKey,
},
projectSlug: "gh/CircleCI-Public/api-preview-docs",
});
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.CreateCheckoutKeyRequest | ✔️ | The request object to use for the request. |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Promise<operations.CreateCheckoutKeyResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
Creates a new environment variable.
import { Circleci } from "circleci-v2-sdk";
async function run() {
const sdk = new Circleci({
security: {
apiKeyHeader: "<YOUR_API_KEY_HERE>",
},
});
const res = await sdk.project.createEnvVar({
requestBody: {
name: "foo",
value: "xxxx1234",
},
projectSlug: "gh/CircleCI-Public/api-preview-docs",
});
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.CreateEnvVarRequest | ✔️ | The request object to use for the request. |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Promise<operations.CreateEnvVarResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
[EXPERIMENTAL] Creates a new CircleCI project, and returns a list of the default advanced settings. Can only be called on a repo with a main branch and an existing config.yml file. Not yet available to projects that use GitLab or GitHub App.
import { Circleci } from "circleci-v2-sdk";
async function run() {
const sdk = new Circleci({
security: {
apiKeyHeader: "<YOUR_API_KEY_HERE>",
},
});
const res = await sdk.project.createProject({
organization: "CircleCI-Public",
project: "api-preview-docs",
provider: "gh",
});
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.CreateProjectRequest | ✔️ | The request object to use for the request. |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Promise<operations.CreateProjectResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
Deletes the checkout key via md5 or sha256 fingerprint. sha256 keys should be url-encoded.
import { Circleci } from "circleci-v2-sdk";
async function run() {
const sdk = new Circleci({
security: {
apiKeyHeader: "<YOUR_API_KEY_HERE>",
},
});
const res = await sdk.project.deleteCheckoutKey({
fingerprint: "c9:0b:1c:4f:d5:65:56:b9:ad:88:f9:81:2b:37:74:2f",
projectSlug: "gh/CircleCI-Public/api-preview-docs",
});
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.DeleteCheckoutKeyRequest | ✔️ | The request object to use for the request. |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Promise<operations.DeleteCheckoutKeyResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
Deletes the environment variable named :name.
import { Circleci } from "circleci-v2-sdk";
async function run() {
const sdk = new Circleci({
security: {
apiKeyHeader: "<YOUR_API_KEY_HERE>",
},
});
const res = await sdk.project.deleteEnvVar({
name: "foo",
projectSlug: "gh/CircleCI-Public/api-preview-docs",
});
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.DeleteEnvVarRequest | ✔️ | The request object to use for the request. |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Promise<operations.DeleteEnvVarResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
Returns an individual checkout key via md5 or sha256 fingerprint. sha256 keys should be url-encoded.
import { Circleci } from "circleci-v2-sdk";
async function run() {
const sdk = new Circleci({
security: {
apiKeyHeader: "<YOUR_API_KEY_HERE>",
},
});
const res = await sdk.project.getCheckoutKey({
fingerprint: "c9:0b:1c:4f:d5:65:56:b9:ad:88:f9:81:2b:37:74:2f",
projectSlug: "gh/CircleCI-Public/api-preview-docs",
});
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.GetCheckoutKeyRequest | ✔️ | The request object to use for the request. |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Promise<operations.GetCheckoutKeyResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
Returns the masked value of environment variable :name.
import { Circleci } from "circleci-v2-sdk";
async function run() {
const sdk = new Circleci({
security: {
apiKeyHeader: "<YOUR_API_KEY_HERE>",
},
});
const res = await sdk.project.getEnvVar({
name: "foo",
projectSlug: "gh/CircleCI-Public/api-preview-docs",
});
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.GetEnvVarRequest | ✔️ | The request object to use for the request. |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Promise<operations.GetEnvVarResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
Retrieves a project by project slug.
import { Circleci } from "circleci-v2-sdk";
async function run() {
const sdk = new Circleci({
security: {
apiKeyHeader: "<YOUR_API_KEY_HERE>",
},
});
const res = await sdk.project.getProjectBySlug({
projectSlug: "gh/CircleCI-Public/api-preview-docs",
});
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.GetProjectBySlugRequest | ✔️ | The request object to use for the request. |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Promise<operations.GetProjectBySlugResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
[EXPERIMENTAL] Returns a list of the advanced settings for a CircleCI project, whether enabled (true) or not (false).
import { Circleci } from "circleci-v2-sdk";
async function run() {
const sdk = new Circleci({
security: {
apiKeyHeader: "<YOUR_API_KEY_HERE>",
},
});
const res = await sdk.project.getProjectSettings({
organization: "CircleCI-Public",
project: "api-preview-docs",
provider: "gh",
});
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.GetProjectSettingsRequest | ✔️ | The request object to use for the request. |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Promise<operations.GetProjectSettingsResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
Returns a sequence of checkout keys for :project
.
import { Circleci } from "circleci-v2-sdk";
import { Digest } from "circleci-v2-sdk/dist/sdk/models/operations";
async function run() {
const sdk = new Circleci({
security: {
apiKeyHeader: "<YOUR_API_KEY_HERE>",
},
});
const res = await sdk.project.listCheckoutKeys({
projectSlug: "gh/CircleCI-Public/api-preview-docs",
});
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ListCheckoutKeysRequest | ✔️ | The request object to use for the request. |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Promise<operations.ListCheckoutKeysResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
Returns four 'x' characters, in addition to the last four ASCII characters of the value, consistent with the display of environment variable values on the CircleCI website.
import { Circleci } from "circleci-v2-sdk";
async function run() {
const sdk = new Circleci({
security: {
apiKeyHeader: "<YOUR_API_KEY_HERE>",
},
});
const res = await sdk.project.listEnvVars({
projectSlug: "gh/CircleCI-Public/api-preview-docs",
});
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ListEnvVarsRequest | ✔️ | The request object to use for the request. |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Promise<operations.ListEnvVarsResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
[EXPERIMENTAL] Updates one or more of the advanced settings for a CircleCI project.
import { Circleci } from "circleci-v2-sdk";
async function run() {
const sdk = new Circleci({
security: {
apiKeyHeader: "<YOUR_API_KEY_HERE>",
},
});
const res = await sdk.project.patchProjectSettings({
organization: "CircleCI-Public",
project: "api-preview-docs",
projectSettings: {
advanced: {
prOnlyBranchOverrides: [
"<value>",
],
},
},
provider: "gh",
});
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.PatchProjectSettingsRequest | ✔️ | The request object to use for the request. |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Promise<operations.PatchProjectSettingsResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |