### Setting up Local Node.js SDK Installation (Shell) Source: https://github.com/dopplerhq/node-sdk/blob/main/examples/README.md This command is used to install the @dopplerhq/node-sdk package locally, typically when it's not yet published to npm. It rebuilds the parent package and links it for local use within the examples folder. ```sh npm run setup ``` -------------------------------- ### Running Node.js SDK Example (Shell) Source: https://github.com/dopplerhq/node-sdk/blob/main/examples/README.md This command executes the example application provided within the SDK's examples folder. It's used to demonstrate the basic functionality and usage of the @dopplerhq/node-sdk package. ```sh npm run start ``` -------------------------------- ### Installing Node.js SDK from npm (Shell) Source: https://github.com/dopplerhq/node-sdk/blob/main/examples/README.md This command installs the @dopplerhq/node-sdk package directly from the npm registry. It's the standard method for integrating the SDK into a project once it's publicly available. ```sh npm install @dopplerhq/node-sdk ``` -------------------------------- ### Installing Doppler Node.js SDK via npm Source: https://github.com/dopplerhq/node-sdk/blob/main/README.md This snippet demonstrates how to install the Doppler Node.js SDK using npm. It adds the `@dopplerhq/node-sdk` package to your project's dependencies, allowing you to interact with the Doppler API. This SDK leverages Node's built-in request libraries and does not install any external dependencies. ```sh npm install @dopplerhq/node-sdk ``` -------------------------------- ### Initializing and Using Doppler Node.js SDK in TypeScript Source: https://github.com/dopplerhq/node-sdk/blob/main/README.md This example shows how to import the Doppler SDK, initialize it with an access token, and make a basic API call to list projects. The `DopplerSDK` class is instantiated with an `accessToken` for authentication, and then `doppler.projects.list()` is called to fetch project data, which is subsequently logged to the console. ```ts import DopplerSDK from '@dopplerhq/node-sdk' const doppler = new DopplerSDK({ accessToken: 'dp.xx.yyy' }); const res = await doppler.projects.list(); console.log(res); ``` -------------------------------- ### Get Options - Doppler Node.js SDK (Typescript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet demonstrates how to retrieve integration options using the Doppler Node.js SDK. It performs a GET request to the /v3/integrations/integration/options endpoint, requiring an 'integration' slug as a parameter, and returns an OptionsResponse. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const result = await sdk.get.options('integration'); console.log(result); })(); ``` -------------------------------- ### Listing Project Roles with Doppler Node.js SDK (TypeScript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet demonstrates how to list all project roles using the Doppler Node.js SDK. It performs a GET request to the `/v3/projects/roles` endpoint and does not require any parameters. The operation returns a `ProjectRolesListResponse` object. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const result = await sdk.projectRoles.list(); console.log(result); })(); ``` -------------------------------- ### Listing Activity Logs with Doppler Node.js SDK Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This example demonstrates how to list activity logs using the Doppler Node.js SDK. It supports optional pagination parameters, 'page' for the page number and 'perPage' for the number of items per page, to control the returned results. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const result = await sdk.activityLogs.list({ page: '1', perPage: 20 }); console.log(result); })(); ``` -------------------------------- ### Listing Configs with Doppler Node.js SDK (TypeScript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet shows how to list configurations for a given project using the Doppler Node.js SDK. It performs a GET request to /v3/configs, allowing optional parameters like environment, page, and perPage for filtering and pagination. The method returns a ConfigsListResponse. ```TypeScript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const result = await sdk.configs.list('project', { environment: 'Environment slug', page: 1, perPage: 20, }); console.log(result); })(); ``` -------------------------------- ### List Webhooks - Doppler Node.js SDK (Typescript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet demonstrates how to list existing webhooks using the Doppler Node.js SDK. It performs a GET request to the /v3/webhooks endpoint, optionally filtering by 'project' name, and returns a WebhooksListResponse. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const result = await sdk.webhooks.list({ project: 'project' }); console.log(result); })(); ``` -------------------------------- ### Listing Project Permissions with Doppler Node.js SDK (TypeScript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet demonstrates how to list all available project permissions using the Doppler Node.js SDK. It performs a GET request to the `/v3/projects/permissions` endpoint and does not require any parameters. The operation returns a `ProjectRolesListPermissionsResponse` object. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const result = await sdk.projectRoles.listPermissions(); console.log(result); })(); ``` -------------------------------- ### Listing Environments using Doppler Node.js SDK (Typescript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet demonstrates how to list all environments associated with a specific project using the Doppler Node.js SDK. It performs an HTTP GET request to the `/v3/environments` endpoint, requiring the `project` name as a parameter. The operation returns an `EnvironmentsListResponse`. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const result = await sdk.environments.list('project'); console.log(result); })(); ``` -------------------------------- ### Listing Projects using DopplerHQ Node SDK (TypeScript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet shows how to retrieve a list of projects using the DopplerHQ Node SDK. It uses an access token for authentication and allows optional parameters like `page` and `perPage` for pagination. The `list` method sends a GET request to `/v3/projects` and returns a `ListResponse`. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const result = await sdk.projects.list({ page: 1, perPage: 20 }); console.log(result); })(); ``` -------------------------------- ### Listing Config Logs using Doppler Node.js SDK (Typescript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet demonstrates how to list log entries for a specific configuration, with optional pagination. It sends a GET request to `/v3/configs/config/logs`, requiring `project` and `config` names, and optionally accepts `page` and `perPage` parameters. The method returns a `ConfigLogsListResponse`. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const result = await sdk.configLogs.list('PROJECT_NAME', 'CONFIG_NAME', { page: 1, perPage: 20 }); console.log(result); })(); ``` -------------------------------- ### Retrieving Workplace Information with Doppler Node.js SDK Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet illustrates how to retrieve general workplace information using the Doppler Node.js SDK. This operation does not require any parameters and performs a GET request to the /v3/workplace endpoint, returning a WorkplaceGetResponse. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const result = await sdk.workplace.get(); console.log(result); })(); ``` -------------------------------- ### Listing Users using Doppler Node.js SDK (TypeScript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet shows how to retrieve a list of users from the Doppler workplace. It supports optional parameters for pagination (`page`) and filtering by `email`. The method performs a GET request to `/v3/workplace/users` and returns a `UsersListResponse`. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const result = await sdk.users.list({ page: 1, email: 'email' }); console.log(result); })(); ``` -------------------------------- ### Listing Groups using Doppler Node.js SDK (TypeScript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet shows how to retrieve a list of groups from the Doppler workplace. It supports optional pagination parameters (`page` and `perPage`). The method performs a GET request to `/v3/workplace/groups` and returns a `GroupsListResponse`. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const result = await sdk.groups.list({ page: 1, perPage: 20 }); console.log(result); })(); ``` -------------------------------- ### Retrieving a User using Doppler Node.js SDK (TypeScript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet demonstrates how to retrieve a specific user's details from the Doppler workplace by their `slug`. The method performs a GET request to `/v3/workplace/users/{slug}` and returns a `UsersGetResponse`. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const result = await sdk.users.get('slug'); console.log(result); })(); ``` -------------------------------- ### Retrieving a Config Log using Doppler Node.js SDK (Typescript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet shows how to retrieve a specific log entry for a configuration. It performs a GET request to `/v3/configs/config/logs/log`, requiring `project`, `config`, and `log` identifiers. The method returns a `ConfigLogsGetResponse`. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const result = await sdk.configLogs.get('PROJECT_NAME', 'CONFIG_NAME', 'LOG_ID'); console.log(result); })(); ``` -------------------------------- ### Retrieving a Config with Doppler Node.js SDK (TypeScript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet shows how to retrieve a specific configuration using the Doppler Node.js SDK. It performs a GET request to /v3/configs/config, requiring project and config names as parameters. The method returns a ConfigsGetResponse. ```TypeScript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const result = await sdk.configs.get('PROJECT_NAME', 'CONFIG_NAME'); console.log(result); })(); ``` -------------------------------- ### Listing Workplace Permissions using Doppler Node.js SDK (Typescript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet shows how to retrieve a list of all available workplace permissions using the Doppler Node.js SDK. It does not require any parameters. The operation uses the GET HTTP method on the /v3/workplace/permissions endpoint and returns a ListPermissionsResponse. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const result = await sdk.workplaceRoles.listPermissions(); console.log(result); })(); ``` -------------------------------- ### Retrieving a Project using Doppler Node.js SDK (Typescript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet demonstrates how to retrieve a specific project using the Doppler Node.js SDK. It performs an HTTP GET request to the `/v3/projects/project` endpoint, requiring a `project` identifier as a string parameter. The operation returns a `GetResponse` object. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const result = await sdk.projects.get('PROJECT_NAME'); console.log(result); })(); ``` -------------------------------- ### Updating Workplace Settings with Doppler Node.js SDK Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This example shows how to update workplace settings using the Doppler Node.js SDK. It requires an input object containing the new billing email, name, and security email for the workplace. The method sends a POST request to the /v3/workplace endpoint. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const input = { billing_email: 'billing_email', name: 'name', security_email: 'security_email' }; const result = await sdk.workplace.update(input); console.log(result); })(); ``` -------------------------------- ### Listing Workplace Roles using Doppler Node.js SDK (Typescript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet shows how to retrieve a list of all workplace roles using the Doppler Node.js SDK. It does not require any parameters. The operation uses the GET HTTP method on the /v3/workplace/roles endpoint and returns a WorkplaceRolesListResponse. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const result = await sdk.workplaceRoles.list(); console.log(result); })(); ``` -------------------------------- ### Retrieve Webhook - Doppler Node.js SDK (Typescript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet illustrates how to retrieve a specific webhook by its slug using the Doppler Node.js SDK. It executes a GET request to the /v3/webhooks/webhook/{slug} endpoint, requiring the webhook's 'slug' and optionally a 'project' name, returning a WebhooksGetResponse. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const result = await sdk.webhooks.get('slug', { project: 'project' }); console.log(result); })(); ``` -------------------------------- ### Retrieving an Environment using Doppler Node.js SDK (Typescript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet illustrates how to retrieve a specific environment within a project using the Doppler Node.js SDK. It performs an HTTP GET request to the `/v3/environments/environment` endpoint, requiring both `project` name and `environment` slug as parameters. The operation returns an `EnvironmentsGetResponse`. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const result = await sdk.environments.get('project', 'environment'); console.log(result); })(); ``` -------------------------------- ### Listing Trusted IPs for Config using Doppler Node.js SDK (Typescript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet illustrates how to retrieve a list of trusted IP addresses associated with a given configuration. It performs a GET request to `/v3/configs/config/trusted_ips`, requiring `project` and `config` names. The method returns a `ListTrustedIpsResponse`. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const result = await sdk.configs.listTrustedIps('project', 'config'); console.log(result); })(); ``` -------------------------------- ### Retrieving Project Role with Doppler Node.js SDK (TypeScript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet demonstrates how to retrieve a specific project role using the Doppler Node.js SDK. It performs a GET request to the `/v3/projects/roles/role/{role}` endpoint, requiring a `role` identifier as a string. The operation returns a `ProjectRolesGetResponse` object. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const result = await sdk.projectRoles.get('role'); console.log(result); })(); ``` -------------------------------- ### Deleting a Service Token with Doppler Node.js SDK Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This example demonstrates how to delete a service token using the Doppler Node.js SDK. It requires an input object specifying the 'config', 'project', 'slug', and 'token' of the service token to be deleted. This operation sends a DELETE request to the /v3/configs/config/tokens/token endpoint. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const input = { config: 'CONFIG_NAME', project: 'PROJECT_NAME', slug: 'TOKEN_SLUG', token: 'TOKEN_VALUE', }; const result = await sdk.serviceTokens.delete(input); console.log(result); })(); ``` -------------------------------- ### Retrieving a Specific Activity Log with Doppler Node.js SDK Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet shows how to retrieve a specific activity log entry using its unique identifier with the Doppler Node.js SDK. The 'log' parameter is required to specify which log to retrieve. The method performs a GET request to the /v3/logs/log endpoint. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const result = await sdk.activityLogs.retrieve('LOG_ID'); console.log(result); })(); ``` -------------------------------- ### Retrieve Member - Doppler Node.js SDK (Typescript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet illustrates how to retrieve a specific member within a group using the Doppler Node.js SDK. It executes a GET request to the /v3/workplace/groups/group/{group_slug}/members/{member_type}/{member_slug} endpoint, requiring groupSlug, memberType, and memberSlug, and returns a MemberResponse. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const result = await sdk.retrieve.member('group_slug', 'workplace_user', 'member_slug'); console.log(result); })(); ``` -------------------------------- ### Listing Secrets in Doppler Node.js SDK Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet demonstrates how to retrieve a list of secrets for a given project and config using the Doppler Node.js SDK. It performs an HTTP GET request to the `/v3/configs/config/secrets` endpoint, supporting various optional parameters like `accepts`, `includeDynamicSecrets`, and `secrets` for filtering. The method returns a `SecretsListResponse`. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const result = await sdk.secrets.list('PROJECT_NAME', 'CONFIG_NAME', { accepts: 'application/json', includeDynamicSecrets: true, dynamicSecretsTtlSec: -33704873, secrets: 'secrets', includeManagedSecrets: true }); console.log(result); })(); ``` -------------------------------- ### Retrieving a Specific Workplace Role using Doppler Node.js SDK (Typescript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet demonstrates how to retrieve details for a specific workplace role using the Doppler Node.js SDK. It requires the role's unique identifier. The operation uses the GET HTTP method on the /v3/workplace/roles/role/{role} endpoint and returns a WorkplaceRolesGetResponse. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const result = await sdk.workplaceRoles.get('role'); console.log(result); })(); ``` -------------------------------- ### Creating Projects using DopplerHQ Node SDK (TypeScript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet demonstrates how to create a new project using the DopplerHQ Node SDK. It requires an access token for authentication and an input object containing the project's description and name. The `create` method sends a POST request to `/v3/projects` and returns a `CreateResponse`. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const input = { description: 'PROJECT_DESCRIPTION', name: 'PROJECT_NAME' }; const result = await sdk.projects.create(input); console.log(result); })(); ``` -------------------------------- ### Creating a Sync for a Config with Doppler Node.js SDK (Typescript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet demonstrates how to create a new sync for a specific project and config using the Doppler Node.js SDK. It requires 'project' and 'config' slugs, and an 'input' object with sync details. It returns a 'SyncsCreateResponse'. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const input = { await_initial_sync: true, data: {}, import_option: 'none', integration: 'integration' }; const result = await sdk.syncs.create(input, 'project', 'config'); console.log(result); })(); ``` -------------------------------- ### Creating a Config with Doppler Node.js SDK (TypeScript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet demonstrates how to create a new configuration using the Doppler Node.js SDK. It sends a POST request to /v3/configs with an input object containing the environment, name, and project for the new config. The method returns a ConfigsCreateResponse. ```TypeScript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const input = { environment: 'ENVIRONMENT_ID', name: 'CONFIG_NAME', project: 'PROJECT_NAME' }; const result = await sdk.configs.create(input); console.log(result); })(); ``` -------------------------------- ### Enabling a Webhook using Doppler Node.js SDK (Typescript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet shows how to enable an existing webhook via the Doppler Node.js SDK. It takes the webhook's `slug` as a required parameter and an optional `project` name. The `enable` method is invoked on `sdk.webhooks`, and the response is printed. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const result = await sdk.webhooks.enable('slug', { project: 'project' }); console.log(result); })(); ``` -------------------------------- ### Creating an Environment using Doppler Node.js SDK (Typescript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet shows how to create a new environment within a project using the Doppler Node.js SDK. It performs an HTTP POST request to the `/v3/environments` endpoint, requiring a `project` name and an `input` object with `name` and `slug` properties. The operation returns an `EnvironmentsCreateResponse`. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const input = { name: 'name', slug: 'slug' }; const result = await sdk.environments.create(input, 'project'); console.log(result); })(); ``` -------------------------------- ### Creating a Service Account in Doppler Node.js SDK (TypeScript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet illustrates how to create a new service account via the Doppler Node.js SDK. It takes an input object specifying the service account's name and workplace role with permissions. An initialized SDK instance with an access token is required. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const input = { name: 'name', workplace_role: { identifier: 'identifier', permissions: ['do consequat', 'eiusmod quis nostrud nisi laborum'], }, }; const result = await sdk.serviceAccounts.create(input); console.log(result); })(); ``` -------------------------------- ### Listing Workplace Invites (Typescript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet shows how to list workplace invites. It supports optional 'page' and 'perPage' parameters for pagination. The list of invites is logged to the console. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const result = await sdk.invites.list({ page: 1, perPage: 20 }); console.log(result); })(); ``` -------------------------------- ### Cloning a Config with Doppler Node.js SDK (TypeScript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet illustrates how to clone an existing configuration using the Doppler Node.js SDK. It sends a POST request to /v3/configs/config/clone with an input object specifying the source config, new config name, and project. The method returns a CloneResponse. ```TypeScript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const input = { config: 'CONFIG_NAME', name: 'NEW_CONFIG_NAME', project: 'PROJECT_NAME' }; const result = await sdk.configs.clone(input); console.log(result); })(); ``` -------------------------------- ### Listing Service Tokens with Doppler Node.js SDK (Typescript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet shows how to list existing service tokens for a specific project and config using the Doppler Node.js SDK. The sdk.serviceTokens.list method is invoked with the project and config names as string parameters, and the returned list is logged. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const result = await sdk.serviceTokens.list('PROJECT_NAME', 'CONFIG_NAME'); console.log(result); })(); ``` -------------------------------- ### Creating Service Tokens with Doppler Node.js SDK (Typescript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet demonstrates how to create a new service token using the Doppler Node.js SDK. It requires an input object specifying access, config, expiration, name, and project. The method sdk.serviceTokens.create is called with this input, and the result is logged. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const input = { access: 'read', config: 'CONFIG_NAME', expire_at: '1908-01-12T01:17:11.0Z', name: 'TOKEN_NAME', project: 'PROJECT_NAME', }; const result = await sdk.serviceTokens.create(input); console.log(result); })(); ``` -------------------------------- ### Creating an Integration with Doppler Node.js SDK (Typescript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet demonstrates how to create a new integration using the Doppler Node.js SDK. It requires an 'input' object (request body) with integration details like 'data', 'name', and 'type_'. It returns an 'IntegrationsCreateResponse'. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const input = { data: {}, name: 'name', type_: 'type' }; const result = await sdk.integrations.create(input); console.log(result); })(); ``` -------------------------------- ### Creating Project Role with Doppler Node.js SDK (TypeScript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet demonstrates how to create a new project role using the Doppler Node.js SDK. It performs a POST request to the `/v3/projects/roles` endpoint, requiring an `input` object for the request body. The operation returns a `ProjectRolesCreateResponse` object. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const input = { name: 'name', permissions: ['Lorem ea quis commodo occaecat', 'qui voluptate et consectetur dolor'] }; const result = await sdk.projectRoles.create(input); console.log(result); })(); ``` -------------------------------- ### Downloading Secrets using Doppler Node.js SDK (Typescript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet shows how to download secrets for a given project and configuration using the `sdk.secrets.download` method. It supports optional parameters like format, name transformer, inclusion of dynamic secrets, TTL for dynamic secrets, and a comma-delimited list of specific secrets to download. It returns a `DownloadResponse` object. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const result = await sdk.secrets.download('project', 'config', { format: 'json', nameTransformer: 'camel', includeDynamicSecrets: true, dynamicSecretsTtlSec: 1800, secrets: 'secrets' }); console.log(result); })(); ``` -------------------------------- ### Listing Service Accounts in Doppler Node.js SDK (TypeScript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet demonstrates how to retrieve a list of service accounts using the Doppler Node.js SDK. It supports optional pagination parameters like `page` and `perPage`. The SDK needs to be initialized with an access token. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const result = await sdk.serviceAccounts.list({ page: 1, perPage: 20 }); console.log(result); })(); ``` -------------------------------- ### Creating a Service Account Token using Doppler Node.js SDK (Typescript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet demonstrates how to create a new service account token using the Doppler Node.js SDK. It requires the `serviceAccount` slug and an `input` object containing token details like `expires_at` and `name`. The `create` method is called on `sdk.serviceAccountTokens`, and the new token's details are logged. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const input = { expires_at: '1940-05-02T11:24:43.0Z', name: 'name' }; const result = await sdk.serviceAccountTokens.create(input, 'service_account'); console.log(result); })(); ``` -------------------------------- ### Listing Project Members (Typescript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet demonstrates how to list project members using the Doppler Node.js SDK. It requires a 'project' slug and supports optional 'page' and 'perPage' parameters for pagination. The result is logged to the console. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const result = await sdk.projectMembers.list('project', { page: 1, perPage: 20 }); console.log(result); })(); ``` -------------------------------- ### Updating Projects using DopplerHQ Node SDK (TypeScript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet illustrates how to update an existing project using the DopplerHQ Node SDK. It requires an access token and an input object specifying the project to update by its current name, along with its new description and name. The `update` method sends a POST request to `/v3/projects/project` and returns an `UpdateResponse`. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const input = { description: 'PROJECT_DESCRIPTION', name: 'PROJECT_NEW_NAME', project: 'PROJECT_NAME', }; const result = await sdk.projects.update(input); console.log(result); })(); ``` -------------------------------- ### Creating a Workplace Role using Doppler Node.js SDK (Typescript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet illustrates how to create a new workplace role via the Doppler Node.js SDK. It accepts an input object containing the role's name and an array of permissions. The operation uses the POST HTTP method on the /v3/workplace/roles endpoint and returns a WorkplaceRolesCreateResponse. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const input = { name: 'name', permissions: ['sunt', 'deserunt ad Lorem nisi'] }; const result = await sdk.workplaceRoles.create(input); console.log(result); })(); ``` -------------------------------- ### Listing Integrations with Doppler Node.js SDK (Typescript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet shows how to retrieve a list of all integrations using the Doppler Node.js SDK. This operation does not require any parameters and returns an 'IntegrationsListResponse' object containing the list of integrations. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const result = await sdk.integrations.list(); console.log(result); })(); ``` -------------------------------- ### Retrieving an Integration with Doppler Node.js SDK (Typescript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet demonstrates how to retrieve a specific integration using the Doppler Node.js SDK. It requires an 'integration' slug as a parameter and returns an 'IntegrationsGetResponse' object. The SDK is initialized with an access token. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const result = await sdk.integrations.get('integration'); console.log(result); })(); ``` -------------------------------- ### Creating a Group using Doppler Node.js SDK (TypeScript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet demonstrates how to create a new group within the Doppler workplace using the Node.js SDK. It requires an input object containing `default_project_role` and `name` for the new group. The method sends a POST request to `/v3/workplace/groups` and returns a `GroupsCreateResponse`. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const input = { default_project_role: 'default_project_role', name: 'name' }; const result = await sdk.groups.create(input); console.log(result); })(); ``` -------------------------------- ### Adding Project Member with Doppler Node.js SDK (TypeScript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet demonstrates how to add a member to a project using the Doppler Node.js SDK. It performs a POST request to the `/v3/projects/project/members` endpoint, requiring a `project` slug and an `input` object for the request body. The operation returns an `AddResponse` object. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const input = { environments: ['laborum elit enim cillum', 'consequat quis'], role: 'role', slug: 'slug', type_: 'group' }; const result = await sdk.projectMembers.add(input, 'project'); console.log(result); })(); ``` -------------------------------- ### Issuing Dynamic Secret Leases with Doppler Node.js SDK (Typescript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet shows how to issue a new dynamic secret lease using the Doppler Node.js SDK. It requires an input object specifying the config, dynamic secret, project, and the time-to-live (ttl_sec) for the lease. The sdk.dynamicSecrets.issueLease method is called with this input, and the result is logged. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const input = { config: 'config', dynamic_secret: 'dynamic_secret', project: 'project', ttl_sec: -46828653, }; const result = await sdk.dynamicSecrets.issueLease(input); console.log(result); })(); ``` -------------------------------- ### Add Webhook - Doppler Node.js SDK (Typescript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet shows how to add a new webhook using the Doppler Node.js SDK. It sends a POST request to the /v3/webhooks endpoint, requiring an 'input' object in the request body and optionally accepting a 'project' name, returning a WebhooksAddResponse. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const result = await sdk.webhooks.add({ project: 'project' }); console.log(result); })(); ``` -------------------------------- ### Updating a Config with Doppler Node.js SDK (TypeScript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet demonstrates how to update an existing configuration using the Doppler Node.js SDK. It sends a POST request to /v3/configs/config with an input object containing the config, new name, and project. The method returns a ConfigsUpdateResponse. ```TypeScript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const input = { config: 'CONFIG_NAME', name: 'CONFIG_NEW_NAME', project: 'PROJECT_NAME' }; const result = await sdk.configs.update(input); console.log(result); })(); ``` -------------------------------- ### Listing Service Account Tokens using Doppler Node.js SDK (Typescript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet shows how to list service account tokens associated with a specific service account using the Doppler Node.js SDK. It requires the `serviceAccount` slug and supports optional `page` and `perPage` parameters for pagination. The `list` method is invoked on `sdk.serviceAccountTokens`, and the retrieved list is logged. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const result = await sdk.serviceAccountTokens.list('service_account', { page: 1, perPage: 20 }); console.log(result); })(); ``` -------------------------------- ### Unlocking a Config with Doppler Node.js SDK (TypeScript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet demonstrates how to unlock a configuration using the Doppler Node.js SDK. It sends a POST request to /v3/configs/config/unlock with an input object specifying the config and project to be unlocked. The method returns an UnlockResponse. ```TypeScript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const input = { config: 'CONFIG_NAME', project: 'PROJECT_NAME' }; const result = await sdk.configs.unlock(input); console.log(result); })(); ``` -------------------------------- ### Renaming an Environment using Doppler Node.js SDK (Typescript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet demonstrates how to rename an environment within a project using the Doppler Node.js SDK. It performs an HTTP PUT request to the `/v3/environments/environment` endpoint, requiring `project` name, `environment` slug, and an `input` object with `name` and `slug` properties. The operation returns a `RenameResponse`. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const input = { name: 'name', slug: 'slug' }; const result = await sdk.environments.rename(input, 'project', 'environment'); console.log(result); })(); ``` -------------------------------- ### Deleting a Project using Doppler Node.js SDK (Typescript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet illustrates how to delete a project using the Doppler Node.js SDK. It sends an HTTP DELETE request to the `/v3/projects/project` endpoint, requiring an `input` object containing the `project` name. The operation returns a dictionary object. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const input = { project: 'PROJECT_NAME' }; const result = await sdk.projects.delete(input); console.log(result); })(); ``` -------------------------------- ### Retrieving a Sync for a Config with Doppler Node.js SDK (Typescript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet shows how to retrieve a specific sync associated with a project and config using the Doppler Node.js SDK. It requires 'project', 'config', and 'sync' slugs as parameters and returns a 'SyncsGetResponse'. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const result = await sdk.syncs.get('project', 'config', 'sync'); console.log(result); })(); ``` -------------------------------- ### Locking a Config using Doppler Node.js SDK (Typescript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet demonstrates how to lock a configuration using the Doppler Node.js SDK. It performs a POST request to `/v3/configs/config/lock`, requiring a request body with `config` and `project` names. The method returns a `LockResponse`. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const input = { config: 'CONFIG_NAME', project: 'PROJECT_NAME' }; const result = await sdk.configs.lock(input); console.log(result); })(); ``` -------------------------------- ### Adding a Group Member using Doppler Node.js SDK (TypeScript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet demonstrates how to add a new member to an existing group in the Doppler workplace. It requires the group's `slug` and an `input` object containing the member's `slug` and `type_`. The method performs a POST request to `/v3/workplace/groups/group/{slug}/members` and returns a dictionary object. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const input = { slug: 'slug', type_: 'workplace_user' }; const result = await sdk.groups.addMember(input, 'slug'); console.log(result); })(); ``` -------------------------------- ### Updating an Integration with Doppler Node.js SDK (Typescript) Source: https://github.com/dopplerhq/node-sdk/blob/main/src/services/README.md This snippet shows how to update an existing integration using the Doppler Node.js SDK. It requires an 'integration' slug and an 'input' object (request body) containing the update data. It returns an 'IntegrationsUpdateResponse'. ```Typescript import { DopplerSDK } from '@dopplerhq/node-sdk'; const DOPPLERSDK_ACCESS_TOKEN = ''; const sdk = new DopplerSDK({ accessToken: DOPPLERSDK_ACCESS_TOKEN }); (async () => { const input = { data: 'data', name: 'name' }; const result = await sdk.integrations.update(input, 'integration'); console.log(result); })(); ```