-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added "Like Message" operation
refactor: validationGuidRegex
- Loading branch information
1 parent
8c52e27
commit fc786ff
Showing
7 changed files
with
88 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
nodes/Habitica/operations/chat_messages/functions/ChatMessageLike.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { INodeProperties, INodePropertyOptions } from "n8n-workflow"; | ||
import { parameterSelectGroup } from "../../../parameters/ParameterSelectGroup"; | ||
|
||
export const likeMessageOperation: INodePropertyOptions = | ||
{ | ||
name: 'Like Message', | ||
value: 'likeMessage', | ||
action: 'Like', | ||
description: 'Like a chat message', | ||
routing: { | ||
request: { | ||
method: 'POST', | ||
url: '=groups/{{$parameter.groupId}}/chat/{{$parameter.messageId}}/like', | ||
}, | ||
output: { | ||
postReceive: [ | ||
{ | ||
type: 'rootProperty', | ||
properties: { | ||
property: 'data', | ||
}, | ||
}, | ||
], | ||
}, | ||
}, | ||
}; | ||
|
||
export const likeMessageParameters : INodeProperties[] = [ | ||
// select group | ||
{ | ||
...parameterSelectGroup, | ||
displayOptions: { | ||
show: { | ||
operation: [ | ||
likeMessageOperation.value, | ||
], | ||
}, | ||
}, | ||
}, | ||
// message ID | ||
// (doesn't make sense to select from a list here, | ||
// it should be obtained from "Get All Messages" node at runtime) | ||
{ | ||
displayName: 'Message ID', | ||
name: 'messageId', | ||
type: 'string', | ||
default: '', | ||
required: true, | ||
displayOptions: { | ||
show: { | ||
operation: [ | ||
likeMessageOperation.value, | ||
], | ||
}, | ||
}, | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { INodePropertyModeValidation } from "n8n-workflow"; | ||
import { AUTHOR_ID } from "../../../credentials/HabiticaApi.credentials"; | ||
|
||
export const validationGuidRegex : INodePropertyModeValidation = { | ||
type: 'regex', | ||
properties: { | ||
regex: "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}", | ||
errorMessage: 'The ID must look like this: "' + AUTHOR_ID + '"', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters