Skip to content
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

feat: add support for listing Schema apps by organization #242

Closed
Closed
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions .changeset/lemon-bobcats-tap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@smartthings/core-sdk": minor
---

add support for listing Schema apps by organization
5 changes: 4 additions & 1 deletion src/endpoint/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,10 @@ export class SchemaEndpoint extends Endpoint {
* Returns a list of all ST Schema C2C connectors belonging to the principal (i.e. the user)
*/
public async list(): Promise<SchemaApp[]> {
const response = await this.client.get<SchemaAppList>('apps')
// Querying Schema apps requires a different API for listing by organization in addition to
// the standard header other endpoints use.
const organization = this.client.config.headers?.['X-ST-Organization']
const response = await this.client.get<SchemaAppList>('apps' + (organization ? '/organizations/' : ''))
return response.endpointApps
}

Expand Down
Loading