( client: SmartThingsClient, options?: Partial<ListChannelOptions>, )
| 11 | subscriberId?: string |
| 12 | } |
| 13 | export const listChannels = async ( |
| 14 | client: SmartThingsClient, |
| 15 | options?: Partial<ListChannelOptions>, |
| 16 | ): Promise<(Channel & WithOrganization)[]> => { |
| 17 | const includeReadOnly = options?.includeReadOnly |
| 18 | const subscriberType = options?.subscriberType |
| 19 | const subscriberId = options?.subscriberId |
| 20 | if (options?.allOrganizations) { |
| 21 | if (includeReadOnly) { |
| 22 | return fatalError('--includeReadOnly (-I) and --allOrganizations (-A) options are incompatible') |
| 23 | } |
| 24 | return forAllOrganizations(client, orgClient => orgClient.channels.list({ subscriberType, subscriberId })) |
| 25 | } |
| 26 | return client.channels.list({ includeReadOnly, subscriberType, subscriberId }) |
| 27 | } |
| 28 | |
| 29 | export type WithChannel = { |
| 30 | channelId: string |
no test coverage detected