2021-01-13 00:00:07 -08:00
import { INodeProperties } from 'n8n-workflow' ;
2020-05-19 04:47:21 -07:00
2021-12-03 00:44:16 -08:00
export const streamOperations : INodeProperties [ ] = [
2020-05-19 04:47:21 -07:00
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
displayOptions : {
show : {
resource : [
'stream' ,
] ,
} ,
} ,
options : [
2020-05-22 15:59:40 -07:00
{
2020-05-19 04:47:21 -07:00
name : 'Create' ,
value : 'create' ,
description : 'Create a stream.' ,
} ,
{
name : 'Delete' ,
value : 'delete' ,
description : 'Delete a stream.' ,
} ,
{
name : 'Get All' ,
value : 'getAll' ,
description : 'Get all streams.' ,
2020-05-22 15:59:40 -07:00
} ,
{
2020-05-19 04:47:21 -07:00
name : 'Get Subscribed' ,
value : 'getSubscribed' ,
description : 'Get subscribed streams.' ,
} ,
2020-05-31 02:15:45 -07:00
{
name : 'Update' ,
value : 'update' ,
description : 'Update a stream.' ,
} ,
2020-05-19 04:47:21 -07:00
] ,
default : 'create' ,
description : 'The operation to perform.' ,
} ,
2021-12-03 00:44:16 -08:00
] ;
2020-05-19 04:47:21 -07:00
2021-12-03 00:44:16 -08:00
export const streamFields : INodeProperties [ ] = [
2020-05-22 15:59:40 -07:00
/* -------------------------------------------------------------------------- */
/* stream:create */
/* -------------------------------------------------------------------------- */
{
2020-05-19 04:47:21 -07:00
displayName : 'JSON Parameters' ,
name : 'jsonParameters' ,
type : 'boolean' ,
default : false ,
description : '' ,
displayOptions : {
show : {
resource : [
'stream' ,
] ,
operation : [
'create' ,
] ,
} ,
} ,
} ,
{
displayName : ' Additional Fields' ,
name : 'additionalFieldsJson' ,
type : 'json' ,
typeOptions : {
alwaysOpenEditWindow : true ,
} ,
default : '' ,
displayOptions : {
show : {
resource : [
'stream' ,
] ,
operation : [
'create' ,
] ,
jsonParameters : [
true ,
] ,
} ,
} ,
description : ` JSON format parameters for stream creation. ` ,
} ,
2020-05-22 15:59:40 -07:00
{
displayName : 'Subscriptions' ,
name : 'subscriptions' ,
type : 'fixedCollection' ,
default : { } ,
displayOptions : {
show : {
resource : [
'stream' ,
] ,
operation : [
'create' ,
] ,
jsonParameters : [
false ,
] ,
} ,
} ,
required : true ,
description : 'A list of dictionaries containing the the key name and value specifying the name of the stream to subscribe. If the stream does not exist a new stream is created.' ,
typeOptions : {
multipleValues : true ,
} ,
options : [
{
displayName : 'Subscription Properties' ,
name : 'properties' ,
values : [
{
displayName : 'Name' ,
name : 'name' ,
type : 'string' ,
required : true ,
default : '' ,
description : 'Name of Subscription.' ,
} ,
{
displayName : 'Description' ,
name : 'description' ,
type : 'string' ,
required : true ,
default : '' ,
description : 'Description of Subscription.' ,
2020-10-22 06:46:03 -07:00
} ,
2020-05-22 15:59:40 -07:00
] ,
} ,
] ,
} ,
2020-05-19 04:47:21 -07:00
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
resource : [
'stream' ,
] ,
operation : [
'create' ,
] ,
jsonParameters : [
false ,
] ,
} ,
} ,
options : [
2020-05-22 15:59:40 -07:00
{
displayName : 'Announce' ,
name : 'announce' ,
type : 'boolean' ,
default : false ,
description : 'If announce is True and one of the streams specified in subscriptions has to be created (i.e. doesnt exist to begin with), an announcement will be made notifying that a new stream was created.' ,
} ,
{
displayName : 'Authorization Errors Fatal' ,
name : 'authorizationErrorsFatal' ,
type : 'boolean' ,
default : false ,
description : 'A boolean specifying whether authorization errors (such as when the requesting user is not authorized to access a private stream) should be considered fatal or not. When True, an authorization error is reported as such. When set to False, the returned JSON payload indicates that there was an authorization error, but the response is still considered a successful one.' ,
} ,
{
displayName : 'History Public to Subscribers' ,
name : 'historyPublicToSubscribers' ,
type : 'boolean' ,
default : false ,
description : 'Whether the streams message history should be available to newly subscribed members, or users can only access messages they actually received while subscribed to the stream.' ,
} ,
{
displayName : 'Invite Only' ,
name : 'inviteOnly' ,
type : 'boolean' ,
default : false ,
description : 'A boolean specifying whether the streams specified in subscriptions are invite-only or not.' ,
} ,
{
2020-05-19 04:47:21 -07:00
displayName : 'Principals' ,
name : 'principals' ,
type : 'fixedCollection' ,
2020-05-22 15:59:40 -07:00
default : { } ,
2020-05-19 04:47:21 -07:00
description : 'A list of email addresses of the users that will be subscribed/unsubscribed to the streams specified in the subscriptions argument. If not provided, then the requesting user/bot is subscribed.' ,
typeOptions : {
multipleValues : true ,
} ,
options : [
{
displayName : 'Principals Properties' ,
name : 'properties' ,
values : [
{
displayName : 'Principal Email' ,
name : 'email' ,
type : 'string' ,
required : true ,
default : '' ,
description : 'Principal email address.' ,
2020-10-22 06:46:03 -07:00
} ,
2020-05-19 04:47:21 -07:00
] ,
} ,
] ,
2020-05-22 15:59:40 -07:00
} ,
{
2020-05-19 04:47:21 -07:00
displayName : 'Stream Post Policy' ,
name : 'streamPostPolicy' ,
2020-05-22 15:59:40 -07:00
type : 'options' ,
default : '' ,
2020-05-19 04:47:21 -07:00
description : 'Policy for which users can post messages to the stream.' ,
options : [
2020-05-22 15:59:40 -07:00
{
name : '1' ,
value : 1 ,
2020-10-22 06:46:03 -07:00
description : 'Any user can post.' ,
2020-05-22 15:59:40 -07:00
} ,
{
name : '2' ,
value : 2 ,
2020-10-22 06:46:03 -07:00
description : 'Only administrators can post.' ,
2020-05-22 15:59:40 -07:00
} ,
{
name : '3' ,
value : 3 ,
2020-10-22 06:46:03 -07:00
description : 'Only new members can post.' ,
2020-05-22 15:59:40 -07:00
} ,
] ,
2020-10-22 06:46:03 -07:00
} ,
] ,
2020-05-22 15:59:40 -07:00
} ,
/* -------------------------------------------------------------------------- */
/* stream:get all */
/* -------------------------------------------------------------------------- */
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
resource : [
'stream' ,
] ,
operation : [
'getAll' ,
] ,
} ,
} ,
options : [
{
displayName : 'Include All Active' ,
name : 'includeAllActive' ,
type : 'boolean' ,
default : true ,
description : 'Include all active streams. The user must have administrative privileges to use this parameter.' ,
} ,
{
displayName : 'Include Default' ,
name : 'includeDefault' ,
type : 'boolean' ,
default : true ,
description : 'Include all default streams for the users realm.' ,
} ,
{
displayName : 'Include Owner Subscribed' ,
name : 'includeOwnersubscribed' ,
type : 'boolean' ,
default : true ,
description : 'If the user is a bot, include all streams that the bots owner is subscribed to.' ,
} ,
{
displayName : 'Include Public' ,
name : 'includePublic' ,
type : 'boolean' ,
default : true ,
description : 'Include all public streams.' ,
} ,
{
displayName : 'Include Subscribed' ,
name : 'includeSubscribed' ,
type : 'boolean' ,
default : true ,
description : 'Include all streams that the user is subscribed to.' ,
} ,
2020-10-22 06:46:03 -07:00
] ,
2020-05-22 15:59:40 -07:00
} ,
/* -------------------------------------------------------------------------- */
/* stream:get subscribed */
/* -------------------------------------------------------------------------- */
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
resource : [
'stream' ,
] ,
operation : [
'getSubscribed' ,
] ,
} ,
} ,
options : [
{
displayName : 'Include Subscribers' ,
name : 'includeSubscribers' ,
type : 'boolean' ,
default : true ,
description : 'Whether each returned stream object should include a subscribers field containing a list of the user IDs of its subscribers.' ,
2020-10-22 06:46:03 -07:00
} ,
] ,
2020-05-22 15:59:40 -07:00
} ,
/* -------------------------------------------------------------------------- */
/* stream:update */
/* -------------------------------------------------------------------------- */
{
displayName : 'Stream ID' ,
name : 'streamId' ,
type : 'string' ,
required : true ,
default : '' ,
displayOptions : {
show : {
resource : [
'stream' ,
] ,
operation : [
'update' ,
] ,
} ,
} ,
description : 'ID of stream to update.' ,
} ,
{
2020-05-19 04:47:21 -07:00
displayName : 'JSON Parameters' ,
name : 'jsonParameters' ,
type : 'boolean' ,
default : false ,
description : '' ,
displayOptions : {
show : {
resource : [
'stream' ,
] ,
operation : [
'update' ,
] ,
} ,
} ,
} ,
{
displayName : ' Additional Fields' ,
name : 'additionalFieldsJson' ,
type : 'json' ,
typeOptions : {
alwaysOpenEditWindow : true ,
} ,
default : '' ,
displayOptions : {
show : {
resource : [
'stream' ,
] ,
operation : [
'update' ,
] ,
jsonParameters : [
true ,
] ,
} ,
} ,
description : ` JSON format parameters for stream creation. ` ,
} ,
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
resource : [
'stream' ,
] ,
operation : [
'update' ,
] ,
jsonParameters : [
false ,
] ,
} ,
} ,
options : [
2020-05-22 15:59:40 -07:00
{
displayName : 'Announcement Only' ,
name : 'isAnnouncementOnly' ,
type : 'boolean' ,
default : false ,
description : 'Whether the stream is limited to announcements.' ,
} ,
{
displayName : 'Description' ,
name : 'description' ,
type : 'string' ,
default : '' ,
description : 'The new description for the stream.' ,
2020-10-22 06:46:03 -07:00
placeholder : 'Place of discussion' ,
2020-05-22 15:59:40 -07:00
} ,
{
displayName : 'Is Private' ,
name : 'isPrivate' ,
type : 'boolean' ,
default : false ,
description : 'Change whether the stream is a private stream.' ,
} ,
{
displayName : 'History Public to Subscribers' ,
name : 'historyPublicToSubscribers' ,
type : 'boolean' ,
default : false ,
description : 'Whether the streams message history should be available to newly subscribed members, or users can only access messages they actually received while subscribed to the stream.' ,
} ,
{
displayName : 'New Name' ,
name : 'newName' ,
type : 'string' ,
default : '' ,
description : 'The new name for the stream.' ,
2020-10-22 06:46:03 -07:00
placeholder : 'Italy' ,
2020-05-22 15:59:40 -07:00
} ,
{
2020-05-19 04:47:21 -07:00
displayName : 'Stream Post Policy' ,
name : 'streamPostPolicy' ,
2020-05-22 15:59:40 -07:00
type : 'options' ,
default : '' ,
2020-05-19 04:47:21 -07:00
description : 'Policy for which users can post messages to the stream.' ,
options : [
2020-05-22 15:59:40 -07:00
{
name : '1' ,
value : 1 ,
2020-10-22 06:46:03 -07:00
description : 'Any user can post.' ,
2020-05-22 15:59:40 -07:00
} ,
{
name : '2' ,
value : 2 ,
2020-10-22 06:46:03 -07:00
description : 'Only administrators can post.' ,
2020-05-22 15:59:40 -07:00
} ,
{
name : '3' ,
value : 3 ,
2020-10-22 06:46:03 -07:00
description : 'Only new members can post.' ,
2020-05-22 15:59:40 -07:00
} ,
] ,
} ,
2020-10-22 06:46:03 -07:00
] ,
2020-05-22 15:59:40 -07:00
} ,
/* -------------------------------------------------------------------------- */
/* stream:delete */
/* -------------------------------------------------------------------------- */
{
displayName : 'Stream ID' ,
name : 'streamId' ,
type : 'string' ,
required : true ,
default : '' ,
displayOptions : {
show : {
resource : [
'stream' ,
] ,
operation : [
'delete' ,
] ,
} ,
} ,
description : 'ID of stream to delete.' ,
} ,
2020-05-19 04:47:21 -07:00
2021-12-03 00:44:16 -08:00
] ;