Skip to content

@salesforce/b2c-tooling-sdk / operations/mrt / getEnv

Function: getEnv() ​

getEnv(options, auth): Promise<{ }>

Defined in: packages/b2c-tooling-sdk/src/operations/mrt/env.ts:324

Gets an environment (target) from an MRT project.

Parameters ​

options ​

GetEnvOptions

Environment retrieval options

auth ​

AuthStrategy

Authentication strategy (ApiKeyStrategy)

Returns ​

Promise<{ }>

The environment object from the API

Throws ​

Error if retrieval fails

Example ​

typescript
import { ApiKeyStrategy } from '@salesforce/b2c-tooling-sdk/auth';
import { getEnv } from '@salesforce/b2c-tooling-sdk/operations/mrt';

const auth = new ApiKeyStrategy(process.env.MRT_API_KEY!, 'Authorization');

const env = await getEnv({
  projectSlug: 'my-storefront',
  slug: 'staging'
}, auth);

console.log(`Environment state: ${env.state}`);

Released under the Apache-2.0 License.