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

Function handler

src/commands/apps/oauth/update.ts:53–75  ·  view source on GitHub ↗
(argv: ArgumentsCamelCase<CommandArgs>)

Source from the content-addressed store, hash-verified

51 .epilog(buildEpilog({ command, apiDocs: [docNames] }))
52
53const handler = async (argv: ArgumentsCamelCase<CommandArgs>): Promise<void> => {
54 const command = await apiCommand(argv)
55
56 const appId = await chooseApp(command, argv.id)
57
58 const getInputFromUser = async (): Promise<AppOAuthRequest> => {
59 const startingRequest: AppOAuthRequest = await command.client.apps.getOauth(appId)
60 if (!startingRequest.scope) {
61 startingRequest.scope = []
62 }
63 const inputDef = objectDef('OAuth Settings', {
64 clientName: stringDef('Client Name'),
65 scope: oauthAppScopeDef,
66 redirectUris: redirectUrisDef,
67 }, { helpText: itemInputHelpText(docNames) })
68
69 return updateFromUserInput(command, inputDef, startingRequest, { dryRun: !!argv.dryRun })
70 }
71
72 await inputAndOutputItem(command, { tableFieldDefinitions: oauthTableFieldDefinitions },
73 (_, data: AppOAuthRequest) => command.client.apps.updateOauth(appId, data),
74 inputProcessor(() => true, getInputFromUser))
75}
76
77const cmd: CommandModule<object, CommandArgs> = { command, describe, builder, handler }
78export default cmd

Callers

nothing calls this directly

Calls 3

apiCommandFunction · 0.85
inputAndOutputItemFunction · 0.85
inputProcessorFunction · 0.85

Tested by

no test coverage detected