Skip to content

chore: update README with import snippets #418

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 4, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 25 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,31 @@ Install it via npm:
```bash
npm i @contentstack/management
```
To import the SDK, use the following command:
```javascript
import contentstack from ‘@contentstack/management’

contentstackClient = contentstack.client()
```
To import the SDK, use one of the following ways :
1. **JavaScript ES Modules**
```javascript
import contentstack from '@contentstack/management';
```
- Requires `"type": "module"` in package.json

2. **TypeScript with esModuleInterop**
```typescript
import contentstack from '@contentstack/management';
```
- Requires `"esModuleInterop": true` in tsconfig.json

3. **TypeScript Namespace Import**
```typescript
import * as contentstack from '@contentstack/management';
```
- Works regardless of esModuleInterop setting

4. **TypeScript Destructuring**
```typescript
import contentstack from '@contentstack/management';
const { client } = contentstack;
```
- Access client function from default export

### Authentication
To use this SDK, you need to authenticate your users by using the Authtoken, credentials, or Management Token (stack-level token).
Expand Down
Loading