Skip to content

Commit

Permalink
Support ProposeAttributeRequestItem with RelationshipAttributes (#42)
Browse files Browse the repository at this point in the history
* chore: add function

* chore: use function
  • Loading branch information
jkoenig134 authored Jan 30, 2025
1 parent 5c9906a commit 7373376
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions src/mixins/AddSendRequestByMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ export function AddSendRequestByMessage<TBase extends ConnectorTUIBaseConstructo
title: "ProposeAttributeRequestItem",
value: this.createProposeAttributeRequestItem.bind(this),
},
{
title: "ProposeAttributeRequestItem with RelationshipAttribute",
value: this.createProposeRelationshipAttributeRequestItem.bind(this),
},
{
title: "IQLProposeAttributeRequestItem",
value: this.createIQLProposeAttributeRequestItem.bind(this),
Expand Down Expand Up @@ -344,6 +348,49 @@ export function AddSendRequestByMessage<TBase extends ConnectorTUIBaseConstructo
return requestItem
}

private async createProposeRelationshipAttributeRequestItem() {
const result = await prompts([
{
message: "What's the title of your Attribute?",
type: "text",
name: "title",
},
{
message: "What's the value of your Attribute?",
type: "text",
name: "value",
},
])

const requestItem: ProposeAttributeRequestItemJSON = {
"@type": "ProposeAttributeRequestItem",
mustBeAccepted: true,
query: {
"@type": "RelationshipAttributeQuery",
attributeCreationHints: {
title: result.title,
confidentiality: RelationshipAttributeConfidentiality.Public,
valueType: "ProprietaryString",
},
key: "aKey",
owner: "",
},
attribute: {
"@type": "RelationshipAttribute",
owner: "",
key: "aKey",
confidentiality: RelationshipAttributeConfidentiality.Public,
value: {
"@type": "ProprietaryString",
title: result.title,
value: result.value,
},
},
}

return requestItem
}

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

0 comments on commit 7373376

Please sign in to comment.