(client: SmartThingsClient, appId?: string)
| 60 | |
| 61 | type InvitationProviderFunction = () => Promise<InvitationWithAppDetails[]> |
| 62 | const listFn = (client: SmartThingsClient, appId?: string): InvitationProviderFunction => |
| 63 | async (): Promise<InvitationWithAppDetails[]> => { |
| 64 | // We have to be careful to not use the method to get a single app. For more |
| 65 | // details see `getSchemaAppEnsuringOrganization` in schema-utils. |
| 66 | const apps = appId |
| 67 | ? (await client.schema.list({ includeAllOrganizations: true })) |
| 68 | .filter(app => app.endpointAppId === appId) |
| 69 | : await client.schema.list() |
| 70 | return (await Promise.all(apps.map(async app => { |
| 71 | return app.endpointAppId |
| 72 | ? (await client.invitesSchema.list(app.endpointAppId)) |
| 73 | .map(invite => addAppDetails(invite, app)) |
| 74 | : [] |
| 75 | }))).flat() |
| 76 | } |
| 77 | |
| 78 | const config: OutputItemOrListConfig<InvitationWithAppDetails> = { |
| 79 | primaryKeyName: 'id', |
no test coverage detected