1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2024-11-24 08:52:18 +02:00

Преобразование OPI -> OInt (workflow)

This commit is contained in:
Vitaly the Alpaca 2024-07-17 18:23:05 +00:00 committed by Vitaly the Alpaca (bot)
parent 024d473722
commit ebfccc8af0
10 changed files with 4448 additions and 4394 deletions

File diff suppressed because it is too large Load Diff

View File

@ -209,7 +209,7 @@ EndFunction
// Change post data
//
// Note
// Method at API documentation: [log.blogpost.update](@dev.1c-bitrix.ru/rest_help/log/log_blogpost_update.php.php)
// Method at API documentation: [log.blogpost.update](@dev.1c-bitrix.ru/rest_help/log/log_blogpost_update.php)
//
// Parameters:
// URL - String - URL of webhook or a Bitrix24 domain, when token used - url

View File

@ -357,6 +357,7 @@ EndFunction
// Document - BinaryData,String - Document file - doc
// Keyboard - String - See GenerateKeyboardFromArray - keyboard - Keyboard JSON or path to .json
// Markup - String - Text processing type (HTML, Markdown, MarkdownV2) - parsemode
// FileName - String - Custom displayed file name with extension, if necessary - filename
//
// Returns:
// Map Of KeyAndValue - Serialized JSON response from Telegram
@ -365,9 +366,10 @@ Function SendDocument(Val Token
, Val Text
, Val Document
, Val Keyboard = ""
, Val Markup = "Markdown") Export
, Val Markup = "Markdown"
, Val FileName = "") Export
Return SendFile(Token, ChatID, Text, Document, "document", Keyboard, Markup);
Return SendFile(Token, ChatID, Text, Document, "document", Keyboard, Markup, FileName);
EndFunction
@ -1041,7 +1043,14 @@ EndFunction
#Region Private
Function SendFile(Val Token, Val ChatID, Val Text, Val File, Val View, Val Keyboard, Val Markup)
Function SendFile(Val Token
, Val ChatID
, Val Text
, Val File
, Val View
, Val Keyboard
, Val Markup
, Val FileName = "")
OPI_TypeConversion.GetLine(Token);
OPI_TypeConversion.GetLine(ChatID);
@ -1054,6 +1063,8 @@ Function SendFile(Val Token, Val ChatID, Val Text, Val File, Val View, Val Keybo
ConvertFileData(File, Extension, View);
OPI_Tools.ReplaceSpecialCharacters(Text, Markup);
FileName = ?(ValueIsFilled(FileName), View + "|" + FileName, View + Extension);
Parameters = New Structure;
OPI_Tools.AddField("parse_mode" , Markup , "String" , Parameters);
OPI_Tools.AddField("caption" , Text , "String" , Parameters);
@ -1061,11 +1072,11 @@ Function SendFile(Val Token, Val ChatID, Val Text, Val File, Val View, Val Keybo
AddChatIdentifier(ChatID, Parameters);
FileStructure = New Structure;
FileStructure.Insert(View + Extension, File);
FileMapping = New Map;
FileMapping.Insert(FileName, File);
URL = "api.telegram.org/bot" + Token + Method;
Response = OPI_Tools.PostMultipart(URL, Parameters, FileStructure, "mixed");
Response = OPI_Tools.PostMultipart(URL, Parameters, FileMapping, "mixed");
Return Response;

View File

@ -4050,6 +4050,12 @@ Procedure Telegram_SendDocument(FunctionParameters)
OPI_TestDataRetrieval.WriteLog(Result, "SendDocument", "Telegram");
Check_TelegramDocument(Result, Text); // SKIP
Result = OPI_Telegram.SendDocument(Token, ChatID, Text, Document, , , "customname.docx");
OPI_TestDataRetrieval.WriteLog(Result, "SendDocument (with name)", "Telegram");
Check_TelegramDocument(Result, Text); // SKIP
Result = OPI_Telegram.SendDocument(Token, ChannelID, Text, DocumentPath);
@ -4058,7 +4064,7 @@ Procedure Telegram_SendDocument(FunctionParameters)
Check_TelegramDocument(Result, Text); // SKIP
Result = OPI_Telegram.SendDocument(Token, ChannelID, Text, DocumentDD);
Result = OPI_Telegram.SendDocument(Token, ChannelID, Text, DocumentDD, , , "customname.docx");
// END

View File

@ -209,7 +209,7 @@ EndFunction
// Change post data
//
// Note
// Method at API documentation: [log.blogpost.update](@dev.1c-bitrix.ru/rest_help/log/log_blogpost_update.php.php)
// Method at API documentation: [log.blogpost.update](@dev.1c-bitrix.ru/rest_help/log/log_blogpost_update.php)
//
// Parameters:
// URL - String - URL of webhook or a Bitrix24 domain, when token used - url

View File

@ -357,6 +357,7 @@ EndFunction
// Document - BinaryData,String - Document file - doc
// Keyboard - String - See GenerateKeyboardFromArray - keyboard - Keyboard JSON or path to .json
// Markup - String - Text processing type (HTML, Markdown, MarkdownV2) - parsemode
// FileName - String - Custom displayed file name with extension, if necessary - filename
//
// Returns:
// Map Of KeyAndValue - Serialized JSON response from Telegram
@ -365,9 +366,10 @@ Function SendDocument(Val Token
, Val Text
, Val Document
, Val Keyboard = ""
, Val Markup = "Markdown") Export
, Val Markup = "Markdown"
, Val FileName = "") Export
Return SendFile(Token, ChatID, Text, Document, "document", Keyboard, Markup);
Return SendFile(Token, ChatID, Text, Document, "document", Keyboard, Markup, FileName);
EndFunction
@ -1041,7 +1043,14 @@ EndFunction
#Region Private
Function SendFile(Val Token, Val ChatID, Val Text, Val File, Val View, Val Keyboard, Val Markup)
Function SendFile(Val Token
, Val ChatID
, Val Text
, Val File
, Val View
, Val Keyboard
, Val Markup
, Val FileName = "")
OPI_TypeConversion.GetLine(Token);
OPI_TypeConversion.GetLine(ChatID);
@ -1054,6 +1063,8 @@ Function SendFile(Val Token, Val ChatID, Val Text, Val File, Val View, Val Keybo
ConvertFileData(File, Extension, View);
OPI_Tools.ReplaceSpecialCharacters(Text, Markup);
FileName = ?(ValueIsFilled(FileName), View + "|" + FileName, View + Extension);
Parameters = New Structure;
OPI_Tools.AddField("parse_mode" , Markup , "String" , Parameters);
OPI_Tools.AddField("caption" , Text , "String" , Parameters);
@ -1061,11 +1072,11 @@ Function SendFile(Val Token, Val ChatID, Val Text, Val File, Val View, Val Keybo
AddChatIdentifier(ChatID, Parameters);
FileStructure = New Structure;
FileStructure.Insert(View + Extension, File);
FileMapping = New Map;
FileMapping.Insert(FileName, File);
URL = "api.telegram.org/bot" + Token + Method;
Response = OPI_Tools.PostMultipart(URL, Parameters, FileStructure, "mixed");
Response = OPI_Tools.PostMultipart(URL, Parameters, FileMapping, "mixed");
Return Response;

View File

@ -4050,6 +4050,12 @@ Procedure Telegram_SendDocument(FunctionParameters)
// !OInt OPI_TestDataRetrieval.WriteLog(Result, "SendDocument", "Telegram");
Check_TelegramDocument(Result, Text); // SKIP
Result = OPI_Telegram.SendDocument(Token, ChatID, Text, Document, , , "customname.docx");
// !OInt OPI_TestDataRetrieval.WriteLog(Result, "SendDocument (with name)", "Telegram");
Check_TelegramDocument(Result, Text); // SKIP
Result = OPI_Telegram.SendDocument(Token, ChannelID, Text, DocumentPath);
@ -4058,7 +4064,7 @@ Procedure Telegram_SendDocument(FunctionParameters)
Check_TelegramDocument(Result, Text); // SKIP
Result = OPI_Telegram.SendDocument(Token, ChannelID, Text, DocumentDD);
Result = OPI_Telegram.SendDocument(Token, ChannelID, Text, DocumentDD, , , "customname.docx");
// END

View File

@ -410,6 +410,16 @@
NewLine.Область = "Data sending";
NewLine = CompositionTable.Add();
NewLine.Библиотека = "telegram";
NewLine.Модуль = "OPI_Telegram";
NewLine.Метод = "SendDocument";
NewLine.МетодПоиска = "SENDDOCUMENT";
NewLine.Параметр = "--filename";
NewLine.Описание = "Custom displayed file name with extension, if necessary (optional, def. val. - Empty value)";
NewLine.Область = "Data sending";
NewLine = CompositionTable.Add();
NewLine.Библиотека = "telegram";
NewLine.Модуль = "OPI_Telegram";

View File

@ -1,21 +1,21 @@
<package-def>
<module name="OPI_Airtable" file="core/Modules/OPI_Airtable.os"/>
<module name="OPI_Bitrix24" file="core/Modules/OPI_Bitrix24.os"/>
<module name="OPI_Dropbox" file="core/Modules/OPI_Dropbox.os"/>
<module name="OPI_GoogleCalendar" file="core/Modules/OPI_GoogleCalendar.os"/>
<module name="OPI_GoogleDrive" file="core/Modules/OPI_GoogleDrive.os"/>
<module name="OPI_GoogleSheets" file="core/Modules/OPI_GoogleSheets.os"/>
<module name="OPI_GoogleWorkspace" file="core/Modules/OPI_GoogleWorkspace.os"/>
<module name="OPI_Notion" file="core/Modules/OPI_Notion.os"/>
<module name="OPI_Slack" file="core/Modules/OPI_Slack.os"/>
<module name="OPI_Telegram" file="core/Modules/OPI_Telegram.os"/>
<module name="OPI_Twitter" file="core/Modules/OPI_Twitter.os"/>
<module name="OPI_Viber" file="core/Modules/OPI_Viber.os"/>
<module name="OPI_VK" file="core/Modules/OPI_VK.os"/>
<module name="OPI_YandexDisk" file="core/Modules/OPI_YandexDisk.os"/>
<module name="OPI_YandexID" file="core/Modules/OPI_YandexID.os"/>
<module name="OPI_Инструменты" file="tools/Modules/internal/Modules/OPI_Инструменты.os"/>
<module name="OPI_Криптография" file="tools/Modules/internal/Modules/OPI_Криптография.os"/>
<module name="OPI_ПолучениеДанныхТестов" file="tools/Modules/OPI_ПолучениеДанныхТестов.os"/>
<module name="OPI_Инструменты" file="tools/Modules/internal/Modules/OPI_Инструменты.os"/>
<module name="OPI_GoogleDrive" file="core/Modules/OPI_GoogleDrive.os"/>
<module name="OPI_Twitter" file="core/Modules/OPI_Twitter.os"/>
<module name="OPI_YandexID" file="core/Modules/OPI_YandexID.os"/>
<module name="OPI_Dropbox" file="core/Modules/OPI_Dropbox.os"/>
<module name="OPI_GoogleWorkspace" file="core/Modules/OPI_GoogleWorkspace.os"/>
<module name="OPI_Bitrix24" file="core/Modules/OPI_Bitrix24.os"/>
<module name="OPI_Viber" file="core/Modules/OPI_Viber.os"/>
<module name="OPI_GoogleCalendar" file="core/Modules/OPI_GoogleCalendar.os"/>
<module name="OPI_Telegram" file="core/Modules/OPI_Telegram.os"/>
<module name="OPI_Airtable" file="core/Modules/OPI_Airtable.os"/>
<module name="OPI_Slack" file="core/Modules/OPI_Slack.os"/>
<module name="OPI_Notion" file="core/Modules/OPI_Notion.os"/>
<module name="OPI_GoogleSheets" file="core/Modules/OPI_GoogleSheets.os"/>
<module name="OPI_YandexDisk" file="core/Modules/OPI_YandexDisk.os"/>
<module name="OPI_ПреобразованиеТипов" file="tools/Modules/OPI_ПреобразованиеТипов.os"/>
<module name="OPI_VK" file="core/Modules/OPI_VK.os"/>
<module name="OPI_ПолучениеДанныхТестов" file="tools/Modules/OPI_ПолучениеДанныхТестов.os"/>
</package-def>

View File

@ -410,6 +410,16 @@
НоваяСтрока.Область = "Отправка данных";
НоваяСтрока = ТаблицаСостава.Добавить();
НоваяСтрока.Библиотека = "telegram";
НоваяСтрока.Модуль = "OPI_Telegram";
НоваяСтрока.Метод = "ОтправитьДокумент";
НоваяСтрока.МетодПоиска = "ОТПРАВИТЬДОКУМЕНТ";
НоваяСтрока.Параметр = "--filename";
НоваяСтрока.Описание = "Отображаемое имя файла c расширением, если необходимо (необяз. по ум. - Пустое значение)";
НоваяСтрока.Область = "Отправка данных";
НоваяСтрока = ТаблицаСостава.Добавить();
НоваяСтрока.Библиотека = "telegram";
НоваяСтрока.Модуль = "OPI_Telegram";