Skip to content

Commit f5e1129

Browse files
update README with usage instructions
1 parent 8d75e96 commit f5e1129

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,52 @@ _unPublished (not recommended):_
4444
```
4545
npm install PATH_TO_GENERATED_PACKAGE --save
4646
```
47+
48+
### Example Usage
49+
```ts
50+
import {
51+
Configuration,
52+
ProjectsApi,
53+
UsersApi,
54+
} from "@makeplane/plane-node-sdk";
55+
56+
async function testPlaneSDK() {
57+
console.log("🚀 Testing Plane Node SDK...\n");
58+
59+
try {
60+
// Create configuration using API Key Authentication
61+
const config = new Configuration({
62+
apiKey: "<PLANE_API_KEY>",
63+
});
64+
65+
// Create configuration using OAuth Client Credentials Authentication
66+
// const config = new Configuration({
67+
// accessToken: "<PLANE_ACCESS_TOKEN>",
68+
// });
69+
70+
console.log("✅ Configuration created successfully");
71+
console.log(`Base URL: ${config.basePath}\n`);
72+
73+
// Initialize APIs
74+
const projectsApi = new ProjectsApi(config);
75+
const usersApi = new UsersApi(config);
76+
77+
console.log("✅ APIs initialized successfully\n");
78+
79+
const user = await usersApi.getCurrentUser();
80+
console.log(user);
81+
82+
const projectsResponse = await projectsApi.listProjects({
83+
slug: "<workspace-slug>",
84+
});
85+
for (const project of projectsResponse.results) {
86+
console.log(`${project.id} - ${project.name}`);
87+
}
88+
} catch (error) {
89+
console.error("❌ Error initializing SDK:", error);
90+
}
91+
}
92+
93+
// Run the test
94+
testPlaneSDK().catch(console.error);
95+
```

0 commit comments

Comments
 (0)