Skip to content

Commit

Permalink
Feature/add RegisterAttributeListenerRequestItem option (#30)
Browse files Browse the repository at this point in the history
* feat: add RegisterAttributeListener

* chore: increase version

* chore: bump sdk version

* chore: naming
  • Loading branch information
Vin-RM authored Jan 2, 2024
1 parent 55f9024 commit dc5904f
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 15 deletions.
26 changes: 13 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nmshd/connector-tui",
"version": "1.1.0",
"version": "1.2.0",
"repository": "github:nmshd/connector-tui",
"license": "MIT",
"author": "j&s-soft GmbH",
Expand All @@ -25,7 +25,7 @@
"test": "echo 'no test specified'"
},
"dependencies": {
"@nmshd/connector-sdk": "^2.2.4",
"@nmshd/connector-sdk": "^2.2.5",
"chalk": "^5.3.0",
"dotenv": "^16.3.1",
"luxon": "^3.4.4",
Expand Down
26 changes: 26 additions & 0 deletions src/mixins/AddSendRequestByMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
CreateOutgoingRequestRequestContentItemDerivations,
ProposeAttributeRequestItem,
ReadAttributeRequestItem,
RegisterAttributeListenerRequestItem,
} from "@nmshd/connector-sdk"
import prompts from "prompts"
import { ConnectorTUIBaseConstructor } from "../ConnectorTUIBase.js"
Expand Down Expand Up @@ -64,6 +65,10 @@ export function AddSendRequestByMessage<TBase extends ConnectorTUIBaseConstructo
title: "ConsentRequestItem",
value: this.createConsentRequestItem.bind(this),
},
{
title: "RegisterAttributeListenerRequestItem",
value: this.createRegisterAttributeListenerRequestItem.bind(this),
},
{
title: "AuthenticationRequestItem",
value: this.createAuthenticationRequestItem.bind(this),
Expand Down Expand Up @@ -525,6 +530,27 @@ export function AddSendRequestByMessage<TBase extends ConnectorTUIBaseConstructo
return requestItem
}

private async createRegisterAttributeListenerRequestItem() {
const result = await prompts([
{
message: "What's the attribute type you would like to query?",
type: "text",
name: "attributeType",
},
])

const requestItem: RegisterAttributeListenerRequestItem = {
"@type": "RegisterAttributeListenerRequestItem",
mustBeAccepted: true,
query: {
"@type": "IdentityAttributeQuery",
valueType: result.attributeType,
},
}

return requestItem
}

private async createAuthenticationRequestItem() {
const result = await prompts([
{
Expand Down

0 comments on commit dc5904f

Please sign in to comment.