Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

Commit bc23537

Browse files
authored
Merge pull request #254 from christopheranderson/chrande/qnamaker-reshuffle
Reverse structure of qnamaker (subject/verb instead of verb/subject)
2 parents 1c08bee + 6ffc424 commit bc23537

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1017
-942
lines changed

packages/qnamaker/README.md

Lines changed: 221 additions & 206 deletions
Large diffs are not rendered by default.

packages/qnamaker/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,17 @@
3434
"@oclif/tslint": "^3.1.1",
3535
"@types/chai": "^4.1.7",
3636
"@types/mocha": "^5.2.7",
37+
"@types/nock": "^11.1.0",
3738
"@types/node": "^10.14.13",
3839
"chai": "^4.2.0",
40+
"fetch-mock": "^7.3.9",
3941
"globby": "^10.0.1",
4042
"mocha": "^5.2.0",
43+
"nock": "^10.0.6",
4144
"nyc": "^13.3.0",
4245
"ts-node": "^8.3.0",
4346
"tslint": "^5.18.0",
44-
"typescript": "^3.5.3",
45-
"fetch-mock": "^7.3.9",
46-
"nock": "^10.0.6"
47+
"typescript": "^3.5.3"
4748
},
4849
"engines": {
4950
"node": ">=8.0.0"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import {Command, flags} from '@microsoft/bf-cli-command'
2+
3+
export default class QnamakerAlterationsIndex extends Command {
4+
static description = 'Commands for replacing and listing your alterations'
5+
6+
static flags: flags.Input<any> = {
7+
help: flags.help({char: 'h', description: 'display qnamaker:alterations available commands'}),
8+
}
9+
10+
async run() {
11+
this._help()
12+
}
13+
}

packages/qnamaker/src/commands/qnamaker/list/alterations.ts renamed to packages/qnamaker/src/commands/qnamaker/alterations/list.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ const qnamaker = require('./../../../../utils/index')
44
const listAlterationsJSON = require('./../../../../utils/payloads/listalterations')
55
import {Inputs, processInputs} from '../../../utils/qnamakerbase'
66

7-
export default class QnamakerListAlterations extends Command {
7+
export default class QnamakerAlterationsList extends Command {
88
static description = 'Downloads all word alterations (synonyms) that have been added by the user.'
99

1010
static flags: flags.Input<any> = {
1111
subscriptionKey: flags.string({description: 'Specifies the qnamaker Ocp-Apim-Subscription Key (found in Keys under Resource Management section for your Qna Maker cognitive service). Overrides the subscriptionkey value present in the config'}),
1212
endpoint: flags.string({description: 'Overrides public endpoint https://westus.api.cognitive.microsoft.com/qnamaker/v4.0/'}),
13-
help: flags.help({char: 'h', description: 'qnamaker:list:alterations command help'}),
13+
help: flags.help({char: 'h', description: 'qnamaker:alterations:list command help'}),
1414
}
1515

1616
async run() {
17-
const {flags} = this.parse(QnamakerListAlterations)
17+
const {flags} = this.parse(QnamakerAlterationsList)
1818
let input: Inputs = await processInputs(flags, listAlterationsJSON, this.config.configDir)
1919

2020
const result = await qnamaker(input.config, input.serviceManifest, flags, input.requestBody)

packages/qnamaker/src/commands/qnamaker/replace/alterations.ts renamed to packages/qnamaker/src/commands/qnamaker/alterations/replace.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ const qnamaker = require('./../../../../utils/index')
33
const replaceAlterationsJSON = require('./../../../../utils/payloads/replacealterations')
44
import {Inputs, processInputs} from '../../../utils/qnamakerbase'
55

6-
export default class QnamakerReplaceAlterations extends Command {
6+
export default class QnamakerAlterationsReplace extends Command {
77
static description = 'Replaces word alterations (synonyms) for the KB with the give records.'
88

99
static flags: flags.Input<any> = {
1010
in: flags.string({description: 'File path to the WordAlterationsDTO object to send in the body of the request'}),
1111
subscriptionKey: flags.string({description: 'Specifies the qnamaker Ocp-Apim-Subscription Key (found in Keys under Resource Management section for your Qna Maker cognitive service). Overrides the subscriptionkey value present in the config'}),
1212
endpoint: flags.string({description: 'Overrides public endpoint https://westus.api.cognitive.microsoft.com/qnamaker/v4.0/'}),
13-
help: flags.help({char: 'h', description: 'qnamaker:replace:alterations command help'}),
13+
help: flags.help({char: 'h', description: 'qnamaker:alterations:replace command help'}),
1414
}
1515

1616
async run() {
17-
const {flags} = this.parse(QnamakerReplaceAlterations)
17+
const {flags} = this.parse(QnamakerAlterationsReplace)
1818
const stdin = await this.readStdin()
1919

2020
if (!stdin && !flags.in) {
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import {Command, flags} from '@microsoft/bf-cli-command'
2+
3+
export default class QnamakerEndpointkeysIndex extends Command {
4+
static description = 'Commands to refresh and list keys'
5+
6+
static flags: flags.Input<any> = {
7+
help: flags.help({char: 'h', description: 'display qnamaker:endpointkeys available commands'}),
8+
}
9+
10+
async run() {
11+
this._help()
12+
}
13+
}

packages/qnamaker/src/commands/qnamaker/list/endpointkeys.ts renamed to packages/qnamaker/src/commands/qnamaker/endpointkeys/list.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ const qnamaker = require('./../../../../utils/index')
44
const listEndpointKeysJSON = require('./../../../../utils/payloads/listendpointkeys')
55
import {Inputs, processInputs} from '../../../utils/qnamakerbase'
66

7-
export default class QnamakerListEndpointkeys extends Command {
7+
export default class QnamakerEndpointkeysList extends Command {
88
static description = 'List all the currently valid endpointKeys for querying your private endpoint'
99

1010
static flags: flags.Input<any> = {
1111
subscriptionKey: flags.string({description: 'Specifies the qnamaker Ocp-Apim-Subscription Key (found in Keys under Resource Management section for your Qna Maker cognitive service). Overrides the subscriptionkey value present in the config'}),
1212
endpoint: flags.string({description: 'Overrides public endpoint https://westus.api.cognitive.microsoft.com/qnamaker/v4.0/'}),
13-
help: flags.help({char: 'h', description: 'qnamaker:list:endpointkeys command help'}),
13+
help: flags.help({char: 'h', description: 'qnamaker:endpointkeys:list command help'}),
1414
}
1515

1616
async run() {
17-
const {flags} = this.parse(QnamakerListEndpointkeys)
17+
const {flags} = this.parse(QnamakerEndpointkeysList)
1818
let input: Inputs = await processInputs(flags, listEndpointKeysJSON, this.config.configDir)
1919

2020
const result = await qnamaker(input.config, input.serviceManifest, flags, input.requestBody)

packages/qnamaker/src/commands/qnamaker/refresh/endpointkeys.ts renamed to packages/qnamaker/src/commands/qnamaker/endpointkeys/refresh.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@ const qnamaker = require('./../../../../utils/index')
44
const refreshEndpointKeysJSON = require('./../../../../utils/payloads/refreshendpointkeys')
55
import {Inputs, processInputs} from '../../../utils/qnamakerbase'
66

7-
export default class QnamakerRefreshEndpointkeys extends Command {
7+
export default class QnamakerEndpointkeysRefresh extends Command {
88
static description = 'Re-generates an endpoint key, in case you suspect your keys have been compromised'
99

1010
static flags: flags.Input<any> = {
1111
keyType: flags.string({description: 'Type of Key. (PrimaryKey/SecondaryKey)', required: true}),
1212
subscriptionKey: flags.string({description: 'Specifies the qnamaker Ocp-Apim-Subscription Key (found in Keys under Resource Management section for your Qna Maker cognitive service). Overrides the subscriptionkey value present in the config'}),
1313
endpoint: flags.string({description: 'Overrides public endpoint https://westus.api.cognitive.microsoft.com/qnamaker/v4.0/'}),
14-
help: flags.help({char: 'h', description: 'qnamaker:refresh:endpoints command help'}),
14+
help: flags.help({char: 'h', description: 'qnamaker:endpoints:refresh command help'}),
1515
}
1616

1717
async run() {
18-
const {flags} = this.parse(QnamakerRefreshEndpointkeys)
18+
const {flags} = this.parse(QnamakerEndpointkeysRefresh)
1919
let input: Inputs = await processInputs(flags, refreshEndpointKeysJSON, this.config.configDir)
2020

2121
const result = await qnamaker(input.config, input.serviceManifest, flags, input.requestBody)

packages/qnamaker/src/commands/qnamaker/get/endpointsettings.ts renamed to packages/qnamaker/src/commands/qnamaker/endpointsettings/get.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ const qnamaker = require('./../../../../utils/index')
33
const getEndpointJSON = require('./../../../../utils/payloads/getendpointsettings')
44
import {Inputs, processInputs} from './../../../utils/qnamakerbase'
55

6-
export default class QnamakerGetEndpointsettings extends Command {
6+
export default class QnamakerEndpointsettingsGet extends Command {
77
static description = 'Gets endpoint settings for an endpoint.'
88

99
static flags: flags.Input<any> = {
1010
kbId: flags.string({description: 'Knowledgebase id to get metadata.'}),
1111
subscriptionKey: flags.string({description: 'Specifies the qnamaker Ocp-Apim-Subscription Key (found in Keys under Resource Management section for your Qna Maker cognitive service). Overrides the subscriptionkey value present in the config'}),
1212
endpoint: flags.string({description: 'Overrides public endpoint https://westus.api.cognitive.microsoft.com/qnamaker/v4.0/'}),
13-
help: flags.help({char: 'h', description: 'qnamaker:get:endpointsettings command help'}),
13+
help: flags.help({char: 'h', description: 'qnamaker:endpointsettings:get command help'}),
1414
}
1515

1616
async run() {
17-
const {flags} = this.parse(QnamakerGetEndpointsettings)
17+
const {flags} = this.parse(QnamakerEndpointsettingsGet)
1818
let input: Inputs = await processInputs(flags, getEndpointJSON, this.config.configDir)
1919
const result = await qnamaker(input.config, input.serviceManifest, flags, input.requestBody)
2020
if (result.error) {

packages/qnamaker/src/commands/qnamaker/update/index.ts renamed to packages/qnamaker/src/commands/qnamaker/endpointsettings/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {Command, flags} from '@microsoft/bf-cli-command'
22

3-
export default class QnamakerUpdateIndex extends Command {
4-
static description = 'Updates KB or Endpoint settings'
3+
export default class QnamakerEndpointsettingsIndex extends Command {
4+
static description = 'Commands to get and update endpoint settings'
55

66
static flags: flags.Input<any> = {
77
help: flags.help({char: 'h', description: 'display qnamaker:update available commands'}),

0 commit comments

Comments
 (0)