MCPcopy Create free account
hub / github.com/SmartThingsCommunity/smartthings-cli / handler

Function handler

src/commands/schema.ts:55–89  ·  view source on GitHub ↗
(argv: ArgumentsCamelCase<CommandArgs>)

Source from the content-addressed store, hash-verified

53 .epilog(buildEpilog({ command, apiDocs: ['getAppsByUserToken', 'getAppsByEndpointAppId'] }))
54
55const handler = async (argv: ArgumentsCamelCase<CommandArgs>): Promise<void> => {
56 const command = await apiOrganizationCommand(argv)
57
58 const config: OutputItemOrListConfig<SchemaApp> = {
59 tableFieldDefinitions: [
60 'appName', 'partnerName', 'endpointAppId', 'organizationId', 'schemaType', 'hostingType',
61 // stClientId is missing from the docs
62 ('stClientId' as keyof SchemaApp), 'oAuthAuthorizationUrl', 'oAuthTokenUrl', 'oAuthClientId',
63 'oAuthClientSecret', 'icon', 'icon2x', 'icon3x',
64 { prop: 'lambdaArn', skipEmpty: true },
65 { prop: 'lambdaArnAP', skipEmpty: true },
66 { prop: 'lambdaArnCN', skipEmpty: true },
67 { prop: 'lambdaArnEU', skipEmpty: true },
68 { prop: 'webhookUrl', skipEmpty: true },
69 { prop: 'userEmail', skipEmpty: true },
70 ],
71 primaryKeyName: 'endpointAppId',
72 sortKeyName: 'appName',
73 listTableFieldDefinitions: ['appName', 'endpointAppId', 'organizationId', 'hostingType'],
74 }
75 if (argv.verbose) {
76 config.listTableFieldDefinitions.push({
77 label: 'ARN/URL',
78 value: app => app.hostingType === 'lambda' ? app.lambdaArn : app.webhookUrl,
79 })
80 }
81
82 await outputItemOrList(
83 command,
84 config,
85 argv.idOrIndex,
86 () => command.client.schema.list({ includeAllOrganizations: argv.allOrganizations }),
87 async id => (await getSchemaAppEnsuringOrganization(command, id, argv)).schemaApp,
88 )
89}
90
91const cmd: CommandModule<object, CommandArgs> = { command, describe, builder, handler }
92export default cmd

Callers

nothing calls this directly

Calls 3

apiOrganizationCommandFunction · 0.85
outputItemOrListFunction · 0.85

Tested by

no test coverage detected