From cd23b8744e68393bb540d3ea85ecfe0799c37053 Mon Sep 17 00:00:00 2001 From: Anton Date: Sat, 1 Jun 2024 00:44:55 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=BF=D1=8B=D1=82=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=BB=D0=BE=D0=BA=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0=D1=86=D0=B8?= =?UTF-8?q?=D0=B8=20en?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/os/oint_dictionary.os | 19 +- .github/workflows/os/opi_translate.os | 20 +- service/dictionaries/en.json | 5137 ++++++++-------- service/interim/en/OPI/.project | 18 - .../org.eclipse.core.resources.prefs | 2 - service/interim/en/OPI/DT-INF/PROJECT.PMF | 3 - .../src/CommonModules/OPI_Airtable/Module.bsl | 681 --- .../OPI_Airtable/OPI_Airtable.mdo | 11 - .../src/CommonModules/OPI_Dropbox/Module.bsl | 961 --- .../CommonModules/OPI_Dropbox/OPI_Dropbox.mdo | 15 - .../OPI_GoogleCalendar/Module.bsl | 631 -- .../OPI_GoogleCalendar/OPI_GoogleCalendar.mdo | 11 - .../CommonModules/OPI_GoogleDrive/Module.bsl | 719 --- .../OPI_GoogleDrive/OPI_GoogleDrive.mdo | 11 - .../CommonModules/OPI_GoogleSheets/Module.bsl | 409 -- .../OPI_GoogleSheets/OPI_GoogleSheets.mdo | 11 - .../OPI_GoogleWorkspace/Module.bsl | 173 - .../OPI_GoogleWorkspace.mdo | 11 - .../src/CommonModules/OPI_Notion/Module.bsl | 889 --- .../CommonModules/OPI_Notion/OPI_Notion.mdo | 11 - .../src/CommonModules/OPI_Slack/Module.bsl | 1055 ---- .../src/CommonModules/OPI_Slack/OPI_Slack.mdo | 11 - .../src/CommonModules/OPI_Telegram/Module.bsl | 1253 ---- .../OPI_Telegram/OPI_Telegram.mdo | 11 - .../src/CommonModules/OPI_Twitter/Module.bsl | 682 --- .../CommonModules/OPI_Twitter/OPI_Twitter.mdo | 11 - .../OPI/src/CommonModules/OPI_VK/Module.bsl | 2190 ------- .../OPI/src/CommonModules/OPI_VK/OPI_VK.mdo | 11 - .../src/CommonModules/OPI_Viber/Module.bsl | 414 -- .../src/CommonModules/OPI_Viber/OPI_Viber.mdo | 11 - .../CommonModules/OPI_YandexDisk/Module.bsl | 635 -- .../OPI_YandexDisk/OPI_YandexDisk.mdo | 11 - .../src/CommonModules/OPI_YandexID/Module.bsl | 112 - .../OPI_YandexID/OPI_YandexID.mdo | 11 - .../CommonModules/OPI_Инструменты/Module.bsl | 1229 ---- .../OPI_Инструменты/OPI_Инструменты.mdo | 11 - .../CommonModules/OPI_Криптография/Module.bsl | 110 - .../OPI_Криптография/OPI_Криптография.mdo | 11 - .../OPI_ПолучениеДанныхТестов/Module.bsl | 470 -- .../OPI_ПолучениеДанныхТестов.mdo | 11 - .../OPI_ПреобразованиеТипов/Module.bsl | 320 - .../OPI_ПреобразованиеТипов.mdo | 11 - .../src/CommonModules/OPI_Тесты/Module.bsl | 5307 ----------------- .../src/CommonModules/OPI_Тесты/OPI_Тесты.mdo | 15 - .../OPI/src/Configuration/Configuration.mdo | 70 - .../OPI_Интеграция/OPI_Интеграция.mdo | 28 - src/en/OPI/.project | 32 +- .../org.eclipse.core.resources.prefs | 2 +- src/en/OPI/DT-INF/PROJECT.PMF | 2 +- .../src/CommonModules/OPI_Airtable/Module.bsl | 870 +-- .../OPI_Airtable/OPI_Airtable.mdo | 18 +- .../CommonModules/OPI_Cryptography/Module.bsl | 100 +- .../OPI_Cryptography/OPI_Cryptography.mdo | 18 +- .../src/CommonModules/OPI_Dropbox/Module.bsl | 1316 ++-- .../CommonModules/OPI_Dropbox/OPI_Dropbox.mdo | 26 +- .../CommonModules/OPI_GetTestData/Module.bsl | 730 +-- .../OPI_GetTestData/OPI_GetTestData.mdo | 18 +- .../OPI_GoogleCalendar/Module.bsl | 870 +-- .../OPI_GoogleCalendar/OPI_GoogleCalendar.mdo | 18 +- .../CommonModules/OPI_GoogleDrive/Module.bsl | 1084 ++-- .../OPI_GoogleDrive/OPI_GoogleDrive.mdo | 18 +- .../CommonModules/OPI_GoogleSheets/Module.bsl | 538 +- .../OPI_GoogleSheets/OPI_GoogleSheets.mdo | 18 +- .../OPI_GoogleWorkspace/Module.bsl | 198 +- .../OPI_GoogleWorkspace.mdo | 18 +- .../src/CommonModules/OPI_Notion/Module.bsl | 1292 ++-- .../CommonModules/OPI_Notion/OPI_Notion.mdo | 18 +- .../src/CommonModules/OPI_Slack/Module.bsl | 1340 ++--- .../src/CommonModules/OPI_Slack/OPI_Slack.mdo | 18 +- .../src/CommonModules/OPI_Telegram/Module.bsl | 1624 ++--- .../OPI_Telegram/OPI_Telegram.mdo | 18 +- .../src/CommonModules/OPI_Tests/Module.bsl | 5307 +++++++++++++++++ .../src/CommonModules/OPI_Tests/OPI_Tests.mdo | 15 + .../src/CommonModules/OPI_Tools/Module.bsl | 1782 +++--- .../src/CommonModules/OPI_Tools/OPI_Tools.mdo | 18 +- .../src/CommonModules/OPI_Twitter/Module.bsl | 1028 ++-- .../CommonModules/OPI_Twitter/OPI_Twitter.mdo | 18 +- .../OPI_TypeConversion/Module.bsl | 506 +- .../OPI_TypeConversion/OPI_TypeConversion.mdo | 18 +- .../OPI/src/CommonModules/OPI_VK/Module.bsl | 3268 +++++----- .../OPI/src/CommonModules/OPI_VK/OPI_VK.mdo | 18 +- .../src/CommonModules/OPI_Viber/Module.bsl | 538 +- .../src/CommonModules/OPI_Viber/OPI_Viber.mdo | 18 +- .../CommonModules/OPI_YandexDisk/Module.bsl | 912 +-- .../OPI_YandexDisk/OPI_YandexDisk.mdo | 18 +- .../src/CommonModules/OPI_YandexID/Module.bsl | 106 +- .../OPI_YandexID/OPI_YandexID.mdo | 18 +- .../src/CommonModules/OPI_Тесты/Module.bsl | 5307 ----------------- .../src/CommonModules/OPI_Тесты/OPI_Тесты.mdo | 15 - .../OPI/src/Configuration/Configuration.mdo | 136 +- .../Subsystems/OPI_Integrations}/CommandInterface.cmi | 0 .../OPI_Integrations/OPI_Integrations.mdo | 28 + .../OPI_Интеграция/CommandInterface.cmi | 2 - .../OPI_Интеграция/OPI_Интеграция.mdo | 28 - 94 files changed, 17273 insertions(+), 35789 deletions(-) delete mode 100644 service/interim/en/OPI/.project delete mode 100644 service/interim/en/OPI/.settings/org.eclipse.core.resources.prefs delete mode 100644 service/interim/en/OPI/DT-INF/PROJECT.PMF delete mode 100644 service/interim/en/OPI/src/CommonModules/OPI_Airtable/Module.bsl delete mode 100644 service/interim/en/OPI/src/CommonModules/OPI_Airtable/OPI_Airtable.mdo delete mode 100644 service/interim/en/OPI/src/CommonModules/OPI_Dropbox/Module.bsl delete mode 100644 service/interim/en/OPI/src/CommonModules/OPI_Dropbox/OPI_Dropbox.mdo delete mode 100644 service/interim/en/OPI/src/CommonModules/OPI_GoogleCalendar/Module.bsl delete mode 100644 service/interim/en/OPI/src/CommonModules/OPI_GoogleCalendar/OPI_GoogleCalendar.mdo delete mode 100644 service/interim/en/OPI/src/CommonModules/OPI_GoogleDrive/Module.bsl delete mode 100644 service/interim/en/OPI/src/CommonModules/OPI_GoogleDrive/OPI_GoogleDrive.mdo delete mode 100644 service/interim/en/OPI/src/CommonModules/OPI_GoogleSheets/Module.bsl delete mode 100644 service/interim/en/OPI/src/CommonModules/OPI_GoogleSheets/OPI_GoogleSheets.mdo delete mode 100644 service/interim/en/OPI/src/CommonModules/OPI_GoogleWorkspace/Module.bsl delete mode 100644 service/interim/en/OPI/src/CommonModules/OPI_GoogleWorkspace/OPI_GoogleWorkspace.mdo delete mode 100644 service/interim/en/OPI/src/CommonModules/OPI_Notion/Module.bsl delete mode 100644 service/interim/en/OPI/src/CommonModules/OPI_Notion/OPI_Notion.mdo delete mode 100644 service/interim/en/OPI/src/CommonModules/OPI_Slack/Module.bsl delete mode 100644 service/interim/en/OPI/src/CommonModules/OPI_Slack/OPI_Slack.mdo delete mode 100644 service/interim/en/OPI/src/CommonModules/OPI_Telegram/Module.bsl delete mode 100644 service/interim/en/OPI/src/CommonModules/OPI_Telegram/OPI_Telegram.mdo delete mode 100644 service/interim/en/OPI/src/CommonModules/OPI_Twitter/Module.bsl delete mode 100644 service/interim/en/OPI/src/CommonModules/OPI_Twitter/OPI_Twitter.mdo delete mode 100644 service/interim/en/OPI/src/CommonModules/OPI_VK/Module.bsl delete mode 100644 service/interim/en/OPI/src/CommonModules/OPI_VK/OPI_VK.mdo delete mode 100644 service/interim/en/OPI/src/CommonModules/OPI_Viber/Module.bsl delete mode 100644 service/interim/en/OPI/src/CommonModules/OPI_Viber/OPI_Viber.mdo delete mode 100644 service/interim/en/OPI/src/CommonModules/OPI_YandexDisk/Module.bsl delete mode 100644 service/interim/en/OPI/src/CommonModules/OPI_YandexDisk/OPI_YandexDisk.mdo delete mode 100644 service/interim/en/OPI/src/CommonModules/OPI_YandexID/Module.bsl delete mode 100644 service/interim/en/OPI/src/CommonModules/OPI_YandexID/OPI_YandexID.mdo delete mode 100644 service/interim/en/OPI/src/CommonModules/OPI_Инструменты/Module.bsl delete mode 100644 service/interim/en/OPI/src/CommonModules/OPI_Инструменты/OPI_Инструменты.mdo delete mode 100644 service/interim/en/OPI/src/CommonModules/OPI_Криптография/Module.bsl delete mode 100644 service/interim/en/OPI/src/CommonModules/OPI_Криптография/OPI_Криптография.mdo delete mode 100644 service/interim/en/OPI/src/CommonModules/OPI_ПолучениеДанныхТестов/Module.bsl delete mode 100644 service/interim/en/OPI/src/CommonModules/OPI_ПолучениеДанныхТестов/OPI_ПолучениеДанныхТестов.mdo delete mode 100644 service/interim/en/OPI/src/CommonModules/OPI_ПреобразованиеТипов/Module.bsl delete mode 100644 service/interim/en/OPI/src/CommonModules/OPI_ПреобразованиеТипов/OPI_ПреобразованиеТипов.mdo delete mode 100644 service/interim/en/OPI/src/CommonModules/OPI_Тесты/Module.bsl delete mode 100644 service/interim/en/OPI/src/CommonModules/OPI_Тесты/OPI_Тесты.mdo delete mode 100644 service/interim/en/OPI/src/Configuration/Configuration.mdo delete mode 100644 service/interim/en/OPI/src/Subsystems/OPI_Интеграция/OPI_Интеграция.mdo create mode 100644 src/en/OPI/src/CommonModules/OPI_Tests/Module.bsl create mode 100644 src/en/OPI/src/CommonModules/OPI_Tests/OPI_Tests.mdo delete mode 100644 src/en/OPI/src/CommonModules/OPI_Тесты/Module.bsl delete mode 100644 src/en/OPI/src/CommonModules/OPI_Тесты/OPI_Тесты.mdo rename {service/interim/en/OPI/src/Subsystems/OPI_Интеграция => src/en/OPI/src/Subsystems/OPI_Integrations}/CommandInterface.cmi (100%) create mode 100644 src/en/OPI/src/Subsystems/OPI_Integrations/OPI_Integrations.mdo delete mode 100644 src/en/OPI/src/Subsystems/OPI_Интеграция/CommandInterface.cmi delete mode 100644 src/en/OPI/src/Subsystems/OPI_Интеграция/OPI_Интеграция.mdo diff --git a/.github/workflows/os/oint_dictionary.os b/.github/workflows/os/oint_dictionary.os index 579b36abb1..24f91f1fe2 100644 --- a/.github/workflows/os/oint_dictionary.os +++ b/.github/workflows/os/oint_dictionary.os @@ -24,10 +24,15 @@ Процедура СоздатьСловарь(Знач Язык) - ФайлыМодулей = НайтиФайлы("./src/ru/", "*.os", Истина); + ФайлыМодулей = НайтиФайлы("./src/ru/", "*", Истина); СписокСлов = Новый СписокЗначений(); Для Каждого Модуль Из ФайлыМодулей Цикл + + Если Модуль.ЭтоКаталог() Тогда + Продолжить; + КонецЕсли; + Если СтрНайти(Модуль.ПолноеИмя, "cli\data") <> 0 Тогда Продолжить; КонецЕсли; @@ -107,6 +112,10 @@ ТекстовыйДок.ДобавитьСтроку("""" + Ключ + """: """ + Значение + ""","); КонецЦикла; + ПоследняяСтрока = ТекстовыйДок.ПолучитьСтроку(ТекстовыйДок.КоличествоСтрок()); + ПоследняяСтрока = Лев(ПоследняяСтрока, СтрДлина(ПоследняяСтрока) - 1); + ТекстовыйДок.ЗаменитьСтроку(ТекстовыйДок.КоличествоСтрок(), ПоследняяСтрока); + ТекстовыйДок.ДобавитьСтроку("}"); ТекстовыйДок.Записать(ПутьСловаря); @@ -133,11 +142,17 @@ Продолжить; КонецЕсли; - Если СтрНайти(ТекущаяСтрока, """") <> 0 Или СтрНайти(ТекущаяСтрока, "|") <> 0 Тогда + Если СтрНайти(ТекущаяСтрока, """") <> 0 + Или СтрНайти(ТекущаяСтрока, "|") <> 0 + Или СтрНайти(ТекущаяСтрока, "<") <> 0 + Или СтрНайти(ТекущаяСтрока, ">") <> 0 Тогда + ТекущаяСтрока = " " + ТекущаяСтрока; ТекущаяСтрока = СтрЗаменить(ТекущаяСтрока, """", "$"); ТекущаяСтрока = СтрЗаменить(ТекущаяСтрока, "|", "$"); + ТекущаяСтрока = СтрЗаменить(ТекущаяСтрока, "<", "$"); + ТекущаяСтрока = СтрЗаменить(ТекущаяСтрока, ">", "$"); ТекущаяСтрока = СтрЗаменить(ТекущаяСтрока, "$$", """"""); МассивСтроки = СтрРазделить(ТекущаяСтрока, "$", Истина); diff --git a/.github/workflows/os/opi_translate.os b/.github/workflows/os/opi_translate.os index 815ba47e6b..153776b07f 100644 --- a/.github/workflows/os/opi_translate.os +++ b/.github/workflows/os/opi_translate.os @@ -29,15 +29,15 @@ ПолучитьТаблицуСловаря(ПутьКСловарю); - КаталогИсточник = Новый Файл(".\ru\OPI"); - КаталогПриемник = Новый Файл(".\service\interim\" + Язык + "\OPI"); + КаталогИсточник = Новый Файл(".\src\ru\OPI"); + КаталогПриемник = Новый Файл(".\src\" + Язык + "\OPI"); Если КаталогПриемник.Существует() Тогда УдалитьФайлы(КаталогПриемник.ПолноеИмя); КонецЕсли; СкопироватьФайлы(КаталогИсточник.ПолноеИмя, КаталогПриемник.ПолноеИмя); - ФайлыМодулей = НайтиФайлы(".\service\interim\" + Язык + "\", "*", Истина); + ФайлыМодулей = НайтиФайлы(".\src\" + Язык + "\", "*", Истина); Для Каждого ФайлМодуля Из ФайлыМодулей Цикл @@ -48,7 +48,7 @@ ПеревестиМодуль(ФайлМодуля.ПолноеИмя); КонецЦикла; - ВсеФайлыЛокализации = НайтиФайлы("./" + Язык, "*", Истина); + ВсеФайлыЛокализации = НайтиФайлы(".\src\" + Язык, "*", Истина); ОтборИменМодулей = Новый Структура("ИмяМодуля", Истина); СтрокиИмен = ТаблицаСловаря.НайтиСтроки(ОтборИменМодулей); УдаляемыеКаталоги = Новый Массив; @@ -107,6 +107,18 @@ ДокументМодуля = Новый ТекстовыйДокумент(); ДокументМодуля.Прочитать(ПутьКМодулю, "UTF-8"); + Для Н = 1 По ДокументМодуля.КоличествоСтрок() Цикл + + ТекущаяСтрока = СокрЛП(ДокументМодуля.ПолучитьСтроку(Н)); + + Пока СтрНайти(ТекущаяСтрока, " ") <> 0 Цикл + ТекущаяСтрока = СтрЗаменить(ТекущаяСтрока, " ", " "); + КонецЦикла; + + ДокументМодуля.ЗаменитьСтроку(Н, ТекущаяСтрока); + + КонецЦикла; + ТекстМодуля = ДокументМодуля.ПолучитьТекст(); Для Каждого Элемент Из ТаблицаСловаря Цикл diff --git a/service/dictionaries/en.json b/service/dictionaries/en.json index 1d65317a43..e19f4caedc 100644 --- a/service/dictionaries/en.json +++ b/service/dictionaries/en.json @@ -1,782 +1,795 @@ { -"В": "In", "к": "to", -"К": "To", "Н": "N", -"И": "And", -"в": "in", -"с": "with", +"К": "To", "д": "d", -"ПС": "PS", +"в": "in", +"И": "And", +"В": "In", +"с": "with", +"МБ": "MB", "Не": "Not", -"ДД": "BD", "ВК": "VK", -"По": "For", +"ДД": "BD", +"ПС": "PS", "из": "from", +"Из": "In", "ФС": "FS", "См": "See", -"МБ": "MB", -"Из": "In", +"По": "For", "на": "to", -"Для": "For", -"Или": "Or", "ООД": "OOD", -"Вид": "View", -"для": "for", -"доп": "add", -"Нет": "No", +"Хэш": "Hash", +"тип": "type", "Вес": "Weight", +"Цел": "Goal", +"Тег": "Tag", +"Хеш": "Hash", +"Для": "For", +"ОТД": "OTD", "БСП": "BSP", +"осн": "main", +"Тип": "Type", +"Или": "Or", +"для": "for", +"Что": "What", +"Лев": "Left", +"Код": "Code", +"доп": "add", +"Час": "Hour", +"Окр": "Round", +"это": "this", +"Нет": "No", +"ОПИ": "OPI", +"Таб": "Tab", +"без": "without", +"Бан": "Ban", +"Имя": "Name", +"или": "or", +"Вид": "View", "Чат": "Chat", "НПП": "NPP", -"Лев": "Left", -"Тег": "Tag", -"Хэш": "Hash", -"это": "this", -"Хеш": "Hash", -"Код": "Code", "ИВФ": "AndVF", -"осн": "main", -"или": "or", -"Имя": "Name", -"без": "without", -"Что": "What", -"ОПИ": "OPI", -"Бан": "Ban", -"ОТД": "OTD", -"Цел": "Goal", -"Час": "Hour", -"Тип": "Type", -"Таб": "Tab", -"Окр": "Round", -"тип": "type", -"Авто": "Auto", -"Линк": "Link", -"Пара": "Pair", -"Цикл": "Do", -"Знач": "Val", -"Цель": "Purpose", -"Ключ": "Key", -"Тема": "Topic", -"Тело": "Body", -"Вход": "Entry", -"Дата": "Date", -"Файл": "File", -"АирТ": "AirT", -"Пока": "WHile", -"вРег": "inReg", -"нРег": "nReg", -"тему": "topic", -"Слак": "Slack", -"Поля": "Fields", -"Ложь": "False", -"Путь": "Path", -"быть": "be", +"Прав": "Right", "всех": "all", -"Лист": "Sheet", +"Знач": "Val", +"Фото": "Photo", +"Блок": "Block", "Цвет": "Color", "Поле": "Field", -"Куда": "To", -"Фото": "Photo", -"Цена": "Price", -"цены": "price", -"Тест": "Test", -"путь": "path", -"фото": "photo", -"Блок": "Block", "Пост": "Post", -"файл": "file", -"Сайт": "Website", +"Дата": "Date", +"Пока": "WHile", "Сред": "Average", -"Прав": "Right", -"Лого": "Logo", -"Если": "If", -"Пути": "Paths", +"фото": "photo", +"Цикл": "Do", +"Слак": "Slack", +"вРег": "inReg", +"нРег": "nReg", +"путь": "path", +"АирТ": "AirT", "Флаг": "Flag", -"База": "Base", +"Лист": "Sheet", +"цены": "price", +"Куда": "To", +"Авто": "Auto", +"Ключ": "Key", +"Вход": "Entry", "поля": "fields", -"Финал": "Final", -"Набор": "Set", -"Аудио": "Audio", -"Товар": "Product", -"Вызов": "Call", -"Серый": "Gray", -"Гифка": "GIF", -"Белый": "White", -"Добро": "Welcome", -"Шапка": "Header", -"Адрес": "Address", -"ТЗнач": "TValue", -"Файла": "File", -"Текст": "Text", -"Видео": "Video", +"Линк": "Link", +"Тест": "Test", +"Сайт": "Website", +"База": "Base", +"Ложь": "False", +"Пара": "Pair", +"Поля": "Fields", +"Цель": "Purpose", +"тему": "topic", +"Файл": "File", +"Если": "If", +"Тело": "Body", +"Лого": "Logo", +"Цена": "Price", +"быть": "be", +"файл": "file", +"Путь": "Path", +"Тема": "Topic", +"Пути": "Paths", +"ЮТест": "UTest", +"Равно": "Equal", "Опции": "Options", -"Медиа": "Media", +"Файла": "File", +"Целое": "Whole", +"Книга": "Book", +"Лимит": "Limit", +"Вызов": "Call", +"Текст": "Text", +"Белый": "White", +"Тесты": "Tests", +"Почта": "Email", +"Добро": "Welcome", +"Набор": "Set", +"Шапка": "Header", +"Отбор": "Filter", "Заказ": "Order", "Сдвиг": "Shift", "путей": "paths", -"нечто": "something", -"Листы": "Sheets", -"Книга": "Book", -"вроде": "like", -"Часть": "Part", -"Сутки": "Day", -"Токен": "Token", -"Твиты": "Tweets", -"текст": "text", -"будет": "will", -"Номер": "Number", -"Лист2": "Sheet2", -"Копия": "Copy", -"Форум": "Forum", -"Почты": "Mails", -"Число": "Number", -"Тесты": "Tests", -"Папка": "Folder", -"Опрос": "Poll", -"ЯДиск": "YDisk", -"Драйв": "Drive", -"своей": "of its", -"Синий": "Blue", -"КБайт": "KBytes", -"Лимит": "Limit", -"МБайт": "MByte", -"Равно": "Equal", -"Отбор": "Filter", -"Режим": "Mode", -"ЮТест": "UTest", -"Метка": "Label", -"Лист1": "Sheet1", -"Пауза": "Pause", -"Ноушн": "Notion", -"ЕдИзм": "Unit", -"Ответ": "Response", -"Тогда": "Then", -"Файлы": "Files", -"Схема": "Scheme", -"Почта": "Email", -"файлу": "file", -"места": "of the venue", -"Дата0": "Date0", -"Иначе": "Else", -"Буфер": "Buffer", -"Всего": "Total", -"файла": "file", -"Вывод": "Output", -"после": "after", -"Целое": "Whole", -"Части": "Parts", -"Новый": "New", -"Метод": "Method", -"Блоки": "Blocks", -"Перем": "Var", -"Дата1": "Date1", "Канал": "Channel", -"Диалог": "Dialog", -"Формат": "Format", -"Ячейка": "Cell", -"Запись": "Record", -"Это B1": "ThisIsB1", -"Это B4": "ThisIsB4", -"Разбан": "Unban", -"Раздел": "Section", -"Первый": "First", -"Список": "List", -"Рефреш": "Refresh", -"булево": "boolean", -"Дважды": "Twice", -"Иконки": "Icons", -"команд": "commands", -"СокрЛП": "ShortLP", -"Откуда": "From", -"Модуль": "Module", -"Это B2": "ThisIsB2", -"Работа": "Work", -"начала": "of start", -"Скрыть": "Hide", -"Книга2": "Book2", -"Сессия": "Session", -"важное": "important", -"Это B3": "ThisIsB3", -"Важное": "Important", -"ФотоID": "PhotoID", -"данные": "Data", -"Данные": "Data", -"Кнопка": "Button", -"Ответы": "Answers", +"Листы": "Sheets", +"Файлы": "Files", +"Всего": "Total", +"Пауза": "Pause", +"ЕдИзм": "Unit", +"Синий": "Blue", +"Блоки": "Blocks", +"своей": "of its", +"Адрес": "Address", +"Метка": "Label", +"метод": "method", +"Товар": "Product", +"Метод": "Method", +"Буфер": "Buffer", +"вроде": "like", +"места": "of the venue", +"Тогда": "Then", +"Иначе": "Else", +"Часть": "Part", +"файлу": "file", +"Копия": "Copy", +"Гифка": "GIF", +"Номер": "Number", +"Части": "Parts", +"Медиа": "Media", +"Новый": "New", +"Твиты": "Tweets", +"будет": "will", +"текст": "text", +"Форум": "Forum", +"Токен": "Token", +"Дата1": "Date1", +"Сутки": "Day", +"Автор": "Author", +"после": "after", +"Дата0": "Date0", +"КБайт": "KBytes", +"МБайт": "MByte", +"Перем": "Var", +"Аудио": "Audio", +"Видео": "Video", +"нечто": "something", +"Драйв": "Drive", +"Финал": "Final", +"Серый": "Gray", +"Ноушн": "Notion", +"Число": "Number", +"Ответ": "Response", +"Опрос": "Poll", +"Лист2": "Sheet2", +"ЯДиск": "YDisk", +"Схема": "Scheme", +"файла": "file", +"Папка": "Folder", +"Почты": "Mails", +"Вывод": "Output", +"Режим": "Mode", +"ТЗнач": "TValue", +"Лист1": "Sheet1", "Черный": "Black", -"Это A3": "ThisIsA3", -"Кнопки": "Buttons", -"Вайбер": "Viber", -"корень": "root", +"Текст2": "Text2", +"важное": "important", +"Флажок": "Checkbox", +"начала": "of start", "ВСпейс": "VSpace", -"Альбом": "Album", +"метода": "method", +"СКонца": "FromEnd", +"Привет": "Hello", +"Диалог": "Dialog", +"Вайбер": "Viber", +"Запись": "Record", +"Отступ": "Indent", +"Это B4": "ThisIsB4", +"Иконка": "Icon", +"Важное": "Important", +"Первый": "First", "Это A4": "ThisIsA4", -"Ошибка": "Error", -"IDТемы": "ThreadID", -"IDФото": "PhotoID", -"Клиент": "Client", +"Рефреш": "Refresh", +"Это A3": "ThisIsA3", +"Это B3": "ThisIsB3", +"Это B2": "ThisIsB2", +"Это A2": "ThisIsA2", +"Это A1": "ThisIsA1", +"Работа": "Work", +"Это B1": "ThisIsB1", +"данные": "Data", "опции:": "options:", +"Раздел": "Section", +"Книга2": "Book2", +"Ширина": "Width", +"тестов": "tests", +"Дважды": "Twice", +"Должно": "Should", +"булево": "boolean", +"Данные": "Data", +"ФотоID": "PhotoID", +"IDЧата": "ChatID", +"Ячейка": "Cell", "Широта": "Latitude", -"Способ": "Method", -"Размер": "Size", -"ТипЗнч": "TypeValue", -"ИДФото": "PhotoID", -"Массив": "Array", -"Прочие": "Others", +"IDФото": "PhotoID", +"Откуда": "From", +"Бирюза": "Turquoise", +"Модуль": "Module", +"Ошибка": "Error", +"корень": "root", +"Товары": "Products", +"Курсор": "Cursor", +"Ответы": "Answers", +"Вопрос": "Question", +"команд": "commands", +"Список": "List", +"Версия": "Version", "вывода": "output", +"Строки": "Strings", +"Разбан": "Unban", +"Иконки": "Icons", +"данных": "data", +"Сессия": "Session", +"Парсер": "Parser", +"Объект": "Object", +"КудаID": "ToID", +"IDТемы": "ThreadID", +"работы": "work", +"Клиент": "Client", +"Коммит": "Commit", +"Скрыть": "Hide", +"Кнопка": "Button", +"Кнопки": "Buttons", +"товара": "product", +"Булево": "Boolean", +"Альбом": "Album", +"группе": "group", +"Прочее": "Miscellaneous", +"ТипЗнч": "TypeValue", "Сервер": "Server", "Строка": "String", -"IDЧата": "ChatID", -"Запрос": "Request", -"СКонца": "FromEnd", -"Флажок": "Checkbox", -"Должно": "Should", "Статус": "Status", +"Запрос": "Request", "Пароль": "Password", -"Высота": "Height", -"Прочее": "Miscellaneous", -"Версия": "Version", -"Привет": "Hello", -"Ширина": "Width", +"СокрЛП": "ShortLP", +"Прочие": "Others", "Истина": "True", -"группе": "group", -"Коммит": "Commit", -"Ссылка": "Link", -"Это A2": "ThisIsA2", -"данных": "data", -"Товары": "Products", -"Строки": "Strings", -"Это A1": "ThisIsA1", +"Размер": "Size", +"Формат": "Format", +"Высота": "Height", +"Способ": "Method", +"Массив": "Array", "Записи": "Records", -"тестов": "tests", -"КудаID": "ToID", -"метода": "method", -"работы": "work", -"товара": "product", -"Бирюза": "Turquoise", -"Иконка": "Icon", -"Курсор": "Cursor", -"Желтый": "Yellow", -"Объект": "Object", -"Отступ": "Indent", -"Текст2": "Text2", -"Вопрос": "Question", -"Булево": "Boolean", +"Ссылка": "Link", "Заказы": "Orders", -"Парсер": "Parser", +"Желтый": "Yellow", +"ИДФото": "PhotoID", "изменен": "changed", -"Справка": "Help", -"Отметка": "Timestamp", -"Отметки": "Tags", -"Удалить": "Delete", -"Активен": "Active", -"Обложка": "Cover", -"Обычный": "Regular", +"Глубина": "Depth", +"запуска": "start", +"Коммент": "Comment", +"Открыть": "Open", +"граммах": "grams", +"Скрытый": "Hidden", "удалено": "deleted", -"Команды": "Commands", -"ИЛИ,Или": "Or", -"ЭтоБаза": "ThisIsBase", -"парсера": "parser", +"Скрытая": "Hidden", +"Булево_": "Boolean_", +"Обычный": "Regular", +"1 Тогда": "1 Then", "Альбомы": "Albums", "ДопФото": "AdditionalPhoto", -"Каталог": "Directory", -"Вариант": "Option", -"Скрытая": "Hidden", -"свойств": "properties", -"Аккаунт": "Account", +"ID темы": "Thread ID", +"Отметки": "Tags", "Артикул": "SKU", -"Отладка": "Debugging", -"граммах": "grams", -"Строка_": "String_", -"Глубина": "Depth", -"Сделать": "Make", -"запуска": "start", -"ТипПоля": "FieldType", -"Таблица": "Table", -"Запросы": "Requests", -"IDПоста": "PostID", -"Телефон": "Phone", "В офисе": "InOffice", -"ОпросID": "PollID", -"История": "Story", -"Перейти": "Goto", -"Область": "Region", -"Реклама": "Advertisement", +"IDФайла": "FileID", +"Фамилия": "Last name", +"события": "events", +"Событие": "Event", +"Аккаунт": "Account", +"Граница": "Boundary", +"Запросы": "Requests", +"Колонки": "Columns", +"Строка_": "String_", "IDСтены": "WallID", +"Подпись": "Signature", +"свойств": "properties", +"Сделать": "Make", +"История": "Story", +"главным": "main", +"ОпросID": "PollID", "Красный": "Red", "Удаляет": "Deletes", -"Коммент": "Comment", -"команды": "commands", -"Граница": "Boundary", -"текущей": "current", -"ИДПоста": "PostID", -"ИДБлока": "BlockID", -"Символы": "Symbols", -"главным": "main", -"Ревизия": "Revision", -"Функция": "Function", -"Объекты": "Objects", -"справку": "help", -"главную": "main", -"Префикс": "Prefix", -"события": "events", -"Каждого": "Each", -"IDВидео": "VideoID", -"Открыть": "Open", -"Долгота": "Longitude", -"вызова:": "call:", -"Событие": "Event", -"ЕстьТег": "HasTag", -"Попытка": "Try", -"Текущее": "Current", -"Экспорт": "Export", -"Фамилия": "Last name", -"Консоль": "Console", -"Зеленый": "Green", +"IDПоста": "PostID", +"Реклама": "Advertisement", +"Каталог": "Directory", "События": "Events", -"Разделы": "Sections", -"Синоним": "Synonym", -"ID темы": "Thread ID", -"Секунды": "Seconds", -"Вывести": "Output", -"Твиттер": "Twitter", -"Скрытый": "Hidden", -"Таймаут": "Timeout", -"Причина": "Reason", -"ЧатТема": "ChatTopic", -"Процент": "Percent", -"Возврат": "Return", -"Ожидаем": "Awaiting", -"каждого": "each", -"ИмяПоля": "FieldName", -"Команда": "Command", -"Колонки": "Columns", -"Булево_": "Boolean_", -"Подпись": "Signature", -"Счетчик": "Counter", -"ЮТТесты": "UTTests", -"Закрыть": "Close", -"Признак": "Indication", "Единица": "Unit", -"IDПапки": "FolderID", -"ВидеоДД": "VideoDD", -"Таблицы": "Tables", -"АудиоДД": "AudioDD", -"методы:": "methods:", "IDМедиа": "MediaID", -"IDФайла": "FileID", -"СНачала": "FromStart", -"Элемент": "Element", +"IDПапки": "FolderID", +"Долгота": "Longitude", +"Активен": "Active", +"Таймаут": "Timeout", +"Отметка": "Timestamp", +"ИДПоста": "PostID", +"вызова:": "call:", +"Префикс": "Prefix", +"IDВидео": "VideoID", "Извлечь": "Extract", +"Телефон": "Phone", +"Элемент": "Element", +"Удалить": "Delete", +"Ревизия": "Revision", +"Обложка": "Cover", +"ЕстьТег": "HasTag", +"Разделы": "Sections", +"Попытка": "Try", +"каждого": "each", +"Вариант": "Option", +"Признак": "Indication", +"Команда": "Command", +"СНачала": "FromStart", +"Твиттер": "Twitter", +"Таблицы": "Tables", +"Функция": "Function", +"Вывести": "Output", +"ЮТТесты": "UTTests", +"ЭтоБаза": "ThisIsBase", +"Синоним": "Synonym", +"Секунды": "Seconds", +"Счетчик": "Counter", +"Текущее": "Current", +"Каждого": "Each", +"Процент": "Percent", +"Причина": "Reason", +"Ожидаем": "Awaiting", +"Символы": "Symbols", +"Возврат": "Return", +"ТипПоля": "FieldType", +"Справка": "Help", +"Область": "Region", +"Экспорт": "Export", +"главную": "main", +"команды": "commands", +"ИмяПоля": "FieldName", +"текущей": "current", +"Таблица": "Table", +"Закрыть": "Close", +"АудиоДД": "AudioDD", +"Консоль": "Console", +"ВидеоДД": "VideoDD", +"справку": "help", +"парсера": "parser", +"Зеленый": "Green", +"Отладка": "Debugging", +"Перейти": "Goto", +"Объекты": "Objects", +"Команды": "Commands", "ГифкаДД": "GifDD", -"ОткудаID": "FromID", -"Подборка": "Selection", -"ПоляБазы": "BaseFields", -"ID книги": "BookID", -"СтрВсего": "StrTotal", -"ИмяФайла": "FileName", -"ТипЧисло": "TypeNumber", -"Страница": "Page", -"входящих": "incoming", -"Сообщить": "Notify", -"Делитель": "Divider", -"ФайлСлак": "SlackFile", -"методами": "methods", -"Параметр": "Parameter", -"Проверки": "Checks", -"ВКорзину": "ToCart", -"СтрДлина": "StrLength", -"ФайлТела": "BodyFile", -"Получить": "Get", +"методы:": "methods:", +"ЧатТема": "ChatTopic", +"Русский": "Russian", +"0 Тогда": "0 Then", +"ИДБлока": "BlockID", +"ИЛИ,Или": "Or", "Значение": "Value", -"СтрокаТЗ": "DataString", -"ID блока": "Block ID", -"Смещение": "Offset", -"Разметка": "Markup", -"Картинка": "Image", -"Максимум": "Maximum", -"варианты": "variants", -"Подборки": "Selections", -"Записать": "Write", -"НЕ JSON:": "NOT JSON:", -"Основная": "Main", -"Значения": "Values", -"Документ": "Document", -"магазина": "store", +"Оригинал": "Original", +"Делитель": "Divider", "Действие": "Action", "страницу": "page", -"ФайлЛога": "LogFile", -"Свойство": "Property", -"ИДТовара": "ProductID", -"отправки": "of sending", -"Подробно": "Detailed", -"Не JSON:": "Not JSON:", -"Свернуть": "Collapse", -"Оригинал": "Original", -"ИмеетТип": "HasType", -"Описание": "Description", -"JSONДата": "JSONDate", -"Внимание": "Attention", -"МассивИД": "IDArray", -"ID поста": "Post ID", -"загрузки": "upload", -"РазмерДД": "SizeDD", -"ИДРаботы": "WorkID", +"ВКорзину": "ToCart", "Родитель": "Parent", -"каталога": "directory", -"Добавить": "Add", -"название": "name", -"ЭтотФайл": "ThisFile", -"ИмяМедиа": "MediaName", -"ЭтоКанал": "IsChannel", -"ПотокZip": "ZipStream", -"Основные": "Main", -"В работе": "InProgress", +"магазина": "store", +"НЕ JSON:": "NOT JSON:", +"Значения": "Values", +"Свернуть": "Collapse", +"Подборки": "Selections", "Вложения": "Attachments", -"Вставить": "Insert", -"ЕстьДата": "HasDate", -"Прервать": "Break", -"БлокJSON": "JSONBlock", -"ИмяЛиста": "SheetName", -"Отправка": "Sending", -"Вложение": "Attachment", -"Двоичные": "Binary", +"ФайлСлак": "SlackFile", +"варианты": "variants", +"ИДТовара": "ProductID", +"Максимум": "Maximum", +"Записать": "Write", +"ФайлТела": "BodyFile", +"ФайлЛога": "LogFile", +"СтрДлина": "StrLength", +"ИмяФайла": "FileName", +"Получить": "Get", +"Основная": "Main", +"СтрокаТЗ": "DataString", +"Подробно": "Detailed", +"НовоеИмя": "NewName", +"Разметка": "Markup", +"Картинка": "Image", +"ЭтоКанал": "IsChannel", "Элементы": "Elements", -"IDКанала": "ChannelID", -"Числовой": "Numeric", -"СтрНайти": "StrFind", -"Строчный": "StringType", +"ID блока": "Block ID", "ХешСумма": "HashSum", -"Телеграм": "Telegram", -"ПутьФайл": "FilePath", -"подборки": "selections", -"КонецДня": "EndOfDay", -"Свойства": "Properties", +"Страница": "Page", +"ПотокZip": "ZipStream", +"Документ": "Document", +"Основные": "Main", +"ИмяМедиа": "MediaName", +"ЭтотФайл": "ThisFile", +"методами": "methods", +"ОткудаID": "FromID", +"входящих": "incoming", +"IDИконки": "IconID", +"отправки": "of sending", +"ИмяЛиста": "SheetName", +"ID поста": "Post ID", +"Свойство": "Property", +"РазмерДД": "SizeDD", +"Смещение": "Offset", +"Вложение": "Attachment", +"СтрВсего": "StrTotal", +"ID книги": "BookID", +"Подборка": "Selection", +"Сообщить": "Notify", +"JSONДата": "JSONDate", "ДатаСтоп": "EndDate", -"URLФайла": "FileURL", -"IDРаботы": "JobID", +"ПоляБазы": "BaseFields", "Приемник": "Receiver", +"Источник": "Source", +"URLФайла": "FileURL", +"ОбъектВК": "VKObject", +"IDРаботы": "JobID", +"Загрузка": "Upload", +"загрузки": "upload", +"ПутьФайл": "FilePath", +"каталога": "directory", +"Внимание": "Attention", +"Параметр": "Parameter", +"IDКанала": "ChannelID", +"МассивИД": "IDArray", +"Название": "Name", +"ЕстьДата": "HasDate", +"КонецДня": "EndOfDay", "Кнопка 1": "Button 1", "Кнопка 2": "Button 2", -"Источник": "Source", "подборку": "selection", -"IDИконки": "IconID", -"Кнопка 3": "Button 3", +"Точность": "Precision", +"Описание": "Description", +"подборки": "selections", "Удаление": "Deletion", "Уадление": "Removal", -"Точность": "Precision", -"Название": "Name", +"Кнопка 3": "Button 3", "описание": "description", "ВГраница": "WithinBoundary", -"НовоеИмя": "NewName", -"ОбъектВК": "VKObject", "ДропБокс": "Dropbox", -"Загрузка": "Upload", -"ID товара": "Product ID", -"МассивИД_": "ArrayID_", -"изменения": "change", -"ДатаСтарт": "StartDate", -"Приватный": "Private", -"Константы": "Constants", -"Анонимный": "Anonymous", -"отражения": "reflection", -"Категории": "Categories", -"Категория": "Category", -"ВерсияАпи": "APIVersion", -"Сигнатура": "Signature", -"Рекламный": "Advertising", -"Календарь": "Calendar", -"Календари": "Calendars", -"ID канала": "Channel ID", -"окончания": "of end", -"URL файла": "File URL", -"НачалоДня": "StartOfDay", -"Заголовок": "Title", -"HTTPОтвет": "HTTPResponse", -"Значение:": "Value:", -"IDАльбома": "AlbumID", -"ИДЖелтого": "YellowID", -"Строковое": "String", -"Результат": "Result", -"Открывает": "Opens", -"Прочитать": "Read", -"НовыйЛист": "NewSheet", +"Добавить": "Add", +"Телеграм": "Telegram", +"ИДРаботы": "WorkID", +"В работе": "InProgress", +"Вставить": "Insert", +"Двоичные": "Binary", +"Прервать": "Break", +"название": "name", +"Отправка": "Sending", +"Числовой": "Numeric", +"Строчный": "StringType", +"СтрНайти": "StrFind", +"Проверки": "Checks", +"ИмеетТип": "HasType", +"ТипЧисло": "TypeNumber", +"БлокJSON": "JSONBlock", +"Не JSON:": "Not JSON:", +"Свойства": "Properties", "Структура": "Structure", -"Кодировка": "Encoding", -"Имя папки": "Folder name", -"ВКонтакте": "VK", -"Процедура": "Procedure", -"Заполнено": "Filled", -"ИначеЕсли": "ElsIf", -"доступных": "available", -"НовыйТест": "NewTest", -"Сообщение": "Message", -"ВебКлиент": "WebClient", -"Разобрать": "Parse", -"Картинка2": "Image2", -"Выполнить": "Execute", -"Закрывает": "Closes", +"Рекламный": "Advertising", "Картинка1": "Image1", -"Параметры": "Parameters", "ТипСтрока": "TypeString", -"ГифкаПуть": "GifPath", -"РазмерЛФХ": "SizeLFH", -"ИДОбъекта": "ObjectID", -"РазмерЕСД": "SizeESD", +"Календари": "Calendars", +"Приватный": "Private", +"Файл_Стат": "File_Stat", +"Значение_": "Value_", +"ДатаСтарт": "StartDate", "ТокенБота": "BotToken", "Истечение": "Expiration", -"Служебные": "Service", -"ЧтениеZip": "ReadingZip", -"КонецЕсли": "EndIf", -"Удаляемый": "Deletable", -"ПутьКопии": "CopyPath", -"РазмерСДХ": "SizeCDH", -"РазмерCDH": "SizeCDH", -"Вариант 1": "Option 1", -"АудиоПуть": "AudioPath", -"Файл_Стат": "File_Stat", -"Заголовки": "Headers", -"Свойства_": "Properties_", -"Изменение": "Change", -"Коллекция": "Collection", -"Значение_": "Value_", -"НаСервере": "AtServer", -"ИДАльбома": "AlbumID", -"Вычислить": "Calculate", -"Выражение": "Expression", -"ПутьЛогов": "LogPath", -"ТекущийИД": "CurrentID", "ПолноеИмя": "FullName", -"Подборки_": "Selections_", -"программы": "program", -"ТипДанных": "DataType", -"ИмяПакета": "PackageName", -"В корзину": "To cart", -"URLОтвета": "ResponseURL", +"Разобрать": "Parse", +"Результат": "Result", +"Заголовок": "Title", +"Категории": "Categories", +"Категория": "Category", +"ПутьКопии": "CopyPath", +"Выполнить": "Execute", +"Изменение": "Change", "Удаленный": "Remote", -"Исполнить": "Execute", -"ИмяМетода": "MethodName", -"СтрШаблон": "StrTemplate", -"НаКлиенте": "AtClient", -"Последний": "Last", -"ВидеоПуть": "VideoPath", -"Доступные": "Available", -"ОбъектОПИ": "OPIObject", +"HTTPОтвет": "HTTPResponse", +"НовыйТест": "NewTest", +"OPI_Тесты": "OPI_Tests", +"Картинка2": "Image2", +"ПутьЛогов": "LogPath", +"Календарь": "Calendar", +"Удаляемый": "Deletable", +"URL файла": "File URL", +"ЧтениеZip": "ReadingZip", +"ИмяПакета": "PackageName", +"Значение:": "Value:", +"Сигнатура": "Signature", +"ВерсияАпи": "APIVersion", +"Параметры": "Parameters", +"РазмерCDH": "SizeCDH", +"Прочитать": "Read", +"В корзину": "To cart", "Вариант 2": "Option 2", +"Константы": "Constants", +"OPI тесты": "OPI tests", +"Вариант 1": "Option 1", +"РазмерЛФХ": "SizeLFH", +"РазмерЕСД": "SizeESD", +"ВКонтакте": "VK", +"РазмерСДХ": "SizeCDH", +"Открывает": "Opens", +"Закрывает": "Closes", +"НовыйЛист": "NewSheet", +"IDАльбома": "AlbumID", +"КонецЕсли": "EndIf", +"URLОтвета": "ResponseURL", +"Сообщение": "Message", +"Вычислить": "Calculate", +"Кодировка": "Encoding", +"ЗависитОт": "ЗависитОт", +"ID товара": "Product ID", +"Заголовки": "Headers", +"Подборки_": "Selections_", +"ВидеоПуть": "VideoPath", +"ИмяМетода": "MethodName", +"Заполнено": "Filled", +"окончания": "of end", +"Исполнить": "Execute", +"Имя папки": "Folder name", +"НаКлиенте": "AtClient", +"МассивИД_": "ArrayID_", +"Доступные": "Available", +"ИДЖелтого": "YellowID", +"Служебные": "Service", +"Последний": "Last", "обработки": "processing", -"ПутьКСтат": "PathToStat", +"ID канала": "Channel ID", +"ТипДанных": "DataType", +"АудиоПуть": "AudioPath", +"ИначеЕсли": "ElsIf", +"СтрШаблон": "StrTemplate", +"ТекущийИД": "CurrentID", +"ОбъектОПИ": "OPIObject", +"ИДАльбома": "AlbumID", +"НаСервере": "AtServer", +"ГифкаПуть": "GifPath", "Параметр_": "Parameter_", -"СтрПроцент": "StrPercentage", -"ЗаписьJSON": "WritingJSON", -"КартинкаДД": "ImageDD", -"СтрТекущее": "StrCurrent", -"ДокументДД": "DocumentDD", -"ID диалога": "Dialog ID", -"УдалитьТег": "DeleteTag", -"Разрешения": "Permissions", +"Процедура": "Procedure", +"ПутьКСтат": "PathToStat", +"Выражение": "Expression", +"отражения": "reflection", +"изменения": "change", +"ВебКлиент": "WebClient", +"программы": "program", +"Коллекция": "Collection", +"доступных": "available", +"НачалоДня": "StartOfDay", +"Анонимный": "Anonymous", +"Строковое": "String", +"ИДОбъекта": "ObjectID", +"Свойства_": "Properties_", "ЧтениеJSON": "ReadingJSON", -"ИмяТаблицы": "TableName", -"ИДКартинки": "ImageID", -"КонецЦикла": "EndDo", -"Файл видео": "Video file", -"Файл гифки": "GIF file", -"ПутьКФайлу": "FilePath", -"ЦветТекста": "TextColor", -"HTTPМетоды": "HTTPMethods", -"пожаловать": "welcome", -"возвращает": "returns", -"библиотек:": "libraries:", -"Клавиатура": "Keyboard", -"Расширение": "Extension", -"Библиотека": "Library", -"ВидЗапроса": "RequestType", -"ФайлОтвета": "ResponseFile", -"Бан\/Разбан": "Ban\/Unban", -"Продолжить": "Continue", -"Параметры:": "Parameters:", -"Пропустить": "Skip", -"БезСтатуса": "NoStatus", -"Информация": "Information", +"отладочной": "debug", +"ХешФункция": "HashFunction", "Приложение": "Application", -"HTTPЗапрос": "HTTPRequest", -"НовяИконка": "NewIcon", -"МассивЧата": "ChatArray", +"на сервере": "on the server", +"информации": "information", +"отключения": "disconnection", +"Пропустить": "Skip", +"ООО Вектор": "LLC Vector", +"Разрешения": "Permissions", +"ЗаписьJSON": "WritingJSON", "ОтветТокен": "TokenResponse", -"Твит с гиф": "Tweet with gif", +"Файл гифки": "GIF file", +"ДокументДД": "DocumentDD", "Параметры_": "Parameters_", -"Исключение": "Except", +"МассивЧата": "ChatArray", +"ФорматДаты": "DateFormat", +"Новый файл": "NewFile", +"ИмяТаблицы": "TableName", +"Назначение": "Destination", +"ID диалога": "Dialog ID", +"библиотеки": "libraries", +"УдалитьТег": "DeleteTag", +"ПолныйПуть": "FullPath", +"параметров": "parameters", +"МассивИмен": "ArrayOfNames", +"Количество": "Quantity", +"Файл аудио": "Audio file", "Текст тега": "Tag text", -"ИДКрасного": "RedID", +"НовяИконка": "NewIcon", +"ФайлВывода": "OutputFile", +"пожаловать": "welcome", +"Интеграция": "Integrations", +"ЦветТекста": "TextColor", +"Файл видео": "Video file", "ИДВарианта": "VariantID", +"они разные": "they are different", +"СтараяЦена": "OldPrice", +"Твит с гиф": "Tweet with gif", +"МассивФото": "PhotoArray", +"КонецЦикла": "EndDo", +"участникам": "to participants", +"ПутьКФайлу": "FilePath", +"СерверФото": "PhotoServer", "Добавление": "Adding", -"ID события": "Event ID", -"Статистика": "Statistics", -"IDКабинета": "AccountID", -"Токен бота": "Bot token", +"ИДПодборки": "SelectionID", "ИДКампании": "CampaignID", "ИДКабинета": "CabinetID", "ИмеетДлину": "HasLength", -"ОжидаетЧто": "ExpectsThat", -"Объявление": "Ad", -"библиотеки": "libraries", -"параметров": "parameters", -"Имя товара": "Product name", -"ДанныеПоля": "FieldData", -"ФайлВывода": "OutputFile", -"ПолныйПуть": "FullPath", -"Назначение": "Destination", -"СтараяЦена": "OldPrice", -"отключения": "disconnection", -"МассивФото": "PhotoArray", -"СерверФото": "PhotoServer", -"ИДПодборки": "SelectionID", -"информации": "information", -"ФорматДаты": "DateFormat", -"отладочной": "debug", -"РазбитьURL": "SplitURL", "Соединение": "Connection", -"Количество": "Quantity", -"Сохранение": "Save", +"Информация": "Information", +"HTTPЗапрос": "HTTPRequest", +"БезСтатуса": "NoStatus", +"КартинкаДД": "ImageDD", +"РазбитьURL": "SplitURL", +"ID события": "Event ID", +"ФайлОтвета": "ResponseFile", "Существует": "Exists", -"ТокенКанал": "ChannelToken", -"ДатаНачала": "StartDate", -"проведения": "of the event", -"ИДКаталога": "CatalogID", -"МассивИмен": "ArrayOfNames", -"Файл аудио": "Audio file", -"ЦветКнопок": "ButtonColor", -"они разные": "they are different", +"Токен бота": "Bot token", +"HTTPМетоды": "HTTPMethods", +"ВидЗапроса": "RequestType", +"ОжидаетЧто": "ExpectsThat", +"Расширение": "Extension", +"СтрТекущее": "StrCurrent", +"возвращает": "returns", +"бибилотека": "library", +"Параметры:": "Parameters:", +"Исключение": "Except", "ID альбома": "Album ID", -"на сервере": "on the server", -"ХешФункция": "HashFunction", -"участникам": "to participants", -"ООО Вектор": "LLC Vector", -"Новый файл": "NewFile", +"ИДКаталога": "CatalogID", "IDКартинки": "ImageID", -"СоздатьБлок": "CreateBlock", -"ОтборСтрока": "FilterString", -"НайтиСтроки": "FindLines", -"МетодПоиска": "SearchMethod", -"СтрокаФайла": "FileString", -"ТелоЗапроса": "RequestBody", -"Цель канала": "Channel purpose", -"XMLЗначение": "XMLValue", -"ДанныеСхемы": "SchemaData", -"УдалитьБлок": "DeleteBlock", -"ЗаменаТочки": "DotReplacement", -"ZipРазмерDD": "ZipSizeDD", -"ПолныйОтвет": "FullResponse", -"ТекстОшибки": "ErrorText", -"JSONСтрокой": "JSONString", -"Уведомления": "Notifications", -"СтрЗаменить": "StringReplace", -"ФайлНаДиске": "FileOnDisk", -"Хеширование": "Hashing", -"ТипКонтента": "ContentType", -"НоваяСтрока": "NewLine", -"ТекущаяДата": "CurrentDate", -"Сортировать": "Sort", -"уведомлений": "notifications", -"КопироватьВ": "CopyTo", -"Скопировать": "Copy", +"проведения": "of the event", +"Клавиатура": "Keyboard", +"Сохранение": "Save", +"ИДКрасного": "RedID", +"ИДКартинки": "ImageID", +"Продолжить": "Continue", +"ДатаНачала": "StartDate", +"библиотек:": "libraries:", +"IDКабинета": "AccountID", +"ЦветКнопок": "ButtonColor", +"Библиотека": "Library", +"ТокенКанал": "ChannelToken", +"Объявление": "Ad", +"ДанныеПоля": "FieldData", +"СтрПроцент": "StrPercentage", +"Бан\/Разбан": "Ban\/Unban", +"Имя товара": "Product name", +"Статистика": "Statistics", +"ID страницы": "Page ID", "УдалитьФайл": "DeleteFile", -"расширением": "extension", +"УдалитьБлок": "DeleteBlock", +"СтрокаФайла": "FileString", "Тема канала": "Channel topic", +"ID Родителя": "Parent ID", +"IDОригинала": "OriginalID", +"Сортировать": "Sort", +"НоваяСтрока": "NewLine", "МассивСвязи": "LinkArray", +"ДанныеСхемы": "SchemaData", "ПолеОтметки": "TimestampField", -"РазмерБлока": "BlockSize", -"НовыйЗапрос": "NewRequest", -"миллиметрах": "millimeters", -"СоздатьПост": "CreatePost", -"НомерГруппы": "GroupNumber", -"МассивЯчеек": "Cell array", +"Цель канала": "Channel purpose", +"ТекущийКлюч": "Current key", +"ТекущаяДата": "CurrentDate", +"уведомлений": "notifications", "Новое видео": "NewVideo", -"ИмяСодержит": "NameContains", -"ID картинки": "Image ID", -"СоздатьПоле": "CreateField", -"Фон истории": "Story background", -"ИДКатегории": "CategoryID", -"Петр Петров": "Petr Petrov", -"ЛишниеБайты": "ExtraBytes", -"Разделитель": "Delimiter", -"УдалитьПост": "DeletePost", -"СкачатьФайл": "DownloadFile", -"Комментарии": "Comments", -"ИзИсточника": "FromSource", +"ОбщийРазмер": "TotalSize", +"МассивПутей": "PathsArray", +"ЦелевойПуть": "TargetPath", +"ВходнойФайл": "InputFile", +"Медиагруппа": "MediaGroup", +"ТекстОтвета": "ReplyText", +"Файл) = Тип": "File) = Type", +"АдресАвтора": "АдресАвтора", +"ВерсияСреды": "ВерсияСреды", +"СоздатьБазу": "CreateDatabase", "МассивПолей": "FieldArray", +"Комментарии": "Comments", +"ЛишниеБайты": "ExtraBytes", "ОписаниеИзм": "EditedDescription", -"УдалитьЛист": "DeleteSheet", +"Петр Петров": "Petr Petrov", +"СоздатьБлок": "CreateBlock", +"СоздатьПоле": "CreateField", +"НомерГруппы": "GroupNumber", +"ИДКатегории": "CategoryID", +"IDСообщения": "MessageID", "ВнешнийПост": "ExternalPost", "ЗаписатьЛог": "WriteLog", -"ID подборок": "Selection IDs", -"ID подборки": "Selection ID", -"ID свойства": "Property ID", -"ID варианта": "Variant ID", -"МассивБлока": "ArrayBlock", -"ОтветМассив": "ResponseArray", -"НовыйСпособ": "NewMethod", -"Комментарий": "Comment", -"ОтборПоТипу": "FilterByType", +"JSON данные": "JSON data", +"ОченьВажное": "VeryImportant", +"ОбщийМодуль": "CommonModule", +"Стандартные": "Standard", +"РазмерБлока": "BlockSize", +"Хеширование": "Hashing", +"ТекстОшибки": "ErrorText", +"КопироватьВ": "CopyTo", +"расширением": "extension", +"ZipРазмерDD": "ZipSizeDD", +"ЗаменаТочки": "DotReplacement", +"ТелоЗапроса": "RequestBody", +"МетодПоиска": "SearchMethod", +"НайтиСтроки": "FindLines", +"Для Asserts": "For Asserts", +"ФайлНаДиске": "FileOnDisk", +"JSONСтрокой": "JSONString", +"СтрЗаменить": "StringReplace", +"НовыйЗапрос": "NewRequest", +"ТипКонтента": "ContentType", +"ПолныйОтвет": "FullResponse", +"ОтборСтрока": "FilterString", +"XMLЗначение": "XMLValue", +"ИзИсточника": "FromSource", +"ЦветКонсоли": "ConsoleColor", +"ОткрытьФайл": "OpenFile", +"Скопировать": "Copy", +"Для YaxUnit": "For YAxUnit", +"ВернутьБлок": "ReturnBlock", "ОбщийДоступ": "PublicAccess", +"ID картинки": "Image ID", +"Фон истории": "Story background", +"УдалитьПост": "DeletePost", +"КодВозврата": "ReturnCode", +"Разделитель": "Delimiter", +"СоздатьПост": "CreatePost", +"СкачатьФайл": "DownloadFile", +"Текст поста": "Post text", +"ТекстКнопки": "ButtonText", +"ИмяКонтакта": "ContactName", +"Токен Viber": "Viber Token", +"ДобавитьТег": "AddTag", +"Удалить тег": "Delete tag", +"ТипВложений": "AttachmentsType", +"ТекущийФайл": "CurrentFile", +"МассивВидео": "Video array", +"МассивГифок": "Gif array", +"Авторизация": "Authorization", +"АдресаПочты": "EmailAddresses", +"МассивЯчеек": "Cell array", +"Текст твита": "Tweet text", +"Уведомления": "Notifications", +"ID подборки": "Selection ID", +"ОтборПоТипу": "FilterByType", +"Комментарий": "Comment", +"НовыйСпособ": "NewMethod", +"РазмерЧасти": "ChunkSize", +"ОтветМассив": "ResponseArray", +"МассивБлока": "ArrayBlock", +"ID варианта": "Variant ID", +"ID свойства": "Property ID", +"ЭтоУдаление": "ThisIsDeletion", +"УдалитьЛист": "DeleteSheet", +"МассивМедиа": "MediaArray", +"миллиметрах": "millimeters", +"РефрешТокен": "RefreshToken", "Новый товар": "New product", "Остаток. -1": "Balance. -1", "Цена товара": "Product price", -"КодВозврата": "ReturnCode", -"Для YaxUnit": "For YAxUnit", -"Для Asserts": "For Asserts", -"СоздатьЛист": "CreateSheet", -"Текст поста": "Post text", -"СоздатьБазу": "CreateDatabase", -"ВернутьБлок": "ReturnBlock", -"МассивМедиа": "MediaArray", -"ЭтоУдаление": "ThisIsDeletion", -"ЦелевойПуть": "TargetPath", "ВЗаголовках": "InHeaders", -"ТекущийФайл": "CurrentFile", -"РефрешТокен": "RefreshToken", -"Медиагруппа": "MediaGroup", -"Текст твита": "Tweet text", -"ОбщийРазмер": "TotalSize", -"ТекстКнопки": "ButtonText", -"Авторизация": "Authorization", -"МассивПутей": "PathsArray", -"JSON данные": "JSON data", -"ОченьВажное": "VeryImportant", -"МассивГифок": "Gif array", -"МассивВидео": "Video array", -"IDСообщения": "MessageID", -"ОбщийМодуль": "CommonModule", -"ИмяКонтакта": "ContactName", -"Токен Viber": "Viber Token", -"ОткрытьФайл": "OpenFile", -"ДобавитьТег": "AddTag", -"Удалить тег": "Delete tag", -"ТекстОтвета": "ReplyText", -"РазмерЧасти": "ChunkSize", -"ЦветКонсоли": "ConsoleColor", -"ТекущийКлюч": "Current key", -"Стандартные": "Standard", -"ID Родителя": "Parent ID", -"АдресаПочты": "EmailAddresses", -"ТипВложений": "AttachmentsType", -"ID страницы": "Page ID", -"IDОригинала": "OriginalID", -"ВходнойФайл": "InputFile", -"МассивЛистов": "SheetArray", -"Создать блок": "Create block", -"Удалить лист": "DeleteSheet", -"СоздатьКнигу": "CreateBook", -"МассивДанных": "Data array", -"Архивирована": "Archived", +"ИмяСодержит": "NameContains", +"СоздатьЛист": "CreateSheet", +"ID подборок": "Selection IDs", "ОбъектИконка": "Icon object", -"КодСостояния": "StatusCode", +"Создать блок": "Create block", "загружаемого": "uploading", -"ДанныеЯчейки": "CellData", -"ОписаниеJSON": "JSONDescription", -"ДопЗаголовки": "AdditionalHeaders", -"ДобавитьЛист": "AddSheet", "МассивФайлов": "ArrayOfFiles", +"Архивирована": "Archived", +"МассивЛистов": "SheetArray", +"МассивДанных": "Data array", +"Удалить лист": "DeleteSheet", +"ОписаниеJSON": "JSONDescription", +"ДобавитьЛист": "AddSheet", +"ДопЗаголовки": "AdditionalHeaders", +"КодСостояния": "StatusCode", +"ДанныеЯчейки": "CellData", +"СоздатьКнигу": "CreateBook", "Использовать": "Use", "ТолькоОснова": "OnlyBase", "ТекущийТовар": "CurrentProduct", @@ -848,2204 +861,2228 @@ "Создать пост": "Create post", "ОбновитьФайл": "UpdateFile", "ТонкийКлиент": "ThinClient", -"ЭтоКоллекция": "ThisIsCollection", -"ИзменитьПоле": "ModifyField", -"СтрСоединить": "StrJoin", -"Рефреш токен": "Refresh token", -"Неопределено": "Undefined", -"ОсновнойЦвет": "PrimaryColor", -"ЦветнойВывод": "ColorOutput", -"ИмяПараметра": "ParameterName", -"ЧтениеДанных": "ReadingData", -"СтрокаВызова": "CallString", -"СтруктураURL": "URLStructure", -"Создать поле": "Create field", -"Число,Строка": "Number, String", -"Добавить тег": "Add tag", -"СкачатьПапку": "DownloadFolder", -"пустой ответ": "empty response", -"КонецОбласти": "EndRegion", -"КонецФункции": "EndFunction", -"ОтборКоманды": "CommandSelection", -"Скачать файл": "Download file", "ДобавитьПоле": "AddField", -"КонецПопытки": "EndTry", -"Создать базу": "Create base", -"СоздатьПапку": "CreateFolder", -"МассивТаблиц": "TableArray", +"ОтборКоманды": "CommandSelection", +"СтруктураURL": "URLStructure", +"КонецФункции": "EndFunction", +"КонецОбласти": "EndRegion", "Соответствие": "Match", -"ЧислоВСтроку": "NumberToString", +"СтрокаВызова": "CallString", +"МассивТаблиц": "TableArray", +"ИмяПараметра": "ParameterName", "Наименование": "Name", +"СтрРазделить": "StrSplit", +"Создать базу": "Create base", +"ВключитьФайл": "ВключитьФайл", "Безвозвратно": "Irretrievably", -"НовыйПрефикс": "NewPrefix", -"ЗаписатьJSON": "WriteJSON", -"ID календаря": "Calendar ID", -"Файл размера": "File size", -"ПараметрыURL": "URLParameters", -"ПолучитьДату": "GetDate", -"Дублирования": "duplicates", +"ОсновнойЦвет": "PrimaryColor", +"БезВозвратно": "Irrecoverable", "Существующее": "Existing", "СписокКоманд": "CommandList", -"СтрРазделить": "StrSplit", -"ТекстСправки": "HelpText", -"СтрокаМетода": "MethodLine", +"ЦветнойВывод": "ColorOutput", +"ПараметрыURL": "URLParameters", "УдалитьФайлы": "DeleteFiles", +"ЗаписатьJSON": "WriteJSON", +"НовыйПрефикс": "NewPrefix", +"СтрокаМетода": "MethodLine", +"ТекстСправки": "HelpText", +"Дублирования": "duplicates", +"Добавить тег": "Add tag", +"ЭтоКоллекция": "ThisIsCollection", +"ID календаря": "Calendar ID", +"Файл размера": "File size", +"КонецПопытки": "EndTry", +"Рефреш токен": "Refresh token", +"Создать поле": "Create field", "Тестирование": "Testing", -"БезВозвратно": "Irrecoverable", -"ПолучитьКанал": "GetChannel", -"ПараметрыJSON": "JSONParameters", -"Файл с Base64": "Base64 File", -"Тестовая цель": "TestGoal", -"Тестовая тема": "TestTopic", -"СписокТоваров": "ProductList", -"УдалитьОбъект": "DeleteObject", -"не ограничено": "unlimited", -"Создать папку": "Create folder", +"ЧислоВСтроку": "NumberToString", +"СкачатьПапку": "DownloadFolder", +"пустой ответ": "empty response", +"ЧтениеДанных": "ReadingData", +"СоздатьПапку": "CreateFolder", +"Неопределено": "Undefined", +"ПолучитьДату": "GetDate", +"Число,Строка": "Number, String", +"Скачать файл": "Download file", +"СтрСоединить": "StrJoin", +"ИзменитьПоле": "ModifyField", "ДобавитьТовар": "AddProduct", -"ФайловыйПоток": "FileStream", -"Тестовая база": "TestDatabase", -"СимволМассива": "ArraySymbol", -"ПокинутьКанал": "LeaveChannel", -"Переадресация": "Redirection", -"ВывестиСтроку": "PrintString", -"ДатаОкончания": "EndDate", -"СоздатьАльбом": "CreateAlbum", -"Дата создания": "CreationDate", -"ТекущиеДанные": "Current data", -"Новое событие": "New event", -"РаботаСБазами": "DatabaseWork", -"МассивСобытий": "ArrayOfEvents", -"СвойстваЛиста": "Sheet properties", -"ИзменитьТовар": "EditProduct", -"ПоставитьЛайк": "LikePost", -"ЗапросыСТелом": "RequestsWithBody", -"UnixИстечение": "UnixExpiration", -"ЭтоОтложенное": "IsDelayed", -"ОбновитьТокен": "RefreshToken", -"Удалить товар": "Delete product", -"ОписаниеТипов": "TypeDescription", -"ЗагрузкаВидео": "VideoUpload", -"ЕдиницаДанных": "DataUnit", -"ПрочитаноБайт": "BytesRead", -"ПрочитатьJSON": "ReadJSON", -"ОбработатьТег": "ProcessTag", -"ОткрытьСессию": "OpenSession", -"Идентификатор": "Identifier", -"ВозможныйПуть": "PossiblePath", -"ВозможныеПути": "PossiblePaths", -"ВозможныйФайл": "PossibleFile", -"Новая таблица": "NewTable", -"Создать канал": "Create channel", -"ЭтоСимвольное": "ThisIsSymbolic", -"ПолучитьТекст": "GetText", -"СоздатьЗапрос": "CreateRequest", -"ОбъектОбложка": "Cover object", -"Экранирование": "Escaping", -"СтрокаТаблицы": "TableRow", -"ТекущийМассив": "Current array", "ПолучитьТокен": "GetToken", -"УдалитьАльбом": "DeleteAlbum", -"ВладелецВидео": "VideoOwner", -"ЛишниеСимволы": "ExtraCharacters", -"СтрокаТоваров": "ProductsString", -"СделатьРепост": "MakeRepost", -"Описание поля": "Field description", -"МассивОтветов": "AnswersArray", -"КодУстройства": "DeviceCode", -"Адрес объекта": "Object address", -"НомерКампании": "CampaignNumber", -"АдресЗагрузки": "UploadURL", -"ОтветЗагрузки": "UploadResponse", -"ПутьОригинала": "OriginalPath", -"ИсходныйПоток": "SourceStream", -"Массив кнопок": "Array of buttons", -"Блок картинки": "Image block", -"Строка, Число": "String, Number", -"ПорядокБайтов": "ByteOrder", -"Изменить поле": "Modify field", -"Администратор": "Administrator", -"Вопрос опроса": "Poll question", -"ПолучитьЧисло": "GetNumber", -"ТекущийОбъект": "CurrentObject", -"РаботаСТегами": "TagWork", -"СтрокаНомеров": "NumbersString", -"ТаблицаТестов": "TestTable", -"ОтправитьФайл": "SendFile", -"Обновить файл": "Update file", -"Файл картинки": "Image file", -"ДобавитьМесяц": "AddMonth", -"СоздатьЗаписи": "CreatePosts", -"МассивКаналов": "ChannelArray", -"НовыйРодитель": "NewParent", -"ДФ=yyyy-MM-dd": "DF=yyyy-MM-dd", -"ВставитьПосле": "InsertAfter", -"УдалитьЗаписи": "DeletePosts", -"ИДКомментария": "CommentID", -"СтрокаЗаписей": "RecordString", -"ВыборЗначения": "ValueSelection", -"НомерТелефона": "PhoneNumber", -"СтруктураДаты": "DateStructure", -"ТекущийРаздел": "CurrentSection", -"ПодСообщением": "UnderMessage", -"ОтветПроверки": "CheckResponse", -"ПолучитьКнигу": "GetBook", -"Создать опрос": "Create poll", -"ЗакрытьСессию": "CloseSession", -"РазложитьJSON": "ParseJSON", -"ПрочитатьGZip": "ReadGZip", -"Версия: 2.4.8": "Version: 2.4.8", -"ФайлЛокальный": "LocalFile", -"Число, Строка": "Number, String", -"НомерСтраницы": "PageNumber", -"Добавить лист": "AddSheet", -"МассивТоваров": "Array of products", -"ЗакрытьДиалог": "CloseDialog", -"РазмерТекущих": "CurrentSize", -"ID обсуждения": "Discussion ID", -"ОткрытьДиалог": "OpenDialog", -"Скачать папку": "Download folder", -"Тестовый лист": "TestSheet", +"СвойстваЛиста": "Sheet properties", +"ПрочитатьJSON": "ReadJSON", "МассивЗаказов": "ArrayOfOrders", -"ZipРазмерEOCD": "ZipSizeEOCD", -"СтруктураПоля": "FieldStructure", -"РаботаСПолями": "FieldWork", -"КартинкаПоста": "PostImage", -"ДатаИстечения": "ExpirationDate", -"Метод,Область": "Method,Region", -"Массив файлов": "Files array", -"Создать книгу": "CreateBook", +"РазмерТекущих": "CurrentSize", +"СтрокаТоваров": "ProductsString", +"СоздатьЗаписи": "CreatePosts", +"ПараметрыJSON": "JSONParameters", +"УдалитьЗаписи": "DeletePosts", +"МассивТоваров": "Array of products", "ID объявления": "Ad ID", -"ЗагрузитьФайл": "UploadFile", +"КодУстройства": "DeviceCode", +"СписокТоваров": "ProductList", +"Адрес объекта": "Object address", +"РаботаСПолями": "FieldWork", +"Администратор": "Administrator", +"ЗагрузкаВидео": "VideoUpload", +"ВладелецВидео": "VideoOwner", +"ПолучитьТекст": "GetText", +"Файл с Base64": "Base64 File", +"РазложитьJSON": "ParseJSON", "пустая строка": "empty string", "ТекущийСтатус": "CurrentStatus", -"ПолучитьБулево": "GetBoolean", +"НомерКампании": "CampaignNumber", +"ОткрытьСессию": "OpenSession", +"ЗагрузитьФайл": "UploadFile", +"ПрочитаноБайт": "BytesRead", +"СтрокаЗаписей": "RecordString", +"Описание поля": "Field description", +"СтруктураПоля": "FieldStructure", +"ИзменитьТовар": "EditProduct", +"Массив кнопок": "Array of buttons", +"Тестовый лист": "TestSheet", +"ВставитьПосле": "InsertAfter", +"ПодСообщением": "UnderMessage", +"ДФ=yyyy-MM-dd": "DF=yyyy-MM-dd", +"ЗакрытьСессию": "CloseSession", +"ПолучитьЧисло": "GetNumber", +"СтруктураДаты": "DateStructure", +"СоздатьЗапрос": "CreateRequest", +"Изменить поле": "Modify field", +"Дата создания": "CreationDate", +"Строка, Число": "String, Number", +"РаботаСБазами": "DatabaseWork", +"ТекущийМассив": "Current array", +"ТекущиеДанные": "Current data", +"Тестовая тема": "TestTopic", +"Тестовая цель": "TestGoal", +"МассивОтветов": "AnswersArray", +"ОбновитьТокен": "RefreshToken", +"Тестовая база": "TestDatabase", +"Новая таблица": "NewTable", +"Массив файлов": "Files array", +"ДатаИстечения": "ExpirationDate", +"ОбъектОбложка": "Cover object", +"ПутьОригинала": "OriginalPath", +"не ограничено": "unlimited", +"Удалить товар": "Delete product", +"UnixИстечение": "UnixExpiration", +"ПолучитьКанал": "GetChannel", +"Вопрос опроса": "Poll question", +"ЭтоОтложенное": "IsDelayed", +"ТаблицаТестов": "TestTable", +"ПорядокБайтов": "ByteOrder", +"Переадресация": "Redirection", +"МассивКаналов": "ChannelArray", +"СимволМассива": "ArraySymbol", +"Блок картинки": "Image block", +"Создать папку": "Create folder", +"АдресЗагрузки": "UploadURL", +"ОтветЗагрузки": "UploadResponse", +"ИсходныйПоток": "SourceStream", +"Экранирование": "Escaping", +"ЛишниеСимволы": "ExtraCharacters", +"УдалитьАльбом": "DeleteAlbum", +"ЕдиницаДанных": "DataUnit", +"ЗапросыСТелом": "RequestsWithBody", +"ВозможныйФайл": "PossibleFile", +"УдалитьОбъект": "DeleteObject", +"ОтветПроверки": "CheckResponse", +"ТекущийОбъект": "CurrentObject", +"Файл картинки": "Image file", +"СтрокаТаблицы": "TableRow", +"Версия: 2.4.8": "Version: 2.4.8", +"Обновить файл": "Update file", +"НомерТелефона": "PhoneNumber", +"Новое событие": "New event", +"ПокинутьКанал": "LeaveChannel", +"НовыйРодитель": "NewParent", +"Создать канал": "Create channel", +"ОткрытьДиалог": "OpenDialog", +"МассивСобытий": "ArrayOfEvents", +"РаботаСТегами": "TagWork", +"Скачать папку": "Download folder", +"КартинкаПоста": "PostImage", +"ЗакрытьДиалог": "CloseDialog", +"НомерСтраницы": "PageNumber", +"ZipРазмерEOCD": "ZipSizeEOCD", +"ИДКомментария": "CommentID", +"Число, Строка": "Number, String", +"ПрочитатьGZip": "ReadGZip", +"Создать опрос": "Create poll", +"ОписаниеТипов": "TypeDescription", +"СоздатьАльбом": "CreateAlbum", +"ВыборЗначения": "ValueSelection", +"ОбработатьТег": "ProcessTag", +"Добавить лист": "AddSheet", +"ЭтоСимвольное": "ThisIsSymbolic", +"ТекущийРаздел": "CurrentSection", +"ФайлЛокальный": "LocalFile", +"СделатьРепост": "MakeRepost", +"СтрокаНомеров": "NumbersString", +"Метод,Область": "Method,Region", +"ПолучитьКнигу": "GetBook", +"ВозможныеПути": "PossiblePaths", +"ДатаОкончания": "EndDate", +"ПоставитьЛайк": "LikePost", +"Граница Тогда": "Border Then", +"ВозможныйПуть": "PossiblePath", +"ОтправитьФайл": "SendFile", +"ВывестиСтроку": "PrintString", +"Идентификатор": "Identifier", +"Создать книгу": "CreateBook", +"ФайловыйПоток": "FileStream", +"ДобавитьМесяц": "AddMonth", +"ID обсуждения": "Discussion ID", +"Тип клавиатуры": "KeyboardType", +"РаботаСГруппой": "GroupWork", "НомерКатегории": "CategoryNumber", -"ИДПользователя": "UserID", -"МассивТоваров_": "Array_of_Products", -"Base64Значение": "Base64Value", -"МассивОписания": "DescriptionArray", -"СоздатьСобытие": "CreateEvent", -"Изменить товар": "Edit product", -"СтруктураФайла": "FileStructure", -"ОписаниеТовара": "ProductDescription", -"Перезаписывать": "Overwrite", -"ТекущийЭлемент": "CurrentElement", -"ПолучитьЗапись": "GetRecord", -"Загрузить файл": "Upload file", -"МассивСтруктур": "Array of Structures", -"МассивКартинок": "ImageArray", -"Добавить товар": "Add product", -"АТ_СоздатьБазу": "AT_CreateDatabase", -"СтрочныйМассив": "StringArray", -"МассивПодборок": "SelectionArray", +"МаксимумПостов": "MaximumPosts", "ОписаниеЗаписи": "RecordDescription", +"Библиотека: VK": "Library: VK", +"СтрокаПодборок": "SelectionsString", +"СтруктураМедиа": "MediaStructure", +"Номер телефона": "Phone number", +"ТекущаяПозиция": "CurrentPosition", +"ОтправкаВКанал": "SendingToChannel", +"КлючПриложения": "AppKey", +"JsonВСтруктуру": "JsonToStructure", +"ПолноеИмяМедиа": "FullMediaName", +"СтруктураФайла": "FileStructure", +"Новое название": "New name", +"ID базы данных": "Database ID", +"Перезаписывать": "Overwrite", +"ПолучитьБулево": "GetBoolean", +"Получить токен": "Get token", +"Путь к объекту": "Path to the object", +"МассивИДПостов": "Array of post IDs", +"МассивТоваров_": "Array_of_Products", +"Описание видео": "Video description", +"СоздатьИсторию": "CreateStory", +"МассивКартинок": "ImageArray", +"СоздатьСобытие": "CreateEvent", +"Удалить альбом": "Delete album", +"Изменить товар": "Edit product", +"Удалить объект": "Delete object", +"МассивСтруктур": "Array of Structures", +"Поставить лайк": "Like", +"Обновить токен": "Refresh token", +"Создать альбом": "Create album", +"ОписаниеТовара": "ProductDescription", +"ТолькоПросмотр": "ViewOnly", +"ГлавныйВГруппе": "MainInGroup", +"Добавить товар": "Add product", +"ПолучитьПревью": "GetPreview", +"Сделать репост": "Make repost", +"Загрузить файл": "Upload file", +"УдалитьСобытие": "DeleteEvent", +"СтрокаВложений": "AttachmentsString", +"РаботаСБлоками": "BlockWork", +"ИДПользователя": "UserID", +"МассивАльбомов": "ArrayOfAlbums", "МассивОтправки": "SendArray", +"Получить канал": "Get channel", +"ПолучитьОбъект": "GetObject", +"ЗапросыБезТела": "RequestsWithoutBody", +"ЗаписанныйФайл": "RecordedFile", +"РаботаСКнигами": "BookWork", +"ОписаниеОшибки": "ErrorDescription", +"СоздатьКаталог": "CreateDirectory", +"ОтправитьВидео": "SendVideo", +"Получить книгу": "GetBook", +"ТекущаяОбласть": "CurrentRegion", +"МассивОбъектов": "ArrayOfObjects", +"МассивЗапросов": "ArrayOfRequests", +"РаботаСЛистами": "SheetWork", +"ОписаниеМетода": "MethodDescription", +"ПараметрМетода": "MethodParameter", +"Отбор по имени": "Filter by name", +"Твит с опросом": "Tweet with poll", +"Текстовый твит": "Text tweet", +"МассивПодборок": "SelectionArray", +"ТекущийЭлемент": "CurrentElement", +"КопироватьЛист": "CopySheet", +"ДвоичныеДанные": "BinaryData", +"РаботаСДанными": "DataWork", +"ОтправкаДанных": "DataSending", +"СтрОбщийРазмер": "StrTotalSize", +"ВступитьВКанал": "JoinChannel", +"ТекущаяКоманда": "CurrentCommand", +"Покинуть канал": "Leave channel", +"OPI_Интеграция": "OPI_Integrations", +"ПолучитьВерсию": "GetVersion", +"Описание файла": "File description", +"Открыть диалог": "Open dialog", +"Новый файл.jpg": "New file.jpg", +"Это новый файл": "This is a new file", +"КонецПроцедуры": "EndProcedure", +"Закрыть диалог": "Close dialog", +"ПутьСохранения": "SavePath", +"ПолучитьСостав": "GetComposition", +"РаботаСФайлами": "FileWork", +"ЧтениеZipФайла": "ReadingZipFile", +"ПрочитанноБайт": "BytesRead", +"Номер страницы": "Page number", +"ЗаписатьСтроку": "WriteString", +"УдалитьWebhook": "DeleteWebhook", +"HTTPСоединение": "HTTPConnection", +"ОтправитьАудио": "SendAudio", +"МассивОписания": "DescriptionArray", +"Base64Значение": "Base64Value", +"Файл документа": "Document file", +"СтруктураЯчеек": "CellStructure", "КартинкаЗамены": "ReplacementImage", "Тестовая папка": "TestFolder", +"СоздатьТаблицу": "CreateTable", "Новое описание": "New description", -"IDПользователя": "UserID", -"ПолучитьОбъект": "GetObject", "Проверка_Пусто": "Check_Empty", -"ОтправитьОпрос": "SendPoll", -"СтруктураОпций": "OptionsStructure", -"УдалитьWebhook": "DeleteWebhook", -"Заголовок темы": "Thread title", "Тестовый товар": "TestProduct", -"Удалить записи": "Delete records", -"ФайлСтатистики": "StatisticsFile", -"РабочийКаталог": "WorkingDirectory", -"ОтправкаДанных": "DataSending", -"Файл, Значение": "File, Value", -"Создать записи": "Create records", -"ОтправитьГифку": "SendGif", -"VK_УдалитьПост": "VK_DeletePost", -"Файл документа": "Document file", +"СтруктураОпций": "OptionsStructure", +"Тестовый твитт": "TestTweet", +"IDПользователя": "UserID", "VK_СоздатьПост": "VK_CreatePost", "ПараметрыТеста": "TestParameters", -"ОтправитьВидео": "SendVideo", +"Заголовок темы": "Thread title", +"ПолучитьЗапись": "GetRecord", +"РабочийКаталог": "WorkingDirectory", +"ФайлСтатистики": "StatisticsFile", +"Создать записи": "Create records", +"Удалить записи": "Delete records", "ПолучитьМассив": "GetArray", -"ПолучитьПревью": "GetPreview", -"КлючПриложения": "AppKey", -"СтруктураЯчеек": "CellStructure", -"ПолучитьСтроку": "GetLine", -"Путь к объекту": "Path to the object", -"СтрНачинаетсяС": "StringStartsWith", -"АтомарныеТесты": "AtomicTests", -"КопироватьФайл": "CopyFile", -"СтруктураМедиа": "MediaStructure", -"ПолноеИмяМедиа": "FullMediaName", -"ГлавныйВГруппе": "MainInGroup", -"Обновить токен": "Refresh token", -"ТекущаяПозиция": "CurrentPosition", -"МассивОписаний": "ArrayOfDescriptions", -"ФорматДатыJSON": "JSONDateFormat", -"СоздатьТаблицу": "CreateTable", -"АТ_СоздатьПоле": "AT_CreateField", -"СтрокаПодборок": "SelectionsString", -"Получить канал": "Get channel", -"МаксимумПостов": "MaximumPosts", -"ВступитьВКанал": "JoinChannel", -"Покинуть канал": "Leave channel", -"Новое название": "New name", -"Получить токен": "Get token", -"Тестовый твитт": "TestTweet", -"Открыть диалог": "Open dialog", -"Закрыть диалог": "Close dialog", -"РаботаСФайлами": "FileWork", -"Номер страницы": "Page number", -"МассивАльбомов": "ArrayOfAlbums", -"Текстовый твит": "Text tweet", -"Тип клавиатуры": "KeyboardType", -"ОтправитьАудио": "SendAudio", -"ПолучитьВерсию": "GetVersion", -"РаботаСДанными": "DataWork", -"КопироватьЛист": "CopySheet", -"ID базы данных": "Database ID", -"Создать альбом": "Create album", -"ПутьСохранения": "SavePath", -"Библиотека: VK": "Library: VK", -"Удалить объект": "Delete object", -"Отправить файл": "SendFile", -"РаботаСГруппой": "GroupWork", -"СтрОбщийРазмер": "StrTotalSize", -"Сделать репост": "Make repost", -"ЧтениеZipФайла": "ReadingZipFile", -"ЗаписатьСтроку": "WriteString", -"ОтправкаВКанал": "SendingToChannel", -"МассивОбъектов": "ArrayOfObjects", -"СоздатьИсторию": "CreateStory", -"ПолучитьСостав": "GetComposition", -"ОписаниеОшибки": "ErrorDescription", -"Поставить лайк": "Like", -"ПрочитанноБайт": "BytesRead", -"РаботаСКнигами": "BookWork", -"РаботаСЛистами": "SheetWork", +"VK_УдалитьПост": "VK_DeletePost", +"ОтправитьОпрос": "SendPoll", "МассивВложений": "AttachmentsArray", -"МассивЗапросов": "ArrayOfRequests", -"ТекущеВложение": "CurrentAttachment", -"СтрокаВложений": "AttachmentsString", -"СоздатьКаталог": "CreateDirectory", -"Получить книгу": "GetBook", -"Описание видео": "Video description", -"Удалить альбом": "Delete album", -"КонецПроцедуры": "EndProcedure", -"Номер телефона": "Phone number", -"HTTPСоединение": "HTTPConnection", -"Описание файла": "File description", -"ПараметрМетода": "MethodParameter", -"Твит с опросом": "Tweet with poll", -"МассивИДПостов": "Array of post IDs", -"Новый файл.jpg": "New file.jpg", -"ДвоичныеДанные": "BinaryData", -"УдалитьСобытие": "DeleteEvent", -"ТолькоПросмотр": "ViewOnly", -"Это новый файл": "This is a new file", -"ТекущаяКоманда": "CurrentCommand", -"ОписаниеМетода": "MethodDescription", -"Отбор по имени": "Filter by name", -"ЗаписанныйФайл": "RecordedFile", +"АТ_СоздатьПоле": "AT_CreateField", +"ПолучитьСтроку": "GetLine", "ОчиститьЯчейки": "ClearCells", -"JsonВСтруктуру": "JsonToStructure", -"РаботаСБлоками": "BlockWork", -"ЗапросыБезТела": "RequestsWithoutBody", -"ТекущаяОбласть": "CurrentRegion", -"ОписаниеСтроки1": "RowDescription1", -"НужнаРаспаковка": "NeedsUnpacking", -"ПолучитьТаблицу": "GetTable", -"ЗапросИзменения": "ChangeRequest", -"Создать историю": "Create story", -"Очистить ячейки": "Clear cells", -"СтрокаСигнатуры": "SignatureString", -"Создать таблицу": "Create table", -"Картинка опроса": "Poll image", -"ТекущаяДатаUNIX": "CurrentUNIXDate", -"Проверка_СлакОк": "Check_SlackOk", -"ЗначениеСтрокой": "ValueAsString", -"OPI_Инструменты": "OPI_Tools", -"МестоПроведения": "Venue", -"УдалитьПодборку": "DeleteSelection", -"КоллекцияТаблиц": "TableCollection", -"Удалить событие": "Delete event", -"ЗагруженныйФайл": "UploadedFile", -"Новый заголовок": "New title", -"ТекстВыполнения": "ExecutionText", -"КодировкаТекста": "TextEncoding", -"Вспомогательные": "Auxiliary", -"Копировать лист": "CopySheet", -"РаботаСЗаказами": "OrderManagement", -"СтатусСообщения": "MessageStatus", -"Перенаправление": "Redirection", -"Ключ приложения": "Application key", -"ТаблицаЗначений": "ValueTable", -"РаботаСЗаписями": "RecordManagement", -"Получить запись": "Get record", -"ТипСоответствие": "TypeMatch", -"СтруктураФайлов": "FileStructure", -"Каждого,каждого": "Each,each", -"ОтправитьСсылку": "SendLink", +"СтрочныйМассив": "StringArray", +"СтрНачинаетсяС": "StringStartsWith", +"КопироватьФайл": "CopyFile", +"АтомарныеТесты": "AtomicTests", +"АТ_СоздатьБазу": "AT_CreateDatabase", +"ТекущеВложение": "CurrentAttachment", +"ОтправитьГифку": "SendGif", +"Файл, Значение": "File, Value", +"ФорматДатыJSON": "JSONDateFormat", +"Отправить файл": "SendFile", +"МассивОписаний": "ArrayOfDescriptions", "Отправить гифку": "Send GIF", -"VK_СоздатьОпрос": "VK_CreatePoll", -"ВК_СоздатьОпрос": "VK_CreatePoll", -"МассивРодителей": "ArrayOfParents", -"СтруктураКнопки": "ButtonStructure", -"Отправить видео": "Send video", -"МобильныйКлиент": "MobileClient", -"Telegram_Разбан": "Telegram_Unban", -"перенаправления": "redirection", -"Отправить аудио": "Send audio", -"ДвоичныеДанные2": "BinaryData2", -"ТокенВЗаголовки": "TokenInHeaders", -"ДвоичныеДанные1": "BinaryData1", -"Удалить Webhook": "Delete webhook", -"IDПользователей": "UserIDs", -"установлен свой": "set your", -"ОписаниеТаблицы": "TableDescription", -"МассивУдаляемых": "ArrayOfDeletions", -"ДобавитьКоманду": "AddCommand", -"ИзменитьТаблицу": "ModifyTable", -"Получить объект": "Get object", -"Массив картинок": "Array of images", -"JSON клавиатуры": "Keyboard JSON", -"ОписаниеКоманды": "CommandDescription", -"ЗаголовокПотока": "StreamHeader", -"ПолучениеТокена": "TokenRetrieval", -"Команда CLI: vk": "CLI Command: vk", -"ТекущееЗначение": "CurrentValue", -"ЗаписатьЦелое32": "WriteInt32", -"ЗаписатьЦелое16": "WriteInt16", -"Отправить опрос": "Send poll", -"ПовторитьСтроку": "RepeatString", -"Номер,Строковое": "Number,String", -"ПараметрыМетода": "MethodParameters", -"РаботаСКаналами": "ChannelManagement", "СтатусОбработки": "ProcessingStatus", -"ОписаниеСобытия": "EventDescription", -"ОписаниеСтроки2": "RowDescription2", -"Описание товара": "Product description", -"ПеременнаяСреды": "EnvironmentVariable", -"Получить превью": "Get preview", +"ТекущаяДатаUNIX": "CurrentUNIXDate", +"Отправить аудио": "Send audio", +"СтрокаСигнатуры": "SignatureString", +"IDПользователей": "UserIDs", +"ТаблицаЗначений": "ValueTable", "IDИнициализации": "InitializationID", -"ПреобразоватьИД": "ConvertID", -"Текст сообщения": "Message text", -"ПолучитьСобытие": "GetEvent", -"ЗначениеВМассив": "ValueToArray", -"УстановитьТекст": "SetText", -"ID пользователя": "User ID", -"СоздатьСтраницу": "CreatePage", -"Создать событие": "Create event", -"УдалитьКартинку": "DeleteImage", -"СтруктураВыбора": "ChoiceStructure", +"ТокенВЗаголовки": "TokenInHeaders", +"СтруктураФайлов": "FileStructure", +"Удалить Webhook": "Delete webhook", +"JSON клавиатуры": "Keyboard JSON", "Массив ID медиа": "Media ID array", -"ИзменитьСобытие": "EditEvent", -"Загрузить видео": "Upload video", -"ТекущееОписание": "CurrentDescription", +"Отправить опрос": "Send poll", +"Отправить видео": "Send video", +"VK_СоздатьОпрос": "VK_CreatePoll", +"СтруктураКнопки": "ButtonStructure", +"ВводныйПараметр": "IntroductoryParameter", +"НужнаРаспаковка": "NeedsUnpacking", +"УстановитьТекст": "SetText", +"ЗначениеВМассив": "ValueToArray", +"ЗавершитьРаботу": "FinishWork", +"ФайлРепозитория": "RepositoryFile", +"OPI_Инструменты": "OPI_Tools", "Создать каталог": "Create folder", -"СтруктураДанных": "DataStructure", -"СтруктураТекста": "TextStructure", -"ОригиналныйПуть": "OriginalPath", -"СократитьСсылку": "ShortenLink", -"Сокращенный URL": "Shortened URL", +"ТекущееОписание": "CurrentDescription", "ИскомыйПараметр": "DesiredParameter", "ЗависимостиГугл": "GoogleDependencies", -"ЗавершитьРаботу": "FinishWork", -"ID целевой базы": "Target database ID", -"РаботаСТоварами": "ProductManagement", -"МассивВариантов": "OptionArray", -"ПолучитьАккаунт": "GetAccount", -"ФайлРепозитория": "RepositoryFile", -"ЗначенияСвойств": "PropertyValues", -"ОдиночнаяЗапись": "SingleRecord", -"ОбработатьОтвет": "ProcessResponse", +"ОригиналныйПуть": "OriginalPath", +"ПеременнаяСреды": "EnvironmentVariable", "Проверка_ВКПост": "Check_VKPost", -"ВводныйПараметр": "IntroductoryParameter", -"ПолучитьФайлПути": "GetFilePath", -"СоздатьКалендарь": "CreateCalendar", -"Расширение файла": "File extension", -"ОтправитьКонтакт": "SendContact", -"ЗначениеОсновной": "MainValue", -"ОписаниеКартинки": "ImageDescription", -"КоличествоЧастей": "NumberOfParts", -"Телефон контакта": "Contact phone number", -"Фамилия контакта": "Contact last name", -"Сократить ссылку": "Shorten link", -"ДобавитьПараметр": "AddParameter", -"ПолучитьДвоичные": "GetBinary", -"ДобавитьИмяЛиста": "AddSheetName", -"Тестовый товар 2": "TestProduct2", -"HTTPСервисЗапрос": "HTTPServiceRequest", -"ПутьКФайлуДанных": "DataFilePath", -"СоответствиеMIME": "MIMETypeMapping", -"ЗаписатьФайлЛога": "WriteLogFile", -"УправлениеФайлом": "FileManagement", -"URLВКодировкеURL": "URLInURLEncoding", -"СтруктураСтатуса": "StatusStructure", -"KeyИнициализации": "InitializationKey", -"СекретПриложения": "AppSecret", -"ВладелецКартинки": "ImageOwner", -"ПараметрыЗапроса": "RequestParameters", -"СмещениеОтНачала": "OffsetFromStart", -"СсылкаПодЗаписью": "LinkUnderPost", -"ЗаписатьПараметр": "WriteParameter", -"ГВ_ПолучитьТокен": "GV_GetToken", -"Неактивный : red": "Inactive : red", -"КодироватьСтроку": "EncodeString", -"СтруктураФормата": "FormatStructure", -"КонецКодовУспеха": "EndOfSuccessCodes", -"Твит с картинкой": "Tweet with image", -"Получить таблицу": "Get table", -"Code из браузера": "Code from browser", -"СоздатьТвитГифки": "CreateGifTweet", -"МассивСтатистики": "Array of Statistics", -"СтрокаПараметров": "ParameterString", -"СоздатьТвитВидео": "CreateVideoTweet", -"РаспаковатьОтвет": "UnpackResponse", -"УдалитьКалендарь": "DeleteCalendar", -"МетодХэширования": "HashingMethod", -"VK_СоздатьАльбом": "VK_CreateAlbum", -"ЗапускаемыеТесты": "RunnableTests", -"VK_УдалитьАльбом": "VK_DeleteAlbum", -"ЮнитТестирование": "UnitTesting", -"СоздатьТвитОпрос": "CreatePollTweet", -"Коллекция файлов": "File collection", -"Изменить событие": "Edit event", -"Отправить ссылку": "SendLink", -"НеобходимаяДлина": "RequiredLength", -"МассивКалендарей": "ArrayOfCalendars", -"ВызватьHTTPМетод": "CallHTTPMethod", -"ЗапросыMultipart": "MultipartRequests", -"ОтправитьЛокацию": "SendLocation", -"МассивРазрешений": "Permissions array", -"ОбъектПроцессора": "ProcessorObject", -"OPI_Криптография": "OPI_Cryptography", -"ДоступныйОстаток": "AvailableBalance", -"ПолучитьПараметр": "GetParameter", -"СоставБиблиотеки": "LibraryComposition", -"ПолучитьПолеДаты": "GetDateField", -"ГВ_ОбновитьТокен": "GV_UpdateToken", -"Массив ID постов": "Array of post IDs", -"Описание события": "Event description", -"превью документа": "document preview", -"МассивПараметров": "ParameterArray", -"Описание таблицы": "Table description", -"РаботаССобытиями": "EventManagement", -"МБ был записан в": "MB was recorded in", -"ДанныеИНастройка": "DataAndSettings", -"СледующаяПозиция": "NextPosition", -"КопироватьОбъект": "CopyObject", -"Удалить картинку": "Delete image", -"Создать страницу": "Create page", -"ПолучитьСтраницу": "GetPage", -"Канал для отбора": "Channel for selection", -"Массив Из Строка": "Array Of String", -"ЭлементКоллекции": "CollectionItem", -"Удалить подборку": "DeleteSelection", -"РаботаСТаблицами": "TableManagement", -"ИмяФайлаОтправки": "SendingFileName", -"ПереносСтрокJSON": "JSONLineBreak", -"УстановитьСтроку": "SetString", -"ИсходноеЗначение": "InitialValue", -"РаботаСДиалогами": "DialogManagement", -"ЗапятаяВКавычках": "CommaInQuotes", -"Получить событие": "Get event", -"ПараметрыФункции": "FunctionParameters", -"Описание альбома": "Album description", -"ПривестиЗначение": "ConvertValue", -"РазделительСтрок": "LineSeparator", -"ЭтоПереадресация": "ThisIsRedirection", -"Вступить в канал": "Join channel", -"Тестовая таблица": "TestTable", -"УдалитьСообщение": "DeleteMessage", -"МассивКлавиатуры": "KeyboardArray", -"Изменить таблицу": "Modify table", -"ЗагрузкаКартинки": "ImageUpload", +"Загрузить видео": "Upload video", +"ОдиночнаяЗапись": "SingleRecord", +"Вспомогательные": "Auxiliary", +"ПараметрыМетода": "MethodParameters", +"перенаправления": "redirection", +"МобильныйКлиент": "MobileClient", +"Каждого,каждого": "Each,each", +"OPI инструменты": "OPI tools", +"ДвоичныеДанные2": "BinaryData2", +"ДвоичныеДанные1": "BinaryData1", +"ТекстВыполнения": "ExecutionText", +"ПовторитьСтроку": "RepeatString", +"ЗаписатьЦелое16": "WriteInt16", +"ЗаписатьЦелое32": "WriteInt32", +"ДобавитьКоманду": "AddCommand", +"СтатусСообщения": "MessageStatus", +"ЗначениеСтрокой": "ValueAsString", +"КодировкаТекста": "TextEncoding", +"ОписаниеКоманды": "CommandDescription", +"ОтправитьСсылку": "SendLink", +"ОписаниеСтроки2": "RowDescription2", +"ОписаниеСтроки1": "RowDescription1", +"ОбработатьОтвет": "ProcessResponse", +"ЗначенияСвойств": "PropertyValues", +"ПолучитьАккаунт": "GetAccount", +"Описание товара": "Product description", +"Получить превью": "Get preview", +"РаботаСТоварами": "ProductManagement", +"Ключ приложения": "Application key", +"СократитьСсылку": "ShortenLink", +"УдалитьКартинку": "DeleteImage", +"Создать историю": "Create story", +"Картинка опроса": "Poll image", +"Массив картинок": "Array of images", +"ПолучениеТокена": "TokenRetrieval", +"Команда CLI: vk": "CLI Command: vk", +"Сокращенный URL": "Shortened URL", +"Номер,Строковое": "Number,String", +"УдалитьПодборку": "DeleteSelection", +"установлен свой": "set your", +"ЗагруженныйФайл": "UploadedFile", +"Проверка_СлакОк": "Check_SlackOk", +"КоллекцияТаблиц": "TableCollection", +"ПолучитьТаблицу": "GetTable", +"Создать таблицу": "Create table", +"МассивУдаляемых": "ArrayOfDeletions", +"РаботаСЗаказами": "OrderManagement", +"ИзменитьТаблицу": "ModifyTable", +"ТипСоответствие": "TypeMatch", +"ВК_СоздатьОпрос": "VK_CreatePoll", +"Telegram_Разбан": "Telegram_Unban", +"Получить запись": "Get record", +"Получить объект": "Get object", +"ОписаниеТаблицы": "TableDescription", +"РаботаСЗаписями": "RecordManagement", +"МассивРодителей": "ArrayOfParents", +"Новый заголовок": "New title", +"ЗаголовокПотока": "StreamHeader", +"Копировать лист": "CopySheet", +"ПреобразоватьИД": "ConvertID", +"ID пользователя": "User ID", +"СтруктураТекста": "TextStructure", +"МассивВариантов": "OptionArray", +"ПолучитьСобытие": "GetEvent", +"Очистить ячейки": "Clear cells", +"МестоПроведения": "Venue", +"ID целевой базы": "Target database ID", +"РаботаСКаналами": "ChannelManagement", +"ТекущееЗначение": "CurrentValue", +"СтруктураВыбора": "ChoiceStructure", +"Удалить событие": "Delete event", +"Создать событие": "Create event", +"Текст сообщения": "Message text", +"СтруктураДанных": "DataStructure", +"ОписаниеСобытия": "EventDescription", +"Перенаправление": "Redirection", +"ЗапросИзменения": "ChangeRequest", +"СоздатьСтраницу": "CreatePage", +"ИзменитьСобытие": "EditEvent", "УдалитьПолностью": "Delete completely", -"ВыгрузитьКолонку": "UnloadColumn", -"НеобходимоЧастей": "PartsRequired", -"МассивИнформации": "ArrayOfInformation", -"ID целевого чата": "Target chat ID", -"ОсвободитьОбъект": "ReleaseObject", -"СтрокаФотографий": "PhotoString", +"Тестовый товар 2": "TestProduct2", +"ПолучитьПолеДаты": "GetDateField", "МассивИменЛистов": "ArrayOfSheetNames", +"РазделительСтрок": "LineSeparator", +"РаспаковатьОтвет": "UnpackResponse", "Массив из Строка": "Array of Strings", -"ОбработатьОбъект": "ProcessObject", +"Тестовая таблица": "TestTable", +"Описание события": "Event description", +"ПолучитьПараметр": "GetParameter", +"ПолучитьФайлПути": "GetFilePath", +"МассивСтатистики": "Array of Statistics", +"Удалить картинку": "Delete image", +"ЭтоПереадресация": "ThisIsRedirection", +"ПолучитьДвоичные": "GetBinary", +"ЗаписатьФайлЛога": "WriteLogFile", +"МассивРазрешений": "Permissions array", +"Создать страницу": "Create page", +"МассивКлавиатуры": "KeyboardArray", +"OPI_Криптография": "OPI_Cryptography", "ПрочитатьЦелое32": "ReadInt32", -"Загружаемый файл": "File to be uploaded", +"Изменить событие": "Edit event", +"СледующаяПозиция": "NextPosition", +"КонецКодовУспеха": "EndOfSuccessCodes", +"ЗапросыMultipart": "MultipartRequests", +"ГВ_ОбновитьТокен": "GV_UpdateToken", +"ИмяФайлаОтправки": "SendingFileName", +"МассивКалендарей": "ArrayOfCalendars", +"ГВ_ПолучитьТокен": "GV_GetToken", +"ЗаписатьПараметр": "WriteParameter", +"Сократить ссылку": "Shorten link", +"ЭлементКоллекции": "CollectionItem", +"ВызватьHTTPМетод": "CallHTTPMethod", +"СтрокаПараметров": "ParameterString", +"Изменить таблицу": "Modify table", +"Удалить подборку": "DeleteSelection", +"Описание таблицы": "Table description", +"ID целевого чата": "Target chat ID", +"ПривестиЗначение": "ConvertValue", +"МассивИнформации": "ArrayOfInformation", +"НеобходимоЧастей": "PartsRequired", +"СекретПриложения": "AppSecret", +"МБ был записан в": "MB was recorded in", +"Code из браузера": "Code from browser", +"ДоступныйОстаток": "AvailableBalance", +"ОбщийРазмер Цикл": "TotalSize Do", +"УправлениеФайлом": "FileManagement", +"ЗапятаяВКавычках": "CommaInQuotes", +"ПолучитьСтраницу": "GetPage", +"ОсвободитьОбъект": "ReleaseObject", +"ЗначениеОсновной": "MainValue", +"Массив ID постов": "Array of post IDs", +"ОбработатьОбъект": "ProcessObject", +"СтруктураФормата": "FormatStructure", +"УдалитьКалендарь": "DeleteCalendar", +"Получить таблицу": "Get table", +"Описание альбома": "Album description", +"КоличествоЧастей": "NumberOfParts", +"Расширение файла": "File extension", +"URLВКодировкеURL": "URLInURLEncoding", +"ПараметрыФункции": "FunctionParameters", +"РаботаССобытиями": "EventManagement", +"МассивПараметров": "ParameterArray", +"ИсходноеЗначение": "InitialValue", +"УстановитьСтроку": "SetString", +"ПереносСтрокJSON": "JSONLineBreak", +"СоздатьТвитГифки": "CreateGifTweet", +"СоздатьТвитВидео": "CreateVideoTweet", +"СоздатьКалендарь": "CreateCalendar", +"РаботаСДиалогами": "DialogManagement", +"ДобавитьПараметр": "AddParameter", +"Вступить в канал": "Join channel", +"ЗагрузкаКартинки": "ImageUpload", +"СоздатьТвитОпрос": "CreatePollTweet", +"ВладелецКартинки": "ImageOwner", +"МетодХэширования": "HashingMethod", +"ЗапускаемыеТесты": "RunnableTests", +"Массив Из Строка": "Array Of String", +"ЮнитТестирование": "UnitTesting", +"ВыгрузитьКолонку": "UnloadColumn", +"ОбъектПроцессора": "ProcessorObject", +"Коллекция файлов": "File collection", +"СоответствиеMIME": "MIMETypeMapping", +"НеобходимаяДлина": "RequiredLength", +"KeyИнициализации": "InitializationKey", +"КодироватьСтроку": "EncodeString", +"СоставБиблиотеки": "LibraryComposition", +"ДобавитьИмяЛиста": "AddSheetName", +"ОтправитьЛокацию": "SendLocation", +"ДанныеИНастройка": "DataAndSettings", +"УдалитьСообщение": "DeleteMessage", +"превью документа": "document preview", +"СсылкаПодЗаписью": "LinkUnderPost", +"ПараметрыЗапроса": "RequestParameters", +"РаботаСТаблицами": "TableManagement", +"СтруктураСтатуса": "StatusStructure", +"HTTPСервисЗапрос": "HTTPServiceRequest", +"ОтправитьКонтакт": "SendContact", +"КопироватьОбъект": "CopyObject", +"ОписаниеКартинки": "ImageDescription", +"Телефон контакта": "Contact phone number", +"VK_УдалитьАльбом": "VK_DeleteAlbum", +"Получить событие": "Get event", +"Канал для отбора": "Channel for selection", +"VK_СоздатьАльбом": "VK_CreateAlbum", "МаксимумВЗапросе": "MaxInRequest", -"При отправке URL": "When sending URL", -"Библиотека: Viber": "Library: Viber", -"ПереместитьОбъект": "MoveObject", -"СортироватьПоДате": "SortByDate", -"ОткрытьТемуФорума": "OpenForumThread", -"ОтправкаСообщений": "MessageSending", -"Значение свойства": "Property value", -"УдалитьТемуФорума": "DeleteForumTopic", -"Название свойства": "Property name", -"Копировать объект": "Copy object", -"Администрирование": "Administration", -"ОтправитьДокумент": "SendDocument", -"ЗакрытьТемуФорума": "CloseForumThread", -"Строка, Структура": "String, Structure", -"СоздатьСоединение": "CreateConnection", -"Текст комментария": "Comment text", +"СмещениеОтНачала": "OffsetFromStart", +"ПутьКФайлуДанных": "DataFilePath", +"Твит с картинкой": "Tweet with image", +"СтрокаФотографий": "PhotoString", +"Отправить ссылку": "SendLink", +"Неактивный : red": "Inactive : red", +"Фамилия контакта": "Contact last name", +"Загружаемый файл": "File to be uploaded", +"СкопироватьОбъект": "CopyObject", +"СтруктураРодителя": "ParentStructure", +"СтруктураВозврата": "ReturnStructure", +"КонецКодовПадений": "EndOfFailureCodes", +"РезультатПроверки": "CheckResult", "ЭлементСтатистики": "StatisticsItem", -"КаталогИсходников": "SourceDirectory", -"ОпросСоответствие": "PollCorrespondence", -"Название подборки": "Selection name", -"Данные для API v2": "Data for API v2", -"ID целевого поста": "ID of the target post", -"СтандартныйСпособ": "StandardMethod", -"УстановитьКоманду": "SetCommand", -"Массив ID товаров": "Array of product IDs", -"НаписатьСообщение": "WriteMessage", +"ОсновнаяСтруктура": "MainStructure", "Отправить контакт": "Send contact", -"СоздатьТемуФорума": "CreateForumThread", -"СоздатьОбсуждение": "CreateDiscussion", -"Описание картинки": "Image description", +"ПолучитьСписокБаз": "GetListOfBases", +"ЗначениеПараметра": "ParameterValue", +"НачалоКодовОшибок": "StartOfErrorCodes", +"СтруктураКампании": "CampaignStructure", +"КалендарьИсточник": "SourceCalendar", +"УдалитьТемуФорума": "DeleteForumTopic", +"НачалоКодовУспеха": "StartOfSuccessCodes", "Путь или ID файла": "Path or ID of the file", "ОтветСоответствие": "ResponseCorrespondence", -"ЗакрытьОбсуждение": "CloseDiscussion", -"УправлениеТоваром": "ProductManagement", -"Создать календарь": "Create calendar", -"СтруктураВарианта": "OptionStructure", -"ОткрытьОбсуждение": "OpenDiscussion", -"Секрет приложения": "Application secret", -"СтруктураКампании": "CampaignStructure", -"Отправить локацию": "SendLocation", -"ОпубликоватьПапку": "PublishFolder", -"Скрытый календарь": "Hidden calendar", -"ГД_СоздатьКаталог": "GD_CreateCatalog", -"ТекстовыйДокумент": "TextDocument", -"ГТ_СоздатьТаблицу": "GT_CreateTable", -"МассивРезультатов": "ResultArray", -"Наш первый клиент": "OurFirstClient", -"Библиотека: Slack": "Library: Slack", -"МаксимальнаяДлина": "MaximumLength", -"СтруктураРодителя": "ParentStructure", -"СоответствиеПолей": "FieldMapping", -"Новый комментарий": "NewComment", -"ВК_ЗагрузитьВидео": "VK_UploadVideo", -"ОбъектКомментарий": "CommentObject", -"ЗначениеПараметра": "ParameterValue", -"СтруктураВозврата": "ReturnStructure", -"СтруктураЗначений": "ValueStructure", -"АрхивироватьКанал": "ArchiveChannel", -"Получить страницу": "Get page", -"Картинка автотест": "AutoTestImage", -"Проверка_ВайберОк": "Check_ViberOk", -"ПолучитьСписокБаз": "GetListOfBases", -"ЗначениеЛокальный": "LocalValue", -"КалендарьИсточник": "SourceCalendar", -"Проверка_ГКОбъект": "Check_GKObject", -"ЗаполняемыеДанные": "FillableData", -"СохранятьЛокально": "SaveLocally", -"КалендарьПриемник": "TargetCalendar", -"Тестовое описание": "TestDescription", -"ПараметрЛокальный": "LocalParameter", -"МинимальныйРазмер": "MinimumSize", -"Дата : date": "Date : date", -"ПолучитьКоллекцию": "GetCollection", -"ПрочитатьJSONФайл": "ReadJSONFile", -"СоздатьБазуДанных": "CreateDatabase", -"Имя файла в Slack": "File name in Slack", -"ID блока родителя": "Parent block ID", -"ВызватьИсключение": "Raise", -"ПреобразоватьДату": "ConvertDate", -"ВыходнаяКоллекция": "OutputCollection", -"ОсновнаяСтруктура": "MainStructure", -"УстановитьWebhook": "SetWebhook", -"РезультатПроверки": "CheckResult", -"НеВосстанавливать": "DoNotRestore", -"СоответствиеФайла": "FileMapping", -"ХешированиеДанных": "DataHashing", -"ПоследняяФигурная": "LastCurly", -"VK_СоздатьИсторию": "VK_CreateStory", "НачальнаяФигурная": "InitialCurly", -"ВК_СоздатьИсторию": "VK_CreateStory", -"УдалитьОбработчик": "RemoveHandler", -"Новое имя объекта": "New object name", -"СкопироватьОбъект": "CopyObject", -"ОтправитьКартинку": "SendImage", -"Удалить календарь": "Delete calendar", -"ВнешнееСоединение": "ExternalConnection", -"ТаблицаПараметров": "ParametersTable", -"НачалоКодовОшибок": "StartOfErrorCodes", -"КонецКодовПадений": "EndOfFailureCodes", -"Файл для загрузки": "File for upload", -"ЗагруженныеДанные": "UploadedData", -"Проверка_ВКИстина": "Check_VKTrue", -"Наименование поля": "Field name", -"ОсновноеИзмерение": "MajorDimension", -"Тестовая подборка": "TestCollection", -"АТ_СоздатьТаблицу": "AT_CreateTable", -"СообщитьРезультат": "ReportResult", -"ЗначениеЗаполнено": "ValueFilled", -"НачалоКодовУспеха": "StartOfSuccessCodes", -"Тестовая кампания": "TestCampaign", -"НаправлениеПоиска": "SearchDirection", +"МинимальныйРазмер": "MinimumSize", +"Строка, Структура": "String, Structure", "Проверка_ВКАльбом": "Check_VKAlbum", -"ИзменитьСообщение": "EditMessage", -"Удалить сообщение": "Delete message", +"СтруктураЗначений": "ValueStructure", +"МаксимальнаяДлина": "MaximumLength", +"Отправить локацию": "SendLocation", +"СтруктураВарианта": "OptionStructure", +"Библиотека: Slack": "Library: Slack", +"ОтправкаСообщений": "MessageSending", +"Библиотека: Viber": "Library: Viber", +"СоответствиеПолей": "FieldMapping", +"ОпубликоватьПапку": "PublishFolder", +"Картинка автотест": "AutoTestImage", +"ОсновноеИзмерение": "MajorDimension", +"ПолучитьКоллекцию": "GetCollection", +"Данные для API v2": "Data for API v2", +"ПереместитьОбъект": "MoveObject", +"ОпросСоответствие": "PollCorrespondence", +"ПараметрЛокальный": "LocalParameter", +"ЗначениеЛокальный": "LocalValue", +"Наш первый клиент": "OurFirstClient", +"ТекстовыйДокумент": "TextDocument", +"ID целевого поста": "ID of the target post", +"НаписатьСообщение": "WriteMessage", +"ЗагруженныеДанные": "UploadedData", +"ВызватьИсключение": "Raise", +"ОткрытьОбсуждение": "OpenDiscussion", +"СоздатьТемуФорума": "CreateForumThread", +"ЗакрытьОбсуждение": "CloseDiscussion", +"Администрирование": "Administration", +"ЗакрытьТемуФорума": "CloseForumThread", +"ОткрытьТемуФорума": "OpenForumThread", +"АТ_СоздатьТаблицу": "AT_CreateTable", +"НаправлениеПоиска": "SearchDirection", +"ЗаполняемыеДанные": "FillableData", +"Описание картинки": "Image description", +"ПрочитатьJSONФайл": "ReadJSONFile", +"СохранятьЛокально": "SaveLocally", +"ПоследняяФигурная": "LastCurly", +"Копировать объект": "Copy object", +"СоздатьОбсуждение": "CreateDiscussion", +"При отправке URL": "When sending URL", +"Создать календарь": "Create calendar", +"Скрытый календарь": "Hidden calendar", "Пост из автотеста": "Post from autotest", +"Имя файла в Slack": "File name in Slack", +"Файл для загрузки": "File for upload", +"СообщитьРезультат": "ReportResult", +"VK_СоздатьИсторию": "VK_CreateStory", +"Получить страницу": "Get page", +"Проверка_ВайберОк": "Check_ViberOk", +"СоздатьСоединение": "CreateConnection", +"ВК_СоздатьИсторию": "VK_CreateStory", +"ПреобразоватьДату": "ConvertDate", +"СортироватьПоДате": "SortByDate", +"Тестовое описание": "TestDescription", +"Удалить календарь": "Delete calendar", +"Проверка_ГКОбъект": "Check_GKObject", +"Новое имя объекта": "New object name", +"Дата : date": "Date : date", +"ЗначениеЗаполнено": "ValueIsFilled", +"УстановитьWebhook": "SetWebhook", +"Наименование поля": "Field name", +"Тестовая кампания": "TestCampaign", +"НеВосстанавливать": "DoNotRestore", +"Проверка_ВКИстина": "Check_VKTrue", +"Значение свойства": "Property value", +"СтандартныйСпособ": "StandardMethod", +"Секрет приложения": "Application secret", +"ХешированиеДанных": "DataHashing", +"ВК_ЗагрузитьВидео": "VK_UploadVideo", +"Текст комментария": "Comment text", +"РазмерБлока Тогда": "BlockSize Then", +"Название подборки": "Selection name", "ПолучитьПолеПочты": "GetEmailField", +"МассивРезультатов": "ResultArray", +"Название свойства": "Property name", +"УстановитьКоманду": "SetCommand", +"Тестовая подборка": "TestCollection", +"УправлениеТоваром": "ProductManagement", +"СоответствиеФайла": "FileMapping", +"Массив ID товаров": "Array of product IDs", +"Удалить сообщение": "Delete message", +"Новый комментарий": "NewComment", +"ТаблицаПараметров": "ParametersTable", +"КалендарьПриемник": "TargetCalendar", +"ВнешнееСоединение": "ExternalConnection", +"ИзменитьСообщение": "EditMessage", +"УдалитьОбработчик": "RemoveHandler", +"ВыходнаяКоллекция": "OutputCollection", +"ГТ_СоздатьТаблицу": "GT_CreateTable", +"ОтправитьКартинку": "SendImage", +"СоздатьБазуДанных": "CreateDatabase", +"КаталогИсходников": "SourceDirectory", +"ID блока родителя": "Parent block ID", +"ОтправитьДокумент": "SendDocument", +"АрхивироватьКанал": "ArchiveChannel", +"ГД_СоздатьКаталог": "GD_CreateCatalog", +"ОбъектКомментарий": "CommentObject", "Команда CLI: tools": "CLI Command: tools", -"СтруктураВариантов": "VariantStructure", -"ДлительностьОпроса": "PollDuration", -"ПереместитьСобытие": "MoveEvent", -"ДанныеПользователя": "UserData", -"ЗагрузитьМалыйФайл": "UploadSmallFile", -"СуществующаяГруппа": "ExistingGroup", -"ПреобразоватьЧисло": "ConvertNumber", -"ПолучитьТоварыПоИД": "GetProductsByID", -"ПреобразоватьСвязь": "ConvertLink", -"ПреобразоватьФайлы": "ConvertFiles", -"ПреобразоватьПочту": "ConvertEmail", -"УправлениеСобытием": "EventManagement", -"СоответствиеФайлов": "FileMapping", -"Команда CLI: slack": "CLI command: slack", -"'Желтый','Зеленый'": "'Yellow','Green'", -"РаботаССообщениями": "MessageManagement", -"ОтправитьСообщение": "SendMessage", -"ДополнительныеФото": "AdditionalPhotos", -"Проверка_ВКИстория": "Check_VKStory", -"Изменить сообщение": "Edit message", -"ПреобразоватьТекст": "ConvertText", -"Телеграм_БанРазбан": "Telegram_BanUnban", -"ДвоичныеВКоллекцию": "BinaryToCollection", -"URL источник файла": "URL source of the file", -"Заголовок страницы": "Page title", -"РаботаСоСтраницами": "PageManagement", -"Опубликовать папку": "Publish folder", -"Библиотека: Notion": "Library: Notion", -"Переместить объект": "Move object", -"ПереданныйПараметр": "PassedParameter", -"МассивКлючЗначение": "KeyValueArray", -"ЧЦ=10; ЧДЦ=0; ЧГ=0": "HC=10; HDC=0; HG=0", -"Наименование видео": "Video name", -"Команда CLI: viber": "CLI Command: viber", -"ID книги приемника": "DestinationBookID", -"ID книги источника": "SourceBookID", -"РазмерПрефиксаGZip": "GZipPrefixSize", "Удаляет пост по id": "Deletes a post by ID", -"ЗначенияПараметров": "ParameterValues", -"РазмерСжатыхДанных": "CompressedDataSize", -"ДобавитьОбработчик": "AddHandler", -"ОсновнойОбработчик": "MainHandler", -"ИнформацияОбОшибке": "ErrorInformation", -"СтандартнаяЕдиница": "StandardUnit", -"СтрЗаканчиваетсяНа": "StrEndsWith", -"Создать обсуждение": "Create discussion", -"ЗагрузитьФайлПоURL": "UploadFileByURL", -"ПолеИдентификатора": "IdentifierField", -"Создать твит гифки": "Create gif tweet", -"Удаляет блок по ID": "Deletes block by ID", -"Создать твит видео": "Create video tweet", -"ПолучитьСтатистику": "GetStatistics", -"Создать твит опрос": "Create poll tweet", -"Работа с доступами": "Access management", -"URL для сокращения": "URL for shortening", -"ПолучитьБазуДанных": "GetDatabase", -"ЗагрузитьМедиафайл": "UploadMediaFile", -"Написать сообщение": "Write a message", -"Активный : green": "Active : green", +"ПолучитьПолеНомера": "GetNumberField", +"ID книги источника": "SourceBookID", "ОтветИнициализации": "InitializationResponse", -"Имя : title": "Name : title", -"Открыть обсуждение": "Open discussion", -"СоответствиеИконки": "Icon match", -"Закрыть обсуждение": "Close discussion", -"РежимОткрытияФайла": "FileOpenMode", -"НачальнаяТабуляция": "InitialTab", -"Dropbox_УдалитьТег": "Dropbox_DeleteTag", +"ЗагрузитьМедиафайл": "UploadMediaFile", +"ПреобразоватьФайлы": "ConvertFiles", +"ДвоичныеВКоллекцию": "BinaryToCollection", +"ПолучитьИДКартинки": "GetImageID", +"ПреобразоватьСвязь": "ConvertLink", +"УправлениеДиалогом": "DialogManagement", +"ПреобразоватьЧисло": "ConvertNumber", +"Переместить объект": "Move object", +"ПолучитьПолеФлажка": "GetCheckboxField", +"ПреобразоватьТекст": "ConvertText", +"Токен пользователя": "User token", +"ID книги приемника": "DestinationBookID", +"ПолучитьПолеСсылки": "GetLinkField", +"Опубликовать папку": "Publish folder", +"Архивировать канал": "Archive channel", +"СоздатьКомментарий": "CreateComment", +"УдалитьКомментарий": "DeleteComment", +"Создать твит опрос": "Create poll tweet", +"ПроцессорГенерации": "GenerationProcessor", +"Работа с доступами": "Access management", +"ДобавитьОбработчик": "AddHandler", +"Команда CLI: viber": "CLI Command: viber", +"Создать твит видео": "Create video tweet", +"ОсновнойОбработчик": "MainHandler", +"'Желтый','Зеленый'": "'Yellow','Green'", +"Создать твит гифки": "Create gif tweet", +"Телеграм_БанРазбан": "Telegram_BanUnban", +"ОпубликоватьОбъект": "PublishObject", +"РаботаССообщениями": "MessageManagement", +"Команда CLI: slack": "CLI command: slack", +"Активный : green": "Active : green", +"ПереименоватьКанал": "RenameChannel", +"ПреобразоватьПочту": "ConvertEmail", "ТекущаяВложенность": "CurrentNesting", +"Заголовок страницы": "Page title", +"Проверка_ВКИстория": "Check_VKStory", +"ДополнительныйЦвет": "SecondaryColor", +"VK_УдалитьКартинку": "VK_DeleteImage", +"Имя : title": "Name : title", +"ПараметрВКоллекцию": "ParameterToCollection", +"СоответствиеФайлов": "FileMapping", +"ПереданныйПараметр": "PassedParameter", +"ИдентификаторФайла": "FileID", +"Dropbox_УдалитьТег": "Dropbox_DeleteTag", +"СоответствиеИконки": "Icon match", +"ДанныеПользователя": "UserData", +"ДлительностьОпроса": "PollDuration", +"ЧЦ=10; ЧДЦ=0; ЧГ=0": "HC=10; HDC=0; HG=0", +"НачальнаяТабуляция": "InitialTab", +"УдалитьВнешнийФайл": "DeleteExternalFile", +"Удаляет блок по ID": "Deletes block by ID", +"Изменить сообщение": "Edit message", +"РазмерСжатыхДанных": "CompressedDataSize", +"ПереместитьСобытие": "MoveEvent", +"Установить Webhook": "Set Webhook", +"ЗагрузитьФайлПоURL": "UploadFileByURL", +"Анонимность опроса": "Poll anonymity", +"ОткрепитьСообщение": "UnpinMessage", +"Отправить картинку": "Send image", +"URL источник файла": "URL source of the file", +"ПереслатьСообщение": "ForwardMessage", +"СкоприроватьОбъект": "CopyObject", +"ЗакрепитьСообщение": "PinMessage", +"СуществующаяГруппа": "ExistingGroup", +"СтруктураВариантов": "VariantStructure", +"Написать сообщение": "Write a message", +"Тестовое сообщение": "TestMessage", +"ЛимитПользователей": "UserLimit", +"РазмерПрефиксаGZip": "GZipPrefixSize", +"ПолучитьБазуДанных": "GetDatabase", +"ДополнительныеФото": "AdditionalPhotos", +"URL для сокращения": "URL for shortening", +"ОтправитьСообщение": "SendMessage", +"ИнформацияОбОшибке": "ErrorInformation", +"ПолучитьСтатистику": "GetStatistics", +"Тестовый календарь": "TestCalendar", +"Новое наименование": "New name", +"СтруктураПараметра": "ParameterStructure", +"ЗагрузитьМалыйФайл": "UploadSmallFile", +"Изменить календарь": "Edit calendar", +"ПолеИдентификатора": "IdentifierField", +"ПолучитьОбновления": "GetUpdates", +"Закрыть обсуждение": "Close discussion", +"РаботаСоСтраницами": "PageManagement", +"Наименование видео": "Video name", +"Тестовая таблица 2": "TestTable2", +"ФормированиеБлоков": "BlockFormation", +"СоответствиеТаблиц": "TableMapping", +"УправлениеСобытием": "EventManagement", +"Библиотека: Notion": "Library: Notion", +"Создать обсуждение": "Create discussion", +"Идентификатор поля": "Field identifier", +"МассивКлючЗначение": "KeyValueArray", +"ГТ_ПолучитьТаблицу": "GT_GetTable", +"Тестовый заголовок": "TestTitle", +"СтандартнаяЕдиница": "StandardUnit", +"Идентификатор базы": "Base identifier", +"ПолучитьТоварыПоИД": "GetProductsByID", +"Отправить документ": "Send document", +"ЗначенияПараметров": "ParameterValues", +"СтрЗаканчиваетсяНа": "StrEndsWith", +"ЯДиск_СоздатьПапку": "YDisk_CreateFolder", +"Открыть обсуждение": "Open discussion", +"РежимОткрытияФайла": "FileOpenMode", "ИзменитьТемуФорума": "EditForumTopic", "Получить календарь": "Get calendar", -"Установить Webhook": "Set Webhook", -"Тестовый заголовок": "TestTitle", -"ПолучитьОбновления": "GetUpdates", -"ПолучитьПолеНомера": "GetNumberField", -"ПереименоватьКанал": "RenameChannel", -"СтруктураПараметра": "ParameterStructure", -"ГТ_ПолучитьТаблицу": "GT_GetTable", -"ИдентификаторФайла": "FileID", -"ПолучитьИДКартинки": "GetImageID", -"Анонимность опроса": "Poll anonymity", -"Идентификатор поля": "Field identifier", -"Токен пользователя": "User token", -"ОткрепитьСообщение": "UnpinMessage", -"ЯДиск_СоздатьПапку": "YDisk_CreateFolder", -"ОпубликоватьОбъект": "PublishObject", -"ПереслатьСообщение": "ForwardMessage", -"ЗакрепитьСообщение": "PinMessage", -"УдалитьКомментарий": "DeleteComment", -"СкоприроватьОбъект": "CopyObject", -"Тестовое сообщение": "TestMessage", -"Новое наименование": "New name", -"ДополнительныйЦвет": "SecondaryColor", -"ФормированиеБлоков": "BlockFormation", -"ЛимитПользователей": "UserLimit", -"УдалитьВнешнийФайл": "DeleteExternalFile", -"СоздатьКомментарий": "CreateComment", -"ПолучитьПолеФлажка": "GetCheckboxField", -"Идентификатор базы": "Base identifier", -"Тестовый календарь": "TestCalendar", -"ПроцессорГенерации": "GenerationProcessor", -"Архивировать канал": "Archive channel", -"Отправить картинку": "Send image", -"СоответствиеТаблиц": "TableMapping", -"ПараметрВКоллекцию": "ParameterToCollection", -"Тестовая таблица 2": "TestTable2", -"ПолучитьПолеСсылки": "GetLinkField", -"Изменить календарь": "Edit calendar", -"VK_УдалитьКартинку": "VK_DeleteImage", -"Отправить документ": "Send document", -"УправлениеДиалогом": "DialogManagement", -"СтруктураПараметров": "ParametersStructure", -"РаботаСОбсуждениями": "DiscussionManagement", -"ПолучитьКомментарии": "GetComments", -"Отправляемая ссылка": "SentLink", -"АльтернативныйТекст": "AlternateText", -"Опубликовать объект": "Publish object", -"Отбор по типу файла": "Filter by file type", -"ПутьЛоговБиблиотеки": "LibraryLogPath", -"ЗаменитьСпецСимволы": "ReplaceSpecialCharacters", -"СоответствиеОбложки": "Cover match", -"РаботаСБазамиДанных": "DatabaseManagement", -"НаписатьВОбсуждение": "WriteInDiscussion", -"Создать базу данных": "Create database", -"Ставит лайк на пост": "Likes a post", -"Создает базу данных": "Creates a database", -"Структура Из Строка": "Structure Of String", -"СоздатьКопиюОбъекта": "CreateObjectCopy", -"СтруктураКлавиатуры": "KeyboardStructure", -"Создать комментарий": "Create comment", -"Данные для API v1.1": "Data for API v1.1", -"ПолучитьКомментарий": "GetComment", -"РаскодироватьСтроку": "DecodeString", -"ОбработатьВыводJSON": "ProcessJSONOutput", -"ОбработатьДанныеTMA": "ProcessTMAData", -"РазмерПостфиксаGZip": "GZipPostfixSize", -"ПолучитьСписокТегов": "GetTagList", -"Измененная подборка": "EditedCollection", -"Идентификатор книги": "BookIdentifier", -"Создает новую книгу": "Creates a new book", -"ЗаменитьСпецсимволы": "ReplaceSpecialCharacters", -"СоответствиеСвойств": "PropertyMatch", -"Получить обновления": "Get updates", -"ИсполняемыеСценарии": "ExecutableScripts", -"ПолучитьПараметрыВК": "GetVKParameters", -"ВК_МетодыОбсуждений": "VK_DiscussionMethods", -"БуферДвоичныхДанных": "BinaryDataBuffer", -"Получает файл по ID": "Gets file by ID", -"Команда CLI: google": "CLI command: google", -"НеобходимыйПараметр": "RequiredParameter", -"Идентификатор файла": "File identifier", -"СформироватьКоманду": "FormCommand", -"ПолучитьТокенПоКоду": "GetTokenByCode", -"Переслать сообщение": "Forward message", -"Команда CLI: notion": "CLI command: notion", -"Команда CLI: yandex": "CLI Command: yandex", -"Путь внутри объекта": "Path inside the object", -"СтруктураЗаголовков": "HeadersStructure", -"Скоприровать объект": "Copy object", -"ПереданныеПараметры": "PassedParameters", -"Команда CLI: gdrive": "CLI Command: gdrive", -"Количество : number": "Quantity : number", -"Создать тему форума": "Create forum thread", -"СоответствиеМетодов": "MethodCorrespondence", -"АккаунтИАвторизация": "AccountAndAuthorization", -"МассивПользователей": "ArrayOfUsers", -"Библиотека: Twitter": "Library: Twitter", -"Массив из Структура": "Array of Structure", -"ПолучитьДанныеФайла": "GetFileData", "Массив Из Структура": "Array of Structures", -"ПолучитьТекущуюДату": "GetCurrentDate", -"Переместить событие": "Move event", -"ПреобразованиеТипов": "TypeConversion", -"Переименовать канал": "Rename channel", -"ПараметрыЗаписиJSON": "JSONWriteParameters", -"Закрыть тему форума": "Close forum thread", -"ПреобразоватьСтатус": "ConvertStatus", -"Архив : yellow": "Archive : yellow", -"РабочееПространство": "Workspace", -"ПолучитьТаблицыБазы": "GetDatabaseTables", -"Отправить сообщение": "Send message", -"ПреобразоватьБулево": "ConvertBoolean", -"ПреобразоватьСсылку": "ConvertLink", -"Открыть тему форума": "Open forum thread", -"Удалить тему форума": "Delete forum thread", -"Альбом из автотеста": "AlbumFromAutoTest", -"Удаляет тему форума": "Deletes a forum thread", -"УправлениеПодборкой": "SelectionManagement", -"Структура из Строка": "Structure Of String", -"СгруппироватьТовары": "GroupProducts", -"Библиотека: Dropbox": "Library: Dropbox", -"РаботаСТемамиФорума": "ForumTopicManagement", -"Получить список баз": "Get list of bases", -"СоответствиеСобытия": "EventMatch", -"Dropbox_ДобавитьТег": "Dropbox_AddTag", -"Команда CLI: yadisk": "CLI command: yadisk", -"ИзменитьКомментарий": "EditComment", -"ПолучитьВнешнийФайл": "GetExternalFile", -"НаписатьКомментарий": "WriteComment", -"Новое описание базы": "New database description", -"СоздатьТвитКартинки": "Create image tweet", -"Создает новый канал": "Creates a new channel", -"ПолучитьОбщийМодуль": "GetCommonModule", -"Закрепить сообщение": "Pin message", -"Длительность опроса": "Poll duration", -"Dropbox_СкачатьФайл": "Dropbox_DownloadFile", -"Получить статистику": "Get statistics", -"Удалить комментарий": "Delete comment", -"Создать\/Удалить тег": "Create\/Delete tag", -"Массив файлов видео": "Video files array", -"Наименование канала": "Channel name", -"Массив файлов гифок": "Gif files array", -"Открепить сообщение": "Unpin message", "СписокПользователей": "UserList", -"ПолучитьСвойАккаунт": "GetOwnAccount", +"Путь внутри объекта": "Path inside the object", "Дата начала периода": "Start date of the period", +"ПараметрыЗаписиJSON": "JSONWriteParameters", +"Данные для API v1.1": "Data for API v1.1", +"Команда CLI: notion": "CLI command: notion", +"Команда CLI: gdrive": "CLI Command: gdrive", +"СоответствиеСобытия": "EventMatch", +"ПолучитьТаблицыБазы": "GetDatabaseTables", +"Получить список баз": "Get list of bases", +"Альбом из автотеста": "AlbumFromAutoTest", +"Команда CLI: yandex": "CLI Command: yandex", +"СгруппироватьТовары": "GroupProducts", +"Количество : number": "Quantity : number", +"Структура Из Строка": "Structure Of String", +"РабочееПространство": "Workspace", +"ПолучитьСписокТегов": "GetTagList", +"НаписатьКомментарий": "WriteComment", +"Создает базу данных": "Creates a database", +"ПреобразоватьСсылку": "ConvertLink", +"ПреобразоватьБулево": "ConvertBoolean", +"НаписатьВОбсуждение": "WriteInDiscussion", +"Новое описание базы": "New database description", +"ПреобразоватьСтатус": "ConvertStatus", +"УправлениеПодборкой": "SelectionManagement", +"Dropbox_СкачатьФайл": "Dropbox_DownloadFile", +"ИзменитьКомментарий": "EditComment", +"Удалить комментарий": "Delete comment", +"Переместить событие": "Move event", +"СоответствиеСвойств": "PropertyMatch", +"ПреобразованиеТипов": "TypeConversion", +"Измененная подборка": "EditedCollection", +"СоответствиеМетодов": "MethodCorrespondence", +"РаботаСОбсуждениями": "DiscussionManagement", +"Библиотека: Dropbox": "Library: Dropbox", +"АккаунтИАвторизация": "AccountAndAuthorization", +"Создать комментарий": "Create comment", +"Получить статистику": "Get statistics", +"Команда CLI: yadisk": "CLI command: yadisk", +"Ставит лайк на пост": "Likes a post", +"Опубликовать объект": "Publish object", +"Создать базу данных": "Create database", +"РаботаСБазамиДанных": "DatabaseManagement", +"СоответствиеОбложки": "Cover match", +"Отбор по типу файла": "Filter by file type", +"ПолучитьСвойАккаунт": "GetOwnAccount", +"Отправляемая ссылка": "SentLink", +"Массив из Структура": "Array of Structure", +"СтруктураКлавиатуры": "KeyboardStructure", +"ВК_МетодыОбсуждений": "VK_DiscussionMethods", +"ПолучитьПараметрыВК": "GetVKParameters", +"СтруктураПараметров": "ParametersStructure", +"СтруктураЗаголовков": "HeadersStructure", +"СоздатьКопиюОбъекта": "CreateObjectCopy", +"Архив : yellow": "Archive : yellow", +"ПолучитьКомментарии": "GetComments", +"ПолучитьТокенПоКоду": "GetTokenByCode", +"Dropbox_ДобавитьТег": "Dropbox_AddTag", +"Команда CLI: google": "CLI command: google", +"ИсполняемыеСценарии": "ExecutableScripts", +"Создать\/Удалить тег": "Create\/Delete tag", +"Длительность опроса": "Poll duration", "ДобавитьВнешнийФайл": "AddExternalFile", -"ПрограммныйИнтерфейс": "ProgrammingInterface", -"МассивСтруктурКнопок": "ArrayOfButtonStructures", -"VK_СоздатьОбсуждение": "VK_CreateDiscussion", -"ВозвращаемоеЗначение": "ReturnValue", -"VK_ЗакрытьОбсуждение": "VK_CloseDiscussion", -"VK_ОткрытьОбсуждение": "VK_OpenDiscussion", -"СледующаяВложенность": "NextNesting", -"ПолучитьСписокТестов": "GetTestList", -"Проверка_ТелеграмБан": "Check_TelegramBan", -"СтруктураОтправителя": "SenderStructure", -"СформироватьТестыЯкс": "FormYAXTests", -"ПолучитьПодборкиПоИД": "GetSelectionsByID", -"МассивДвоичныхДанных": "BinaryDataArray", -"ВК_ЛайкРепостКоммент": "VK_LikeRepostComment", -"Библиотека: Airtable": "Library: Airtable", -"Тестовый комментарий": "TestComment", -"Вайбер_ОтправитьФайл": "Viber_SendFile", -"Проверка_НоушнОбъект": "Check_NotionObject", -"Сгруппировать товары": "Group products", -"Делает репост записи": "Reposts the record", -"Описание нового поля": "Description of the new field", -"Dropbox_СоздатьПапку": "Dropbox_CreateFolder", -"Изменить комментарий": "Modify comment", -"Написать комментарий": "Write a comment", -"КоличествоПараметров": "NumberOfParameters", -"Создать\/Удалить блок": "Create\/Delete block", -"Изменение публикации": "PublicationChange", -"Обновленный файл.jpg": "UpdatedFile.jpg", -"Создать\/Удалить пост": "Create\/Delete post", -"Команда CLI: dropbox": "CLI Command: dropbox", -"ПолучитьИмяФайлаТела": "GetBodyFileName", -"РазмерНесжатыхДанных": "UncompressedDataSize", -"Получить комментарии": "Get comments", -"СоответствиеСимволов": "CharacterMapping", -"ПолучитьПолеВложения": "GetAttachmentField", -"Наименование альбома": "Album name", -"ВывестиДопИнформацию": "DisplayAdditionalInformation", -"Тестовое сообщение 1": "TestMessage1", -"УстановитьФайлВывода": "SetOutputFile", -"ПолучитьПолеТелефона": "GetPhoneField", -"Путь или ID каталога": "Path or ID of the directory", -"УстановитьРежимТеста": "SetTestMode", -"СоздатьСоставнойПост": "CreateCompositePost", -"Тестовое сообщение 2": "TestMessage2", -"Telegram_СкачатьФайл": "Telegram_DownloadFile", -"РаботаСКомментариями": "CommentManagement", +"ЗаменитьСпецСимволы": "ReplaceSpecialCharacters", +"РаботаСТемамиФорума": "ForumTopicManagement", +"БуферДвоичныхДанных": "BinaryDataBuffer", +"Массив файлов видео": "Video files array", +"Открепить сообщение": "Unpin message", +"АльтернативныйТекст": "AlternateText", +"Идентификатор файла": "File identifier", +"Получить обновления": "Get updates", +"Закрепить сообщение": "Pin message", +"Создает новую книгу": "Creates a new book", +"Массив файлов гифок": "Gif files array", +"СоздатьТвитКартинки": "Create image tweet", +"Переслать сообщение": "Forward message", +"ОбработатьВыводJSON": "ProcessJSONOutput", +"ПолучитьКомментарий": "GetComment", +"РазмерПостфиксаGZip": "GZipPostfixSize", +"ОбработатьДанныеTMA": "ProcessTMAData", +"РаскодироватьСтроку": "DecodeString", +"НеобходимыйПараметр": "RequiredParameter", +"ЗаменитьСпецсимволы": "ReplaceSpecialCharacters", +"Получает файл по ID": "Gets file by ID", +"ПереданныеПараметры": "PassedParameters", +"Отправить сообщение": "Send message", +"Закрыть тему форума": "Close forum thread", +"Создать тему форума": "Create forum thread", +"Скоприровать объект": "Copy object", +"ПолучитьВнешнийФайл": "GetExternalFile", +"Наименование канала": "Channel name", +"Структура из Строка": "Structure Of String", +"Переименовать канал": "Rename channel", +"Идентификатор книги": "BookIdentifier", +"ПолучитьТекущуюДату": "GetCurrentDate", +"ПолучитьОбщийМодуль": "GetCommonModule", +"ПолучитьДанныеФайла": "GetFileData", +"ПутьЛоговБиблиотеки": "LibraryLogPath", +"Удаляет тему форума": "Deletes a forum thread", +"МассивПользователей": "ArrayOfUsers", +"Удалить тему форума": "Delete forum thread", +"Создает новый канал": "Creates a new channel", +"Открыть тему форума": "Open forum thread", +"СформироватьКоманду": "FormCommand", +"Библиотека: Twitter": "Library: Twitter", "Dropbox_СкачатьПапку": "Dropbox_DownloadFolder", -"ЗагрузитьБольшойФайл": "UploadLargeFile", -"ИнформацияОПрогрессе": "ProgressInformation", -"ОтправитьВнешнийФайл": "SendExternalFile", -"ПолучениеОбщихДанных": "GeneralDataRetrieval", -"УстановитьЦельКанала": "SetChannelGoal", "ЗагрузитьФайлЧастями": "UploadFileInParts", -"УстановитьТемуКанала": "SetChannelTopic", -"ДобавитьСвойстваБазы": "AddDatabaseProperties", -"ВернутьДочерниеБлоки": "ReturnChildBlocks", -"Команда CLI: gsheets": "CLI Command: gsheets", -"Список пользователей": "User list", -"ОтправитьМедиагруппу": "SendMediaGroup", -"УправлениеИНастройки": "ManagementAndSettings", -"СоответствиеВарианта": "OptionMap", -"ответ сервера Google": "Google server response", -"URL к внешнему файлу": "URL to external file", -"Пустой макет события": "Empty event template", -"НастройкиИИнформация": "SettingsAndInformation", -"ДобавитьРодителяБазы": "AddDatabaseParent", +"СоздатьСоставнойПост": "CreateCompositePost", +"ПодчиненнаяСтруктура": "SubordinateStructure", +"Проверка_НоушнОбъект": "Check_NotionObject", "ПреобразоватьТелефон": "ConvertPhone", -"Идентификатор канала": "Channel ID", -"ЗаголовокАвторизации": "AuthorizationHeader", -"Получить базу данных": "Get database", -"СделатьФайлПубличным": "MakeFilePublic", -"СоответствиеЗначений": "ValueMapping", -"ID копируемого листа": "CopiedSheetID", "ПолучитьСписокФайлов": "GetFilesList", "Команда CLI: twitter": "CLI Command: twitter", -"СоответствиеВозврата": "ReturnMapping", -"Новый заголовок базы": "New database title", -"ПодчиненнаяСтруктура": "SubordinateStructure", -"Свойства базы данных": "Database properties", -"ДобавитьОписаниеБазы": "AddDatabaseDescription", -"ID страницы родителя": "Parent page ID", -"ИзменитьСвойстваБазы": "EditDatabaseProperties", -"Библиотека: Telegram": "Library: Telegram", -"СделатьФайлПриватным": "MakeFilePrivate", -"Получить комментарий": "Get comment", -"СоздатьСтраницуВБазу": "CreatePageInDatabase", -"Соответствие свойств": "Properties match", -"Удалить внешний файл": "Delete external file", +"ЗагрузитьБольшойФайл": "UploadLargeFile", +"Написать комментарий": "Write a comment", +"ИнформацияОПрогрессе": "ProgressInformation", "Изменить тему форума": "Edit forum thread", +"Команда CLI: gsheets": "CLI Command: gsheets", +"СоответствиеВарианта": "OptionMap", +"ответ сервера Google": "Google server response", +"Делает репост записи": "Reposts the record", +"Тестовый комментарий": "TestComment", +"ПолучитьИмяФайлаТела": "GetBodyFileName", +"Наименование альбома": "Album name", +"Библиотека: Airtable": "Library: Airtable", +"Тестовое сообщение 2": "TestMessage2", +"Тестовое сообщение 1": "TestMessage1", +"Идентификатор канала": "Channel ID", +"Dropbox_СоздатьПапку": "Dropbox_CreateFolder", +"ПрограммныйИнтерфейс": "ProgrammingInterface", +"КоличествоПараметров": "NumberOfParameters", +"Список пользователей": "User list", +"СоздатьСтраницуВБазу": "CreatePageInDatabase", +"ВернутьДочерниеБлоки": "ReturnChildBlocks", +"ДобавитьСвойстваБазы": "AddDatabaseProperties", +"ДобавитьРодителяБазы": "AddDatabaseParent", +"Изменить комментарий": "Modify comment", +"СделатьФайлПриватным": "MakeFilePrivate", +"СделатьФайлПубличным": "MakeFilePublic", +"ПолучитьПолеТелефона": "GetPhoneField", +"ВК_ЛайкРепостКоммент": "VK_LikeRepostComment", +"Получить комментарии": "Get comments", +"VK_ОткрытьОбсуждение": "VK_OpenDiscussion", +"РаботаСКомментариями": "CommentManagement", +"VK_ЗакрытьОбсуждение": "VK_CloseDiscussion", +"VK_СоздатьОбсуждение": "VK_CreateDiscussion", +"МассивДвоичныхДанных": "BinaryDataArray", +"УстановитьЦельКанала": "SetChannelGoal", +"УстановитьТемуКанала": "SetChannelTopic", +"Пустой макет события": "Empty event template", +"Telegram_СкачатьФайл": "Telegram_DownloadFile", +"ID страницы родителя": "Parent page ID", +"Свойства базы данных": "Database properties", +"ПолучитьСписокТестов": "GetTestList", +"СформироватьТестыЯкс": "FormYAXTests", +"Получить базу данных": "Get database", +"СоответствиеСимволов": "CharacterMapping", +"URL к внешнему файлу": "URL to external file", +"Команда CLI: dropbox": "CLI Command: dropbox", +"Обновленный файл.jpg": "UpdatedFile.jpg", +"Сгруппировать товары": "Group products", +"СоответствиеВозврата": "ReturnMapping", "ID родительской базы": "Parent database ID", +"Соответствие свойств": "Properties match", +"Вайбер_ОтправитьФайл": "Viber_SendFile", +"Путь или ID каталога": "Path or ID of the directory", +"ВывестиДопИнформацию": "DisplayAdditionalInformation", +"УстановитьФайлВывода": "SetOutputFile", +"Изменение публикации": "PublicationChange", +"УстановитьРежимТеста": "SetTestMode", +"ДобавитьОписаниеБазы": "AddDatabaseDescription", +"ИзменитьСвойстваБазы": "EditDatabaseProperties", +"ПолучитьПодборкиПоИД": "GetSelectionsByID", +"Новый заголовок базы": "New database title", +"Описание нового поля": "Description of the new field", +"Библиотека: Telegram": "Library: Telegram", +"РазмерНесжатыхДанных": "UncompressedDataSize", +"Удалить внешний файл": "Delete external file", +"ОтправитьВнешнийФайл": "SendExternalFile", +"Получить комментарий": "Get comment", +"ПолучитьПолеВложения": "GetAttachmentField", +"ПолучениеОбщихДанных": "GeneralDataRetrieval", +"ОтправитьМедиагруппу": "SendMediaGroup", +"НастройкиИИнформация": "SettingsAndInformation", +"СтруктураОтправителя": "SenderStructure", +"Создать\/Удалить пост": "Create\/Delete post", +"Проверка_ТелеграмБан": "Check_TelegramBan", "СоздатьТекстовыйТвит": "CreateTextTweet", +"ВозвращаемоеЗначение": "ReturnValue", +"УправлениеИНастройки": "ManagementAndSettings", +"ЗаголовокАвторизации": "AuthorizationHeader", +"МассивСтруктурКнопок": "ArrayOfButtonStructures", +"СоответствиеЗначений": "ValueMapping", +"СледующаяВложенность": "NextNesting", "Аннотация к картинке": "Image annotation", -"ВыполнитьСборкуМусора": "PerformGarbageCollection", -"ОтправлятьУведомления": "SendNotifications", -"Dropbox_УдалитьОбъект": "Dropbox_DeleteObject", -"Создать копию объекта": "Create object copy", -"МассивВариантовВыбора": "ChoiceOptionArray", -"ID чата создания темы": "Thread creation chat ID", -"ТекстПервогоСообщения": "Text of the first message", -"Проверка_ВКОбсуждение": "Check_VKDiscussion", -"Слак_ПолучитьСписокВФ": "Slack_GetExternalFileList", -"Dropbox_ЗагрузитьФайл": "Dropbox_UploadFile", -"Заголовок базы данных": "Database title", -"ПреобразованныеДанные": "ConvertedData", -"Библиотека: Yandex ID": "Library: Yandex ID", -"УстановитьТелоЗапроса": "SetRequestBody", +"Создать\/Удалить блок": "Create\/Delete block", +"ID копируемого листа": "CopiedSheetID", "УправлениеТемойФорума": "ForumTopicManagement", +"Получить данные файла": "Get file data", +"ID рекламной кампании": "Advertising campaign ID", +"Слак_ПолучитьСписокВФ": "Slack_GetExternalFileList", +"ID пользователя Viber": "Viber User ID", +"ПолучитьЗначенияЯчеек": "GetCellValues", +"Ссылка получения кода": "Code retrieval link", +"ПолучитьСписокЗаказов": "GetOrderList", +"СклеитьДвоичныеДанные": "ConcatenateBinaryData", +"ПолучитьСписокСвойств": "GetPropertyList", +"Географическая широта": "Geographic latitude", +"Ноушн_СоздатьСтраницу": "Notion_CreatePage", +"ВК_ОтправитьСообщение": "VK_SendMessage", +"Проверка_ТвиттерТекст": "Check_TwitterText", +"Заголовок базы данных": "Database title", +"Твиттер_ОбновитьТокен": "Twitter_UpdateToken", +"Строка,ДвоичныеДанные": "String, BinaryData", "Проверка_ДропБоксФайл": "Check_DropboxFile", "СоответствиеКатегорий": "CategoryCorrespondence", -"ПолучитьСписокСобытий": "GetEventList", -"ЗаписатьПараметрВФайл": "WriteParameterToFile", -"ДобавитьЗаголовокБазы": "AddDatabaseHeader", -"Команда CLI: airtable": "CLI Command: airtable", -"Новый текст сообщения": "New message text", -"Создать\/Изменить поле": "Create\/Edit field", +"ПолучитьТаблицуТестов": "GetTestTable", +"ТекстПервогоСообщения": "Text of the first message", +"ID чата создания темы": "Thread creation chat ID", +"Удаляет событие по ID": "Deletes an event by ID", +"Получить список тегов": "Get list of tags", +"ОтправлятьУведомления": "SendNotifications", +"МассивВариантовОпроса": "PollOptionsArray", "ВыполнитьЗапросСТелом": "ExecuteRequestWithBody", "ПолучитьСписокКаналов": "GetChannelList", -"Ссылка получения кода": "Code retrieval link", -"ПолучитьСписокТоваров": "GetProductList", -"Загрузить файл по URL": "Upload file by URL", -"Создает новое событие": "Creates a new event", -"Заголовок приглашения": "Invitation title", -"Проверка_ДропБоксТеги": "Check_DropboxTags", -"Географическая широта": "Geographic latitude", -"Dropbox_ОбновитьТокен": "Dropbox_UpdateToken", -"Dropbox_ПолучитьТокен": "Dropbox_GetToken", -"ЗагрузитьМедиаЧастями": "UploadMediaInParts", -"ID целевого сообщения": "Target message ID", -"ID рекламной кампании": "Advertising campaign ID", -"Получить данные файла": "Get file data", -"МассивВариантовОпроса": "PollOptionsArray", -"ID асинхронной работы": "AsynchronousJobID", -"В работе : checkbox": "In progress : checkbox", -"Получить товары по ID": "Get products by ID", -"Создать твит картинки": "Create image tweet", -"ПолучитьЗначенияЯчеек": "GetCellValues", -"ИнтерактивныеДействия": "InteractiveActions", +"СоответствиеЗаголовка": "HeaderMapping", "ЗаписатьЗначениеВФайл": "WriteValueToFile", -"Удаляет файл на Slack": "Deletes a file on Slack", +"Идентификатор объекта": "Object identifier", +"Заголовок приглашения": "Invitation title", +"ПолучитьОписаниеФайла": "GetFileDescription", +"Новое название канала": "New channel name", "Написать в обсуждение": "Write in discussion", "Создать\/Изменить базу": "Create\/Edit database", -"Наименование кампании": "Campaign name", -"СоздатьСвойствоТовара": "CreateProductProperty", -"Путь сохранения файла": "File save path", -"Получить список тегов": "Get list of tags", -"Удаляет лист из книги": "Deletes a sheet from the book", -"Получить внешний файл": "Get external file", -"Удаляет событие по ID": "Deletes an event by ID", -"ЗаполнитьМассивЛистов": "FillSheetArray", -"Строка,ДвоичныеДанные": "String, BinaryData", -"Проверка_ТвиттерТекст": "Check_TwitterText", -"ЗагрузитьФотоНаСервер": "UploadPhotoToServer", -"Отправить медиагруппу": "Send media group", -"УдалитьСвойствоТовара": "DeleteProductProperty", -"ДвоичныеДанные,Строка": "BinaryData,String", +"Создать твит картинки": "Create image tweet", "Получить таблицы базы": "Get base tables", -"Идентификатор объекта": "Object identifier", -"двоичные данные файла": "binary data of the file", -"ПолучитьСписокЗаписей": "GetListOfRecords", -"ВК_ОтправитьСообщение": "VK_SendMessage", -"ДобавитьТестовыйНабор": "AddTestSet", -"ID пользователя Viber": "Viber User ID", -"Идентификатор таблицы": "Table identifier", -"Добавить внешний файл": "Add external file", -"ВК_ПолучитьСтатистику": "VK_GetStatistics", -"ПолучитьТаблицуТестов": "GetTestTable", -"СклеитьДвоичныеДанные": "ConcatenateBinaryData", -"ПолучитьОписаниеФайла": "GetFileDescription", -"Массив описаний полей": "Array of field descriptions", -"ПолучитьСписокЗаказов": "GetOrderList", +"Загрузить файл по URL": "Upload file by URL", +"Наименование кампании": "Campaign name", +"ID целевого сообщения": "Target message ID", +"Проверка_ВКОбсуждение": "Check_VKDiscussion", "ВК_СоздатьУдалитьПост": "VK_CreateDeletePost", -"ЗаписатьФайлыРелэйтед": "WriteRelatedFiles", -"ДобавитьContentLength": "AddContentLength", -"Команда CLI: telegram": "CLI command: telegram", -"ПолучитьИсториюКанала": "GetChannelHistory", +"ЗагрузитьМедиаЧастями": "UploadMediaInParts", +"Создать копию объекта": "Create object copy", +"ИнтерактивныеДействия": "InteractiveActions", +"Команда CLI: airtable": "CLI Command: airtable", +"Библиотека: Yandex ID": "Library: Yandex ID", +"ВыполнитьСборкуМусора": "PerformGarbageCollection", "ДобавитьСерверныйТест": "AddServerTest", -"Новое название канала": "New channel name", -"Ноушн_СоздатьСтраницу": "Notion_CreatePage", -"ПолучитьПолеСтроковое": "GetStringField", -"ПолучитьСписокСвойств": "GetPropertyList", -"ПреобразоватьВложения": "ConvertAttachments", -"СоответствиеЗаголовка": "HeaderMapping", -"Твиттер_ОбновитьТокен": "Twitter_UpdateToken", +"Команда CLI: telegram": "CLI command: telegram", +"Идентификатор таблицы": "Table identifier", +"ЗаписатьФайлыРелэйтед": "WriteRelatedFiles", "СтруктураПользователя": "UserStructure", -"СоответствиеПараметров": "ParameterMap", -"ID рекламного кабинета": "Advertising account ID", -"ДобавитьТоварВПодборку": "AddProductToSelection", -"Получить пользователей": "Get users", -"и почитать комментарии": "and read comments", -"РаботаСФайламиИПапками": "FileAndFolderManagement", -"Массив файлов картинок": "Image files array", -"УдалитьЛишниеПоляБлока": "RemoveExtraBlockFields", -"ПолучитьОписаниеТовара": "GetProductDescription", -"Проверка_ТелеграмВидео": "Check_TelegramVideo", -"Соответствие из Строка": "Map from String", -"ПреобразоватьЗаголовок": "ConvertHeader", -"Соответствие Из Строка": "Compliance From String", -"Команда CLI: gcalendar": "CLI Command: gcalendar", -"ИзменитьСвойствоТовара": "EditProductProperty", -"Удаляет подборку по ID": "Deletes the selection by ID", -"КаталогЛоговБиблиотеки": "LibraryLogCatalog", -"Проверка_ТелеграмЧисло": "Check_TelegramNumber", -"ПолучитьДвоичныеДанные": "GetBinaryData", -"Проверка_ТелеграмОпрос": "Check_TelegramPoll", -"ID изменяемой страницы": "ID of the page being modified", -"Проверка_ТелеграмГифка": "Check_TelegramGif", -"ЗаполнитьДанныеПоСхеме": "FillDataBySchema", -"Проверка_ТелеграмАудио": "Check_TelegramAudio", -"Дневной лимит в рублях": "Daily limit in rubles", -"Массив из Произвольный": "Array of Arbitrary", -"ПолучитьИнформациюБота": "GetBotInformation", -"УдалитьТоварИзПодборки": "RemoveProductFromSelection", -"Открыть\/Закрыть диалог": "Open\/Close dialog", -"Сделать файл публичным": "Make file public", -"Создать текстовый твит": "Create text tweet", -"Новое имя главной темы": "New main thread name", -"Вайбер_ОтправитьСсылку": "Viber_SendLink", -"ПреобразоватьКодВТокен": "ConvertCodeToToken", -"Загрузить\/Удалить Файл": "Upload\/Delete file", -"Создать\/Удалить записи": "Create\/Delete records", -"УстановитьРежимОтладки": "SetDebugMode", -"СоздатьПодборкуТоваров": "CreateProductCollection", -"Сделать файл приватным": "Make file private", -"ПолучитьМассивПодборок": "GetSelectionArray", -"Загрузить\/Удалить файл": "Upload\/Delete file", -"УстановитьТелоИзСтроки": "SetBodyFromString", -"ID календаря источника": "ID of the source calendar", -"ЗаписатьДвоичныеДанные": "WriteBinaryData", -"Получает список файлов": "Gets the list of files", -"Получить список файлов": "Get list of files", -"ВК_СоздатьСсылкуТокена": "VK_CreateTokenLink", -"СтандартныеЗависимости": "StandardDependencies", -"ЗаписатьJSONМультипарт": "WriteJSONMultipart", -"СформироватьКлавиатуру": "FormKeyboard", -"ПолучитьСписокПодборок": "GetSelectionList", -"Строка, ДвоичныеДанные": "String, BinaryData", -"ЗагрузитьВидеоНаСервер": "UploadVideoToServer", -"УстановитьИмяФайлаТела": "SetBodyFileName", -"Возвращаемое значение:": "Return value:", -"Массив из Строка,Число": "Array of String,Number", -"VK_НаписатьВОбсуждение": "VK_PostToDiscussion", -"Загружает файл на диск": "Uploads a file to the drive", -"Описание : rich_text": "Description : rich_text", -"ВыполнитьЗапросБезТела": "ExecuteRequestWithoutBody", -"Отправить внешний файл": "Send external file", -"СформированноеОписание": "FormedDescription", -"Дата окончания периода": "End date of the period", -"Создает твит с опросом": "Creates a tweet with a poll", -"Массив описаний блоков": "Array of block descriptions", -"Изменить свойства базы": "Edit database properties", -"Вернуть дочерние блоки": "Return child blocks", -"Dropbox_ПолучитьПревью": "Dropbox_GetPreview", -"Получить токен по коду": "Get token by code", +"двоичные данные файла": "binary data of the file", +"ДвоичныеДанные,Строка": "BinaryData,String", +"МассивВариантовВыбора": "ChoiceOptionArray", +"ПолучитьСписокСобытий": "GetEventList", +"УдалитьСвойствоТовара": "DeleteProductProperty", +"ПолучитьИсториюКанала": "GetChannelHistory", +"ЗаполнитьМассивЛистов": "FillSheetArray", +"ЗагрузитьФотоНаСервер": "UploadPhotoToServer", +"ДобавитьТестовыйНабор": "AddTestSet", +"Удаляет лист из книги": "Deletes a sheet from the book", +"Отправить медиагруппу": "Send media group", +"Dropbox_УдалитьОбъект": "Dropbox_DeleteObject", +"Добавить внешний файл": "Add external file", +"УстановитьТелоЗапроса": "SetRequestBody", +"Проверка_ДропБоксТеги": "Check_DropboxTags", +"Путь сохранения файла": "File save path", +"НеобходимаяДлина Цикл": "RequiredLength Do", +"Dropbox_ЗагрузитьФайл": "Dropbox_UploadFile", +"Получить товары по ID": "Get products by ID", +"ЗаписатьПараметрВФайл": "WriteParameterToFile", +"СоздатьСвойствоТовара": "CreateProductProperty", +"Получить внешний файл": "Get external file", +"В работе : checkbox": "In progress : checkbox", +"Новый текст сообщения": "New message text", +"ПолучитьСписокЗаписей": "GetListOfRecords", +"ДобавитьContentLength": "AddContentLength", +"ПолучитьПолеСтроковое": "GetStringField", +"ПреобразованныеДанные": "ConvertedData", +"ID асинхронной работы": "AsynchronousJobID", +"ПреобразоватьВложения": "ConvertAttachments", +"ВК_ПолучитьСтатистику": "VK_GetStatistics", +"Удаляет файл на Slack": "Deletes a file on Slack", +"Dropbox_ПолучитьТокен": "Dropbox_GetToken", +"ПолучитьСписокТоваров": "GetProductList", +"Dropbox_ОбновитьТокен": "Dropbox_UpdateToken", +"Создает новое событие": "Creates a new event", +"ДобавитьЗаголовокБазы": "AddDatabaseHeader", +"Создать\/Изменить поле": "Create\/Edit field", +"Массив описаний полей": "Array of field descriptions", "ПроверитьЗагрузкуЧасти": "CheckPartUpload", -"Установить цель канала": "Set channel purpose", -"Географическая долгота": "Geographic longitude", -"Сообщение из автотеста": "Message from autotest", -"Создать составной пост": "Create composite post", -"НаименованиеИзмененное": "EditedName", -"ДропБокс_ЗагрузитьФайл": "Dropbox_UploadFile", +"СформированноеОписание": "FormedDescription", +"Загрузить\/Удалить Файл": "Upload\/Delete file", "Новое описание события": "New event description", +"Вернуть дочерние блоки": "Return child blocks", +"Массив из Произвольный": "Array of Arbitrary", +"ПреобразоватьЗаголовок": "ConvertHeader", +"Создать текстовый твит": "Create text tweet", +"Сделать файл приватным": "Make file private", +"ПолучитьОписаниеТовара": "GetProductDescription", +"РаботаСФайламиИПапками": "FileAndFolderManagement", +"Строка, ДвоичныеДанные": "String, BinaryData", +"Соответствие Из Строка": "Compliance From String", +"НаименованиеИзмененное": "EditedName", +"Отправить внешний файл": "Send external file", +"Сообщение из автотеста": "Message from autotest", +"ПолучитьМассивПодборок": "GetSelectionArray", +"Дневной лимит в рублях": "Daily limit in rubles", +"ID рекламного кабинета": "Advertising account ID", "Путь к папке или файлу": "Path to folder or file", -"ДобавитьОписаниеДанных": "AddDataDescription", +"ЗаписатьДвоичныеДанные": "WriteBinaryData", +"Загружает файл на диск": "Uploads a file to the drive", +"VK_НаписатьВОбсуждение": "VK_PostToDiscussion", +"Сделать файл публичным": "Make file public", +"Вайбер_ОтправитьСсылку": "Viber_SendLink", +"ПолучитьДвоичныеДанные": "GetBinaryData", +"Команда CLI: gcalendar": "CLI Command: gcalendar", +"ЗаписатьJSONМультипарт": "WriteJSONMultipart", "ID календаря приемника": "ID of the target calendar", +"ID календаря источника": "ID of the source calendar", +"Географическая долгота": "Geographic longitude", +"УстановитьИмяФайлаТела": "SetBodyFileName", +"СоответствиеПараметров": "ParameterMap", +"Описание : rich_text": "Description : rich_text", +"Проверка_ТелеграмГифка": "Check_TelegramGif", +"CommonModule.OPI_Тесты": "CommonModule.OPI_Tests", +"ПолучитьСписокПодборок": "GetSelectionList", +"ДобавитьТоварВПодборку": "AddProductToSelection", +"Создать составной пост": "Create composite post", +"и почитать комментарии": "and read comments", +"ПолучитьИнформациюБота": "GetBotInformation", +"Изменить свойства базы": "Edit database properties", +"Массив из Строка,Число": "Array of String,Number", +"ЗагрузитьВидеоНаСервер": "UploadVideoToServer", +"ИзменитьСвойствоТовара": "EditProductProperty", +"Проверка_ТелеграмАудио": "Check_TelegramAudio", +"Открыть\/Закрыть диалог": "Open\/Close dialog", +"ДобавитьОписаниеДанных": "AddDataDescription", "Установить тему канала": "Set channel topic", +"ПреобразоватьКодВТокен": "ConvertCodeToToken", +"Проверка_ТелеграмВидео": "Check_TelegramVideo", +"Новое имя главной темы": "New main thread name", +"ID изменяемой страницы": "ID of the page being modified", +"СоздатьПодборкуТоваров": "CreateProductCollection", +"УстановитьРежимОтладки": "SetDebugMode", +"ДропБокс_ЗагрузитьФайл": "Dropbox_UploadFile", +"Загрузить\/Удалить файл": "Upload\/Delete file", +"Получить список файлов": "Get list of files", +"КаталогЛоговБиблиотеки": "LibraryLogCatalog", +"Dropbox_ПолучитьПревью": "Dropbox_GetPreview", +"Получить пользователей": "Get users", +"Получает список файлов": "Gets the list of files", +"Проверка_ТелеграмЧисло": "Check_TelegramNumber", +"Удаляет подборку по ID": "Deletes the selection by ID", +"Массив описаний блоков": "Array of block descriptions", +"УдалитьЛишниеПоляБлока": "RemoveExtraBlockFields", +"Соответствие из Строка": "Map from String", +"Создать\/Удалить записи": "Create\/Delete records", +"СтандартныеЗависимости": "StandardDependencies", +"ВК_СоздатьСсылкуТокена": "VK_CreateTokenLink", +"ЗаполнитьДанныеПоСхеме": "FillDataBySchema", +"ВыполнитьЗапросБезТела": "ExecuteRequestWithoutBody", +"СформироватьКлавиатуру": "FormKeyboard", +"Установить цель канала": "Set channel purpose", +"Создает твит с опросом": "Creates a tweet with a poll", +"Массив файлов картинок": "Image files array", +"Проверка_ТелеграмОпрос": "Check_TelegramPoll", +"УдалитьТоварИзПодборки": "RemoveProductFromSelection", +"Получить токен по коду": "Get token by code", "Получает событие по ID": "Gets an event by ID", -"Пустое описание товара:": "Empty product description:", -"Получить\/Обновить токен": "Get\/Update token", -"ДФ=yyyy-MM-ddThh:mm:ssZ": "ISO8601Datetime", -"Какой ваш любимый цвет?": "What's your favorite color?", -"Создать свойство товара": "Create product property", -"Получить список свойств": "Get property list", -"Удалить свойство товара": "Delete product property", -"СкрытьГлавнуюТемуФорума": "HideMainForumTopic", -"Непредвиденная ошибка!:": "Unexpected Error!", -"Массив из Строка, Число": "Array of string, number", -"МаксимальнаяВложенность": "MaximumNesting", -"ГД_ЗагрузитьУдалитьФайл": "GD_UploadDeleteFile", +"Дата окончания периода": "End date of the period", +"Возвращаемое значение:": "Return value:", +"УстановитьТелоИзСтроки": "SetBodyFromString", +"Лайк\/Репост\/Комментарий": "Like\/Repost\/Comment", "ИзменитьПодборкуТоваров": "EditProductCollection", "Новая картинка подборки": "New selection image", -"Новое название подборки": "New selection name", -"Новое значение свойства": "New property value", -"Получить список заказов": "Get order list", -"Сформировать клавиатуру": "Create keyboard", -"Получить подборки по ID": "Get selections by ID", -"Действия с обсуждениями": "Actions with discussions", -"Лайк\/Репост\/Комментарий": "Like\/Repost\/Comment", -"ОпределитьМетодОтправки": "DetermineSendMethod", -"ПараметрыЗапросаВСтроку": "RequestParametersToString", -"ОтменитьПубликациюФайла": "CancelFilePublication", -"Создать\/Удалить событие": "Create\/Delete event", -"ПолучитьЧислоУчастников": "GetParticipantCount", -"Создать\/Удалить каталог": "Create\/Delete catalog", -"Не найден входной файл!": "Input File Not Found!", -"ПолучитьИнформациюОБоте": "GetBotInformation", -"Новый текст комментария": "New comment text", -"Библиотека: Yandex Disk": "Library: Yandex Disk", -"Путь к созаваемой папке": "Path to the created folder", +"ПолучитьКалендарьСписка": "GetListCalendar", +"Создать страницу в базу": "Create page in database", +"ГД_ЗагрузитьУдалитьФайл": "GD_UploadDeleteFile", +"Массив из Строка, Число": "Array of string, number", +"Удалить свойство товара": "Delete product property", +"Пустое описание товара:": "Empty product description:", +"Получить список свойств": "Get property list", +"УправлениеВнешнимФайлом": "ExternalFileManagement", +"Получить значения ячеек": "Get cell values", +"Идентификатор базы База": "Base identifier Base", "Вайбер_ОтправитьКонтакт": "Viber_SendContact", -"ПолучитьПубличныйОбъект": "GetPublicObject", -"ПолучитьЗначениеИзФайла": "GetValueFromFile", -"Получить историю канала": "Get channel history", -"ЗаписатьФайлыМультипарт": "WriteMultipartFiles", +"ПараметрыЗапросаВСтроку": "RequestParametersToString", +"СпособКодированияСтроки": "StringEncodingMethod", +"Вайбер_ОтправитьЛокацию": "Viber_SendLocation", +"ID файла для скачивания": "File ID for downloading", +"ОтменитьПубликациюПапки": "CancelFolderPublication", +"ЗагрузитьМассивВложений": "Upload attachments array", +"ПолучитьРазделительПути": "GetPathSeparator", +"Создать\/Удалить событие": "Create\/Delete event", +"Получить\/Обновить токен": "Get\/Update token", +"Какой ваш любимый цвет?": "What's your favorite color?", +"ВК_СоздатьТоварПодборку": "VK_CreateProductSelection", +"УникальныйИдентификатор": "UniqueIdentifier", "ЯДиск_ПереместитьОбъект": "YDisk_MoveObject", -"Telegram_ОтправитьГифку": "Telegram_SendGif", -"ПолучитьСписокКаталогов": "GetDirectoriesList", -"Телеграм_ОтправитьГифку": "Telegram_SendGIF", -"Telegram_ОтправитьАудио": "Telegram_SendAudio", -"Телеграм_ОтправитьАудио": "Telegram_SendAudio", +"Получить подборки по ID": "Get selections by ID", +"Массив вариантов опроса": "Poll options array", +"Получить список заказов": "Get order list", +"ПолучитьИнформациюОБоте": "GetBotInformation", +"Удаляет календарь по ID": "Deletes a calendar by ID", +"ДФ=yyyy-MM-ddTHH:mm:ssZ": "DF=yyyy-MM-ddTHH:mm:ssZ", +"Новое значение свойства": "New property value", +"Новое название подборки": "New selection name", +"Сформировать клавиатуру": "Create keyboard", +"ПолучитьОписаниеСобытия": "GetEventDescription", +"ЗаписатьФайлыМультипарт": "WriteMultipartFiles", +"СкрытьГлавнуюТемуФорума": "HideMainForumTopic", "Telegram_ОтправитьВидео": "Telegram_SendVideo", -"Телеграм_ОтправитьВидео": "Telegram_SendVideo", -"Слак_ЗагрузитьУдалитьВФ": "Slack_UploadDeleteExternalFile", +"Телеграм_ОтправитьАудио": "Telegram_SendAudio", +"OPI_ПреобразованиеТипов": "OPI_TypeConversion", +"Telegram_ОтправитьАудио": "Telegram_SendAudio", +"ПолучитьПубличныйОбъект": "GetPublicObject", "Наименование обсуждения": "Discussion name", "Текст первого сообщения": "Text of the first message", -"Telegram_УдалитьWebhook": "Telegram_DeleteWebhook", -"УстановитьЗначенияЯчеек": "SetCellValues", -"ВывестиСправкуПоМетодам": "DisplayMethodHelp", -"ДФ=yyyy-MM-ddTHH:mm:ssZ": "DF=yyyy-MM-ddTHH:mm:ssZ", -"Создать канал приватным": "Create channel as private", -"АТ_СоздатьУдалитьЗаписи": "AT_CreateDeleteRecords", +"ОтменитьПубликациюФайла": "CancelFilePublication", +"Слак_ЗагрузитьУдалитьВФ": "Slack_UploadDeleteExternalFile", +"Телеграм_ОтправитьГифку": "Telegram_SendGIF", +"Telegram_ОтправитьГифку": "Telegram_SendGif", "Телеграм_ОтправитьОпрос": "Telegram_SendPoll", -"Telegram_ОтправитьОпрос": "Telegram_SendPoll", -"Идентификатор базы База": "Base identifier Base", -"Массив ID пользователей": "User ID Array", -"ПолучитьОписаниеСобытия": "GetEventDescription", -"ID файла для скачивания": "File ID for downloading", -"Произвольный, HTTPОтвет": "Arbitrary, HTTP Response", -"ВК_СоздатьТоварПодборку": "VK_CreateProductSelection", -"СоединитьДвоичныеДанные": "JoinBinaryData", -"Твиттер_СоздатьТвитСГиф": "Twitter_CreateTweetWithGif", -"Наименование новой базы": "New base name", -"для дальнейших действий": "for further actions", -"СпособКодированияСтроки": "StringEncodingMethod", -"ТаблицаДляИспользования": "TableForUse", -"ПолучитьКалендарьСписка": "GetListCalendar", "Скопированный файл.jpeg": "CopiedFile.jpeg", -"Получить список записей": "Get list of records", -"МассивURLФайловВложений": "ArrayOfAttachmentURLs", -"УправлениеВнешнимФайлом": "ExternalFileManagement", -"OPI_ПреобразованиеТипов": "OPI_TypeConversion", -"VK_СоздатьСоставнойПост": "VK_CreateCompositePost", -"ВК_СоздатьСоставнойПост": "VK_CreateCompositePost", -"Удаляет календарь по ID": "Deletes a calendar by ID", -"Имя файла с расширением": "File name with extension", -"ПолучитьРазделительПути": "GetPathSeparator", -"Получить значения ячеек": "Get cell values", -"Получить список событий": "Get list of events", -"Проверка_ДвоичныеДанные": "Check_BinaryData", -"Проверка_ТелеграмИстина": "Check_TelegramTrue", -"Проверка_ДропБоксМассив": "Check_DropboxArray", -"Создать страницу в базу": "Create page in database", -"Получить список товаров": "Get product list", -"ИсключатьАрхивированные": "ExcludeArchived", -"Проверка_ДропБоксРабота": "Check_DropboxWork", -"Проверка_ДропБоксСтатус": "Check_DropboxStatus", -"ЗагрузитьМассивВложений": "Upload attachments array", -"СоздатьЗаголовкиЗапроса": "CreateRequestHeaders", -"ДропБокс_СоздатьКаталог": "Dropbox_CreateFolder", "ИзменитьКалендарьСписка": "EditListCalendar", -"Массив вариантов опроса": "Poll options array", -"ОбеспечитьПустойКаталог": "EnsureEmptyDirectory", -"СоздатьПроизвольныйТвит": "CreateCustomTweet", -"Массив вариантов ответа": "Array of answer options", -"Проверка_ТелеграмМассив": "Check_TelegramArray", -"РазделитьДвоичныеДанные": "SplitBinaryData", -"ОтправитьМестоположение": "SendLocation", -"УникальныйИдентификатор": "UniqueIdentifier", -"ОтменитьПубликациюПапки": "CancelFolderPublication", -"Вайбер_ОтправитьЛокацию": "Viber_SendLocation", -"ГенераторОтчетаПокрытия": "CoverageReportGenerator", -"СформироватьМассивМедиа": "FormMediaArray", -"Получить список каналов": "Get channel list", +"ПолучитьЧислоУчастников": "GetParticipantCount", +"ВК_СоздатьСоставнойПост": "VK_CreateCompositePost", +"Телеграм_ОтправитьВидео": "Telegram_SendVideo", +"VK_СоздатьСоставнойПост": "VK_CreateCompositePost", "Путь к объекту удаления": "Path to the object to delete", +"ОбеспечитьПустойКаталог": "EnsureEmptyDirectory", +"для дальнейших действий": "for further actions", +"Проверка_ДвоичныеДанные": "Check_BinaryData", +"РазделитьДвоичныеДанные": "SplitBinaryData", +"ДФ=yyyy-MM-ddThh:mm:ssZ": "ISO8601Datetime", +"Получить историю канала": "Get channel history", +"Проверка_ТелеграмИстина": "Check_TelegramTrue", +"ГенераторОтчетаПокрытия": "CoverageReportGenerator", +"Массив ID пользователей": "User ID Array", +"Проверка_ТелеграмМассив": "Check_TelegramArray", +"ДропБокс_СоздатьКаталог": "Dropbox_CreateFolder", +"Telegram_УдалитьWebhook": "Telegram_DeleteWebhook", +"Произвольный, HTTPОтвет": "Arbitrary, HTTP Response", +"ПолучитьЗначениеИзФайла": "GetValueFromFile", +"Создать канал приватным": "Create channel as private", +"ПолучитьСписокКаталогов": "GetDirectoriesList", +"МаксимальнаяВложенность": "MaximumNesting", +"ОпределитьМетодОтправки": "DetermineSendMethod", +"АТ_СоздатьУдалитьЗаписи": "AT_CreateDeleteRecords", +"Получить список событий": "Get list of events", +"Telegram_ОтправитьОпрос": "Telegram_SendPoll", +"Создать свойство товара": "Create product property", +"Библиотека: Yandex Disk": "Library: Yandex Disk", +"ТаблицаДляИспользования": "TableForUse", +"Проверка_ДропБоксРабота": "Check_DropboxWork", +"Проверка_ДропБоксМассив": "Check_DropboxArray", "ПолучитьСтатусОбработки": "GetProcessingStatus", -"Изменяет название канала": "Changes the name of the channel", -"ВК_ПолучитьСписокТоваров": "VK_GetProductList", -"Проверка_ТелеграмКонтакт": "Check_TelegramContact", -"Наименование нового поля": "New field name", -"ВК_ПолучитьСписокЗаказов": "VK_GetOrderList", -"ПолучитьПараметрыТвиттер": "GetTwitterParameters", -"ОписаниеПримитивногоПоля": "PrimitiveFieldDescription", -"Проверка_ДропбоксАккаунт": "Check_DropboxAccount", -"СоздатьВысокуюКлавиатуру": "CreateTallKeyboard", -"УдалитьКалендарьИзСписка": "DeleteCalendarFromList", -"СоздатьДлиннуюКлавиатуру": "CreateLongKeyboard", -"СформироватьТестыАссертс": "FormAssertsTests", -"Создает каталог на диске": "Creates a directory on the disk", +"Получить список товаров": "Get product list", +"Действия с обсуждениями": "Actions with discussions", +"Новый текст комментария": "New comment text", +"Наименование новой базы": "New base name", +"УстановитьЗначенияЯчеек": "SetCellValues", +"Получить список записей": "Get list of records", +"СформироватьМассивМедиа": "FormMediaArray", +"ВывестиСправкуПоМетодам": "DisplayMethodHelp", +"Проверка_ДропБоксСтатус": "Check_DropboxStatus", +"Твиттер_СоздатьТвитСГиф": "Twitter_CreateTweetWithGif", +"СоздатьЗаголовкиЗапроса": "CreateRequestHeaders", +"СоздатьПроизвольныйТвит": "CreateCustomTweet", +"Создать\/Удалить каталог": "Create\/Delete catalog", +"Не найден входной файл!": "Input File Not Found!", +"ОтправитьМестоположение": "SendLocation", +"МассивURLФайловВложений": "ArrayOfAttachmentURLs", +"СоединитьДвоичныеДанные": "JoinBinaryData", +"ИсключатьАрхивированные": "ExcludeArchived", +"Непредвиденная ошибка!:": "Unexpected Error!", +"Массив вариантов ответа": "Array of answer options", +"Путь к созаваемой папке": "Path to the created folder", +"Получить список каналов": "Get channel list", +"Имя файла с расширением": "File name with extension", +"АргументыКоманднойСтроки": "CommandLineArguments", "Набор тестов для YAxUnit": "Test suite for YAxUnit", "ДобавитьПараметрКартинки": "AddImageParameter", -"Новое описание календаря": "New calendar description", -"Отправить местоположение": "Send location", -"Строка, Массив из Строка": "String, Array of Strings", -"Массив заголовков кнопок": "Array of button titles", -"Новый тестовый заголовок": "NewTestTitle", -"СоздатьСсылкуПриглашение": "CreateInvitationLink", -"Dropbox_КопироватьОбъект": "Dropbox_CopyObject", -"СформироватьБлокКартинку": "GenerateImageBlock", -"ПолучитьКодПодтверждения": "GetConfirmationCode", -"Ноушн_СоздатьУдалитьБлок": "Notion_CreateDeleteBlock", -"ДропБокс_ПолучитьАккаунт": "Dropbox_GetAccount", -"Изменить свойство товара": "Edit product property", -"Создает пустой календарь": "Creates an empty calendar", -"ПолучитьСписокКалендарей": "GetCalendarList", -"ПолучитьИнформациюОДиске": "GetDiskInformation", -"ДобавитьКалендарьВСписок": "AddCalendarToList", "РаботаСУдаленнымиФайлами": "DeletedFilesManagement", -"Массив товаров или товар": "Array of products or product", -"ID пользователя адресата": "Recipient user ID", -"Библиотека: Google Drive": "Library: Google Drive", -"ПолучитьСтатистикуПостов": "GetPostStatistics", -"ДобавитьРодителяСтраницы": "AddPageParent", -"СоздатьРекламнуюКампанию": "CreateAdvertisingCampaign", -"Файл источник обновления": "File source for update", -"ПолучитьДвоичныеИлиПоток": "GetBinaryOrStream", -"ПолучитьСписокРазрешений": "GetPermissionsList", -"ИзменитьСвойстваСтраницы": "EditPageProperties", -"Данные файл для загрузки": "Data file for upload", -"Получить данные аккаунта": "Get account data", -"Создать\/Изменить таблицу": "Create\/Edit table", -"Получить список областей": "Get region list", -"Вайбер_ОтправитьКартинку": "Viber_SendImage", -"ПолучитьЗаголовкиЗапроса": "GetRequestHeaders", -"D:\\GD\\Мой диск\\data.json": "D:\\GD\\My Drive\\data.json", -"Признак рекламного поста": "Sign of an advertising post", -"ТекущаяУниверсальнаяДата": "CurrentUniversalDate", -"Путь к целевому каталогу": "Path to the target directory", -"Новый каталог размещения": "New parent directory", -"ГК_ПолучитьСписокСобытий": "GC_GetEventList", -"ОпределитьТекущуюКоманду": "DetermineCurrentCommand", -"АргументыКоманднойСтроки": "CommandLineArguments", -"ВывестиНачальнуюСтраницу": "DisplayStartPage", -"Ссылка (URL) под записью": "Link (URL) under the post", -"ДобавитьПараметрыКоманды": "AddCommandParameters", "Строка, Массив Из Строка": "String, Array of Strings", +"ВК_ПолучитьСписокТоваров": "VK_GetProductList", +"Файл источник обновления": "File source for update", +"Изменить свойство товара": "Edit product property", +"ВывестиНачальнуюСтраницу": "DisplayStartPage", +"Получить информацию бота": "Get bot information", +"СформироватьТестыАссертс": "FormAssertsTests", +"Создать товар и подборку": "Create product and selection", +"Новый каталог размещения": "New parent directory", +"Строка, Массив из Строка": "String, Array of Strings", +"Наименование нового поля": "New field name", +"Массив заголовков кнопок": "Array of button titles", +"ПолучитьКодПодтверждения": "GetConfirmationCode", +"ОписаниеПримитивногоПоля": "PrimitiveFieldDescription", +"УдалитьКалендарьИзСписка": "DeleteCalendarFromList", +"ИзменитьСвойстваСтраницы": "EditPageProperties", +"ПолучитьИнформациюОДиске": "GetDiskInformation", +"Создает каталог на диске": "Creates a directory on the disk", +"ДобавитьПараметрыКоманды": "AddCommandParameters", +"Путь к целевому каталогу": "Path to the target directory", +"Subsystem.OPI_Интеграция": "Subsystem.OPI_Integrations", +"Изменяет название канала": "Changes the name of the channel", +"СформироватьБлокКартинку": "GenerateImageBlock", +"ОпределитьТекущуюКоманду": "DetermineCurrentCommand", +"ПолучитьСписокКалендарей": "GetCalendarList", +"СоздатьРекламнуюКампанию": "CreateAdvertisingCampaign", "РазложитьОбъектыПодробно": "BreakDownObjectsInDetail", -"СохранитьКартинкуВАльбом": "SaveImageToAlbum", -"Путь к объекту оригинала": "Path to the original object", "Загрузить фото на сервер": "Upload photo to server", +"ПолучитьЗаголовкиЗапроса": "GetRequestHeaders", +"ПолучитьСписокРазрешений": "GetPermissionsList", +"Получить список областей": "Get region list", +"ПолучитьДвоичныеИлиПоток": "GetBinaryOrStream", +"Проверка_ТелеграмКонтакт": "Check_TelegramContact", +"ГК_СоздатьУдалитьСобытие": "GC_CreateDeleteEvent", +"ГК_ПолучитьСписокСобытий": "GC_GetEventList", +"ДобавитьРодителяСтраницы": "AddPageParent", +"Проверка_ДропбоксАккаунт": "Check_DropboxAccount", +"Новое описание календаря": "New calendar description", +"Вайбер_ОтправитьКартинку": "Viber_SendImage", +"Признак рекламного поста": "Sign of an advertising post", +"Ноушн_СоздатьУдалитьБлок": "Notion_CreateDeleteBlock", +"СоздатьСсылкуПриглашение": "CreateInvitationLink", +"СоздатьДлиннуюКлавиатуру": "CreateLongKeyboard", +"СоздатьВысокуюКлавиатуру": "CreateTallKeyboard", +"ПолучитьСтатистикуПостов": "GetPostStatistics", +"ТекущаяУниверсальнаяДата": "CurrentUniversalDate", +"ПолучитьПараметрыТвиттер": "GetTwitterParameters", +"Данные файл для загрузки": "Data file for upload", +"Отправить местоположение": "Send location", +"Создает пустой календарь": "Creates an empty calendar", +"ID целевого пользователя": "Target user ID", +"ВК_ПолучитьСписокСвойств": "VK_GetPropertyList", +"ID пользователя адресата": "Recipient user ID", "ОбработатьОшибочныйВывод": "HandleErrorOutput", "Создает новое обсуждение": "Creates a new discussion", -"ГК_СоздатьУдалитьСобытие": "GC_CreateDeleteEvent", -"ПреобразоватьДанныеФайла": "ConvertFileData", -"Создать товар и подборку": "Create product and selection", -"ВК_ПолучитьСписокСвойств": "VK_GetPropertyList", +"Путь к объекту оригинала": "Path to the original object", +"ДобавитьКалендарьВСписок": "AddCalendarToList", +"Создать\/Изменить таблицу": "Create\/Edit table", +"Массив товаров или товар": "Array of products or product", +"Ссылка (URL) под записью": "Link (URL) under the post", "Создать подборку товаров": "Create product selection", -"РаботаСПодборкамиТоваров": "ProductSelectionManagement", -"ID целевого пользователя": "Target user ID", +"ПреобразоватьДанныеФайла": "ConvertFileData", +"СохранитьКартинкуВАльбом": "SaveImageToAlbum", +"Получить данные аккаунта": "Get account data", +"D:\\GD\\Мой диск\\data.json": "D:\\GD\\My Drive\\data.json", +"ДропБокс_ПолучитьАккаунт": "Dropbox_GetAccount", "Получить список подборок": "Get selection list", -"Получить информацию бота": "Get bot information", -"ПолучениеДанныхИНастройка": "DataRetrievalAndSettings", +"Dropbox_КопироватьОбъект": "Dropbox_CopyObject", +"РаботаСПодборкамиТоваров": "ProductSelectionManagement", +"ВК_ПолучитьСписокЗаказов": "VK_GetOrderList", +"Библиотека: Google Drive": "Library: Google Drive", +"Новый тестовый заголовок": "NewTestTitle", "Создать произвольный твит": "Create custom tweet", -"ПоказыватьВыводНемедленно": "ShowOutputImmediately", -"Наименование нового листа": "NewSheetName", -"ИзменитьНаименованиеКниги": "EditBookTitle", -"ДобавитьЗаголовокСтраницы": "AddPageHeader", -"Статус : Соответствие": "Status : Map", -"URL для установки Webhook": "URL for setting up Webhook", -"Путь назначения для копии": "Destination path for the copy", -"Проверка_ДропбоксУчастник": "Check_DropboxMember", -"ДобавитьИдентификаторЧата": "AddChatIdentifier", -"Добавить\/Удалить картинку": "Add\/Delete image", -"РаботаСоСпискомКалендарей": "CalendarListManagement", +"Открытый пакет интеграций": "Open integrations package", +"МобильноеПриложениеКлиент": "MobileAppClient", +"УстановитьБезопасныйРежим": "SetSafeMode", "ПоказатьГлавнуюТемуФорума": "ShowMainForumTopic", -"См.ПолучитьОписаниеТовара": "See GetProductDescription", -"СоответствиеКомандМодулей": "ModuleCommandMapping", -"Архивирует активный канал": "Archives an active channel", -"ПолучитьСсылкуАвторизации": "GetAuthorizationLink", -"ЯДиск_СоздатьКопиюОбъекта": "YDisk_CreateObjectCopy", -"ОтменитьПубликациюОбъекта": "CancelObjectPublication", -"Проверка_ТелеграмКартинка": "Check_TelegramImage", -"Установить значения ячеек": "SetCellValues", +"ВыполнитьЗапросМультипарт": "ExecuteMultipartRequest", +"Наименование нового листа": "NewSheetName", +"Получить список каталогов": "Get list of directories", +"Некорректный вид отправки": "Incorrect sending view", +"Изменить имя главной темы": "Change main topic name", +"Путь назначения для копии": "Destination path for the copy", +"Создает пост с картинками": "Creates a post with images", "РаботаСРекламнымКабинетом": "AdAccountManagement", +"ДропБокс_РаботаСДоступами": "Dropbox_AccessManagement", +"МобильноеПриложениеСервер": "MobileAppServer", +"ИзменитьНаименованиеКниги": "EditBookTitle", "ПереключениеОбщегоДоступа": "TogglePublicAccess", -"Номер рекламной категории": "Advertising category number", -"Проверка_ТелеграмДокумент": "Check_TelegramDocument", -"Изменить подборку товаров": "Edit product selection", -"Получить публичный объект": "Get public object", +"Библиотека: Google Sheets": "Library: Google Sheets", +"Преобразовать код в токен": "Convert code to token", +"Устанавливает тему канала": "Sets the channel topic", +"OPI_ПолучениеДанныхТестов": "OPI_GetTestData", "Загрузить видео на сервер": "Upload video to server", +"СоответствиеКомандМодулей": "ModuleCommandMapping", +"Проверка_ТелеграмДокумент": "Check_TelegramDocument", +"Проверка_ТелеграмКартинка": "Check_TelegramImage", +"ЭкранированиеСимволовJSON": "EscapeJSONCharacters", +"Отменить публикацию файла": "Unpublish file", +"Получить число участников": "Get participant count", +"Статус : Соответствие": "Status : Map", +"Dropbox_ПереместитьОбъект": "Dropbox_MoveObject", +"Телеграм_ОтправитьКонтакт": "Telegram_SendContact", +"ПоказыватьВыводНемедленно": "ShowOutputImmediately", "Telegram_ОтправитьКонтакт": "Telegram_SendContact", -"Добавить товар в подборку": "Add product to selection", +"ОтменитьПубликациюОбъекта": "CancelObjectPublication", "Слак_ЗагрузитьУдалитьФайл": "Slack_UploadDeleteFile", "Слак_ПолучитьСписокФайлов": "Slack_GetFileList", -"ОчиститьОсновнойКалендарь": "ClearMainCalendar", +"Установить значения ячеек": "SetCellValues", "Слак_ОткрытьЗакрытьДиалог": "Slack_OpenCloseDialog", -"Dropbox_ОпубликоватьПапку": "Dropbox_PublishFolder", -"ДропБокс_РаботаСДоступами": "Dropbox_AccessManagement", -"Телеграм_ОтправитьКонтакт": "Telegram_SendContact", -"Преобразовать код в токен": "Convert code to token", -"Создает твит без вложений": "Creates a tweet without attachments", -"ВК_ПолучитьСписокПодборок": "VK_GetSelectionList", -"OPI_ПолучениеДанныхТестов": "OPI_GetTestData", -"Получить число участников": "Get participant count", -"Некорректный вид отправки": "Incorrect sending view", -"ПолучитьСсылкуНаСообщение": "GetMessageLink", -"Отменить публикацию файла": "Unpublish file", -"Твиттер_СоздатьТвитСВидео": "Twitter_CreateTweetWithVideo", -"Создать\/Удалить календарь": "Create\/Delete calendar", -"Получить список каталогов": "Get list of directories", -"ЭкранированиеСимволовJSON": "EscapeJSONCharacters", -"Тестовый товар измененный": "EditedTestProduct", -"ВыполнитьЗапросМультипарт": "ExecuteMultipartRequest", -"МобильноеПриложениеКлиент": "MobileAppClient", -"МобильноеПриложениеСервер": "MobileAppServer", -"Dropbox_ПереместитьОбъект": "Dropbox_MoveObject", -"Новый альбом из автотеста": "NewAlbumFromAutoTest", -"ВосстановитьОбъектКВерсии": "RestoreObjectToVersion", -"Изменить имя главной темы": "Change main topic name", -"Изменить календарь списка": "Edit list calendar", -"Заголовок файла для Slack": "File title for Slack", -"Заполнить\/Очистить ячейки": "Fill\/Clear cells", -"РаботаСоСвойствамиТоваров": "ProductPropertiesManagement", -"Удаляет комментарий по ID": "Deletes comment by ID", -"Устанавливает тему канала": "Sets the channel topic", -"См. ПолучитьОписаниеФайла": "See GetFileDescription", +"Получить публичный объект": "Get public object", "Идентификатор базы данных": "Database identifier", -"Копирует файл или каталог": "Copies file or directory", +"ВосстановитьОбъектКВерсии": "RestoreObjectToVersion", +"Заголовок файла для Slack": "File title for Slack", +"ДобавитьИдентификаторЧата": "AddChatIdentifier", "ПолучитьСписокФайловПапки": "GetListOfFolderFiles", -"ID пользователей(я) Viber": "Viber User(s) ID", -"Библиотека: Google Sheets": "Library: Google Sheets", -"ПолучитьИнформациюОКанале": "GetChannelInformation", +"ДобавитьЗаголовокСтраницы": "AddPageHeader", +"ОчиститьОсновнойКалендарь": "ClearMainCalendar", +"Проверка_ДропбоксУчастник": "Check_DropboxMember", "Ноушн_СоздатьИзменитьБазу": "Notion_CreateEditDatabase", -"Идентификатор комментария": "Comment identifier", -"Создает пост с картинками": "Creates a post with images", -"Получить календарь списка": "Get list calendar", -"Отменить публикацию папки": "Unpublish folder", -"ВыполнитьОбработкуКоманды": "ExecuteCommandProcessing", "РаботаСФайламиИКаталогами": "FileAndDirectoryManagement", +"РаботаСоСпискомКалендарей": "CalendarListManagement", +"Архивирует активный канал": "Archives an active channel", +"Удаляет комментарий по ID": "Deletes comment by ID", +"ПолучитьСсылкуНаСообщение": "GetMessageLink", +"ID пользователей(я) Viber": "Viber User(s) ID", +"ПолучитьИнформациюОКанале": "GetChannelInformation", +"Тестовый товар измененный": "EditedTestProduct", +"Создать\/Удалить календарь": "Create\/Delete calendar", +"ПолучитьСсылкуАвторизации": "GetAuthorizationLink", +"Получить календарь списка": "Get list calendar", +"ЯДиск_СоздатьКопиюОбъекта": "YDisk_CreateObjectCopy", +"URL для установки Webhook": "URL for setting up Webhook", +"Изменить подборку товаров": "Edit product selection", +"Добавить товар в подборку": "Add product to selection", "Удалить товар из подборки": "Remove product from selection", +"ПолучениеДанныхИНастройка": "DataRetrievalAndSettings", +"ВК_ПолучитьСписокПодборок": "VK_GetSelectionList", +"РаботаСоСвойствамиТоваров": "ProductPropertiesManagement", +"ВыполнитьОбработкуКоманды": "ExecuteCommandProcessing", +"Идентификатор комментария": "Comment identifier", +"Dropbox_ОпубликоватьПапку": "Dropbox_PublishFolder", +"Отменить публикацию папки": "Unpublish folder", +"Новый альбом из автотеста": "NewAlbumFromAutoTest", +"Изменить календарь списка": "Edit list calendar", +"Заполнить\/Очистить ячейки": "Fill\/Clear cells", +"Номер рекламной категории": "Advertising category number", "Создает новую базу данных": "Creates a new database", -"Telegram_УстановитьWebhook": "Telegram_SetWebhook", -"УдалитьПустыеКлючиЗначения": "RemoveEmptyKeyValues", -"МинимальныйРазмерДляПотока": "MinimumStreamSize", -"ЧислоСтандартныхПараметров": "NumberOfStandardParameters", -"Телеграм_УстановитьWebhook": "Telegram_SetWebhook", -"ПолучитьЗначенияРекурсивно": "GetValuesRecursively", -"ВывестиСправкуПоПараметрам": "DisplayParameterHelp", -"ОжидатьЗавершенияОбработки": "WaitForProcessingCompletion", -"Мне больше нравится желтый": "I like yellow more", -"ЯДиск_ЗагрузитьУдалитьФайл": "YDisk_UploadDeleteFile", -"Telegram_ОтправитьКартинку": "Telegram_SendPicture", -"Наименование новой таблицы": "New table name", -"ГД_ПолучитьСписокКаталогов": "GD_GetCatalogList", +"См. ПолучитьОписаниеФайла": "See GetFileDescription", +"Добавить\/Удалить картинку": "Add\/Delete image", +"См.ПолучитьОписаниеТовара": "See GetProductDescription", +"Твиттер_СоздатьТвитСВидео": "Twitter_CreateTweetWithVideo", +"Создает твит без вложений": "Creates a tweet without attachments", +"Копирует файл или каталог": "Copies file or directory", +"Создать\/Архивировать канал": "Create\/Archive channel", "Число знаков после запятой": "Number of decimal places", -"ПолучитьДанныеПользователя": "GetUserData", -"СлужебныеПроцедурыИФункции": "ServiceProceduresAndFunctions", "Получает комментарий по ID": "Gets comment by ID", -"ПолучитьСписокКомментариев": "GetCommentList", -"СформироватьЗначенияВыбора": "FormSelectionValues", -"Получает схему таблиц базы": "Gets the schema of base tables", -"ГТ_ЗаполнитьОчиститьЯчейки": "GT_FillClearCells", -"ВывестиСообщениеИсключения": "DisplayExceptionMessage", -"Получить список календарей": "Get list of calendars", -"Ноушн_СоздатьСтраницуВБазу": "Notion_CreatePageInDatabase", -"ПолучитьРезультатОбработки": "GetProcessingResult", -"Массив соответствий файлов": "Array of file mappings", -"Telegram_УдалитьТемуФорума": "Telegram_DeleteForumTopic", -"Telegram_ОткрытьТемуФорума": "Telegram_OpenForumTopic", -"Telegram_ЗакрытьТемуФорума": "Telegram_CloseForumTopic", -"Telegram_СоздатьТемуФорума": "Telegram_CreateForumTopic", -"Добавляет товар в подборку": "Adds a product to the selection", -"Слак_ПолучитьСписокКаналов": "Slack_GetChannelList", -"ЯДиск_ПолучитьСписокФайлов": "YDisk_GetFileList", -"Telegram_ОтправитьДокумент": "Telegram_SendDocument", -"Телеграм_ОтправитьДокумент": "Telegram_SendDocument", -"Описание тестового события": "TestEventDescription", -"Телеграм_ОтправитьКартинку": "Telegram_SendImage", -"Скрыть главную тему форума": "Hide main forum thread", -"Очищает значение в ячейках": "Clears the value in cells", -"НормализоватьТекстовыйВвод": "NormalizeTextInput", -"СоздатьРекламноеОбъявление": "CreateAd", -"Dropbox_ЗагрузитьФайлПоURL": "Dropbox_UploadFileByURL", -"ДропБокс_СоздатьУдалитьТег": "Dropbox_CreateDeleteTag", -"Получить категории товаров": "Get product categories", -"Dropbox_ПолчитьСписокТегов": "Dropbox_GetTagList", -"ЗаполнитьПоляЗапросаТовара": "FillProductRequestFields", -"Получить информацию о боте": "Get bot information", +"Проверка_ТелеграмСообщение": "Check_TelegramMessage", +"Телеграм_УстановитьWebhook": "Telegram_SetWebhook", "Структура Из КлючИЗначение": "Structure of Key-Value", -"ID оригинального сообщения": "Original message ID", -"Проверка_ТелеграмПереслать": "Check_TelegramForward", -"УдалитьПустыеПоляКоллекции": "RemoveEmptyCollectionFields", -"Создать рекламную кампанию": "Create advertising campaign", -"ДобавитьПользователяКФайлу": "AddUserToFile", -"Сформировать блок картинку": "Generate image block", +"ЯДиск_ПолучитьСписокФайлов": "YDisk_GetFileList", +"Ноушн_СоздатьСтраницуВБазу": "Notion_CreatePageInDatabase", +"СлужебныеПроцедурыИФункции": "ServiceProceduresAndFunctions", +"Telegram_УдалитьТемуФорума": "Telegram_DeleteForumTopic", +"Массив соответствий файлов": "Array of file mappings", +"КраткоеПредставлениеОшибки": "BriefErrorRepresentation", +"СлужебныеПроцедурыИфункции": "ServiceProceduresAndFunctions", +"ВывестиСообщениеИсключения": "DisplayExceptionMessage", +"Dropbox_ЗагрузитьФайлПоURL": "Dropbox_UploadFileByURL", +"ЯДиск_ЗагрузитьУдалитьФайл": "YDisk_UploadDeleteFile", +"ДропБокс_СоздатьУдалитьТег": "Dropbox_CreateDeleteTag", +"ОбработатьТабуляциюСправки": "HandleHelpTabulation", +"ПолучитьЗначенияРекурсивно": "GetValuesRecursively", +"Dropbox_ПолчитьСписокТегов": "Dropbox_GetTagList", +"Очищает значение в ячейках": "Clears the value in cells", +"Мне больше нравится желтый": "I like yellow more", +"ГТ_ЗаполнитьОчиститьЯчейки": "GT_FillClearCells", +"ПолучитьРезультатОбработки": "GetProcessingResult", "разрешение на методы Drive": "Drive methods permission", "ПолучитьИмяВременногоФайла": "GetTempFileName", -"Проверка_ТелеграмСообщение": "Check_TelegramMessage", -"Получить статистику постов": "Get post statistics", -"ОбработатьТабуляциюСправки": "HandleHelpTabulation", -"ПреобразоватьВариантВыбора": "ConvertSelectionOption", -"Путь сохранения на Dropbox": "Save path on Dropbox", -"Получить информацию канала": "Get channel info", +"Telegram_ОткрытьТемуФорума": "Telegram_OpenForumTopic", +"Проверка_ТелеграмПереслать": "Check_TelegramForward", +"Telegram_ЗакрытьТемуФорума": "Telegram_CloseForumTopic", +"Наименование новой таблицы": "New table name", +"Telegram_СоздатьТемуФорума": "Telegram_CreateForumTopic", +"Слак_ПолучитьСписокКаналов": "Slack_GetChannelList", "Получить информацию о базе": "Get database info", -"Изменить свойства страницы": "Edit page properties", -"ПреобразоватьПользователей": "ConvertUsers", -"Создать ссылку-приглашение": "Create invitation link", -"СлужебныеПроцедурыИфункции": "ServiceProceduresAndFunctions", -"КраткоеПредставлениеОшибки": "BriefErrorRepresentation", +"ЧислоСтандартныхПараметров": "NumberOfStandardParameters", "Проверка_ВККартинкаАльбома": "Check_VKAlbumPicture", -"Создать\/Архивировать канал": "Create\/Archive channel", -"Получить код подтверждения": "Get confirmation code", +"Получить информацию канала": "Get channel info", +"ГД_ПолучитьСписокКаталогов": "GD_GetCatalogList", +"Описание тестового события": "TestEventDescription", +"Получить статистику постов": "Get post statistics", +"Получить категории товаров": "Get product categories", +"УдалитьПустыеКлючиЗначения": "RemoveEmptyKeyValues", +"УдалитьПустыеПоляКоллекции": "RemoveEmptyCollectionFields", +"Telegram_ОтправитьДокумент": "Telegram_SendDocument", +"Телеграм_ОтправитьДокумент": "Telegram_SendDocument", +"ВывестиСправкуПоПараметрам": "DisplayParameterHelp", +"МинимальныйРазмерДляПотока": "MinimumStreamSize", "ГК_СоздатьУдалитьКалендарь": "GC_CreateDeleteCalendar", +"ДобавитьПользователяКФайлу": "AddUserToFile", +"ПолучитьСписокКомментариев": "GetCommentList", +"НормализоватьТекстовыйВвод": "NormalizeTextInput", +"Telegram_ОтправитьКартинку": "Telegram_SendPicture", +"Телеграм_ОтправитьКартинку": "Telegram_SendImage", +"Изменить свойства страницы": "Edit page properties", +"Telegram_УстановитьWebhook": "Telegram_SetWebhook", +"Получает схему таблиц базы": "Gets the schema of base tables", +"СоздатьРекламноеОбъявление": "CreateAd", +"СформироватьЗначенияВыбора": "FormSelectionValues", +"Создать ссылку-приглашение": "Create invitation link", +"Получить список календарей": "Get list of calendars", +"Получить информацию о боте": "Get bot information", +"ЗаполнитьПоляЗапросаТовара": "FillProductRequestFields", +"ПреобразоватьВариантВыбора": "ConvertSelectionOption", +"ПреобразоватьПользователей": "ConvertUsers", +"Скрыть главную тему форума": "Hide main forum thread", +"ID оригинального сообщения": "Original message ID", +"Путь сохранения на Dropbox": "Save path on Dropbox", +"Получить код подтверждения": "Get confirmation code", +"ОжидатьЗавершенияОбработки": "WaitForProcessingCompletion", +"Сформировать блок картинку": "Generate image block", +"ПолучитьДанныеПользователя": "GetUserData", +"Добавляет товар в подборку": "Adds a product to the selection", +"Создать рекламную кампанию": "Create advertising campaign", +"Массив соответствий событий": "Array of event mappings", +"СформироватьОписаниеТаблицы": "GenerateTableDescription", "Ноушн_ПолучитьПользователей": "Notion_GetUsers", -"ВернутьСтандартныеПараметры": "ReturnStandardParameters", -"Слак_ПолучитьСписокОбластей": "Slack_GetRegionList", -"Массив каналов для отправки": "Array of channels for sending", -"Telegram_ИзменитьТемуФорума": "Telegram_EditForumTopic", -"Проверка_ДропБоксМетаданные": "Check_DropboxMetadata", -"Создает историю из картинки": "Creates a story from an image", -"Удалить календарь из списка": "Remove calendar from list", -"ПолучитьСсылкуДляСкачивания": "GetDownloadLink", -"ОтправитьЭфемерноеСообщение": "SendEphemeralMessage", -"Создать\/Удалить кооментарий": "Create\/Delete Comment", -"Путь к файлу для скачивания": "Path to the file for downloading", -"ЗащищенноеСоединениеOpenSSL": "SecureConnectionOpenSSL", -"Библиотека: Google Calendar": "Library: Google Calendar", -"ВК_ПолучитьСтатистикуПостов": "VK_GetPostStatistics", -"Добавить календарь в список": "Add calendar to list", -"ПолучитьОнлайнПользователей": "GetOnlineUsers", -"Получить информацию о диске": "Get disk information", -"Отправить\/Удалить сообщение": "Send\/Delete message", -"Отправить\/Удалить эфемерное": "Send\/Delete ephemeral", -"ДобавитьПараметрФлагКоманды": "AddCommandFlagParameter", -"ЗаписатьБуферДвоичныхДанных": "WriteBinaryDataBuffer", -"ПолучитьСписокПользователей": "GetUserList", +"ЗаписатьПараметрыМультипарт": "WriteMultipartParameters", +"ПреобразоватьЗначениеПоТипу": "ConvertValueByType", +"ПолучитьСписокВнешнихФайлов": "GetExternalFileList", +"ВК_СохранитьУдалитьКартинку": "VK_SaveDeleteImage", +"Разложить JSON на параметры": "Parse JSON to Parameters", +"Очистить основной календарь": "Clear primary calendar", +"ИзменитьМетаданныеКалендаря": "EditCalendarMetadata", "Твиттер_СоздатьТвитСОпросом": "Twitter_CreateTweetWithPoll", +"ОтправитьТекстовоеСообщение": "SendTextMessage", +"Получить информацию о диске": "Get disk information", +"Путь к файлу для скачивания": "Path to the file for downloading", +"ПолучитьСсылкуДляСкачивания": "GetDownloadLink", +"Массив соответствий товаров": "Array of product matches", +"VK_СохранитьКартинкуВАльбом": "VK_SavePictureToAlbum", +"Создать\/Удалить тему форума": "Create\/Delete forum topic", +"НастройкиСовместногоДоступа": "SharedAccessSettings", +"Получить ссылку авторизации": "Get authorization link", +"ПолучитьМетаданныеКалендаря": "GetCalendarMetadata", +"Отправить\/Удалить эфемерное": "Send\/Delete ephemeral", +"Отправить\/Удалить сообщение": "Send\/Delete message", +"ДобавитьПользователейКФайлу": "AddUsersToFile", +"URL для перехода в браузере": "URL for browser transition", +"Создать\/Удалить кооментарий": "Create\/Delete Comment", +"OPI получение данных тестов": "OPI test data retrieval", "ВК_ПолучитьКатегорииТоваров": "VK_GetProductCategories", "Изменить наименование книги": "ChangeBookName", -"Временная отметка сообщения": "Message timestamp", -"ДобавитьПользователейКПапке": "AddUsersToFolder", -"VK_СохранитьКартинкуВАльбом": "VK_SavePictureToAlbum", -"ОтправитьТекстовоеСообщение": "SendTextMessage", -"ВК_СохранитьУдалитьКартинку": "VK_SaveDeleteImage", -"ВыгнатьПользователяИзКанала": "KickUserFromChannel", -"Получает информацию о файле": "Gets information about the file", -"Массив соответствий товаров": "Array of product matches", -"URL для кнопки под историей": "URL for button under the story", -"ПреобразоватьЗначениеПоТипу": "ConvertValueByType", -"Телеграм_ПолучитьОбновления": "Telegram_GetUpdates", "Код со страницы авторизации": "Code from the authorization page", +"Загрузить по URL и получить": "Upload by URL and get", +"Создать товар со свойствами": "Create product with properties", +"ГК_ПолучитьСписокКалендарей": "GC_GetCalendarList", +"Получает информацию о файле": "Gets information about the file", +"ПолучитьСписокПользователей": "GetUserList", +"ДобавитьПользователейКПапке": "AddUsersToFolder", +"ВК_СоздатьРекламнуюКампанию": "VK_CreateAdCampaign", +"ПолучитьИнформациюОбОбъекте": "GetObjectInformation", +"ВК_ПолучитьСтатистикуПостов": "VK_GetPostStatistics", +"Создет новое поле в таблице": "Creates a new field in the table", +"Слак_ПолучитьСписокОбластей": "Slack_GetRegionList", "ВК_СоздатьТоварСоСвойствами": "VK_CreateProductWithProperties", "Telegram_ПолучитьОбновления": "Telegram_GetUpdates", -"Сохранить картинку в альбом": "Save image to album", -"Тип отправляемого сообщения": "TypeOfSentMessage", -"ИзменитьМетаданныеКалендаря": "EditCalendarMetadata", -"Создать\/Удалить тему форума": "Create\/Delete forum topic", -"Массив соответствий событий": "Array of event mappings", "ДропБокс_ЗагрузитьФайлПоURL": "Dropbox_UploadFileByURL", -"Создет новое поле в таблице": "Creates a new field in the table", -"СформироватьМассивИменЯчеек": "FormCellNameArray", -"Создать товар со свойствами": "Create product with properties", -"ID стены расположения поста": "ID of the wall where the post is located", -"ДобавитьПользователейКФайлу": "AddUsersToFile", -"ID целевой стены или группы": "ID of the target wall or group", -"ПолучитьСтатусЗагрузкиПоURL": "GetUploadStatusByURL", -"ПолучитьМетаданныеКалендаря": "GetCalendarMetadata", -"ПолучитьСписокВнешнихФайлов": "GetExternalFileList", +"Путь к публикуемому объекту": "Path to the object to be published", "разрешение на методы Sheets": "Sheets methods permission", -"ГК_ПолучитьСписокКалендарей": "GC_GetCalendarList", -"СформироватьОписаниеТаблицы": "GenerateTableDescription", -"ВК_СоздатьРекламнуюКампанию": "VK_CreateAdCampaign", -"Получить ссылку авторизации": "Get authorization link", -"НастройкиСовместногоДоступа": "SharedAccessSettings", +"Отменить публикацию объекта": "Unpublish object", +"Telegram_ПереслатьСообщение": "Telegram_ForwardMessage", +"Телеграм_ПереслатьСообщение": "Telegram_ForwardMessage", +"ВыгнатьПользователяИзКанала": "KickUserFromChannel", +"Библиотека: Google Calendar": "Library: Google Calendar", +"ЗащищенноеСоединениеOpenSSL": "SecureConnectionOpenSSL", +"Массив каналов для отправки": "Array of channels for sending", +"ОтправитьЭфемерноеСообщение": "SendEphemeralMessage", +"Удалить картинку из альбома": "Deletes an image from the album", +"Сохранить картинку в альбом": "Save image to album", +"URL для кнопки под историей": "URL for button under the story", +"Создает историю из картинки": "Creates a story from an image", +"ПолучитьОнлайнПользователей": "GetOnlineUsers", +"Добавить календарь в список": "Add calendar to list", +"ПолучитьСписокВерсийОбъекта": "GetObjectVersionList", +"Удалить календарь из списка": "Remove calendar from list", +"ID альбома, если необходимо": "Album ID, if necessary", +"Проверка_ДропБоксМетаданные": "Check_DropboxMetadata", +"УправлениеПубличнымДоступом": "ManagePublicAccess", +"ЗаписатьБуферДвоичныхДанных": "WriteBinaryDataBuffer", +"ДобавитьПараметрФлагКоманды": "AddCommandFlagParameter", +"Telegram_ИзменитьТемуФорума": "Telegram_EditForumTopic", +"Ключ > ID, Значение > Emoji": "Key > ID, Value > Emoji", +"Тип отправляемого сообщения": "TypeOfSentMessage", +"ВернутьСтандартныеПараметры": "ReturnStandardParameters", +"Временная отметка сообщения": "Message timestamp", +"ID стены расположения поста": "ID of the wall where the post is located", +"ПолучитьСтатусЗагрузкиПоURL": "GetUploadStatusByURL", +"ID целевой стены или группы": "ID of the target wall or group", "Telegram_ОткрепитьСообщение": "Telegram_UnpinMessage", "Telegram_ЗакрепитьСообщение": "Telegram_PinMessage", -"Ключ > ID, Значение > Emoji": "Key > ID, Value > Emoji", -"ПолучитьИнформациюОбОбъекте": "GetObjectInformation", -"URL для перехода в браузере": "URL for browser transition", -"Очистить основной календарь": "Clear primary calendar", -"Телеграм_ПереслатьСообщение": "Telegram_ForwardMessage", -"Удалить картинку из альбома": "Deletes an image from the album", -"ЗаписатьПараметрыМультипарт": "WriteMultipartParameters", -"Telegram_ПереслатьСообщение": "Telegram_ForwardMessage", -"ПолучитьСписокВерсийОбъекта": "GetObjectVersionList", -"ID альбома, если необходимо": "Album ID, if necessary", -"Загрузить по URL и получить": "Upload by URL and get", -"Разложить JSON на параметры": "Parse JSON to Parameters", -"Отменить публикацию объекта": "Unpublish object", -"Путь к публикуемому объекту": "Path to the object to be published", -"УправлениеПубличнымДоступом": "ManagePublicAccess", +"Телеграм_ПолучитьОбновления": "Telegram_GetUpdates", +"СформироватьМассивИменЯчеек": "FormCellNameArray", +"Получить список внеш. файлов": "Get external file list", +"ПолучитьИнформациюОбАккаунте": "GetAccountInformation", +"Массив соответствий подборок": "Array of selection matches", +"ПолучитьСоответствиеКартинки": "GetImageCorrespondence", +"Массив сформированных кнопок": "Array of formed buttons", +"Проверка_ТелеграмПриглашение": "Check_TelegramInvitation", +"Библиотека: Google Workspace": "Library: Google Workspace", +"HEX цвет кнопок с # в начале": "HEX color of buttons with # at the beginning", +"СоздатьСсылкуПолученияТокена": "CreateTokenRetrievalLink", "Время ожидания новых событий": "Waiting time for new events", +"ГВ_ПолучитьСсылкуАвторизации": "GV_GetAuthorizationLink", +"Слак_ПолучитьИнформациюОБоте": "Slack_GetBotInfo", +"ГД_СоздатьУдалитьКомментарий": "GD_CreateDeleteComment", +"Скрыть\/Показать главную тему": "Hide\/Show main topic", +"Эти токены обновлять не надо": "These tokens do not need to be updated", "Обсуждаем: какой цвет лучше?": "Discussing: Which color is better?", -"Скрывает главную тему форума": "Hides the main forum thread", +"Загрузить\/Удалить внеш. файл": "Upload\/Delete external file", +"ПреобразоватьBase64ВДвоичные": "ConvertBase64ToBinary", +"СледующаяВложенностьДоступна": "NextNestingAvailable", +"ПолучитьЗаголовокАвторизации": "GetAuthorizationHeader", +"Создать рекламное объявление": "Create advertising post", +"Получить список файлов папки": "Get list of folder files", +"Получить информацию о канале": "Get channel information", +"Добавляет новый внешний файл": "Adds a new external file", +"Твиттер_СоздатьТекстовыйТвит": "Twitter_CreateTextTweet", +"Получить данные пользователя": "Get user data", +"Получить ссылку на сообщение": "Get message link", +"УдалитьПустыеЭлементыМассива": "RemoveEmptyArrayElements", "Создает новую таблицу в базе": "Creates a new table in the base", "Получить список комментариев": "Get list of comments", -"Массив сформированных кнопок": "Array of formed buttons", -"ПолучитьСписокИконокАватаров": "GetAvatarIconList", -"HEX цвет кнопок с # в начале": "HEX color of buttons with # at the beginning", -"Твиттер_СоздатьТекстовыйТвит": "Twitter_CreateTextTweet", -"СоздатьСсылкуПолученияТокена": "CreateTokenRetrievalLink", -"ПолучитьИнформациюОбАккаунте": "GetAccountInformation", "Восстановить объект к версии": "Restore object to version", -"ПреобразоватьBase64ВДвоичные": "ConvertBase64ToBinary", -"ГД_СоздатьУдалитьКомментарий": "GD_CreateDeleteComment", -"Получить список файлов папки": "Get list of folder files", -"Проверка_ТелеграмМедиагруппа": "Check_TelegramMediaGroup", -"Добавляет новый внешний файл": "Adds a new external file", -"УдалитьПустыеЭлементыМассива": "RemoveEmptyArrayElements", -"Создать рекламное объявление": "Create advertising post", -"Показать главную тему форума": "Show main forum thread", -"Получает информацию о канале": "Gets information about the channel", -"Получить данные пользователя": "Get user data", -"Отправить группу медиафайлов": "Send media group", -"JSON файлов или путь к .json": "File JSON or path to .json", -"Получить ссылку на сообщение": "Get message link", -"Скрыть\/Показать главную тему": "Hide\/Show main topic", -"ПодробноеПредставлениеОшибки": "DetailedErrorRepresentation", -"Библиотека: Google Workspace": "Library: Google Workspace", -"УдалитьВариантСвойстваТовара": "DeleteProductPropertyVariant", "ПреобразоватьПараметрВСтроку": "ConvertParameterToString", -"Проверка_ТелеграмПриглашение": "Check_TelegramInvitation", -"СледующаяВложенностьДоступна": "NextNestingAvailable", -"URL картинки иконки страницы": "URL of the page icon image", -"ПолучитьЗаголовокАвторизации": "GetAuthorizationHeader", -"РаботаСМетаданнымиКалендарей": "CalendarMetadataManagement", -"ИзменитьИмяГлавнойТемыФорума": "EditMainForumTopicName", -"Получает описание поля с URL": "Gets the description of a URL field", -"C:\\GDrive\\Мой диск\\data.json": "C:\\GDrive\\My Drive\\data.json", -"Слак_ПолучитьИнформациюОБоте": "Slack_GetBotInfo", -"Добавляет новый лист в книгу": "Adds a new sheet to the book", -"ГВ_ПолучитьСсылкуАвторизации": "GV_GetAuthorizationLink", -"Получить информацию о канале": "Get channel information", -"Эти токены обновлять не надо": "These tokens do not need to be updated", +"Проверка_ТелеграмМедиагруппа": "Check_TelegramMediaGroup", "JSON массива описаний блоков": "JSON array of block descriptions", -"Массив соответствий подборок": "Array of selection matches", +"C:\\GDrive\\Мой диск\\data.json": "C:\\GDrive\\My Drive\\data.json", +"Получает описание поля с URL": "Gets the description of a URL field", +"JSON файлов или путь к .json": "File JSON or path to .json", +"Скрывает главную тему форума": "Hides the main forum thread", +"Показать главную тему форума": "Show main forum thread", +"Добавляет новый лист в книгу": "Adds a new sheet to the book", +"URL картинки иконки страницы": "URL of the page icon image", +"CommonModule.OPI_Инструменты": "CommonModule.OPI_Tools", +"УдалитьВариантСвойстваТовара": "DeleteProductPropertyVariant", +"ИзменитьИмяГлавнойТемыФорума": "EditMainForumTopicName", +"Отправить группу медиафайлов": "Send media group", +"РаботаСМетаданнымиКалендарей": "CalendarMetadataManagement", +"ПодробноеПредставлениеОшибки": "DetailedErrorRepresentation", "ПолучитьСтандартныеПараметры": "GetStandardParameters", -"Загрузить\/Удалить внеш. файл": "Upload\/Delete external file", -"Получить список внеш. файлов": "Get external file list", -"ПолучитьСоответствиеКартинки": "GetImageCorrespondence", -"Удаляет внешний файл из Slack": "Deletes an external file from Slack", -"Ошибка в данных описания поля": "Error in field description data", -"Альтернативный текст картинки": "Alternate text of the image", -"ДобавитьВариантСвойстваТовара": "AddProductPropertyVariant", -"Твиттер_СоздатьТвитСКартинкой": "Twitter_CreateTweetWithImage", -"Получить отложенные сообщения": "Get scheduled messages", -"ID блока или сам блок образец": "Block ID or block sample itself", -"Удаляет ранее созданный товар": "Deletes a previously created product", -"Соответствие из КлючИЗначение": "Map from KeyAndValue", -"JSON описание товара или путь": "JSON description of the product or path", -"Получить данные о базе данных": "Get database information", -"ID подборки, если нужен отбор": "Selection ID, if filtering is needed", -"СлужебныйПрограммныйИнтерфейс": "ServiceProgramInterface", +"Получает информацию о канале": "Gets information about the channel", +"ПолучитьСписокИконокАватаров": "GetAvatarIconList", "URL картинки обложки страницы": "URL of the page cover image", -"СоздатьЗаголовокАвторизацииV2": "CreateAuthorizationHeaderV2", "Создает твит с видеовложением": "Creates a tweet with a video attachment", -"Получить статистику по постам": "Get post statistics", -"Добавить пользователя к файлу": "Add user to file", -"разрешение на методы Calendar": "Calendar methods permission", -"СоздатьЗаголовокАвторизацииV1": "CreateAuthorizationHeaderV1", -"СформироватьМассивДанныхЯчеек": "FormCellDataArray", -"Массив соответствий каталогов": "Array of directory mappings", -"Отбор по ID каталога родителя": "Filter by parent directory ID", -"Получить онлайн пользователей": "Get online users", -"app_id из настроек приложения": "app_id from application settings", -"ПолучитьТелоКакДвоичныеДанные": "GetBodyAsBinaryData", -"Закрывает существующий диалог": "Closes an existing dialog", -"Получить ссылку на скачивание": "Get download link", -"ПараметрыЗапросаВСоответствие": "RequestParametersToMatch", "Проверка_ДропбоксПространство": "Check_DropboxSpace", -"Telegram_ОтправитьМеидагруппу": "Telegram_SendMediaGroup", -"Телеграм_ОтправитьМедиагруппу": "Telegram_SendMediaGroup", -"Получает список доступных баз": "Gets the list of available bases", -"Проверка_ТелеграмСозданиеТемы": "Check_TelegramCreateTopic", -"Соответствие Из КлючИЗначение": "Key-Value Pair", -"Отправить эфемерное сообщение": "Send ephemeral message", -"Слак_СоздатьАрхивироватьКанал": "Slack_CreateArchiveChannel", -"Ноушн_ПолучитьИнформациюОБазе": "Notion_GetDatabaseInfo", -"ПолучитьСписокРабочихОбластей": "GetWorkspaceList", -"Отправить текстовое сообщение": "Send text message", -"ИзменитьВариантСвойстваТовара": "EditProductPropertyVariant", +"app_id из настроек приложения": "app_id from application settings", "ПригласитьПользователейВКанал": "InviteUsersToChannel", -"Изменяет существующее событие": "Edits an existing event", -"Получить список пользователей": "Get user list", +"ID блока или сам блок образец": "Block ID or block sample itself", +"разрешение на методы Calendar": "Calendar methods permission", +"Твиттер_СоздатьТвитСКартинкой": "Twitter_CreateTweetWithImage", +"ПолучитьСписокРабочихОбластей": "GetWorkspaceList", +"ID подборки, если нужен отбор": "Selection ID, if filtering is needed", "Закрепить\/Открепить сообщение": "Pin\/Unpin message", -"Ноушн_ИзменитьСвойстваСтраницы": "Notion_EditPageProperties", -"Создать\/Удалить составной пост": "Create\/Delete composite post", -"Получить описание файла !NOCLI": "Get file description !NOCLI", -"ТолстыйКлиентОбычноеПриложение": "ThickClientOrdinaryApplication", -"JSON описания или путь к .json": "JSON description or path to .json", -"Идентификатор удаляемого листа": "IdentifierOfSheetToDelete", -"Слак_ОтправитьУдалитьЭфемерное": "Slack_SendDeleteEphemeral", -"Слак_ОтправитьУдалитьСообщение": "Slack_SendDeleteMessage", +"Изменяет существующее событие": "Edits an existing event", +"Получить ссылку на скачивание": "Get download link", +"Telegram_ОтправитьМеидагруппу": "Telegram_SendMediaGroup", +"Получить данные о базе данных": "Get database information", +"Массив соответствий каталогов": "Array of directory mappings", +"CommonModule.OPI_Криптография": "CommonModule.OPI_Cryptography", +"Отправить эфемерное сообщение": "Send ephemeral message", +"Проверка_ТелеграмСозданиеТемы": "Check_TelegramCreateTopic", +"Телеграм_ОтправитьМедиагруппу": "Telegram_SendMediaGroup", +"ПараметрыЗапросаВСоответствие": "RequestParametersToMatch", +"Альтернативный текст картинки": "Alternate text of the image", +"Слак_СоздатьАрхивироватьКанал": "Slack_CreateArchiveChannel", +"ДобавитьВариантСвойстваТовара": "AddProductPropertyVariant", +"ИзменитьВариантСвойстваТовара": "EditProductPropertyVariant", +"Закрывает существующий диалог": "Closes an existing dialog", +"Получить отложенные сообщения": "Get scheduled messages", +"Ошибка в данных описания поля": "Error in field description data", +"JSON описание товара или путь": "JSON description of the product or path", +"СформироватьМассивДанныхЯчеек": "FormCellDataArray", +"Удаляет внешний файл из Slack": "Deletes an external file from Slack", +"Отбор по ID каталога родителя": "Filter by parent directory ID", +"Соответствие из КлючИЗначение": "Map from KeyAndValue", +"Получить онлайн пользователей": "Get online users", +"Удаляет ранее созданный товар": "Deletes a previously created product", +"СоздатьЗаголовокАвторизацииV2": "CreateAuthorizationHeaderV2", +"Получить список пользователей": "Get user list", +"Отправить текстовое сообщение": "Send text message", +"Получить статистику по постам": "Get post statistics", +"Ноушн_ПолучитьИнформациюОБазе": "Notion_GetDatabaseInfo", +"Получает список доступных баз": "Gets the list of available bases", +"Соответствие Из КлючИЗначение": "Key-Value Pair", +"ПолучитьТелоКакДвоичныеДанные": "GetBodyAsBinaryData", +"Добавить пользователя к файлу": "Add user to file", +"СоздатьЗаголовокАвторизацииV1": "CreateAuthorizationHeaderV1", +"СлужебныйПрограммныйИнтерфейс": "ServiceProgramInterface", +"ID события календаря источника": "ID of the source calendar event", +"Удаляет ранее созданный альбом": "Deletes a previously created album", +"Получить ссылку для скачивания": "Get download link", +"ПолучитьСписокКатегорийТоваров": "GetProductCategoryList", +"УстановитьТелоИзДвоичныхДанных": "SetBodyFromBinaryData", "Выгнать пользователя из канала": "Kick user from channel", -"СформироватьСтрокуВызоваМетода": "FormMethodCallString", "ДропБокс_ПолучитьОбновитьТокен": "Dropbox_GetUpdateToken", "ПолучитьСтрокуИзДвоичныхДанных": "GetStringFromBinaryData", -"МаксимальныйУровеньВложенности": "MaximumNestingLevel", -"ID события календаря источника": "ID of the source calendar event", -"Получить список опубликованных": "Get published list", -"УстановитьТелоИзДвоичныхДанных": "SetBodyFromBinaryData", -"Получить информацию о странице": "Get page info", -"Удаляет файл или каталог по ID": "Deletes file or directory by ID", -"ПолучитьСписокКатегорийТоваров": "GetProductCategoryList", -"Получить ссылку для скачивания": "Get download link", -"ЯДиск_ПолучитьИнформациюОДиске": "YDisk_GetDiskInfo", -"Изменяет ранее созданный товар": "Edits a previously created product", -"СохранитьПубличныйОбъектНаДиск": "SavePublicObjectToDisk", -"Получить список версий объекта": "Get list of object versions", -"Получить информацию об объекте": "Get object information", -"Размер файла в случае отправке": "File size in case of sending", -"Структура, Массив из Структура": "Structure, Array of Structures", -"ПолучитьДвоичныеДанныеИзСтроки": "GetBinaryDataFromString", -"ЗаполнитьПараметрыЗагрузкиФото": "FillPhotoUploadParameters", -"Путь или набору путей к файлам": "Path or set of paths to the files", -"Получить список внешних файлов": "Get list of external files", "УправлениеСостояниемТемыФорума": "ManageForumThreadState", -"Идентификатор записи в таблице": "Record identifier in the table", -"Добавить пользователей к папке": "Add users to folder", -"Удаляет ранее созданный альбом": "Deletes a previously created album", -"Целевой путь создания каталога": "Target path for creating the directory", +"Удаляет файл или каталог по ID": "Deletes file or directory by ID", +"JSON описания или путь к .json": "JSON description or path to .json", +"Ноушн_ИзменитьСвойстваСтраницы": "Notion_EditPageProperties", +"ЗаполнитьПараметрыЗагрузкиФото": "FillPhotoUploadParameters", +"Слак_ОтправитьУдалитьСообщение": "Slack_SendDeleteMessage", +"Путь или набору путей к файлам": "Path or set of paths to the files", "Нельзя замешивать разные типы!": "Different types cannot be mixed!", -"Не удалось записать файл лога!:": "Failed to write log file!:", -"Dropbox_ОтменитьПубликациюПапки": "Dropbox_CancelFolderPublication", -"Создает твит с вложением-гифкой": "Creates a tweet with a gif attachment", -"Получить статус загрузки по URL": "Get upload status by URL", -"Получает значения ячеек таблицы": "Gets cell values of the table", -"Получает список каталогов диска": "Gets the list of drive directories", -"Dropbox_ОтменитьПубликациюФайла": "Dropbox_CancelFilePublication", -"Телеграм_ПолучитьИнформациюБота": "Telegram_GetBotInfo", -"Telegram_ПолучитьИнформациюБота": "Telegram_GetBotInformation", +"Слак_ОтправитьУдалитьЭфемерное": "Slack_SendDeleteEphemeral", +"МаксимальныйУровеньВложенности": "MaximumNestingLevel", +"Получить список внешних файлов": "Get list of external files", +"Целевой путь создания каталога": "Target path for creating the directory", +"ПолучитьДвоичныеДанныеИзСтроки": "GetBinaryDataFromString", +"Получить список опубликованных": "Get published list", +"Получить описание файла !NOCLI": "Get file description !NOCLI", +"ТолстыйКлиентОбычноеПриложение": "ThickClientOrdinaryApplication", +"Структура, Массив из Структура": "Structure, Array of Structures", +"Получить информацию об объекте": "Get object information", +"Добавить пользователей к папке": "Add users to folder", +"Создать\/Удалить составной пост": "Create\/Delete composite post", +"Изменяет ранее созданный товар": "Edits a previously created product", +"ЯДиск_ПолучитьИнформациюОДиске": "YDisk_GetDiskInfo", +"Получить список версий объекта": "Get list of object versions", +"СформироватьСтрокуВызоваМетода": "FormMethodCallString", +"Идентификатор удаляемого листа": "IdentifierOfSheetToDelete", +"Идентификатор записи в таблице": "Record identifier in the table", +"СохранитьПубличныйОбъектНаДиск": "SavePublicObjectToDisk", +"Размер файла в случае отправке": "File size in case of sending", +"Получить информацию о странице": "Get page info", +"Получить список иконок-аватаров": "Get avatar icon list", "Функция вернула пустое значение": "Function Returned Empty Value", +"Проверка_ТелеграмИнформацияБота": "Check_TelegramBotInformation", +"ПарсерАргументовКоманднойСтроки": "CommandLineArgumentParser", +"Создает твит с вложением-гифкой": "Creates a tweet with a gif attachment", +"ЯДиск_ДействияПубличныхОбъектов": "YDisk_PublicObjectActions", +"Создает пустой каталог на диске": "Creates an empty directory on the drive", +"Проверка_ТелеграмУдалениеВебхук": "Check_TelegramWebhookDeletion", +"Получает значения ячеек таблицы": "Gets cell values of the table", +"Проверка_ТелеграмМестоположение": "Check_TelegramLocation", +"Путь назначение для перемещения": "Destination path for moving", +"Удалить вариант свойства товара": "Delete product property variant", +"Не удалось записать файл лога!:": "Failed to write log file!:", +"Добавляет текущего бота в канал": "Adds the current bot to the channel", +"См.ПолучитьСтандартныеПараметры": "See GetStandardParameters", +"VK_СоздатьСсылкуПолученияТокена": "VK_CreateTokenRetrievalLink", +"Удаляет текущего бота из канала": "Removes the current bot from the channel", "Телеграм_ИзменитьИмяГлавнойТемы": "Telegram_ChangeMainTopicName", -"Целевой путь для нового объекта": "Target path for the new object", "СформироватьСсылкуПолученияКода": "FormCodeRetrievalLink", "Массив из Строка,ДвоичныеДанные": "Array from String, BinaryData", -"Получить список аватаров форума": "Get forum avatars list", -"Проверка_ТелеграмУдалениеВебхук": "Check_TelegramWebhookDeletion", +"Получает список каталогов диска": "Gets the list of drive directories", "ПолучитьСписокЗаказовРекурсивно": "GetOrderListRecursively", -"Удалить вариант свойства товара": "Delete product property variant", -"ПреобразоватьМножественныйВыбор": "ConvertMultipleChoice", "Создает пустую подборку товаров": "Creates an empty product selection", -"Получить список иконок-аватаров": "Get avatar icon list", -"Действия с публичными объектами": "Actions with public objects", -"Получить информацию об аккаунте": "Get account information", -"Получает информацию об аккаунте": "Gets account information", -"Двоичные данные или пути к фото": "Binary Data or Photo Paths", -"Двоичные данные или путь к фото": "Binary data or path to photo", -"только конкретному пользователю": "only to a specific user", -"Проверка_ДропбоксПубличнаяПапка": "Check_DropboxPublicFolder", -"Получить ссылку для авторизации": "Get authorization link", -"См.ПолучитьСтандартныеПараметры": "See GetStandardParameters", -"ПолучитьСписокСобытийРекурсивно": "GetEventsListRecursively", -"Путь назначение для перемещения": "Destination path for moving", -"Загружает файл на облачный диск": "Uploads a file to the cloud drive", -"ПолучитьСписокТоваровРекурсивно": "GetProductListRecursively", -"Проверка_ТелеграмМестоположение": "Check_TelegramLocation", -"VK_СоздатьСсылкуПолученияТокена": "VK_CreateTokenRetrievalLink", -"ID чата оригинального сообщения": "Chat ID of the original message", -"Проверка_ТелеграмИнформацияБота": "Check_TelegramBotInformation", -"Добавляет текущего бота в канал": "Adds the current bot to the channel", "Проверка_ДропБоксПубличнаяПапка": "Check_DropboxPublicFolder", -"ЯДиск_ДействияПубличныхОбъектов": "YDisk_PublicObjectActions", -"ПарсерАргументовКоманднойСтроки": "CommandLineArgumentParser", -"Создать ссылку получения токена": "Create token retrieval link", -"Copyright (c) 2019, ООО 1С-Софт": "Copyright (c) 2019, LLC 1C-Soft", -"Создает пустой каталог на диске": "Creates an empty directory on the drive", -"Загружает файл на сервера Slack": "Uploads a file to Slack servers", -"Удаляет текущего бота из канала": "Removes the current bot from the channel", -"Обновляет двоичные данные файла": "Updates file binary data", +"Телеграм_ПолучитьИнформациюБота": "Telegram_GetBotInfo", +"Получить статус загрузки по URL": "Get upload status by URL", +"только конкретному пользователю": "only to a specific user", +"Целевой путь для нового объекта": "Target path for the new object", +"ПреобразоватьМножественныйВыбор": "ConvertMultipleChoice", +"ПолучитьСписокТоваровРекурсивно": "GetProductListRecursively", +"Получить список аватаров форума": "Get forum avatars list", "Отправка в канал или в чат бота": "Sending to channel or bot chat", -"Получить описание товара. !NOCLI": "Get product description. !NOCLI", -"Создает страницу в базе-родителе": "Creates a page in the parent database", -"ОпределитьМетодУправленияФорумом": "DetermineForumManagementMethod", -"ПриостановитьРекламноеОбъявление": "PauseAdvertisingAd", -"Массив ячеек вида А1 для очистки": "Array of cells like A1 to be cleared", -"Получить список рабочих областей": "Get workspace list", -"ДобавитьДополнительныеФотоТовара": "AddAdditionalProductPhotos", -"Получает список подборок товаров": "Gets the list of product selections", -"Отправляет гифку в чат или канал": "Sends a GIF to a chat or channel", -"Удаляет объект с облачного диска": "Deletes an object from the cloud drive", -"Вайбер_ПолучитьИнформациюОКанале": "Viber_GetChannelInfo", -"Количество возвращаемых объектов": "Number of returned objects", -"ПолучитьСписокАльбомовРекурсивно": "GetAlbumListRecursively", -"ПолучитьСписокОтветовНаСообщение": "GetMessageReplyList", -"Обновляет токен по Refresh token": "Updates token by Refresh token", -"См.ДобавитьВариантСвойстваТовара": "See AddPropertyVariant", -"Получает описание поля типа дата": "Gets the description of a date field", -"Массив из Строка, ДвоичныеДанные": "Array from String, BinaryData", -"Загрузить массив вложений !NOCLI": "Upload attachments array !NOCLI", -"Удаляет объект по заданному пути": "Deletes an object at the specified path", -"Путь к удаляемой папке или файлу": "Path to the folder or file to be deleted", -"ВыполнитьЗапросСДвоичнымиДанными": "ExecuteRequestWithBinaryData", -"Идентификатор файла или каталога": "Identifier of the file or folder", -"ЯДиск_ПолучитьСсылкуНаСкачивание": "YDisk_GetDownloadLink", -"Телеграм_ОтправитьМестоположение": "Telegram_SendLocation", -"Изменяет имя главной темы форума": "Edits the name of the main forum thread", -"JSON клавиатуры или путь к .json": "Keyboard JSON or path to .json", -"Ошибка в данных коллекции таблиц": "Error in table collection data", -"См. ПолучитьСписокИконокАватаров": "See GetAvatarIconList", -"ПолучитьСписокОбъектовРекурсивно": "GetObjectsListRecursively", -"Отправляет видео в чат или канал": "Sends a video to a chat or channel", -"Проверка_ТелеграмУстановкаВебхук": "Check_TelegramWebhookSetup", -"Изменить вариант свойства товара": "Edit product property variant", -"Ноушн_ПолучитьДанныеПользователя": "Notion_GetUserData", -"Добавить вариант свойства товара": "Add product property variant", -"Слак_ПолучитьСписокПользователей": "Slack_GetUserList", -"Telegram_СкрытьГлавнуюТемуФорума": "Telegram_HideMainForumTopic", -"Telegram_ОтправитьМестоположение": "Telegram_SendLocation", -"ПолучитьСписокРекламныхКатегорий": "GetAdvertisingCategoryList", -"Отправка в канал или чат с ботом": "Sending to channel or bot chat", -"Получить описание события !NOCLI": "Get event description !NOCLI", -"Идентификатор изменяемого товара": "Identifier of the product being edited", +"ID чата оригинального сообщения": "Chat ID of the original message", +"Двоичные данные или путь к фото": "Binary data or path to photo", +"Двоичные данные или пути к фото": "Binary Data or Photo Paths", +"Создать ссылку получения токена": "Create token retrieval link", +"ПолучитьСписокСобытийРекурсивно": "GetEventsListRecursively", +"Telegram_ПолучитьИнформациюБота": "Telegram_GetBotInformation", +"Загружает файл на облачный диск": "Uploads a file to the cloud drive", +"Получает информацию об аккаунте": "Gets account information", +"Действия с публичными объектами": "Actions with public objects", +"Dropbox_ОтменитьПубликациюФайла": "Dropbox_CancelFilePublication", +"Получить ссылку для авторизации": "Get authorization link", +"Получить информацию об аккаунте": "Get account information", +"Copyright (c) 2019, ООО 1С-Софт": "Copyright (c) 2019, LLC 1C-Soft", +"Проверка_ДропбоксПубличнаяПапка": "Check_DropboxPublicFolder", +"Загружает файл на сервера Slack": "Uploads a file to Slack servers", +"Dropbox_ОтменитьПубликациюПапки": "Dropbox_CancelFolderPublication", +"Обновляет двоичные данные файла": "Updates file binary data", "Закрывает или удаляет обсуждение": "Close or delete discussion", "Пригласить пользователей в канал": "Invite users to channel", +"Удаляет объект с облачного диска": "Deletes an object from the cloud drive", +"ПолучитьСписокОтветовНаСообщение": "GetMessageReplyList", +"Массив ячеек вида А1 для очистки": "Array of cells like A1 to be cleared", +"Телеграм_ОтправитьМестоположение": "Telegram_SendLocation", "Telegram_ПолучитьЧислоУчастников": "Telegram_GetParticipantCount", -"Слак_ПолучитьОтложенныеСообщения": "Slack_GetScheduledMessages", +"Проверка_ТелеграмУстановкаВебхук": "Check_TelegramWebhookSetup", +"Telegram_ОтправитьМестоположение": "Telegram_SendLocation", +"ВыполнитьЗапросСДвоичнымиДанными": "ExecuteRequestWithBinaryData", "Телеграм_ПолучитьЧислоУчастников": "Telegram_GetMemberCount", +"МинимальныйРазмерДляПотока Тогда": "MinimumStreamSize Then", +"Слак_ПолучитьОтложенныеСообщения": "Slack_GetScheduledMessages", +"ПриостановитьРекламноеОбъявление": "PauseAdvertisingAd", +"Получить описание события !NOCLI": "Get event description !NOCLI", +"ПолучитьСписокОбъектовРекурсивно": "GetObjectsListRecursively", +"ПолучитьСписокРекламныхКатегорий": "GetAdvertisingCategoryList", +"Путь к удаляемой папке или файлу": "Path to the folder or file to be deleted", +"Отправка в канал или чат с ботом": "Sending to channel or bot chat", +"Получает описание поля типа дата": "Gets the description of a date field", +"ОпределитьМетодУправленияФорумом": "DetermineForumManagementMethod", +"Отправляет видео в чат или канал": "Sends a video to a chat or channel", +"Отправляет гифку в чат или канал": "Sends a GIF to a chat or channel", +"Ошибка в данных коллекции таблиц": "Error in table collection data", +"См.ДобавитьВариантСвойстваТовара": "See AddPropertyVariant", "Изменить имя главной темы форума": "Edit main forum thread name", -"Твиттер_ПолучитьСсылкуАвторизации": "Twitter_GetAuthorizationLink", -"ПолучитьДвоичныеДанныеИзHexСтроки": "GetBinaryDataFromHexString", +"Получить список рабочих областей": "Get workspace list", +"Изменяет имя главной темы форума": "Edits the name of the main forum thread", +"Идентификатор изменяемого товара": "Identifier of the product being edited", +"Создает страницу в базе-родителе": "Creates a page in the parent database", +"ДобавитьДополнительныеФотоТовара": "AddAdditionalProductPhotos", +"Удаляет объект по заданному пути": "Deletes an object at the specified path", +"Загрузить массив вложений !NOCLI": "Upload attachments array !NOCLI", +"Массив из Строка, ДвоичныеДанные": "Array from String, BinaryData", +"Изменить вариант свойства товара": "Edit product property variant", +"Добавить вариант свойства товара": "Add product property variant", +"Telegram_СкрытьГлавнуюТемуФорума": "Telegram_HideMainForumTopic", +"ЯДиск_ПолучитьСсылкуНаСкачивание": "YDisk_GetDownloadLink", +"См. ПолучитьСписокИконокАватаров": "See GetAvatarIconList", +"Количество возвращаемых объектов": "Number of returned objects", +"Обновляет токен по Refresh token": "Updates token by Refresh token", +"Ноушн_ПолучитьДанныеПользователя": "Notion_GetUserData", +"ПолучитьСписокАльбомовРекурсивно": "GetAlbumListRecursively", +"Слак_ПолучитьСписокПользователей": "Slack_GetUserList", +"Вайбер_ПолучитьИнформациюОКанале": "Viber_GetChannelInfo", +"Идентификатор файла или каталога": "Identifier of the file or folder", +"JSON клавиатуры или путь к .json": "Keyboard JSON or path to .json", +"Получает список подборок товаров": "Gets the list of product selections", +"Получить описание товара. !NOCLI": "Get product description. !NOCLI", "ПолучитьСоответствиеКомандМодулей": "GetCommandModuleMapping", -"Запрос, приходящий на http-сервис": "Request coming to the http service", -"Предпочтительное хранение токенов": "Preferred token storage", -"Скачивает файл по указанному пути": "Downloads a file at the specified path", -"РежимВосстановленияПутейФайловZIP": "ZIPFilePathRecoveryMode", -"JSON авторизации или путь к .json": "Authorization JSON or path to .json", -"Dropbox_ПолучитьСписокФайловПапки": "Dropbox_GetFolderFileList", -"Путь помещения загруженного файла": "Path to place the downloaded file", -"сериализованный JSON ответа от VK": "Serialized JSON response from VK", -"ПолучитьСписокОтложенныхСообщений": "GetDelayedMessageList", -"Ноушн_ПолучитьИнформациюОСтранице": "Notion_GetPageInfo", -"Получить список категорий товаров": "Get a list of product categories", -"Telegram_СоздатьСсылкуПриглашение": "Telegram_CreateInviteLink", -"Получает информацию о книге по ID": "Gets information about the book by ID", -"Dropbox_ВосстановитьОбъектКВерсии": "Dropbox_RestoreObjectToVersion", -"Телеграм_СоздатьСсылкуПриглашение": "Telegram_CreateInvitationLink", -"ПолучитьHexСтрокуИзДвоичныхДанных": "GetHexStringFromBinaryData", -"v1.1. Поэтому что-то нужно делать": "v1.1. Therefore, something needs to be done", -"Закрепляет сообщение в шапке чата": "Pins a message in the chat header", -"Создает опрос с вариантами ответа": "Creates a poll with answer options", -"Открепляет сообщение в шапке чата": "Unpins a message in the chat header", "Вайбер_ПолучитьДанныеПользователя": "Viber_GetUserData", "Получает список доступных каналов": "Gets a list of available channels", -"Dropbox_ПолучитьСсылкуАвторизации": "Dropbox_GetAuthorizationLink", -"ВыполнитьЗапросМультипартРелэйтед": "ExecuteMultipartRelatedRequest", "Ссылка на страницу сайта магазина": "Link to the store's website page", +"сериализованный JSON ответа от VK": "Serialized JSON response from VK", +"Предпочтительное хранение токенов": "Preferred token storage", "ПолучитьСписокПользователейКанала": "GetChannelUserList", +"Запрос, приходящий на http-сервис": "Request coming to the http service", +"JSON авторизации или путь к .json": "Authorization JSON or path to .json", +"ПолучитьДвоичныеДанныеИзHexСтроки": "GetBinaryDataFromHexString", +"v1.1. Поэтому что-то нужно делать": "v1.1. Therefore, something needs to be done", +"Dropbox_ПолучитьСсылкуАвторизации": "Dropbox_GetAuthorizationLink", +"Телеграм_СоздатьСсылкуПриглашение": "Telegram_CreateInvitationLink", +"Dropbox_ПолучитьСписокФайловПапки": "Dropbox_GetFolderFileList", +"Закрепляет сообщение в шапке чата": "Pins a message in the chat header", +"Скачивает файл по указанному пути": "Downloads a file at the specified path", +"ПолучитьHexСтрокуИзДвоичныхДанных": "GetHexStringFromBinaryData", +"Получить список категорий товаров": "Get a list of product categories", +"РежимВосстановленияПутейФайловZIP": "ZIPFilePathRecoveryMode", +"Telegram_СоздатьСсылкуПриглашение": "Telegram_CreateInviteLink", +"Твиттер_ПолучитьСсылкуАвторизации": "Twitter_GetAuthorizationLink", +"Получает информацию о книге по ID": "Gets information about the book by ID", +"Dropbox_ВосстановитьОбъектКВерсии": "Dropbox_RestoreObjectToVersion", +"ПолучитьСписокОтложенныхСообщений": "GetDelayedMessageList", +"Создает опрос с вариантами ответа": "Creates a poll with answer options", +"ВыполнитьЗапросМультипартРелэйтед": "ExecuteMultipartRelatedRequest", +"Путь помещения загруженного файла": "Path to place the downloaded file", +"Ноушн_ПолучитьИнформациюОСтранице": "Notion_GetPageInfo", "Телеграм_СоздатьУдалитьТемуФорума": "Telegram_CreateDeleteForumTopic", -"Изменяет свойства подборки товаров": "Edits the properties of a product selection", -"Идентификатор объекта для удаления": "Identifier of the object to delete", -"Получает список товаров сообщества": "Gets the community's product list", -"Закрывает тему для новых сообщений": "Closes the thread for new messages", -"Получает данные пользователя по ID": "Gets user data by ID", -"СформироватьПараметрыЗагрузкиФайла": "FormFileUploadParameters", -"ТолстыйКлиентУправляемоеПриложение": "ThickClientManagedApplication", -"ЗаписатьПобитовоеИсключительноеИли": "WriteBitwiseExclusiveOr", -"Вайбер_ПолучитьОнлайнПользователей": "Viber_GetOnlineUsers", -"Путь для сохранение файла на Диске": "Path for saving the file to disk", -"Временная отметка или ID сообщения": "Timestamp or message ID", -"Текст лицензии доступен по ссылке:": "License text available at:", -"Идентификатор обновляемого объекта": "Identifier of the object to update", -"Расширение файла в случае отправки": "File extension in case of sending", -"См. ПолучитьСписокКатегорийТоваров": "See GetProductCategoryList", -"Вайбер_ОтправитьТекстовоеСообщение": "Viber_SendTextMessage", -"ЯДиск_ПолучитьСписокОпубликованных": "YDisk_GetPublishedList", -"ID целевого чата или IDЧата*IDТемы": "Target chat ID or ChatID*TopicID", -"Сохранить публичный объект на диск": "Save public object to disk", -"querry из Telegram.WebApp.initData": "Query from Telegram.WebApp.initData", -"Сформировать ссылку получения кода": "Generate code retrieval link", -"ДропБокс_ПолучитьСписокФайловПапки": "Dropbox_GetFolderFileList", -"ДобавитьИменованныйПараметрКоманды": "AddNamedCommandParameter", -"Приостановить рекламное объявление": "Pause advertising post", -"Получает описание поля типа булево": "Gets the description of a boolean field", -"ПолучитьСписокКалендарейРекурсивно": "GetCalendarsListRecursively", -"ОбработатьДанные Telegram Mini App": "Process Telegram Mini App data", -"Создает твит с картинкой вложением": "Creates a tweet with an image attachment", +"Открепляет сообщение в шапке чата": "Unpins a message in the chat header", "что обсуловлено наличием сразу 2-х": "which is due to the presence of two at once", -"Соответствие изменяемых параметров": "Matching of editable parameters", -"ОпределитьМетодЗагрузкиИзображений": "DetermineImageUploadMethod", -"Телеграм_СкрытьПоказатьГлавнуюТему": "Telegram_HideShowMainTopic", -"Telegram_ПоказатьГлавнуюТемуФорума": "Telegram_ShowMainForumTopic", +"ПолучитьСписокКалендарейРекурсивно": "GetCalendarsListRecursively", +"Создает твит с картинкой вложением": "Creates a tweet with an image attachment", +"Закрывает тему для новых сообщений": "Closes the thread for new messages", +"Временная отметка или ID сообщения": "Timestamp or message ID", +"ID целевого чата или IDЧата*IDТемы": "Target chat ID or ChatID*TopicID", +"СформироватьПараметрыЗагрузкиФайла": "FormFileUploadParameters", +"querry из Telegram.WebApp.initData": "Query from Telegram.WebApp.initData", "Скачивает файл с серверов Telegram": "Download file from Telegram servers", -"Массив данных статистики по постам": "Array of post statistics data", -"ДобавитьПозиционныйПараметрКоманды": "AddPositionalCommandParameter", +"ОбработатьДанные Telegram Mini App": "Process Telegram Mini App data", +"ТолстыйКлиентУправляемоеПриложение": "ThickClientManagedApplication", "Устанавливает значения ячеек листа": "Sets sheet cell values", -"Получает информацию о текущем диске": "Gets information about the current disk", -"ПолучитьСтатусАсинхронногоИзменения": "GetAsynchronousChangeStatus", -"Создает сокращенный URL из обычного": "Creates a shortened URL from a regular one", -"Идентификатор рабочего пространства": "Workspace identifier", -"Отправляет документ в чат или канал": "Sends a document to a chat or channel", -"Получает основную информацию о боте": "Gets basic information about the bot", -"Банит пользователя в выбранном чате": "Bans a user in the selected chat", -"Открывает ранее закрытое обсуждение": "Opens a previously closed discussion", -"Получает информацию событиях канала": "Gets information about channel events", -"Отправляет картинку в чат или канал": "Sends an image to a chat or channel", -"Получает массив календарей аккаунта": "Gets an array of account calendars", -"Получает информацию о внешнем файле": "Gets information about the external file", -"ID темы. Главная, если не заполнено": "Thread ID. Main if not filled", -"Типы: audio, document, photo, video": "Types: audio, document, photo, video", -"Dropbox_ПолучитьИнформациюОбОбъекте": "Dropbox_GetObjectInformation", -"Dropbox_ПолучитьСписокВерсийОбъекта": "Dropbox_GetObjectVersionList", -"Получить список рекламных категорий": "Get a list of advertising categories", -"Изменяет свойства существующей базы": "Edits properties of an existing database", -"Dropbox_ДобавитьПользователейКПапке": "Dropbox_AddUsersToFolder", +"ДобавитьИменованныйПараметрКоманды": "AddNamedCommandParameter", +"Расширение файла в случае отправки": "File extension in case of sending", +"Сформировать ссылку получения кода": "Generate code retrieval link", +"Telegram_ПоказатьГлавнуюТемуФорума": "Telegram_ShowMainForumTopic", +"Путь для сохранение файла на Диске": "Path for saving the file to disk", +"ОпределитьМетодЗагрузкиИзображений": "DetermineImageUploadMethod", +"Идентификатор объекта для удаления": "Identifier of the object to delete", +"Получает описание поля типа булево": "Gets the description of a boolean field", +"Массив данных статистики по постам": "Array of post statistics data", +"Соответствие изменяемых параметров": "Matching of editable parameters", +"Телеграм_СкрытьПоказатьГлавнуюТему": "Telegram_HideShowMainTopic", +"Приостановить рекламное объявление": "Pause advertising post", +"Получает список товаров сообщества": "Gets the community's product list", +"Текст лицензии доступен по ссылке:": "License text available at:", +"Изменяет свойства подборки товаров": "Edits the properties of a product selection", +"См. ПолучитьСписокКатегорийТоваров": "See GetProductCategoryList", +"ЗаписатьПобитовоеИсключительноеИли": "WriteBitwiseExclusiveOr", +"ЯДиск_ПолучитьСписокОпубликованных": "YDisk_GetPublishedList", +"Вайбер_ПолучитьОнлайнПользователей": "Viber_GetOnlineUsers", +"Вайбер_ОтправитьТекстовоеСообщение": "Viber_SendTextMessage", +"Получает данные пользователя по ID": "Gets user data by ID", +"ДропБокс_ПолучитьСписокФайловПапки": "Dropbox_GetFolderFileList", +"ДобавитьПозиционныйПараметрКоманды": "AddPositionalCommandParameter", +"Идентификатор обновляемого объекта": "Identifier of the object to update", +"Сохранить публичный объект на диск": "Save public object to disk", "ПолучитьБуферДвоичныхДанныхИзСтроки": "GetBinaryDataBufferFromString", -"Dropbox_ДобавитьПользователейКФайлу": "Dropbox_AddUsersToFile", -"Строка,Число,Массив из Строка,Число": "String,Number,Array of String,Number", +"ПолучитьСтатусАсинхронногоИзменения": "GetAsynchronousChangeStatus", +"ID темы. Главная, если не заполнено": "Thread ID. Main if not filled", "ID родительского блока или страницы": "Parent block or page ID", +"Получает информацию о текущем диске": "Gets information about the current disk", +"Отправляет документ в чат или канал": "Sends a document to a chat or channel", +"Получает массив календарей аккаунта": "Gets an array of account calendars", +"Получить список рекламных категорий": "Get a list of advertising categories", +"Идентификатор рабочего пространства": "Workspace identifier", +"Отправляет картинку в чат или канал": "Sends an image to a chat or channel", +"Открывает ранее закрытое обсуждение": "Opens a previously closed discussion", +"Банит пользователя в выбранном чате": "Bans a user in the selected chat", +"Получает информацию о внешнем файле": "Gets information about the external file", +"Типы: audio, document, photo, video": "Types: audio, document, photo, video", +"Dropbox_ДобавитьПользователейКФайлу": "Dropbox_AddUsersToFile", +"Создает сокращенный URL из обычного": "Creates a shortened URL from a regular one", +"Получает основную информацию о боте": "Gets basic information about the bot", +"Изменяет свойства существующей базы": "Edits properties of an existing database", "Наименование создаваемого календаря": "Name of the created calendar", "Dropbox_ПолучитьСтатусЗагрузкиПоURL": "Dropbox_GetUploadStatusByURL", -"Возвращает список заказов сообщества": "Returns the community's order list", -"Telegram_ОтправитьТекстовоеСообщение": "Telegram_SendTextMessage", -"Отправляет аудиофайл в чат или канал": "Sends an audio file to a chat or channel", -"ПолучитьСоответствиеПараметровТовара": "GetProductParameterMapping", -"Путь к оригинальному файлу или папке": "Path to the original file or folder", -"Dropbox_ПолучитьИнформациюОбАккаунте": "Dropbox_GetAccountInformation", -"Результат чтения JSON ответа сервера": "Result of reading the JSON response from the server", -"Удаляет существующее свойство товара": "Deletes the existing product property", -"Создает альбом для хранения картинок": "Creates an album to store images", -"ПолучитьСписокОпубликованныхОбъектов": "GetPublishedObjectsList", -"Перемещает объект по выбранному пути": "Moves an object to the selected path", -"Телеграм_ЗакрепитьОткрепитьСообщение": "Telegram_PinUnpinMessage", +"Строка,Число,Массив из Строка,Число": "String,Number,Array of String,Number", +"Dropbox_ДобавитьПользователейКПапке": "Dropbox_AddUsersToFolder", +"Dropbox_ПолучитьСписокВерсийОбъекта": "Dropbox_GetObjectVersionList", +"Dropbox_ПолучитьИнформациюОбОбъекте": "Dropbox_GetObjectInformation", +"Получает информацию событиях канала": "Gets information about channel events", "Получает общее число участников чата": "Gets the total number of chat participants", -"Телеграм_ОтправитьТекстовоеСообщение": "Telegram_SendTextMessage", -"Удаляет комментарий к записи таблицы": "Deletes a comment for a table record", -"Получает статистику в разрезе постов": "Gets statistics in terms of posts", -"Получить список ответов на сообщение": "Get list of message replies", "Главный в группе, если есть в группе": "Main in the group, if exists in the group", "Отправляет сообщение в выбранный час": "Sends a message at a selected hour", -"Получить список отложенных сообщений": "Get list of delayed messages", -"Отправляет опрос с вариантами ответа": "Sends a poll with answer options", -"Путь к опубликованному ранее объекту": "Path to the previously published object", -"Получить список пользователей канала": "Get channel user list", "Получает информацию о странице по ID": "Gets information about the page by ID", +"ПолучитьСоответствиеПараметровТовара": "GetProductParameterMapping", "Устанавливает цель (описание) канала": "Sets the channel purpose (description)", -"сериализованный JSON ответа от Slack": "Serialized JSON response from Slack", -"Получает ссылку для скачивания файла": "Gets a download link for the file", -"Строка,Соответствие Из КлючИЗначение": "String, Map From KeyAndValue", +"Возвращает список заказов сообщества": "Returns the community's order list", +"Получить список пользователей канала": "Get channel user list", +"Телеграм_ОтправитьТекстовоеСообщение": "Telegram_SendTextMessage", +"Dropbox_ПолучитьИнформациюОбАккаунте": "Dropbox_GetAccountInformation", +"Получить список отложенных сообщений": "Get list of delayed messages", +"Telegram_ОтправитьТекстовоеСообщение": "Telegram_SendTextMessage", +"Отправляет аудиофайл в чат или канал": "Sends an audio file to a chat or channel", +"Результат чтения JSON ответа сервера": "Result of reading the JSON response from the server", +"Получает статистику в разрезе постов": "Gets statistics in terms of posts", +"Отправляет опрос с вариантами ответа": "Sends a poll with answer options", +"Удаляет существующее свойство товара": "Deletes the existing product property", +"Телеграм_ЗакрепитьОткрепитьСообщение": "Telegram_PinUnpinMessage", "сериализованный JSON ответа от Viber": "serialized JSON response from Viber", -"сериализованный JSON ответа от Notion": "Serialized JSON response from Notion", -"Пример структуры\/соответствия свойств": "Example structure\/property map", -"Перемещает событие в другой календарь": "Moves an event to another calendar", -"Получает статус загрузки файла по URL": "Gets the upload status of the file by URL", -"ID свойства, куда добавляется вариант": "Property ID where the variant is added", -"Для отображения скидки\/изменения цены": "For displaying discount\/changing price", -"Копирует лист из одной книги в другую": "Copies a sheet from one book to another", -"Изменяет существующее свойство товара": "Edits the existing product property", -"УправлениеВидимостьюГлавнойТемыФорума": "ManageMainTopicVisibility", -"ID версии (ревизии) для востановления": "ID of the version (revision) for restoration", -"ПреобразоватьДанныеСПолучениемРазмера": "ConvertDataWithSizeRetrieval", -"СформироватьКлавиатуруИзМассиваКнопок": "CreateKeyboardFromArrayButton", +"Перемещает объект по выбранному пути": "Moves an object to the selected path", +"Создает альбом для хранения картинок": "Creates an album to store images", +"Путь к опубликованному ранее объекту": "Path to the previously published object", +"Получить список ответов на сообщение": "Get list of message replies", +"ПолучитьСписокОпубликованныхОбъектов": "GetPublishedObjectsList", +"Путь к оригинальному файлу или папке": "Path to the original file or folder", +"Получает ссылку для скачивания файла": "Gets a download link for the file", +"сериализованный JSON ответа от Slack": "Serialized JSON response from Slack", +"Строка,Соответствие Из КлючИЗначение": "String, Map From KeyAndValue", +"Удаляет комментарий к записи таблицы": "Deletes a comment for a table record", +"CommonModule.OPI_ПреобразованиеТипов": "CommonModule.OPI_TypeConversion", "Получает информацию о календаре по ID": "Gets calendar information by ID", -"сериализованный JSON ответа от Yandex": "serialized JSON response from Yandex", -"Telegram_ПолучитьСписокАватаровФорума": "Telegram_GetForumAvatarList", -"Получает описание поля числового типа": "Gets the description of a numeric field", +"ПреобразоватьДанныеСПолучениемРазмера": "ConvertDataWithSizeRetrieval", "Telegram_ИзменитьИмяГлавнойТемыФорума": "Telegram_ChangeMainTopicName", -"Получает описание поля файлового типа": "Gets the description of a file field", -"Телеграм_ПолучитьСписокАватаровФорума": "Telegram_GetForumAvatarsList", -"СформироватьКлавиатуруПоМассивуКнопок": "FormKeyboardFromButtonArray", +"Изменяет существующее свойство товара": "Edits the existing product property", +"Копирует лист из одной книги в другую": "Copies a sheet from one book to another", "ЯДиск_ЗагрузитьПоАдресуПолучитьОбъект": "YDisk_UploadByUrlAndGetObject", -"сериализованный JSON ответа от Google": "serialized JSON response from Google", -"Массив соответствий данных календарей": "Array of calendar data mappings", +"Telegram_ПолучитьСписокАватаровФорума": "Telegram_GetForumAvatarList", +"Для отображения скидки\/изменения цены": "For displaying discount\/changing price", "Удаляет сообщение канала по timestamp": "Deletes a channel message by timestamp", -"Получить список подборок по массиву ID": "Gets the list of selections by array of IDs", -"Получает список всех событий календаря": "Gets the list of all calendar events", -"Некорректный статус управления форумом": "Incorrect forum management status", -"ПолучитьБуферДвоичныхДанныхИзHexСтроки": "GetBinaryDataBufferFromHexString", -"Получает описание поля строкового типа": "Gets the description of a string field", -"Получает список файлов бота или канала": "Gets a list of files of the bot or channel", -"Сохраняет публичный объект на ваш диск": "Saves the public object to your disk", -"Получает список тегов выбранных файлов": "Gets the list of tags of the selected files", -"сериализованный JSON ответа от Dropbox": "serialized JSON response from Dropbox", -"Сохраняет картинку в альбом сообщества": "Saves an image to the community album", -"Смещение в списке получаемых сообщений": "Offset in the list of received messages", -"сериализованный JSON ответа от Twitter": "serialized JSON response from Twitter", -"Создает комментарий к записи в таблице": "Creates a comment for a record in the table", +"сериализованный JSON ответа от Google": "serialized JSON response from Google", +"Телеграм_ПолучитьСписокАватаровФорума": "Telegram_GetForumAvatarsList", +"СформироватьКлавиатуруИзМассиваКнопок": "CreateKeyboardFromArrayButton", +"Пример структуры\/соответствия свойств": "Example structure\/property map", +"0 И ЗначениеЗаполнено(Страница) Тогда": "0 And ValueIsFilled(Page) Then", +"сериализованный JSON ответа от Notion": "Serialized JSON response from Notion", +"СформироватьКлавиатуруПоМассивуКнопок": "FormKeyboardFromButtonArray", +"ID свойства, куда добавляется вариант": "Property ID where the variant is added", +"Получает описание поля файлового типа": "Gets the description of a file field", +"ID версии (ревизии) для востановления": "ID of the version (revision) for restoration", +"Получает описание поля числового типа": "Gets the description of a numeric field", +"УправлениеВидимостьюГлавнойТемыФорума": "ManageMainTopicVisibility", +"Массив соответствий данных календарей": "Array of calendar data mappings", +"Получает статус загрузки файла по URL": "Gets the upload status of the file by URL", +"Перемещает событие в другой календарь": "Moves an event to another calendar", +"сериализованный JSON ответа от Yandex": "serialized JSON response from Yandex", "Признак удаления отложенного сообщения": "Indicator of deleting a delayed message", -"Получить статус асинхронного изменения": "Get asynchronous change status", -"Удалить полностью (Истина) или закрыть": "Delete completely (True) or close", +"сериализованный JSON ответа от Twitter": "serialized JSON response from Twitter", +"Получает описание поля строкового типа": "Gets the description of a string field", +"Некорректный статус управления форумом": "Incorrect forum management status", +"Создает комментарий к записи в таблице": "Creates a comment for a record in the table", +"Получить список подборок по массиву ID": "Gets the list of selections by array of IDs", "Получает список свойств товаров группы": "Gets the list of properties of group products", +"Получает список файлов бота или канала": "Gets a list of files of the bot or channel", +"Получает список всех событий календаря": "Gets the list of all calendar events", +"CommonModule.OPI_ПолучениеДанныхТестов": "CommonModule.OPI_TestDataRetrieval", +"Получить статус асинхронного изменения": "Get asynchronous change status", +"Сохраняет публичный объект на ваш диск": "Saves the public object to your disk", "Формирует клавиатуру по массиву кнопок": "Forms a keyboard from an array of buttons", -"Изменяет состав существующего сообщения": "Edits the content of an existing message", -"Дата отправки для отложенного сообщения": "Sending date for delayed message", +"сериализованный JSON ответа от Dropbox": "serialized JSON response from Dropbox", +"ПолучитьБуферДвоичныхДанныхИзHexСтроки": "GetBinaryDataBufferFromHexString", +"Сохраняет картинку в альбом сообщества": "Saves an image to the community album", +"Получает список тегов выбранных файлов": "Gets the list of tags of the selected files", +"Удалить полностью (Истина) или закрыть": "Delete completely (True) or close", +"Смещение в списке получаемых сообщений": "Offset in the list of received messages", "ID существующей группы, если необходимо": "ID of the existing group, if needed", -"сериализованный JSON ответа от Telegram": "Serialized JSON response from Telegram", -"ПолучитьДанныеИспользованияПространства": "GetSpaceUsageData", -"HTTPОтвет, Произвольный, ДвоичныеДанные": "HTTPResponse, Arbitrary, BinaryData", -"ОчиститьСписокЗакрепленныхСообщенийТемы": "ClearThreadPinnedMessagesList", -"Путь к оригинальному файлу или каталогу": "Path to the original file or directory", -"Перезаписывать файл при конфликте путей": "Overwrite file in case of path conflicts", -"сериализованный JSON ответа от Airtable": "serialized JSON response from Airtable", "Получает список опубликованных объектов": "Gets a list of published objects", -"Массив идентификаторов вида photo123_123": "Array of identifiers like photo123_123", -"Массив вариантов опроса, если необходимо": "Array of poll options, if necessary", -"Скачивает файл по указанному пути или ID": "Downloads a file by the specified path or ID", -"Изменяет наименование существующей книги": "Changes the name of the existing book", -"Удаляет календарь из списка пользователя": "Removes a calendar from the user's list", -"Получает информацию о файле или каталоге": "Gets information about a file or directory", -"ПолучитьСоответствиеРазделовТестирования": "GetTestingSectionMapping", -"Добавляет список файлов к полям каталога": "Adds a list of files to the directory fields", +"HTTPОтвет, Произвольный, ДвоичныеДанные": "HTTPResponse, Arbitrary, BinaryData", +"Путь к оригинальному файлу или каталогу": "Path to the original file or directory", +"Дата отправки для отложенного сообщения": "Sending date for delayed message", +"сериализованный JSON ответа от Airtable": "serialized JSON response from Airtable", +"Изменяет состав существующего сообщения": "Edits the content of an existing message", +"ОчиститьСписокЗакрепленныхСообщенийТемы": "ClearThreadPinnedMessagesList", +"ПолучитьДанныеИспользованияПространства": "GetSpaceUsageData", +"сериализованный JSON ответа от Telegram": "Serialized JSON response from Telegram", +"Перезаписывать файл при конфликте путей": "Overwrite file in case of path conflicts", "Удаляет ранее созданный вариант свойства": "Deletes the previously created product property variant", -"Создает комментарий к файлу или каталогу": "Creates a comment for a file or directory", -"Удаляет текстовый тег файла или каталога": "Deletes the text tag of a file or directory", -"Получает список версий (ревизий) объекта": "Gets the list of versions (revisions) of the object", "Получает информацию о пользователе по ID": "Gets user information by ID", -"Изменяет текст существующего комментария": "Changes the text of an existing comment", +"Массив идентификаторов вида photo123_123": "Array of identifiers like photo123_123", +"Скачивает файл по указанному пути или ID": "Downloads a file by the specified path or ID", +"ПолучитьСоответствиеРазделовТестирования": "GetTestingSectionMapping", +"Создает комментарий к файлу или каталогу": "Creates a comment for a file or directory", +"Удаляет календарь из списка пользователя": "Removes a calendar from the user's list", +"Добавляет список файлов к полям каталога": "Adds a list of files to the directory fields", "Загружает файл на диск по заданному пути": "Uploads a file to disk at the specified path", -"Создает пустой каталог по выбранному пути": "Creates an empty directory at the selected path", -"ОбработкаВходящегоЗапросаПослеАвторизации": "HandleIncomingRequestAfterAuthorization", -"Возвращает URL для авторизации в браузере": "Returns URL for browser authorization", -"Создает комментарий под выбранной записью": "Creates a comment under the selected record", -"Получает список записей выбранной таблицы": "Gets the list of records of the selected table", -"Публикует объект диска в публичный доступ": "Publishes the disk object for public access", -"ПолучитьСсылкуСкачиванияПубличногоОбъекта": "GetDownloadLinkForPublicObject", -"См. СформироватьКлавиатуруИзМассиваКнопок": "See CreateKeyboardFromArrayButton", -"Новые или изменяемые свойства базы данных": "New or modified database properties", -"Массив двоичных данных или путей к файлам": "Array of binary data or file paths", -"Кодировка, в которой записаны JSON данные": "Encoding of JSON Data", -"Сформировать клавиатуру из массива кнопок": "Create a keyboard from an array of buttons", -"Добавляет указанных пользователей в канал": "Adds specified users to the channel", -"Сформировать клавиатуру по массиву кнопок": "Generate keyboard from array of buttons", -"Получает описание поля с номером телефона": "Gets the description of a phone number field", -"Изменяет наименование и|или описание базы": "Changes the name and\/or description of the base", +"Массив вариантов опроса, если необходимо": "Array of poll options, if necessary", +"tools\/Modules\/OPI_ПреобразованиеТипов.os": "tools\/Modules\/OPI_TypeConversion.os", +"Получает список версий (ревизий) объекта": "Gets the list of versions (revisions) of the object", +"Изменяет текст существующего комментария": "Changes the text of an existing comment", +"Получает информацию о файле или каталоге": "Gets information about a file or directory", +"Изменяет наименование существующей книги": "Changes the name of the existing book", +"Удаляет текстовый тег файла или каталога": "Deletes the text tag of a file or directory", "См. СформироватьКлавиатуруПоМассивуКнопок": "See GenerateKeyboardFromArray", "действия будут выполняться от лица группы": "actions will be performed on behalf of the group", -"Удаляет указанного пользователя из канала": "Removes specified user from channel", -"Изменяет свойства существуещего календаря": "Edits properties of an existing calendar", "|--------[через 2 ч.]-------------------|": "|--------[after 2 hrs.]-------------------|", "Получает список всех комментариев объекта": "Gets the list of all comments of the object", +"Создает комментарий под выбранной записью": "Creates a comment under the selected record", +"Получает список записей выбранной таблицы": "Gets the list of records of the selected table", +"Кодировка, в которой записаны JSON данные": "Encoding of JSON Data", +"Публикует объект диска в публичный доступ": "Publishes the disk object for public access", +"Получает описание поля с номером телефона": "Gets the description of a phone number field", +"ПолучитьСсылкуСкачиванияПубличногоОбъекта": "GetDownloadLinkForPublicObject", +"Сформировать клавиатуру из массива кнопок": "Create a keyboard from an array of buttons", +"Изменяет свойства существуещего календаря": "Edits properties of an existing calendar", +"Возвращает URL для авторизации в браузере": "Returns URL for browser authorization", +"Массив двоичных данных или путей к файлам": "Array of binary data or file paths", +"Новые или изменяемые свойства базы данных": "New or modified database properties", +"Сформировать клавиатуру по массиву кнопок": "Generate keyboard from array of buttons", "Признак исключения архивированных каналов": "Indicator of excluding archived channels", +"Удаляет указанного пользователя из канала": "Removes specified user from channel", +"ОбработкаВходящегоЗапросаПослеАвторизации": "HandleIncomingRequestAfterAuthorization", +"Создает пустой каталог по выбранному пути": "Creates an empty directory at the selected path", +"См. СформироватьКлавиатуруИзМассиваКнопок": "See CreateKeyboardFromArrayButton", +"Добавляет указанных пользователей в канал": "Adds specified users to the channel", +"Изменяет наименование и|или описание базы": "Changes the name and\/or description of the base", "JSON клавиатуры. См.СформироватьКлавиатуру": "JSON keyboard. See FormKeyboard", -"Очищает список событий основного календаря": "Clears the event list of the primary calendar", "Получает постоянный UTL к сообщению канала": "Gets a permanent URL to the channel message", -"Добавляет новый товар в каталог сообщества": "Adds a new product to the community's catalog", -"Отправляет внейшний файл по списку каналов": "Sends an external file to a list of channels", "Сформировать клавиатуру из массива кнопок:": "Create a keyboard from an array of buttons:", -"Получить данные использования пространства": "Get space usage data", -"ID поста, используемого в качетсве рекламы": "ID of the post used for advertising", -"Разбанивает забаненного ранее пользователя": "Unbans a previously banned user", -"Отправляет файл (документ) в чат или канал": "Sends a file (document) to a chat or channel", "Отменяет режим общего доступа для каталога": "Cancels the public access mode for the directory", +"Отправляет внейшний файл по списку каналов": "Sends an external file to a list of channels", +"Получить данные использования пространства": "Get space usage data", +"Очищает список событий основного календаря": "Clears the event list of the primary calendar", "Ошибка преобразовани данных параметра JSON": "JSON Parameter Data Conversion Error", -"Обновляет v2 токен при помощи refresh_token": "Updates the v2 token using the refresh_token", +"Разбанивает забаненного ранее пользователя": "Unbans a previously banned user", +"tools\/Modules\/OPI_ПолучениеДанныхТестов.os": "tools\/Modules\/OPI_TestDataRetrieval.os", +"Добавляет новый товар в каталог сообщества": "Adds a new product to the community's catalog", +"Отправляет файл (документ) в чат или канал": "Sends a file (document) to a chat or channel", +"ID поста, используемого в качетсве рекламы": "ID of the post used for advertising", +"Открытый пакет интеграций с популярными API": "Open integrations package with popular API aboard", "Ошибка получения данных булево из параметра": "Error getting boolean data from parameter", -"Получает список отложенных сообщений канала": "Gets a list of delayed channel messages", "Получает описание поля с электронной почтой": "Gets the description of an email field", -"Получает информацию о папке или файле по ID": "Gets information about a folder or file by ID", "Очистить список закрепленных сообщений темы": "Clear thread's pinned messages list", -"Получает информацию о товарах по массиву ID": "Gets information about products by array of IDs", +"Обновляет v2 токен при помощи refresh_token": "Updates the v2 token using the refresh_token", +"Получает информацию о папке или файле по ID": "Gets information about a folder or file by ID", "ID файла, к которому предоставляется доступ": "ID of the file to be accessed", -"Удаляет ранее добавленный товар из подборки": "Removes a previously added product from the selection", -"конкретное значение при указании имени поля": "Specific Value When Specifying Field Name", "Красный, желтый, синий или какой-то другой?": "Red, yellow, blue, or some other?", "ПолучитьБуферДвоичныхДанныхИзДвоичныхДанных": "GetBinaryDataBufferFromBinaryData", -"Создает ссылку для вступления в закрытый чат": "Creates a link for joining a closed chat", -"Показывает ранее скрытую главную тему форума": "Shows a previously hidden main forum thread", +"Удаляет ранее добавленный товар из подборки": "Removes a previously added product from the selection", +"конкретное значение при указании имени поля": "Specific Value When Specifying Field Name", +"Получает список отложенных сообщений канала": "Gets a list of delayed channel messages", +"Получает информацию о товарах по массиву ID": "Gets information about products by array of IDs", "Приостанавливает показ рекламного объявления": "Pauses the display of the advertising post", -"Добавляет вариант для существующего свойства": "Adds a variant for an existing property", +"Копирует файл или каталог по выбранному пути": "Copies a file or directory to the selected path", +"Создает ссылку для вступления в закрытый чат": "Creates a link for joining a closed chat", +"Похоже, что в ответе пришли двоичные данные!": "It Seems Binary Data Was Received in Response!", +"Переводит каталог в режим публичного доступа": "Sets the directory to public access mode", "ПолучитьДвоичныеДанныеИзБуфераДвоичныхДанных": "GetBinaryDataFromBinaryDataBuffer", "Получает новый токен на основе рефреш токена": "Gets a new token based on the refresh token", "Создает рекламное объявление на основе поста": "Creates an advertising post based on a post", "Удалить объект без возможности востановления": "Delete object without the possibility of recovery", +"Добавляет вариант для существующего свойства": "Adds a variant for an existing property", +"Показывает ранее скрытую главную тему форума": "Shows a previously hidden main forum thread", "Преобразует файл с Base64 строкой в бинарный": "Convert Base64 String to Binary File", -"Похоже, что в ответе пришли двоичные данные!": "It Seems Binary Data Was Received in Response!", -"Переводит каталог в режим публичного доступа": "Sets the directory to public access mode", "Загружает файлы на сервер и возвращает их ID": "Uploads files to the server and returns their IDs", -"Копирует файл или каталог по выбранному пути": "Copies a file or directory to the selected path", -"Получить ссылку скачивания публичного объекта": "Get download link for public object", -"Требования: платформа 1С версии 8.3.10 и выше": "Requirements: 1C platform version 8.3.10 and above", -"Раскомментировать, если выполняется OneScript": "Uncomment if OneScript is executed", -"Повторно открывает ранее закрытую тему форума": "Reopens a previously closed forum thread", -"Возвращает структура клавиатуры для сообщений": "Returns a keyboard structure for messages", "Получает список пользователей рабочей области": "Gets a list of users in the workspace", +"Возвращает структура клавиатуры для сообщений": "Returns a keyboard structure for messages", +"Раскомментировать, если выполняется OneScript": "Uncomment if OneScript is executed", "Идентификатор новой подборки, если необходимо": "Identifier of the new selection, if needed", +"Получить ссылку скачивания публичного объекта": "Get download link for public object", "Не удалось получить информацию из json медиа!": "Failed to Retrieve Information from JSON media!", -"Отправляет текстовое сообщение в чат или канал": "Sends a text message to a chat or channel", -"Расположение OS: .\/OInt\/core\/Modules\/OPI_VK.os": "Location OS: .\/OInt\/core\/Modules\/OPI_VK.os", -"Список адресов почты добавляемых пользователей": "List of email addresses of users being added", -"URL, по которому необходимо перейти в браузере": "URL to go to in the browser", -"Формирует ссылку для авторизации через браузер": "Forms a link for authorization via the browser", -"Отправляет контакт с именем и номером телефона": "Sends a contact with name and phone number", -"Клавиатура под сообщением или на нижней панели": "Keyboard under the message or on the bottom panel", -"Ошибка получения двоичных данных из параметра:": "Error getting binary data from parameter:", +"Повторно открывает ранее закрытую тему форума": "Reopens a previously closed forum thread", +"Требования: платформа 1С версии 8.3.10 и выше": "Requirements: 1C platform version 8.3.10 and above", "Получает общую статистику сообщества за период": "Gets the overall community statistics for a period", "Число последних версий объекта для отображения": "Number of the latest versions of the object to display", -"Получает список файлов с или без отбора по типу": "Gets a list of files with or without filtering by type", -"Отправляет URL с предпросмотром в чат или канал": "Sends a URL with a preview to a chat or channel", -"Получает список пользователей указанного канала": "Gets a list of users in the specified channel", -"Массив имен для добавления новых листов в книгу": "Array of names to add new sheets to the book", +"Отправляет текстовое сообщение в чат или канал": "Sends a text message to a chat or channel", +"Расположение OS: .\/OInt\/core\/Modules\/OPI_VK.os": "Location OS: .\/OInt\/core\/Modules\/OPI_VK.os", +"Ошибка получения двоичных данных из параметра:": "Error getting binary data from parameter:", +"Клавиатура под сообщением или на нижней панели": "Keyboard under the message or on the bottom panel", +"Формирует ссылку для авторизации через браузер": "Forms a link for authorization via the browser", +"Список адресов почты добавляемых пользователей": "List of email addresses of users being added", +"URL, по которому необходимо перейти в браузере": "URL to go to in the browser", +"Отправляет контакт с именем и номером телефона": "Sends a contact with name and phone number", "Получает список комментариев к записи в таблице": "Gets the list of comments for a record in the table", -"Создает кампанию в выбранном рекламном кабинете": "Creates a campaign in the selected advertising account", -"Dropbox_ПолучитьДанныеИспользованияПространства": "Dropbox_GetSpaceUsageData", "Путь к объекту, тег которого необходимо удалить": "Path to the object whose tag needs to be deleted", +"Создает кампанию в выбранном рекламном кабинете": "Creates a campaign in the selected advertising account", +"Массив имен для добавления новых листов в книгу": "Array of names to add new sheets to the book", "Получает календарь из списка пользователя по ID": "Gets a calendar from the user's list by ID", -"Telegram_ОчиститьСписокЗакрепленныхСообщенийТемы": "Telegram_ClearPinnedMessagesList", -"Получает токен по коду из авторизации в бразуере": "Gets token by code from browser authorization", -"Добавляет сообщение в обсуждение от имени группы": "Adds a message to the discussion on behalf of the group", -"Получает данные строки таблицы по идентификатору": "Gets row data of the table by identifier", -"Созвращает список дочерних блоков блока-родителя": "Returns list of child blocks of parent block", -"Создает новый блок на основе существующего блока": "Creates a new block based on an existing block", -"Истина > сортировать по дате, Ложь > по алфавиту": "True > sort by date, False > alphabetically", -"Некорректный метод! Проверьте правильность ввода": "Incorrect method! Check input correctness", +"Dropbox_ПолучитьДанныеИспользованияПространства": "Dropbox_GetSpaceUsageData", +"Получает список файлов с или без отбора по типу": "Gets a list of files with or without filtering by type", +"Получает список пользователей указанного канала": "Gets a list of users in the specified channel", +"Отправляет URL с предпросмотром в чат или канал": "Sends a URL with a preview to a chat or channel", "двоичные данные zip архива с содержимым каталога": "binary data of the zip archive with the contents of the directory", -"Твиттер не смог обработать загруженное вами видео": "Twitter could not process the video you uploaded", -"ID подборка для помещения товара, если необходимо": "Selection ID for placing the product, if needed", -"Путь к каталогу. Необязателен, если указан курсор": "Path to the directory. Optional if the cursor is specified", -"Расположение OS: .\/OInt\/core\/Modules\/OPI_Slack.os": "Location OS: .\/OInt\/core\/Modules\/OPI_Slack.os", -"Преобразует файл с Base64 строкой в бинарный файл": "Convert file with Base64 string to binary file", +"Создает новый блок на основе существующего блока": "Creates a new block based on an existing block", +"Добавляет сообщение в обсуждение от имени группы": "Adds a message to the discussion on behalf of the group", +"Созвращает список дочерних блоков блока-родителя": "Returns list of child blocks of parent block", +"Истина > сортировать по дате, Ложь > по алфавиту": "True > sort by date, False > alphabetically", +"Telegram_ОчиститьСписокЗакрепленныхСообщенийТемы": "Telegram_ClearPinnedMessagesList", +"Некорректный метод! Проверьте правильность ввода": "Incorrect method! Check input correctness", +"Получает токен по коду из авторизации в бразуере": "Gets token by code from browser authorization", +"Получает данные строки таблицы по идентификатору": "Gets row data of the table by identifier", "Источник: https:github.com\/vbondarevsky\/Connector": "Source: https:github.com\/vbondarevsky\/Connector", -"Отменяет публикацию ранее опубликованного объекта": "Unpublishes a previously published object", -"Расположение OS: .\/OInt\/core\/Modules\/OPI_Viber.os": "Location OS: .\/OInt\/core\/Modules\/OPI_Viber.os", +"Расположение OS: .\/OInt\/core\/Modules\/OPI_Slack.os": "Location OS: .\/OInt\/core\/Modules\/OPI_Slack.os", +"Путь к каталогу. Необязателен, если указан курсор": "Path to the directory. Optional if the cursor is specified", +"Преобразует файл с Base64 строкой в бинарный файл": "Convert file with Base64 string to binary file", +"Твиттер не смог обработать загруженное вами видео": "Twitter could not process the video you uploaded", "Идентификатор или массив индентификаторов записей": "Identifier or array of record identifiers", -"Расположение OS: .\/OInt\/core\/Modules\/OPI_Notion.os": "Location OS: .\/OInt\/core\/Modules\/OPI_Notion.os", -"Не удалось привести структуру значений к коллекции": "Failed to convert the structure of values to a collection", -"Добавляет новый текстовый тег к файлу или каталогу": "Adds a new text tag to a file or directory", +"Расположение OS: .\/OInt\/core\/Modules\/OPI_Viber.os": "Location OS: .\/OInt\/core\/Modules\/OPI_Viber.os", +"ID подборка для помещения товара, если необходимо": "Selection ID for placing the product, if needed", +"tools\/Modules\/internal\/Modules\/OPI_Инструменты.os": "tools\/Modules\/internal\/Modules\/OPI_Tools.os", +"Отменяет публикацию ранее опубликованного объекта": "Unpublishes a previously published object", "Создает новое свойство для использования в товарах": "Creates a new property for use in products", "Данные заполнения, где ключ это имя ячейки вида A1": "Fill data where the key is the cell name like A1", -"Некорректная команда! Проверьте правильность ввода": "Incorrect command! Check input correctness", -"Удаляет одну или массив записей по идентификаторам": "Deletes one or an array of records by identifiers", -"Запрещает доступ к файлу для внешних пользователей": "Prohibits access to the file for external users", -"ID асинхронной работы из ответа ЗагрузитьФайлПоURL": "ID of the asynchronous job from the UploadFileByURL response", "ID блока, после которого необходимо встаивть новый": "Block ID after which to insert the new one", -"Расположение OS: .\/OInt\/core\/Modules\/OPI_Twitter.os": "Location OS: .\/OInt\/core\/Modules\/OPI_Twitter.os", +"Запрещает доступ к файлу для внешних пользователей": "Prohibits access to the file for external users", +"tools\/Modules\/internal\/Modules\/OPI_Криптография.os": "tools\/Modules\/internal\/Modules\/OPI_Cryptography.os", +"ID асинхронной работы из ответа ЗагрузитьФайлПоURL": "ID of the asynchronous job from the UploadFileByURL response", +"Некорректная команда! Проверьте правильность ввода": "Incorrect command! Check input correctness", +"Не удалось привести структуру значений к коллекции": "Failed to convert the structure of values to a collection", +"Удаляет одну или массив записей по идентификаторам": "Deletes one or an array of records by identifiers", +"Добавляет новый текстовый тег к файлу или каталогу": "Adds a new text tag to a file or directory", +"Расположение OS: .\/OInt\/core\/Modules\/OPI_Notion.os": "Location OS: .\/OInt\/core\/Modules\/OPI_Notion.os", "Расположение OS: .\/OInt\/core\/Modules\/OPI_Dropbox.os": "Location OS: .\/OInt\/core\/Modules\/OPI_Dropbox.os", -"Очищает список закрепленных сообщений в теме форума": "Clears the list of pinned messages in the forum thread", -"Изменяет свойства календаря из списка пользователей": "Edits the properties of a calendar from the user's list", "Путь к объекту, для которого необходимо создать тег": "Path to the object for which the tag needs to be created", -"Коннектор: удобный HTTP-клиент для 1С:Предприятие 8": "Connector: convenient HTTP client for 1C:Enterprise 8", +"Очищает список закрепленных сообщений в теме форума": "Clears the list of pinned messages in the forum thread", "Смещение для получение объектов не из начала списка": "Offset for getting objects not from the beginning of the list", -"Истина > кнопки выводятся в столбик, Ложь > в строку": "True > buttons are displayed in a column, False > in a row", -"Здесь собрано определение данных для работы с VK API": "Here is a collection of data definitions for working with the VK API", -"Расположение OS: .\/OInt\/core\/Modules\/OPI_YandexID.os": "Location OS: .\/OInt\/core\/Modules\/OPI_YandexID.os", -"Расположение OS: .\/OInt\/core\/Modules\/OPI_Telegram.os": "Location OS: .\/OInt\/core\/Modules\/OPI_Telegram.os", -"Скачивает zip архив с содержимым указанного каталога": "Downloads a zip archive with the contents of the specified directory", -"Отправляет географические координаты в чат или канал": "Sends geographic coordinates to a chat or channel", +"Изменяет свойства календаря из списка пользователей": "Edits the properties of a calendar from the user's list", +"Коннектор: удобный HTTP-клиент для 1С:Предприятие 8": "Connector: convenient HTTP client for 1C:Enterprise 8", +"Расположение OS: .\/OInt\/core\/Modules\/OPI_Twitter.os": "Location OS: .\/OInt\/core\/Modules\/OPI_Twitter.os", "Основное измерение при заполнении диапазона массивом": "Main dimension when filling the array range", -"Загружает файл на диск, забирая его по заданному URL": "Downloads a file to disk from the specified URL", -"Написать сообщение пользователю в диалоге сообщества": "Write a message to a user in the community's dialog", +"Здесь собрано определение данных для работы с VK API": "Here is a collection of data definitions for working with the VK API", +"Отправляет географические координаты в чат или канал": "Sends geographic coordinates to a chat or channel", +"Расположение OS: .\/OInt\/core\/Modules\/OPI_Telegram.os": "Location OS: .\/OInt\/core\/Modules\/OPI_Telegram.os", "Обрабатывает данные TMA и опредеяет их достоверность": "Processes TMA data and determines its validity", -"Описание таблиц: Ключ > имя, Значение > массив полей": "Table description: Key > name, Value > array of fields", +"Скачивает zip архив с содержимым указанного каталога": "Downloads a zip archive with the contents of the specified directory", +"Написать сообщение пользователю в диалоге сообщества": "Write a message to a user in the community's dialog", +"Истина > кнопки выводятся в столбик, Ложь > в строку": "True > buttons are displayed in a column, False > in a row", +"Расположение OS: .\/OInt\/core\/Modules\/OPI_YandexID.os": "Location OS: .\/OInt\/core\/Modules\/OPI_YandexID.os", "Расположение OS: .\/OInt\/core\/Modules\/OPI_Airtable.os": "Location OS: .\/OInt\/core\/Modules\/OPI_Airtable.os", -"Определяет доступ к файлу для стороннего пользователя": "Defines access to the file for an external user", +"Загружает файл на диск, забирая его по заданному URL": "Downloads a file to disk from the specified URL", +"Описание таблиц: Ключ > имя, Значение > массив полей": "Table description: Key > name, Value > array of fields", "Отправляет контакт с номером телефона в чат или канал": "Sends a contact with a phone number to a chat or channel", +"Определяет доступ к файлу для стороннего пользователя": "Defines access to the file for an external user", "Возвращает список пользователей рабочего пространства": "Returns a list of workspace users", "Генерирует ссылку авторизации для перехода в браузере": "Generates an authorization link for browser transition", +"Группирует товары на основе одинаковых наборов свойств": "Groups products based on similar sets of properties", +"ID аккаунта. Текущий аккаунт токена, если не заполнено": "Account ID. Current token account if not filled", +"Перезаписывать если файл с таким именем уже существует": "Overwrite if a file with the same name already exists", "Добавляет существующий календарь в список пользователя": "Adds an existing calendar to the user's list", +"Получает информацию об объекте диска по заданному пути": "Gets information about a disk object at the specified path", "Изменяет имя и|или описание существующего поля таблицы": "Changes the name and\/or description of an existing table field", +"Расположение OS: .\/OInt\/core\/Modules\/OPI_YandexDisk.os": "OS Location: .\/OInt\/core\/Modules\/OPI_YandexDisk.os", "Получает список внешних файлов пользователя или канала": "Gets a list of external files of a user or channel", "Перемещает объект по заданному пути и пути к оригиналу": "Moves the object to the specified path and path to the original", -"Группирует товары на основе одинаковых наборов свойств": "Groups products based on similar sets of properties", -"Перезаписывать если файл с таким именем уже существует": "Overwrite if a file with the same name already exists", -"Расположение OS: .\/OInt\/core\/Modules\/OPI_YandexDisk.os": "OS Location: .\/OInt\/core\/Modules\/OPI_YandexDisk.os", -"ID аккаунта. Текущий аккаунт токена, если не заполнено": "Account ID. Current token account if not filled", -"Получает информацию об объекте диска по заданному пути": "Gets information about a disk object at the specified path", "Расположение OS: .\/OInt\/core\/Modules\/OPI_GoogleDrive.os": "Location OS: .\/OInt\/core\/Modules\/OPI_GoogleDrive.os", -"Предоставляет стороннии пользователям доступ к каталогу": "Grants external users access to the directory", "Перезаписывать, если файл с таким именем уже существует": "Overwrite if a file with the same name already exists", "Идентификатор файла или каталога размещения комментария": "Identifier of the file or directory where the comment is located", -"Получает информацию об опубликованном объекте по его URL": "Gets information about the published object by its URL", -"Расположение OS: .\/OInt\/core\/Modules\/OPI_GoogleSheets.os": "Location OS: .\/OInt\/core\/Modules\/OPI_GoogleSheets.os", +"Предоставляет стороннии пользователям доступ к каталогу": "Grants external users access to the directory", "Создает дочернюю страницу над другой страницей-родителем": "Creates a child page above another parent page", -"Отправляет сообщение, которое приходит в канал, но видно": "Sends a message that arrives in the channel but is visible", -"Получает прямую ссылку для скачивания публичного объекта": "Gets a direct link to download the public object", "Соответствие данных с результатом проверки в поле passed": "Map of data with the result of verification in the passed field", -"Добавляет дополнительные поля информации для медиафайлов": "Adds additional information fields for media files", +"Отправляет сообщение, которое приходит в канал, но видно": "Sends a message that arrives in the channel but is visible", +"Расположение OS: .\/OInt\/core\/Modules\/OPI_GoogleSheets.os": "Location OS: .\/OInt\/core\/Modules\/OPI_GoogleSheets.os", +"Получает прямую ссылку для скачивания публичного объекта": "Gets a direct link to download the public object", "Изменяет значение варианта существующего свойства товара": "Edits the value of an existing product property variant", +"Получает информацию об опубликованном объекте по его URL": "Gets information about the published object by its URL", +"Добавляет дополнительные поля информации для медиафайлов": "Adds additional information fields for media files", "Получает статус асинхронной работы по изменению доступов": "Gets the status of the asynchronous access change job", "Удаляет публичный URL у файла. Требует токен пользователя": "Removes the public URL from the file. Requires user token", "Идентификатор объекта, для которого необходим комментарий": "Identifier of the object that needs a comment", -"Получает список рабочих областей, в которых подключен бот": "Gets a list of workspaces where the bot is connected", "Создает новую тему в группе с включенным функционалом тем": "Creates a new thread in the group with theme functionality enabled", -"Запрещает редактирование файла для стороннего пользователя": "Prohibits file editing for the external user", -"Расположение OS: .\/OInt\/core\/Modules\/OPI_GoogleCalendar.os": "Location OS: .\/OInt\/core\/Modules\/OPI_GoogleCalendar.os", -"Загружает фото на сервер для его дальнейшего использования": "Uploads photo to server for further use", -"Пересылает сообщение между чатами или в рамках одного чата": "Forwards a message between chats or within a chat", +"Получает список рабочих областей, в которых подключен бот": "Gets a list of workspaces where the bot is connected", "Создает копию объекта по заданному пути и пути к оригиналу": "Creates a copy of the object at the specified path and path to the original", +"Загружает фото на сервер для его дальнейшего использования": "Uploads photo to server for further use", +"Запрещает редактирование файла для стороннего пользователя": "Prohibits file editing for the external user", +"Пересылает сообщение между чатами или в рамках одного чата": "Forwards a message between chats or within a chat", +"Расположение OS: .\/OInt\/core\/Modules\/OPI_GoogleCalendar.os": "Location OS: .\/OInt\/core\/Modules\/OPI_GoogleCalendar.os", "Код, полученный из авторизации См.ПолучитьСсылкуАвторизации": "Code obtained from authorization See GetAuthorizationLink", -"Создает публичный URL для файла. Требует токен пользователя": "Creates a public URL for the file. Requires user token", -"Вы можете переопределять их, передавая в качестве параметра": "You can override them by passing them as a parameter", -"Расположение OS: .\/OInt\/tests\/Modules\/internal\/OPI_Тесты.os": "Location OS: .\/OInt\/tests\/Modules\/internal\/OPI_Tests.os", -"Истина > служебные поля удаляются, остается только сам блок": "True > service fields are deleted, only the block itself remains", "Расположение OS: .\/OInt\/core\/Modules\/OPI_GoogleWorkspace.os": "Location OS: .\/OInt\/core\/Modules\/OPI_GoogleWorkspace.os", +"Вы можете переопределять их, передавая в качестве параметра": "You can override them by passing them as a parameter", +"Истина > служебные поля удаляются, остается только сам блок": "True > service fields are deleted, only the block itself remains", +"Создает публичный URL для файла. Требует токен пользователя": "Creates a public URL for the file. Requires user token", +"Расположение OS: .\/OInt\/tests\/Modules\/internal\/OPI_Тесты.os": "Location OS: .\/OInt\/tests\/Modules\/internal\/OPI_Tests.os", "Имя поля для получения. Выводит весь список, если не указано": "Field name to retrieve. Displays the entire list if not specified", "механизм загрузки файлов и некоторые другие из старой версии": "file upload mechanism and some others from the old version", -"Иднтификатор следующей страницы данных из предыдущего запроса": "Next page identifier of data from the previous request", -"Строка, Произвольный, HTTPОтвет, ДвоичныеДанные, Неопределено": "String, Arbitrary, HTTPResponse, BinaryData, Undefined", -"Смещение для получение вложенных объектов не из начала списка": "Offset for getting nested objects not from the beginning of the list", -"Указатель из предыдущего запроса, если строк результата > 100": "Pointer from the previous request, if the result rows > 100", "Открывает новый диалог с одним или несколькими пользователями": "Opens a new dialog with one or more users", -"Токен бота чата сообщества, котрый можно получить в настройках": "Community chat bot token, which can be obtained in the settings", +"Строка, Произвольный, HTTPОтвет, ДвоичныеДанные, Неопределено": "String, Arbitrary, HTTPResponse, BinaryData, Undefined", +"Указатель из предыдущего запроса, если строк результата > 100": "Pointer from the previous request, if the result rows > 100", +"Иднтификатор следующей страницы данных из предыдущего запроса": "Next page identifier of data from the previous request", +"Смещение для получение вложенных объектов не из начала списка": "Offset for getting nested objects not from the beginning of the list", "Загружает файл на облачный диск, получая его по указанному URL": "Uploads a file to the cloud drive by fetching it from the specified URL", -"Получает статус пользователя или нескольких пользователей по ID": "Gets the status of a user or several users by ID", +"Токен бота чата сообщества, котрый можно получить в настройках": "Community chat bot token, which can be obtained in the settings", "Игнорируем проверку целостности архива, просто читаем результат": "Ignore archive integrity check, just read the result", +"Получает статус пользователя или нескольких пользователей по ID": "Gets the status of a user or several users by ID", +"Удаляет URL обработчика событий бота для работы в режиме Webhook": "Deletes the bot event handler URL for webhook operation", "Получает массив сообщений, которые являются ответом на указанное": "Gets an array of messages that are replies to the specified", "Набор или массив наборов пар Ключ : Значение > Поле : Показатель": "Set or array of sets of Key : Value pairs > Field : Indicator", -"Удаляет URL обработчика событий бота для работы в режиме Webhook": "Deletes the bot event handler URL for webhook operation", "Расположение OS: .\/OInt\/tools\/Modules\/OPI_ПреобразованиеТипов.os": "Location OS: .\/OInt\/tools\/Modules\/OPI_TypeConversion.os", "Клавиатура, если нужна, см. СформироватьКлавиатуруИзМассиваКнопок": "Keyboard, if needed, see CreateKeyboardFromArrayButton", -"Идентификатор следующей страницы списка баз из перыдудщего запроса": "Next page identifier of the base list from the previous request", "Расположение OS: .\/OInt\/tools\/Modules\/OPI_ПолучениеДанныхТестов.os": "Location OS: .\/OInt\/tools\/Modules\/OPI_TestDataRetrieval.os", -"Ограничение на ур. вложенности разбора. На всю глубину по умолчанию": "Parsing depth limit. Full depth by default", +"Идентификатор следующей страницы списка баз из перыдудщего запроса": "Next page identifier of the base list from the previous request", "Формирует блок с картинкой для добавления в массив блоков сообщения": "Generates a block with an image to add to the message block array", +"Ограничение на ур. вложенности разбора. На всю глубину по умолчанию": "Parsing depth limit. Full depth by default", "ID пользователя. Для канала > администратора, для бота > получателя": "User ID. For channel > administrator, for bot > recipient", "Совпадающие поля будут перезаписаны с приоритетом параметра функции": "Matching fields will be overwritten with the parameter of the function", "на redirect_uri после авторизации через браузер есть всего 30 секунд": "on redirect_uri after authorization via the browser is only 30 seconds", -"Курсор из предыдущего запроса для получения следующего набора файлов": "Cursor from the previous request to get the next set of files", "Полеучает токен на основе кода со страницы ПолучитьСсылкуАвторизации": "Gets token based on the code from the GetAuthorizationLink page", +"Курсор из предыдущего запроса для получения следующего набора файлов": "Cursor from the previous request to get the next set of files", "Загружает видео в группу с возможностью его дальнейшего использования": "Uploads video to the group for further use", -"Устанавливает URL обработчика событий бота для работы в режиме Webhook": "Set webhook URL for bot event handling in webhook mode", -"Получает список ID товарных категорий для указания при создании товара": "Gets a list of product category IDs to specify when creating a product", -"Двоичные данные или путь к файлу при указании параметра ПутьСохранения": "Binary data or file path when SavePath parameter is specified", "access_token нужно будет забрать из параметра в строке адреса браузера": "access_token will need to be taken from the parameter in the browser address bar", +"Получает список ID товарных категорий для указания при создании товара": "Gets a list of product category IDs to specify when creating a product", +"Устанавливает URL обработчика событий бота для работы в режиме Webhook": "Set webhook URL for bot event handling in webhook mode", +"Двоичные данные или путь к файлу при указании параметра ПутьСохранения": "Binary data or file path when SavePath parameter is specified", "В следующий раз используйте опцию --out для указания пути их сохранения": "Next time, use the --out option to specify the path for saving", "Получает информацию о количестве использованного дискового пространства": "Gets information on the amount of used disk space", "Полную документацию можно найти по адресу: (https:\/\/openintegrations.dev": "Full documentation can be found at: (https:\/\/openintegrations.dev", "Получает соответствие ID Emoji для установки в качестве иконок тем форума": "Gets the mapping of Emoji IDs for setting as forum theme icons", "Расположение OS: .\/OInt\/tools\/Modules\/internal\/Modules\/OPI_Инструменты.os": "Location OS: .\/OInt\/tools\/Modules\/internal\/Modules\/OPI_Tools.os", "Получает список id рекламных категорий для создания рекламного объявления": "Gets a list of advertising category IDs for creating an advertising post", -"Метод для вставки в http-сервис, адрес которого указывается в redirect_uri": "Method for insertion into an http service, the address of which is specified in redirect_uri", "Расположение OS: .\/OInt\/tools\/Modules\/internal\/Modules\/OPI_Криптография.os": "Location OS: .\/OInt\/tools\/Modules\/internal\/Modules\/OPI_Cryptography.os", "URL вашего http-сервиса (или другого обработчика запросов) для авторизации": "URL of your http service (or other request handler) for authorization", -"Из OAuth 2.0 Client ID and Client Secret страницы настроек Twitter Developer": "From OAuth 2.0 Client ID and Client Secret settings page of Twitter Developer", +"Метод для вставки в http-сервис, адрес которого указывается в redirect_uri": "Method for insertion into an http service, the address of which is specified in redirect_uri", "Показывает значения, которые можно получить из переданного JSON и возвращает": "Displays the values that can be obtained from the passed JSON and returns", "Отправляет местоположение по географической широте и долготе в чат или канал": "Sends location by geographic latitude and longitude to a chat or channel", +"Из OAuth 2.0 Client ID and Client Secret страницы настроек Twitter Developer": "From OAuth 2.0 Client ID and Client Secret settings page of Twitter Developer", "Размер файла. Если не заполнен > определяется автоматически скачиванием файла": "File size. If not filled in > determined automatically by downloading the file", "Получает код подтверждения и адрес страницы, на которой его необходимо ввести": "Gets the confirmation code and the address of the page where it needs to be entered", "Все права защищены. Эта программа и сопроводительные материалы предоставляются": "All rights reserved. This program and accompanying materials are provided", -"1, а что-то на 2: вплоть до того что они убрали возможность постить твиты из v1": "1, and something on 2: up to the point that they removed the ability to post tweets from v1", -"Из Consumer Keys -> Access Token and Secret страницы настроек Twitter Developer": "From Consumer Keys -> Access Token and Secret settings page of Twitter Developer", "Создает одну или массив записей по описанию или массиву описаний значений полей": "Creates one or an array of records by description or an array of field value descriptions", +"Из Consumer Keys -> Access Token and Secret страницы настроек Twitter Developer": "From Consumer Keys -> Access Token and Secret settings page of Twitter Developer", +"1, а что-то на 2: вплоть до того что они убрали возможность постить твиты из v1": "1, and something on 2: up to the point that they removed the ability to post tweets from v1", "id приложения, которое необходимо создать в профиле на странице для разработчиков": "application ID that needs to be created in the profile on the developer page", "Вызывает метод получения токена, так как для получения токена из кода, приходящего": "Calls the token acquisition method, as for obtaining a token from the code received", "Формирует простую JSON клавиатуру из массив кнопок для сообщения или нижней панели": "Generates a simple JSON keyboard from an array of buttons for a message or bottom panel", "ID пользователя из информации о канале не подойдет для отправки сообщений через бота": "The user ID from channel information is not suitable for sending messages through the bot", "Преобразовывает код в токен после ввода кода при выполнении ПолучитьКодПодтверждения": "Converts the code to a token after entering the code when executing GetConfirmationCode", "|--> ОбновитьТокен() ->|access_token --> Используется в т-нии 2-х часов для запросов": "|--> RefreshToken() ->| access_token --> Used in the interval of 2 hours for requests", +"Описание структур см. здесь https:pkware.cachefly.net\/webdocs\/casestudies\/APPNOTE.TXT": "Description of structures see here https:pkware.cachefly.net\/webdocs\/casestudies\/APPNOTE.TXT", "Файл не был записан! Используйте флаг --debug для получения дополнительной информации": "File was not saved! Use the --debug flag for more information", "Все страницы, которые будут созданы как дочерние, должны иметь свойства базы-родителя": "All pages created as children must have parent base properties", -"Описание структур см. здесь https:pkware.cachefly.net\/webdocs\/casestudies\/APPNOTE.TXT": "Description of structures see here https:pkware.cachefly.net\/webdocs\/casestudies\/APPNOTE.TXT", -"id группы с \"-\" в начале. Можно найти в настройках группы ВК или в ее URL, если не был": "group ID with \"-\" at the beginning. Can be found in the settings of the VK group or in its URL if not set", "Получение ссылки для интерактивного получения токена (access_token), который необходим": "Getting a link for interactive token retrieval (access_token), which is necessary", "набор разрешений для получаемого ключа. Может быть любой, но offline.access обязателен": "a set of permissions for the received key. Can be any, but offline.access is mandatory", -"Из Authentication Tokens -> Access Token and Secret страницы настроек Twitter Developer": "From Authentication Tokens -> Access Token and Secret settings page of Twitter Developer", +"id группы с \"-\" в начале. Можно найти в настройках группы ВК или в ее URL, если не был": "group ID with \"-\" at the beginning. Can be found in the settings of the VK group or in its URL if not set", "можно использовать http-сервис. Туда же будет приходить и информация о новых сообщениях": "you can use an HTTP service. Information about new messages will also be sent there", +"Из Authentication Tokens -> Access Token and Secret страницы настроек Twitter Developer": "From Authentication Tokens -> Access Token and Secret settings page of Twitter Developer", "При следующем обновлении нужно использовать уже новый refresh_token, так что захардкодить": "For the next update, you need to use a new refresh_token, so hardcode", -"Приходит вместе с access_token и используется для его обновления (время жизни access_token": "Comes together with access_token and is used to refresh it (access_token lifetime", "Получает токен по коду, полученному при авторизации по ссылке из ПолучитьСсылкуАвторизации": "Gets the token by the code obtained during authorization via the link from GetAuthorizationLink", +"Приходит вместе с access_token и используется для его обновления (время жизни access_token": "Comes together with access_token and is used to refresh it (access_token lifetime", "Отправляет набор файлов в чат или канал. Варианты типов медиа: audio, document, photo, video": "Sends a set of files to a chat or channel. Media types: audio, document, photo, video", "Получает список первых файлов каталога или продолжает получение следующих при указании курсора": "Gets the list of the first files in the directory or continues getting the next ones when the cursor is specified", "который будет возвращать 200 и подлинный SSL сертификат. Если есть сертификат и база опубликована": "which will return 200 and a genuine SSL certificate. If there is a certificate and the database is published", -"что Twitter настаивает на использовании этой актуальной версии, они как-то умудрились не перенести": "that Twitter insists on using this latest version, they somehow managed not to transfer", "Тут можно получить ID пользователей канала. ID для бота необходимо получать из прилетов на Webhook": "Here you can get the channel's user IDs. Bot IDs need to be obtained from the Webhook arrivals", +"что Twitter настаивает на использовании этой актуальной версии, они как-то умудрились не перенести": "that Twitter insists on using this latest version, they somehow managed not to transfer", "но только через нее в твит можно добавить картинку. При этом способы авторизации и токены у них разные": "but only through it you can add a picture to the tweet. At the same time, their authentication methods and tokens are different", "Viber периодически стучит по адресу Webhook, так что если он будет неактивен, то все перестанет работать": "Viber periodically knocks on the Webhook address, so if it is inactive, everything will stop working", -"Выполняет запрос \/getUpdates, возвращающий информацию о событиях бота. Используется при работе в polling режиме": "Executes a request \/getUpdates, returning information about bot events. Used in polling mode" +"Выполняет запрос \/getUpdates, возвращающий информацию о событиях бота. Используется при работе в polling режиме": "Executes a request \/getUpdates, returning information about bot events. Used in polling mode", +"Он состоит из общих модулей, каждый из которых отвечает за свой API, а также нескольких модулей-инструментов, общих для": "He consists of general modules, each responsible for its own API, as well as several tool modules common for" } diff --git a/service/interim/en/OPI/.project b/service/interim/en/OPI/.project deleted file mode 100644 index 5b6683c1ce..0000000000 --- a/service/interim/en/OPI/.project +++ /dev/null @@ -1,18 +0,0 @@ - - - OPI - - - - - - org.eclipse.xtext.ui.shared.xtextBuilder - - - - - - org.eclipse.xtext.ui.shared.xtextNature - com._1c.g5.v8.dt.core.V8ExtensionNature - - diff --git a/service/interim/en/OPI/.settings/org.eclipse.core.resources.prefs b/service/interim/en/OPI/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index d21dc84127..0000000000 --- a/service/interim/en/OPI/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -encoding/=UTF-8 diff --git a/service/interim/en/OPI/DT-INF/PROJECT.PMF b/service/interim/en/OPI/DT-INF/PROJECT.PMF deleted file mode 100644 index f82b4856d1..0000000000 --- a/service/interim/en/OPI/DT-INF/PROJECT.PMF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Runtime-Version: 8.3.15 -Base-Project: OpenIntegrations diff --git a/service/interim/en/OPI/src/CommonModules/OPI_Airtable/Module.bsl b/service/interim/en/OPI/src/CommonModules/OPI_Airtable/Module.bsl deleted file mode 100644 index 719401ad78..0000000000 --- a/service/interim/en/OPI/src/CommonModules/OPI_Airtable/Module.bsl +++ /dev/null @@ -1,681 +0,0 @@ -// Location OS: ./OInt/core/Modules/OPI_Airtable.os -// Library: Airtable -// CLI Command: airtable - -// MIT License - -// Copyright (c) 2023 Anton Tsitavets - -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: - -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. - -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -// https://github.com/Bayselonarrend/OpenIntegrations - -// BSLLS:IncorrectLineBreak-off - -// Uncomment if OneScript is executed -// #Use "../../tools" - -#Region ProgrammingInterface - -#Region DatabaseWork - -// Get list of bases -// Gets the list of available bases -// -// Parameters: -// Token - String - Token - token -// Indent - String - Next page identifier of the base list from the previous request - offset -// -// Return value: -// Key-Value Pair - serialized JSON response from Airtable -Function GetListOfBases(Val Token, Val Indent = "") Export - - OPI_TypeConversion.GetLine(Indent); - - URL = "https://api.airtable.com/v0/meta/bases"; - Headers = GetAuthorizationHeader(Token); - Parameters = New Structure; - - OPI_Tools.AddField("offset", Indent, "String", Parameters); - - Response = OPI_Tools.Get(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Get base tables -// Gets the schema of base tables -// -// Parameters: -// Token - String - Token - token -// Base - String - Base identifier - base -// -// Return value: -// Key-Value Pair - serialized JSON response from Airtable -Function GetDatabaseTables(Val Token, Val Base) Export - - OPI_TypeConversion.GetLine(Base); - - URL = "https://api.airtable.com/v0/meta/bases/" + Base + "/tables"; - Headers = GetAuthorizationHeader(Token); - - Response = OPI_Tools.Get(URL, , Headers); - - Return Response; - -EndFunction - -// Create base -// Creates a new database -// -// Parameters: -// Token - String - Token - token -// Workspace - String - Workspace identifier - ws -// Name - String - New base name - title -// TableCollection - Key-Value Pair - Table description: Key > name, Value > array of fields - tablesdata -// -// Return value: -// Key-Value Pair - serialized JSON response from Airtable -Function CreateDatabase(Val Token, Val Workspace, Val Name, Val TableCollection) Export - - OPI_TypeConversion.GetCollection(TableCollection); - - If Not TypeValue(TableCollection) = Type("Structure") - And Not TypeValue(TableCollection) = Type("Match") Then - - Raise "Error in table collection data"; - - EndIf; - - URL = "https://api.airtable.com/v0/meta/bases"; - Headers = GetAuthorizationHeader(Token); - TableArray = New Array; - - For Each Table In TableCollection Do - - Description = GenerateTableDescription(Table.Key, Table.Value); - TableArray.Add(Description); - - EndDo; - - Parameters = New Structure; - OPI_Tools.AddField("name" , Name , "String", Parameters); - OPI_Tools.AddField("tables" , TableArray , "Array", Parameters); - OPI_Tools.AddField("workspaceId", Workspace, "String", Parameters); - - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - -EndFunction - -#EndRegion - -#Region TableManagement - -// Create table -// Creates a new table in the base -// -// Parameters: -// Token - String - Token - token -// Base - String - Base identifier - base -// Name - String - New table name - title -// FieldArray - Array of Structures - Array of field descriptions - fieldsdata -// Description - String - Table description - description -// -// Return value: -// Key-Value Pair - serialized JSON response from Airtable -Function CreateTable(Val Token, Val Base, Val Name, Val FieldArray, Val Description = "") Export - - OPI_TypeConversion.GetLine(Base); - - URL = "https://api.airtable.com/v0/meta/bases/" + Base + "/tables"; - Headers = GetAuthorizationHeader(Token); - Parameters = GenerateTableDescription(Name, FieldArray, Description); - - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Modify table -// Changes the name and/or description of the base -// -// Parameters: -// Token - String - Token - token -// Base - String - Base identifier - base -// Table - String - Table identifier - table -// Name - String - New name - title -// Description - String - New description - description -// -// Return value: -// Key-Value Pair - serialized JSON response from Airtable -Function ModifyTable(Val Token, Val Base, Val Table, Val Name = "", Val Description = "") Export - - OPI_TypeConversion.GetLine(Base); - OPI_TypeConversion.GetLine(Table); - - URL = "https://api.airtable.com/v0/meta/bases/" + Base + "/tables/" + Table; - Headers = GetAuthorizationHeader(Token); - Parameters = New Structure; - - OPI_Tools.AddField("name" , Name, "String", Parameters); - OPI_Tools.AddField("description", Description , "String", Parameters); - - Response = OPI_Tools.Patch(URL, Parameters, Headers); - - Return Response; - -EndFunction - -#EndRegion - -#Region FieldWork - -// Create field -// Creates a new field in the table -// -// Parameters: -// Token - String - Token - token -// Base - String - Base identifier - base -// Table - String - Table identifier - table -// FieldStructure - Structure of Key-Value - Description of the new field - fielddata -// -// Return value: -// Key-Value Pair - serialized JSON response from Airtable -Function CreateField(Val Token, Val Base, Val Table, Val FieldStructure) Export - - OPI_TypeConversion.GetLine(Base); - OPI_TypeConversion.GetLine(Table); - OPI_TypeConversion.GetCollection(FieldStructure); - - If Not TypeValue(FieldStructure) = Type("Structure") - And Not TypeValue(FieldStructure) = Type("Match") Then - - Raise "Error in field description data"; - - EndIf; - - URL = "https://api.airtable.com/v0/meta/bases/" + Base + "/tables/" + Table + "/fields"; - Headers = GetAuthorizationHeader(Token); - - Response = OPI_Tools.Post(URL, FieldStructure, Headers); - - Return Response; - -EndFunction - -// Modify field -// Changes the name and/or description of an existing table field -// -// Parameters: -// Token - String - Token - token -// Base - String - Base identifier Base - base -// Table - String - Table identifier - table -// Field - String - Field identifier - field -// Name - String - New name - title -// Description - String - New description - description -// -// Return value: -// Key-Value Pair - serialized JSON response from Airtable -Function ModifyField(Val Token, Val Base, Val Table, Val Field, Val Name = "", Val Description = "") Export - - OPI_TypeConversion.GetLine(Base); - OPI_TypeConversion.GetLine(Table); - OPI_TypeConversion.GetLine(Field); - - URL = "https://api.airtable.com/v0/meta/bases/" - + Base - + "/tables/" - + Table - + "/fields/" - + Field; - - Headers = GetAuthorizationHeader(Token); - - Parameters = New Structure(); - OPI_Tools.AddField("name" , Name, "String", Parameters); - OPI_Tools.AddField("description", Description , "String", Parameters); - - Response = OPI_Tools.Patch(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Get поле (withтроtoоinое) -// Gets the description of a string field -// -// Parameters: -// Name - String - New field name - title -// -// Return value: -// Structure - Field description -Function GetStringField(Val Name) Export - Return PrimitiveFieldDescription(Name, "richText"); -EndFunction - -// Get поле (чиwithлоinое) -// Gets the description of a numeric field -// -// Parameters: -// Name - String - New field name - title -// Precision - Number, String - Number of decimal places - precision -// -// Return value: -// Structure - Field description -Function GetNumberField(Val Name, Val Precision = 0) Export - - OPI_TypeConversion.GetNumber(Precision); - - OptionsStructure = New Structure("precision", Precision); - Return PrimitiveFieldDescription(Name, "number", OptionsStructure); - -EndFunction - -// Get поле (file) -// Gets the description of a file field -// -// Parameters: -// Name - String - Field name - title -// -// Return value: -// Structure - Field description -Function GetAttachmentField(Val Name) Export - Return PrimitiveFieldDescription(Name, "multipleAttachments"); -EndFunction - -// Get поле (флажоto) -// Gets the description of a boolean field -// -// Parameters: -// Name - String - Field name - title -// -// Return value: -// Structure - Field description -Function GetCheckboxField(Val Name) Export - - OptionsStructure = New Structure("icon,color", "check", "yellowBright"); - Return PrimitiveFieldDescription(Name, "checkbox", OptionsStructure); - -EndFunction - -// Get поле (dата) -// Gets the description of a date field -// -// Parameters: -// Name - String - Field name - title -// -// Return value: -// Structure - Field description -Function GetDateField(Val Name) Export - - FormatStructure = New Structure("format,name", "YYYY-MM-DD", "iso"); - OptionsStructure = New Structure("dateFormat", FormatStructure); - - Return PrimitiveFieldDescription(Name, "date", OptionsStructure); - -EndFunction - -// Get поле (email) -// Gets the description of an email field -// -// Parameters: -// Name - String - Field name - title -// -// Return value: -// Structure - Field description -Function GetEmailField(Val Name) Export - Return PrimitiveFieldDescription(Name, "email"); -EndFunction - -// Get поле (телефон) -// Gets the description of a phone number field -// -// Parameters: -// Name - String - Field name - title -// -// Return value: -// Structure - Field description -Function GetPhoneField(Val Name) Export - Return PrimitiveFieldDescription(Name, "phoneNumber"); -EndFunction - -// Get поле (url) -// Gets the description of a URL field -// -// Parameters: -// Name - String - Field name - title -// -// Return value: -// Structure - Field description -Function GetLinkField(Val Name) Export - Return PrimitiveFieldDescription(Name, "url"); -EndFunction - -#EndRegion - -#Region RecordManagement - -// Get list of records -// Gets the list of records of the selected table -// -// Parameters: -// Token - String - Token - token -// Base - String - Database identifier - base -// Table - String - Table identifier - table -// Indent - String - Next page identifier of data from the previous request - offset -// -// Return value: -// Key-Value Pair - serialized JSON response from Airtable -Function GetListOfRecords(Val Token, Val Base, Val Table, Val Indent = "") Export - - OPI_TypeConversion.GetLine(Base); - OPI_TypeConversion.GetLine(Table); - - URL = "https://api.airtable.com/v0/" + Base + "/" + Table; - Headers = GetAuthorizationHeader(Token); - - Parameters = New Structure(); - OPI_Tools.AddField("offset", Indent, "String", Parameters); - - Response = OPI_Tools.Get(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Get record -// Gets row data of the table by identifier -// -// Parameters: -// Token - String - Token - token -// Base - String - Database identifier - base -// Table - String - Table identifier - table -// Record - String - Record identifier in the table - record -// -// Return value: -// Key-Value Pair - serialized JSON response from Airtable -Function GetRecord(Val Token, Val Base, Val Table, Val Record) Export - - OPI_TypeConversion.GetLine(Base); - OPI_TypeConversion.GetLine(Table); - OPI_TypeConversion.GetLine(Record); - - URL = "https://api.airtable.com/v0/" + Base + "/" + Table + "/" + Record; - Headers = GetAuthorizationHeader(Token); - - Response = OPI_Tools.Get(URL, , Headers); - - Return Response; - -EndFunction - -// Create records -// Creates one or an array of records by description or an array of field value descriptions -// -// Parameters: -// Token - String - Token - token -// Base - String - Database identifier - base -// Table - String - Table identifier - table -// Data - Structure, Array of Structures - Set or array of sets of Key : Value pairs > Field : Indicator - data -// -// Return value: -// Key-Value Pair - serialized JSON response from Airtable -Function CreatePosts(Val Token, Val Base, Val Table, Val Data) Export - - OPI_TypeConversion.GetLine(Base); - OPI_TypeConversion.GetLine(Table); - OPI_TypeConversion.GetCollection(Data); - - Parameters = New Structure(); - AddDataDescription(Data, Parameters); - - URL = "https://api.airtable.com/v0/" + Base + "/" + Table; - Headers = GetAuthorizationHeader(Token); - - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Delete records -// Deletes one or an array of records by identifiers -// -// Parameters: -// Token - String - Token - token -// Base - String - Database identifier - base -// Table - String - Table identifier - table -// Records - String, Array of Strings - Identifier or array of record identifiers - records -// -// Return value: -// Key-Value Pair - serialized JSON response from Airtable -Function DeletePosts(Val Token, Val Base, Val Table, Val Records) Export - - OPI_TypeConversion.GetLine(Base); - OPI_TypeConversion.GetLine(Table); - OPI_TypeConversion.GetArray(Records); - - RecordString = ""; - - For Each Record In Records Do - RecordString = RecordString - + ?(ValueFilled(RecordString), "&", "?") - + "records[]=" - + OPI_Tools.NumberToString(Record); - EndDo; - - URL = "https://api.airtable.com/v0/" + Base + "/" + Table + RecordString; - Headers = GetAuthorizationHeader(Token); - - Response = OPI_Tools.Delete(URL, , Headers); - - Return Response; - -EndFunction - -#EndRegion - -#Region CommentManagement - -// Get comments -// Gets the list of comments for a record in the table -// -// Parameters: -// Token - String - Token - token -// Base - String - Database identifier - base -// Table - String - Table identifier - table -// Record - String - Record identifier in the table - record -// Indent - String - Next page identifier of data from the previous request - offset -// -// Return value: -// Key-Value Pair - serialized JSON response from Airtable -Function GetComments(Val Token, Val Base, Val Table, Val Record, Val Indent = "") Export - - OPI_TypeConversion.GetLine(Base); - OPI_TypeConversion.GetLine(Table); - OPI_TypeConversion.GetLine(Record); - - URL = "https://api.airtable.com/v0/" + Base + "/" + Table + "/" + Record + "/comments"; - Headers = GetAuthorizationHeader(Token); - - Parameters = New Structure(); - OPI_Tools.AddField("offset", Indent, "String", Parameters); - - Response = OPI_Tools.Get(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Create comment -// Creates a comment for a record in the table -// -// Parameters: -// Token - String - Token - token -// Base - String - Database identifier - base -// Table - String - Table identifier - table -// Record - String - Record identifier in the table - record -// Text - String - Comment text - text -// -// Return value: -// Key-Value Pair - serialized JSON response from Airtable -Function CreateComment(Val Token, Val Base, Val Table, Val Record, Val Text) Export - - OPI_TypeConversion.GetLine(Base); - OPI_TypeConversion.GetLine(Table); - OPI_TypeConversion.GetLine(Record); - - URL = "https://api.airtable.com/v0/" + Base + "/" + Table + "/" + Record + "/comments"; - Headers = GetAuthorizationHeader(Token); - - Parameters = New Structure(); - OPI_Tools.AddField("text", Text, "String", Parameters); - - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Modify comment -// Changes the text of an existing comment -// -// Parameters: -// Token - String - Token - token -// Base - String - Database identifier - base -// Table - String - Table identifier - table -// Record - String - Record identifier in the table - record -// Comment - String - Comment identifier - comment -// Text - String - New comment text - text -// -// Return value: -// Key-Value Pair - serialized JSON response from Airtable -Function EditComment(Val Token, Val Base, Val Table, Val Record, Val Comment, Val Text) Export - - OPI_TypeConversion.GetLine(Base); - OPI_TypeConversion.GetLine(Table); - OPI_TypeConversion.GetLine(Record); - OPI_TypeConversion.GetLine(Comment); - - URL = "https://api.airtable.com/v0/" + Base + "/" + Table + "/" + Record + "/comments/" + Comment; - Headers = GetAuthorizationHeader(Token); - - Parameters = New Structure(); - OPI_Tools.AddField("text", Text, "String", Parameters); - - Response = OPI_Tools.Patch(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Delete comment -// Deletes a comment for a table record -// -// Parameters: -// Token - String - Token - token -// Base - String - Database identifier - base -// Table - String - Table identifier - table -// Record - String - Record identifier in the table - record -// Comment - String - Comment identifier - comment -// -// Return value: -// Key-Value Pair - serialized JSON response from Airtable -Function DeleteComment(Val Token, Val Base, Val Table, Val Record, Val Comment) Export - - OPI_TypeConversion.GetLine(Base); - OPI_TypeConversion.GetLine(Table); - OPI_TypeConversion.GetLine(Record); - OPI_TypeConversion.GetLine(Comment); - - URL = "https://api.airtable.com/v0/" + Base + "/" + Table + "/" + Record + "/comments/" + Comment; - Headers = GetAuthorizationHeader(Token); - - Response = OPI_Tools.Delete(URL, , Headers); - - Return Response; - -EndFunction - -#EndRegion - -#EndRegion - -#Region ServiceProceduresAndFunctions - -Function GetAuthorizationHeader(Val Token) - - OPI_TypeConversion.GetLine(Token); - - Headers = New Match; - Headers.Insert("Authorization", "Bearer " + Token); - - Return Headers; - -EndFunction - -Function GenerateTableDescription(Val Name, Val FieldArray, Val Description = "") - - OPI_TypeConversion.GetLine(Name); - OPI_TypeConversion.GetCollection(FieldArray); - - TableDescription = New Structure("name,fields", Name, FieldArray); - - OPI_Tools.AddField("description", Description, "String", TableDescription); - - Return TableDescription; - -EndFunction - -Function PrimitiveFieldDescription(Val Name, Val Type, Val Options = "") - - FieldStructure = New Structure(); - OPI_Tools.AddField("name" , Name, "String" , FieldStructure); - OPI_Tools.AddField("type" , Type , "String" , FieldStructure); - OPI_Tools.AddField("options", Options , "Collection", FieldStructure); - - Return FieldStructure; - -EndFunction - -Procedure AddDataDescription(Val Data, Parameters) - - If TypeValue(Data) = Type("Array") Then - - SendArray = New Array; - - For Each RecordDescription In Data Do - SendArray.Add(New Structure("fields", RecordDescription)); - EndDo; - - OPI_Tools.AddField("records", SendArray, "Array", Parameters); - - Else - - OPI_Tools.AddField("fields", Data, "Collection", Parameters); - - EndIf; - -EndProcedure - -#EndRegion diff --git a/service/interim/en/OPI/src/CommonModules/OPI_Airtable/OPI_Airtable.mdo b/service/interim/en/OPI/src/CommonModules/OPI_Airtable/OPI_Airtable.mdo deleted file mode 100644 index a1ecfa6d68..0000000000 --- a/service/interim/en/OPI/src/CommonModules/OPI_Airtable/OPI_Airtable.mdo +++ /dev/null @@ -1,11 +0,0 @@ - - - OPI_Airtable - - - OPI airtable - - true - true - true - diff --git a/service/interim/en/OPI/src/CommonModules/OPI_Dropbox/Module.bsl b/service/interim/en/OPI/src/CommonModules/OPI_Dropbox/Module.bsl deleted file mode 100644 index 8cf5ebb25a..0000000000 --- a/service/interim/en/OPI/src/CommonModules/OPI_Dropbox/Module.bsl +++ /dev/null @@ -1,961 +0,0 @@ -// Location OS: ./OInt/core/Modules/OPI_Dropbox.os -// Library: Dropbox -// CLI Command: dropbox - -// MIT License - -// Copyright (c) 2023 Anton Tsitavets - -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: - -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. - -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -// https://github.com/Bayselonarrend/OpenIntegrations - -// BSLLS:IncorrectLineBreak-off - -// Uncomment if OneScript is executed -// #Use "../../tools" - -#Region ProgrammingInterface - -#Region AccountAndAuthorization - -// Get authorization link -// Generates an authorization link for browser transition -// -// Parameters: -// AppKey - String - Application key - appkey -// -// Return value: -// String - URL for browser transition -Function GetAuthorizationLink(Val AppKey) Export - - OPI_TypeConversion.GetLine(AppKey); - Return "https://www.dropbox.com/oauth2/authorize?client_id=" - + AppKey - + "&response_type=code&token_access_type=offline"; - -EndFunction - -// Get token -// Gets token based on the code from the GetAuthorizationLink page -// -// Parameters: -// AppKey - String - Application key - appkey -// AppSecret - String - Application secret - appsecret -// Code - String - Code from the authorization page - code -// -// Return value: -// Key-Value Pair - serialized JSON response from Dropbox -Function GetToken(Val AppKey, Val AppSecret, Val Code) Export - - URL = "https://api.dropbox.com/oauth2/token"; - DataType = "application/x-www-form-urlencoded; charset=utf-8"; - - Parameters = New Structure; - OPI_Tools.AddField("code" , Code , "String", Parameters); - OPI_Tools.AddField("grant_type", "authorization_code", "String", Parameters); - - URLStructure = OPI_Tools.SplitURL(URL); - Server = URLStructure["Server"]; - Address = URLStructure["Address"]; - - Request = OPI_Tools.CreateRequest(Address, , DataType); - Connection = OPI_Tools.CreateConnection(Server, AppKey, AppSecret); - - ParameterString = OPI_Tools.RequestParametersToString(Parameters); - Data = Right(ParameterString, StrLength(ParameterString) - 1); - - Request.SetBodyFromString(Data); - - Response = Connection.CallHTTPMethod("POST", Request); - OPI_Tools.ProcessResponse(Response); - - Return Response; - -EndFunction - -// Refresh token -// Gets a new token based on the refresh token -// -// Parameters: -// AppKey - String - Application key - appkey -// AppSecret - String - Application secret - appsecret -// RefreshToken - String - Refresh token - refresh -// -// Return value: -// Key-Value Pair - serialized JSON response from Dropbox -Function RefreshToken(Val AppKey, Val AppSecret, Val RefreshToken) Export - - String_ = "String"; - URL = "https://api.dropbox.com/oauth2/token"; - - Parameters = New Structure; - OPI_Tools.AddField("refresh_token", RefreshToken , String_, Parameters); - OPI_Tools.AddField("grant_type" , "refresh_token" , String_, Parameters); - OPI_Tools.AddField("client_id" , AppKey , String_, Parameters); - OPI_Tools.AddField("client_secret", AppSecret, String_, Parameters); - - Response = OPI_Tools.Post(URL, Parameters, , False); - - Return Response; - -EndFunction - -// Get account information -// Gets account information -// -// Parameters: -// Token - String - Token - token -// Account - String - Account ID. Current token account if not filled - account -// -// Return value: -// Key-Value Pair - serialized JSON response from Dropbox -Function GetAccountInformation(Val Token, Val Account = "") Export - - If ValueFilled(Account) Then - Result = GetAccount(Token, Account); - Else - Result = GetOwnAccount(Token); - EndIf; - - Return Result; - -EndFunction - -// Get space usage data -// Gets information on the amount of used disk space -// -// Parameters: -// Token - String - Token - token -// -// Return value: -// Key-Value Pair - serialized JSON response from Dropbox -Function GetSpaceUsageData(Val Token) Export - - URL = "https://api.dropboxapi.com/2/users/get_space_usage"; - Headers = GetRequestHeaders(Token); - - Response = OPI_Tools.PostBinary(URL - , GetBinaryDataFromString("null") - , Headers - , - , "text/plain; charset=dropbox-cors-hack"); - - Return Response; - -EndFunction - -#EndRegion - -#Region FileAndDirectoryManagement - -// Get object information -// Gets information about a file or directory -// -// Parameters: -// Token - String - Token - token -// Path - String - Path to the object - path -// Detailed - Boolean - Adds additional information fields for media files - detail -// -// Return value: -// Key-Value Pair - serialized JSON response from Dropbox -Function GetObjectInformation(Val Token, Val Path, Val Detailed = False) Export - - URL = "https://api.dropboxapi.com/2/files/get_metadata"; - - Parameters = New Structure; - OPI_Tools.AddField("path" , Path , "String", Parameters); - OPI_Tools.AddField("include_media_info", Detailed, "Boolean", Parameters); - - Headers = GetRequestHeaders(Token); - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Get list of folder files -// Gets the list of the first files in the directory or continues getting the next ones when the cursor is specified -// -// Parameters: -// Token - String - Token - token -// Path - String - Path to the directory. Optional if the cursor is specified - path -// Detailed - Boolean - Adds additional information fields for media files - detail -// Cursor - String - Cursor from the previous request to get the next set of files - cursor -// -// Return value: -// HTTPResponse - Get list of folder files -Function GetListOfFolderFiles(Val Token, Val Path = "", Val Detailed = False, Val Cursor = "") Export - - If Not ValueFilled(Cursor) Then - - URL = "https://api.dropboxapi.com/2/files/list_folder"; - - Parameters = New Structure; - OPI_Tools.AddField("path" , Path , "String", Parameters); - OPI_Tools.AddField("include_media_info", Detailed , "Boolean", Parameters); - - Else - - URL = "https://api.dropboxapi.com/2/files/list_folder/continue"; - - Parameters = New Structure; - OPI_Tools.AddField("cursor", Cursor, "String", Parameters); - - EndIf; - - Headers = GetRequestHeaders(Token); - - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Get preview -// Forлучает PDF or HTML преinью объеtoта (тольtoо for тоtoументоin) -// -// Parameters: -// Token - String - Token - token -// Path - String - Path to the object - path -// -// Return value: -// BinaryData - document preview -Function GetPreview(Val Token, Val Path) Export - - URL = "https://content.dropboxapi.com/2/files/get_preview"; - Response = ProcessObject(Token, URL, Path, True); - - Return Response; - -EndFunction - -// Upload file -// Uploads a file to the cloud drive -// -// Parameters: -// Token - String - Token - token -// File - String, BinaryData - Data file for upload - file -// Path - String - Save path on Dropbox - path -// Overwrite - Boolean - Overwrite file in case of path conflicts - overwrite -// -// Return value: -// Key-Value Pair - serialized JSON response from Dropbox -Function UploadFile(Val Token, Val File, Val Path, Val Overwrite = False) Export - - OPI_TypeConversion.GetBinaryData(File); - OPI_TypeConversion.GetBoolean(Overwrite); - OPI_TypeConversion.GetLine(Path); - - Mode = ?(Overwrite, "overwrite", "add"); - Size = File.Size(); - Boundary = 100000000; - - If Size > Boundary Then - Response = UploadLargeFile(Token, File, Path, Mode); - Else - Response = UploadSmallFile(Token, File, Path, Mode); - EndIf; - - Return Response; - -EndFunction - -// Upload file by URL -// Uploads a file to the cloud drive by fetching it from the specified URL -// -// Parameters: -// Token - String - Token - token -// FileURL - String - URL source of the file - url -// Path - String - Save path on Dropbox - path -// -// Return value: -// Key-Value Pair - serialized JSON response from Dropbox -Function UploadFileByURL(Val Token, Val FileURL, Val Path) Export - - URL = "https://api.dropboxapi.com/2/files/save_url"; - - Parameters = New Structure; - OPI_Tools.AddField("path", Path , "String", Parameters); - OPI_Tools.AddField("url" , FileURL , "String", Parameters); - - Headers = GetRequestHeaders(Token); - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Get upload status by URL -// Gets the upload status of the file by URL -// -// Parameters: -// Token - String - Token - token -// JobID - String - ID of the asynchronous job from the UploadFileByURL response - job -// -// Return value: -// Key-Value Pair - serialized JSON response from Dropbox -Function GetUploadStatusByURL(Val Token, Val JobID) Export - - URL = "https://api.dropboxapi.com/2/files/save_url/check_job_status"; - - Parameters = New Structure; - OPI_Tools.AddField("async_job_id", JobID, "String", Parameters); - - Headers = GetRequestHeaders(Token); - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Delete object -// Deletes an object from the cloud drive -// -// Parameters: -// Token - String - Token - token -// Path - String - Path to the object to delete - path -// Irrecoverable - String - Delete object without the possibility of recovery - permanently -// -// Return value: -// Key-Value Pair - serialized JSON response from Dropbox -Function DeleteObject(Val Token, Val Path, Val Irretrievably = False) Export - - OPI_TypeConversion.GetBoolean(Irretrievably); - - If Irretrievably Then - URL = "https://api.dropboxapi.com/2/files/permanently_delete"; - Else - URL = "https://api.dropboxapi.com/2/files/delete_v2"; - EndIf; - - Response = ProcessObject(Token, URL, Path); - - Return Response; - -EndFunction - -// Copy object -// Copies a file or directory to the selected path -// -// Parameters: -// Token - String - Token - token -// From - String - Path to the original object - form -// To - String - Target path for the new object - to -// -// Return value: -// Key-Value Pair - serialized JSON response from Dropbox -Function CopyObject(Val Token, Val From, Val To) Export - - URL = "https://api.dropboxapi.com/2/files/copy_v2"; - - Parameters = New Structure; - OPI_Tools.AddField("from_path", From, "String", Parameters); - OPI_Tools.AddField("to_path" , To , "String", Parameters); - - Headers = GetRequestHeaders(Token); - - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Move object -// Moves an object to the selected path -// -// Parameters: -// Token - String - Token - token -// From - String - Path to the original object - form -// To - String - Target path for the new object - to -// -// Return value: -// Key-Value Pair - serialized JSON response from Dropbox -Function MoveObject(Val Token, Val From, Val To) Export - - URL = "https://api.dropboxapi.com/2/files/move_v2"; - - Parameters = New Structure; - OPI_Tools.AddField("from_path", From, "String", Parameters); - OPI_Tools.AddField("to_path" , To , "String", Parameters); - - Headers = GetRequestHeaders(Token); - - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Create folder -// Creates an empty directory at the selected path -// -// Parameters: -// Token - String - Token - token -// Path - String - Target path for creating the directory - path -// -// Return value: -// Key-Value Pair - serialized JSON response from Dropbox -Function CreateFolder(Val Token, Val Path) Export - - URL = "https://api.dropboxapi.com/2/files/create_folder_v2"; - Response = ProcessObject(Token, URL, Path); - - Return Response; - -EndFunction - -// Download file -// Downloads a file by the specified path or ID -// -// Parameters: -// Token - String - Token - token -// Path - String - Path or ID of the file - path -// -// Return value: -// BinaryData - binary data of the file -Function DownloadFile(Val Token, Val Path) Export - - URL = "https://content.dropboxapi.com/2/files/download"; - Response = ProcessObject(Token, URL, Path, True); - - Return Response; - -EndFunction - -// Download folder -// Downloads a zip archive with the contents of the specified directory -// -// Parameters: -// Token - String - Token - token -// Path - String - Path or ID of the directory - path -// -// Return value: -// BinaryData - binary data of the zip archive with the contents of the directory -Function DownloadFolder(Val Token, Val Path) Export - - URL = "https://content.dropboxapi.com/2/files/download_zip"; - Response = ProcessObject(Token, URL, Path, True); - - Return Response; - -EndFunction - -// Get list of object versions -// Gets the list of versions (revisions) of the object -// -// Parameters: -// Token - String - Token - token -// Path - String - Path to the object - path -// Quantity - String, Number - Number of the latest versions of the object to display - amount -// -// Return value: -// Key-Value Pair - serialized JSON response from Dropbox -Function GetObjectVersionList(Val Token, Val Path, Val Quantity = 10) Export - - URL = "https://api.dropboxapi.com/2/files/list_revisions"; - - Parameters = New Structure; - OPI_Tools.AddField("path" , Path , "String", Parameters); - OPI_Tools.AddField("limit", Quantity, "Number" , Parameters); - - Headers = GetRequestHeaders(Token); - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Restore object to version -// Inоwithwithтаtoinлиinает withоwithтояние объеtoта to необхоdимой inерwithии (реinfromии) -// -// Parameters: -// Token - String - Token - token -// Path - String - Path to the object - path -// Version - String - ID of the version (revision) for restoration - rev -// -// Return value: -// Key-Value Pair - serialized JSON response from Dropbox -Function RestoreObjectToVersion(Val Token, Val Path, Val Version) Export - - URL = "https://api.dropboxapi.com/2/files/restore"; - - Parameters = New Structure; - OPI_Tools.AddField("path", Path , "String", Parameters); - OPI_Tools.AddField("rev" , Version, "String", Parameters); - - Headers = GetRequestHeaders(Token); - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - -EndFunction - -#EndRegion - -#Region TagWork - -// Get list of tags -// Gets the list of tags of the selected files -// -// Parameters: -// Token - String - Token - token -// Paths - String, Array of Strings - Path or set of paths to the files - paths -// -// Return value: -// Key-Value Pair - serialized JSON response from Dropbox -Function GetTagList(Val Token, Val Paths) Export - - URL = "https://api.dropboxapi.com/2/files/tags/get"; - - Parameters = New Structure; - OPI_Tools.AddField("paths", Paths, "Array", Parameters); - - Headers = GetRequestHeaders(Token); - - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Add tag -// Adds a new text tag to a file or directory -// -// Parameters: -// Token - String - Token - token -// Path - String - Path to the object for which the tag needs to be created - path -// Tag - String - Tag text - tag -// -// Return value: -// Key-Value Pair - serialized JSON response from Dropbox -Function AddTag(Val Token, Val Path, Val Tag) Export - - Return ProcessTag(Token, Path, Tag); - -EndFunction - -// Delete tag -// Deletes the text tag of a file or directory -// -// Parameters: -// Token - String - Token - token -// Path - String - Path to the object whose tag needs to be deleted - path -// Tag - String - Tag text - tag -// -// Return value: -// Key-Value Pair - serialized JSON response from Dropbox -Function DeleteTag(Val Token, Val Path, Val Tag) Export - - Return ProcessTag(Token, Path, Tag, True); - -EndFunction - -#EndRegion - -#Region SharedAccessSettings - -// Publish folder -// Sets the directory to public access mode -// -// Parameters: -// Token - String - Token - token -// Path - String - Path to the target directory - path -// -// Return value: -// Key-Value Pair - serialized JSON response from Dropbox -Function PublishFolder(Val Token, Val Path) Export - - URL = "https://api.dropboxapi.com/2/sharing/share_folder"; - Response = ProcessObject(Token, URL, Path); - - Return Response; - -EndFunction - -// Unpublish folder -// Cancels the public access mode for the directory -// -// Parameters: -// Token - String - Token - token -// FolderID - String - ID публичного directory (shared folder ID) - folder -// -// Return value: -// Key-Value Pair - serialized JSON response from Dropbox -Function CancelFolderPublication(Val Token, Val FolderID) Export - - URL = "https://api.dropboxapi.com/2/sharing/unshare_folder"; - - Parameters = New Structure; - OPI_Tools.AddField("shared_folder_id", FolderID, "String", Parameters); - - Headers = GetRequestHeaders(Token); - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Add user to file -// Defines access to the file for an external user -// -// Parameters: -// Token - String - Token - token -// FileID - String - ID of the file to be accessed - fileid -// EmailAddresses - String, Array of Strings - List of email addresses of users being added - emails -// ViewOnly - Boolean - Prohibits file editing for the external user - readonly -// -// Return value: -// Key-Value Pair - serialized JSON response from Dropbox -Function AddUsersToFile(Val Token, Val FileID, Val EmailAddresses, Val ViewOnly = True) Export - - String_ = "String"; - - OPI_TypeConversion.GetArray(EmailAddresses); - OPI_TypeConversion.GetLine(FileID); - OPI_TypeConversion.GetBoolean(ViewOnly); - - If Not StringStartsWith(FileID, "id:") Then - FileID = "id:" + FileID; - EndIf; - - URL = "https://api.dropboxapi.com/2/sharing/add_file_member"; - - ArrayOfUsers = New Array; - - For Each Address In EmailAddresses Do - - UserData = New Match; - OPI_Tools.AddField(".tag" , "email", String_, UserData); - OPI_Tools.AddField("email", Address , String_, UserData); - - ArrayOfUsers.Add(UserData); - - EndDo; - - Parameters = New Structure; - OPI_Tools.AddField("file" , FileID , String_, Parameters); - OPI_Tools.AddField("members", ArrayOfUsers , "Array", Parameters); - - Mode = ?(ViewOnly, "viewer", "editor"); - - OPI_Tools.AddField("access_level", Mode , String_, Parameters); - - Headers = GetRequestHeaders(Token); - - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Add users to folder -// Grants external users access to the directory -// -// Parameters: -// Token - String - Token - token -// FolderID - String - ID публичного directory (shared folder ID) - folder -// EmailAddresses - String, Array of Strings - List of email addresses of users being added - emails -// ViewOnly - Boolean - Prohibits file editing for the external user - readonly -// -// Return value: -// Undefined - empty response -Function AddUsersToFolder(Val Token, Val FolderID, Val EmailAddresses, Val ViewOnly = True) Export - - String_ = "String"; - - OPI_TypeConversion.GetArray(EmailAddresses); - OPI_TypeConversion.GetBoolean(ViewOnly); - Mode = ?(ViewOnly, "viewer", "editor"); - - URL = "https://api.dropboxapi.com/2/sharing/add_folder_member"; - - ArrayOfUsers = New Array; - - For Each Address In EmailAddresses Do - - UserData = New Match; - OPI_Tools.AddField(".tag" , "email", String_, UserData); - OPI_Tools.AddField("email", Address , String_, UserData); - - UserStructure = New Structure("member,access_level", UserData, Mode); - - ArrayOfUsers.Add(UserStructure); - - EndDo; - - Parameters = New Structure; - OPI_Tools.AddField("shared_folder_id", FolderID , String_, Parameters); - OPI_Tools.AddField("members" , ArrayOfUsers , "Array", Parameters); - - Headers = GetRequestHeaders(Token); - - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Get asynchronous change status -// Gets the status of the asynchronous access change job -// -// Parameters: -// Token - String - Token - token -// JobID - String - AsynchronousJobID - job -// -// Return value: -// Key-Value Pair - serialized JSON response from Dropbox -Function GetAsynchronousChangeStatus(Val Token, Val JobID) Export - - URL = "https://api.dropboxapi.com/2/sharing/check_job_status"; - - Parameters = New Structure; - OPI_Tools.AddField("async_job_id", JobID, "String", Parameters); - - Headers = GetRequestHeaders(Token); - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Unpublish file -// Prohibits access to the file for external users -// -// Parameters: -// Token - String - Token - token -// FileID - String - ID of the file to be accessed - fileid -// -// Return value: -// Key-Value Pair - serialized JSON response from Dropbox -Function CancelFilePublication(Val Token, Val FileID) Export - - OPI_TypeConversion.GetLine(FileID); - - If Not StringStartsWith(FileID, "id:") Then - FileID = "id:" + FileID; - EndIf; - - URL = "https://api.dropboxapi.com/2/sharing/unshare_file"; - - Parameters = New Structure; - OPI_Tools.AddField("file", FileID, "String", Parameters); - - Headers = GetRequestHeaders(Token); - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - -EndFunction - -#EndRegion - -#EndRegion - -#Region ServiceProceduresAndFunctions - -Function ProcessObject(Val Token, Val URL, Val Path, Val InHeaders = False) - - Parameters = New Structure; - OPI_Tools.AddField("path", Path, "String", Parameters); - - If InHeaders Then - Headers = GetRequestHeaders(Token, Parameters); - Response = OPI_Tools.PostBinary(URL, GetBinaryDataFromString(""), Headers); - Else - Headers = GetRequestHeaders(Token); - Response = OPI_Tools.Post(URL, Parameters, Headers); - EndIf; - - Return Response; - -EndFunction - -Function ProcessTag(Val Token, Val Path, Val Tag, Val ThisIsDeletion = False) - - If ThisIsDeletion Then - URL = "https://api.dropboxapi.com/2/files/tags/remove"; - Else - URL = "https://api.dropboxapi.com/2/files/tags/add"; - EndIf; - - Parameters = New Structure; - OPI_Tools.AddField("path" , Path, "String", Parameters); - OPI_Tools.AddField("tag_text" , Tag , "String", Parameters); - - Headers = GetRequestHeaders(Token); - - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - -EndFunction - -Function GetRequestHeaders(Val Token, Val Parameters = "") - - OPI_TypeConversion.GetLine(Token); - - Headers = New Match; - Headers.Insert("Authorization" , "Bearer " + Token); - - If ValueFilled(Parameters) Then - - JSON = OPI_Tools.JSONString(Parameters, "No"); - JSON = StringReplace(JSON, Symbols.VK + Symbols.PS, ""); - - Headers.Insert("Dropbox-API-Arg", JSON); - - EndIf; - - Return Headers; - -EndFunction - -Function UploadLargeFile(Val Token, Val File, Val Path, Val Mode) - - URL = "https://content.dropboxapi.com/2/files/upload_session/append_v2"; - - ChunkSize = 100000000; - CurrentPosition = 0; - BytesRead = 0; - TotalSize = File.Size(); - Session = OpenSession(Token); - - WHile BytesRead < TotalSize Do - - Indent = CurrentPosition; - Cursor = New Structure("offset,session_id", Indent, Session); - - Parameters = New Structure("cursor", Cursor); - Headers = GetRequestHeaders(Token, Parameters); - - ReadingData = New ReadingData(File); - BytesRead = ReadingData.Skip(CurrentPosition); - Result = ReadingData.Read(ChunkSize); - Current data = Result.GetBinaryData(); - CurrentSize = Current data.Size(); - NextPosition = CurrentPosition + CurrentSize; - - If Not ValueFilled(Current data) Then - Break; - EndIf; - - Response = OPI_Tools.PostBinary(URL, Current data, Headers); - - CurrentPosition = NextPosition; - - // !OInt KBytes = 1024; - // !OInt MByte = KBytes * KBytes; - // !OInt Notify(OPI_Tools.ProgressInformation(CurrentPosition, TotalSize, "MB", MByte)); - - // !OInt PerformGarbageCollection(); - // !OInt ReleaseObject(Current data); - - EndDo; - - Response = CloseSession(Token, Path, Mode, TotalSize, Session); - - Return Response; - -EndFunction - -Function UploadSmallFile(Val Token, Val File, Val Path, Val Mode) - - Boolean_ = "Boolean"; - String_ = "String"; - URL = "https://content.dropboxapi.com/2/files/upload"; - - Parameters = New Structure; - - OPI_Tools.AddField("autorename" , False , Boolean_, Parameters); - OPI_Tools.AddField("mode" , Mode, String_, Parameters); - OPI_Tools.AddField("mute" , False , Boolean_, Parameters); - OPI_Tools.AddField("path" , Path , String_, Parameters); - OPI_Tools.AddField("strict_conflict", False , Boolean_, Parameters); - - Headers = GetRequestHeaders(Token, Parameters); - - Response = OPI_Tools.PostBinary(URL, File, Headers); - - Return Response; - -EndFunction - -Function OpenSession(Val Token) - - SessionId = "session_id"; - URL = "https://content.dropboxapi.com/2/files/upload_session/start"; - Headers = GetRequestHeaders(Token); - - Response = OPI_Tools.PostBinary(URL, GetBinaryDataFromString(""), Headers); - - Return Response[SessionId]; - -EndFunction - -Function CloseSession(Val Token, Val Path, Val Mode, Val TotalSize, Val Session) - - URL = "https://content.dropboxapi.com/2/files/upload_session/finish"; - - Commit = New Structure(); - OPI_Tools.AddField("mode", Mode, "String", Commit); - OPI_Tools.AddField("path", Path, "String", Commit); - - Cursor = New Structure("offset,session_id", TotalSize, Session); - - Parameters = New Structure("commit,cursor", Commit, Cursor); - Headers = GetRequestHeaders(Token, Parameters); - - Response = OPI_Tools.PostBinary(URL, GetBinaryDataFromString(""), Headers); - - Return Response; - -EndFunction - -Function GetAccount(Val Token, Val Account) - - URL = "https://api.dropboxapi.com/2/users/get_account"; - - Parameters = New Structure; - OPI_Tools.AddField("account_id", Account, "String", Parameters); - - Headers = GetRequestHeaders(Token); - - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - -EndFunction - -Function GetOwnAccount(Val Token) - - URL = "https://api.dropboxapi.com/2/users/get_current_account"; - Headers = GetRequestHeaders(Token); - - Response = OPI_Tools.PostBinary(URL - , GetBinaryDataFromString("null") - , Headers - , - , "text/plain; charset=dropbox-cors-hack"); - - Return Response; - -EndFunction - -#EndRegion diff --git a/service/interim/en/OPI/src/CommonModules/OPI_Dropbox/OPI_Dropbox.mdo b/service/interim/en/OPI/src/CommonModules/OPI_Dropbox/OPI_Dropbox.mdo deleted file mode 100644 index fb078b30c9..0000000000 --- a/service/interim/en/OPI/src/CommonModules/OPI_Dropbox/OPI_Dropbox.mdo +++ /dev/null @@ -1,15 +0,0 @@ - - - OPI_Dropbox - - - OPI dropbox - - - ru - Drop box - - true - true - true - diff --git a/service/interim/en/OPI/src/CommonModules/OPI_GoogleCalendar/Module.bsl b/service/interim/en/OPI/src/CommonModules/OPI_GoogleCalendar/Module.bsl deleted file mode 100644 index bc9071245d..0000000000 --- a/service/interim/en/OPI/src/CommonModules/OPI_GoogleCalendar/Module.bsl +++ /dev/null @@ -1,631 +0,0 @@ -// Location OS: ./OInt/core/Modules/OPI_GoogleCalendar.os -// Library: Google Calendar -// CLI Command: gcalendar - -// MIT License - -// Copyright (c) 2023 Anton Tsitavets - -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: - -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. - -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -// https://github.com/Bayselonarrend/OpenIntegrations - -// BSLLS:LatinAndCyrillicSymbolInWord-off -// BSLLS:IncorrectLineBreak-off - -// Uncomment if OneScript is executed -// #Use "../../tools" - -#Region ProgrammingInterface - -#Region CalendarMetadataManagement - -// Create calendar -// Creates an empty calendar -// -// Parameters: -// Token - String - Token - token -// Name - String - Name of the created calendar - title -// -// Return value: -// Key-Value Pair - serialized JSON response from Google -Function CreateCalendar(Val Token, Val Name) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Name); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://www.googleapis.com/calendar/v3/calendars"; - - Parameters = New Structure; - Parameters.Insert("summary" , Name); - Parameters.Insert("timeZone", "Europe/Moscow"); - - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Get calendar -// Gets calendar information by ID -// -// Parameters: -// Token - String - Token - token -// Calendar - String - Calendar ID - calendar -// -// Return value: -// Key-Value Pair - serialized JSON response from Google -Function GetCalendarMetadata(Val Token, Val Calendar) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Calendar); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://www.googleapis.com/calendar/v3/calendars/" + Calendar; - Response = OPI_Tools.Get(URL, , Headers); - - Return Response; - -EndFunction - -// Edit calendar -// Edits properties of an existing calendar -// -// Parameters: -// Token - String - Token - token -// Calendar - String - Calendar ID - calendar -// Name - String - New name - title -// Description - String - New calendar description - description -// -// Return value: -// Key-Value Pair - serialized JSON response from Google -Function EditCalendarMetadata(Val Token - , Val Calendar - , Val Name = "" - , Val Description = "") Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Calendar); - OPI_TypeConversion.GetLine(Name); - OPI_TypeConversion.GetLine(Description); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://www.googleapis.com/calendar/v3/calendars/" + Calendar; - - Parameters = New Structure; - - If ValueFilled(Name) Then - Parameters.Insert("summary", Name); - EndIf; - - If ValueFilled(Description) Then - Parameters.Insert("description", Description); - EndIf; - - Response = OPI_Tools.Patch(URL, Parameters, Headers, True); - - Return Response; - -EndFunction - -// Clear primary calendar -// Clears the event list of the primary calendar -// -// Parameters: -// Token - String - Token - token -// -// Return value: -// Key-Value Pair - serialized JSON response from Google -Function ClearMainCalendar(Val Token) Export - - OPI_TypeConversion.GetLine(Token); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://www.googleapis.com/calendar/v3/calendars/primary/clear"; - Response = OPI_Tools.Post(URL, , Headers, False); - - Return Response; - -EndFunction - -// Delete calendar -// Deletes a calendar by ID -// -// Parameters: -// Token - String - Token - token -// Calendar - String - Calendar ID - calendar -// -// Return value: -// Key-Value Pair - serialized JSON response from Google -Function DeleteCalendar(Val Token, Val Calendar) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Calendar); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://www.googleapis.com/calendar/v3/calendars/" + Calendar; - Response = OPI_Tools.Delete(URL, , Headers); - - Return Response; - -EndFunction - -#EndRegion - -#Region CalendarListManagement - -// Get list of calendars -// Gets an array of account calendars -// -// Parameters: -// Token - String - Token - token -// -// Return value: -// Key-Value Pair - Array of calendar data mappings -Function GetCalendarList(Val Token) Export - - OPI_TypeConversion.GetLine(Token); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - ArrayOfCalendars = New Array; - - GetCalendarsListRecursively(Headers, ArrayOfCalendars); - - Return ArrayOfCalendars; - -EndFunction - -// Add calendar to list -// Adds an existing calendar to the user's list -// -// Parameters: -// Token - String - Token - token -// Calendar - String - Calendar ID - calendar -// -// Return value: -// Key-Value Pair - serialized JSON response from Google -Function AddCalendarToList(Val Token, Val Calendar) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Calendar); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://www.googleapis.com/calendar/v3/users/me/calendarList"; - - Parameters = New Structure; - Parameters.Insert("id", Calendar); - - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Get list calendar -// Gets a calendar from the user's list by ID -// -// Parameters: -// Token - String - Token - token -// Calendar - String - Calendar ID - calendar -// -// Return value: -// Key-Value Pair - serialized JSON response from Google -Function GetListCalendar(Val Token, Val Calendar) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Calendar); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://www.googleapis.com/calendar/v3/users/me/calendarList/" + Calendar; - Response = OPI_Tools.Get(URL, , Headers); - - Return Response; - -EndFunction - -// Remove calendar from list -// Removes a calendar from the user's list -// -// Parameters: -// Token - String - Token - token -// Calendar - String - Calendar ID - calendar -// -// Return value: -// Key-Value Pair - serialized JSON response from Google -Function DeleteCalendarFromList(Val Token, Val Calendar) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Calendar); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://www.googleapis.com/calendar/v3/users/me/calendarList/" + Calendar; - Response = OPI_Tools.Delete(URL, , Headers); - - Return Response; - -EndFunction - -// Edit list calendar -// Edits the properties of a calendar from the user's list -// -// Parameters: -// Token - String - Token - token -// Calendar - String - Calendar ID - calendar -// PrimaryColor - String - HEX mainоinного цinета (#ffffff) - primary -// SecondaryColor - String - HEX addолнительного цinета (#ffffff) - secondary -// Hidden - Boolean - Hidden calendar - hidden -// -// Return value: -// Key-Value Pair - serialized JSON response from Google -Function EditListCalendar(Val Token - , Val Calendar - , Val PrimaryColor - , Val SecondaryColor - , Val Hidden = False) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Calendar); - OPI_TypeConversion.GetLine(PrimaryColor); - OPI_TypeConversion.GetLine(SecondaryColor); - OPI_TypeConversion.GetBoolean(Hidden); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://www.googleapis.com/calendar/v3/users/me/calendarList/" + Calendar + "?colorRgbFormat=true"; - - Parameters = New Match; - Parameters.Insert("hidden" , Hidden); - Parameters.Insert("foregroundColor", PrimaryColor); - Parameters.Insert("backgroundColor", SecondaryColor); - - Response = OPI_Tools.Put(URL, Parameters, Headers); - - Return Response; - -EndFunction - -#EndRegion - -#Region EventManagement - -// Get event description !NOCLI -// -// Return value: -// Key-Value Pair - Empty event template -Function GetEventDescription() Export - - CurrentDate = OPI_Tools.GetCurrentDate(); - Hour = 3600; - Event = New Match; - - Event.Insert("Description" , ""); // Event description - Event.Insert("Title" , "New event"); // Title events - Event.Insert("Venue" , ""); // String description of the venue of the event - Event.Insert("StartDate" , CurrentDate); // Date of start events - Event.Insert("EndDate" , CurrentDate + Hour); // Date of end events - Event.Insert("ArrayOfAttachmentURLs", New Match); // Key - name, Value - URL to file - Event.Insert("SendNotifications" , True); // Indication of sending notifications to participants - - Return Event; - -EndFunction - -// Get list of events -// Gets the list of all calendar events -// -// Parameters: -// Token - String - Token - token -// Calendar - String - Calendar ID - calendar -// -// Return value: -// Key-Value Pair - Array of event mappings -Function GetEventList(Val Token, Val Calendar) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Calendar); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - ArrayOfEvents = New Array; - - GetEventsListRecursively(Headers, Calendar, ArrayOfEvents); - - Return ArrayOfEvents; - -EndFunction - -// Get event -// Gets an event by ID -// -// Parameters: -// Token - String - Token - token -// Calendar - String - Calendar ID - calendar -// Event - String - Event ID - event -// -// Return value: -// Key-Value Pair - serialized JSON response from Google -Function GetEvent(Val Token, Val Calendar, Val Event) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Calendar); - OPI_TypeConversion.GetLine(Event); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://www.googleapis.com/calendar/v3/calendars/" - + Calendar - + "/events/" - + Event; - - Response = OPI_Tools.Get(URL, , Headers); - - Return Response; - -EndFunction - -// Create event -// Creates a new event -// -// Parameters: -// Token - String - Token - token -// Calendar - String - Calendar ID - calendar -// EventDescription - Key-Value Pair - Event description - props -// -// Return value: -// String, Arbitrary, HTTPResponse, BinaryData, Undefined - Google server response -Function CreateEvent(Val Token, Val Calendar, Val EventDescription) Export - Return EventManagement(Token, Calendar, EventDescription); -EndFunction - -// Move event -// Moves an event to another calendar -// -// Parameters: -// Token - String - Token - token -// SourceCalendar - String - ID of the source calendar - from -// TargetCalendar - String - ID of the target calendar - to -// Event - String - ID of the source calendar event - event -// -// Return value: -// Key-Value Pair - serialized JSON response from Google -Function MoveEvent(Val Token, Val SourceCalendar, Val TargetCalendar, Val Event) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(SourceCalendar); - OPI_TypeConversion.GetLine(TargetCalendar); - OPI_TypeConversion.GetLine(Event); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://www.googleapis.com/calendar/v3/calendars/" - + SourceCalendar - + "/events/" - + Event - + "/move?destination=" - + TargetCalendar; - - Response = OPI_Tools.Post(URL, , Headers); - - Return Response; - -EndFunction - -// Edit event -// Edits an existing event -// -// Parameters: -// Token - String - Token - token -// Calendar - String - Calendar ID - calendar -// EventDescription - String - New event description - props -// Event - String - Event ID - event -// -// Return value: -// Key-Value Pair - serialized JSON response from Google -Function EditEvent(Val Token, Val Calendar, Val EventDescription, Val Event) Export - Return EventManagement(Token, Calendar, EventDescription, Event); -EndFunction - -// Delete event -// Deletes an event by ID -// -// Parameters: -// Token - String - Token - token -// Calendar - String - Calendar ID - calendar -// Event - String - Event ID - event -// -// Return value: -// Key-Value Pair - serialized JSON response from Google -Function DeleteEvent(Val Token, Val Calendar, Val Event) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Calendar); - OPI_TypeConversion.GetLine(Event); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://www.googleapis.com/calendar/v3/calendars/" - + Calendar - + "/events/" - + Event; - - Response = OPI_Tools.Delete(URL, , Headers); - - Return Response; - -EndFunction - -#EndRegion - -#EndRegion - -#Region ServiceProceduresAndFunctions - -Function ConvertDate(Val Date) - - OPI_TypeConversion.GetDate(Date); - - DateStructure = New Structure; - - If Not TypeValue(Date) = Type("Date") Then - Return Undefined; - EndIf; - - If Date = StartOfDay(Date) Then - DateFormat = "DF=yyyy-MM-dd"; - Field = "date"; - Else - DateFormat = "DF=yyyy-MM-ddTHH:mm:ssZ"; - Field = "dateTime"; - EndIf; - - Date = Format(Date, DateFormat); - DateStructure.Insert(Field , Date); - DateStructure.Insert("timeZone", "Europe/Moscow"); - - Return DateStructure; - -EndFunction - -Function ConvertAttachments(Val Attachments) - - OPI_TypeConversion.GetCollection(Attachments); - - AttachmentsArray = New Array; - - If TypeValue(Attachments) = Type("Match") Or TypeValue(Attachments) = Type("Structure") Then - - For Each Attachment In Attachments Do - - CurrentAttachment = New Structure; - CurrentAttachment.Insert("title" , Attachment.Key); - CurrentAttachment.Insert("fileUrl", Attachment.Value); - - AttachmentsArray.Add(CurrentAttachment); - - EndDo; - - EndIf; - - If AttachmentsArray.Quantity() > 0 Then - Return AttachmentsArray; - Else - Return Undefined; - EndIf; - -EndFunction - -Function EventManagement(Val Token, Val Calendar, Val EventDescription, Val Event = "") - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Calendar); - OPI_TypeConversion.GetLine(Event); - OPI_TypeConversion.GetCollection(EventDescription); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - Existing = ValueFilled(Event); - URL = "https://www.googleapis.com/calendar/v3/calendars/" - + Calendar - + "/events" - + ?(Existing, "/" + Event, ""); - - Date0 = EventDescription["StartDate"]; - Date1 = EventDescription["EndDate"]; - Attachments = EventDescription["ArrayOfAttachmentURLs"]; - Attachments = ConvertAttachments(Attachments); - Notifications = ?(EventDescription["SendNotifications"] = Undefined - , False - , EventDescription["SendNotifications"]); - - Parameters = New Structure; - Parameters.Insert("summary" , EventDescription["Title"]); - Parameters.Insert("description", EventDescription["Description"]); - Parameters.Insert("location" , EventDescription["Venue"]); - Parameters.Insert("start" , ConvertDate(Date0)); - Parameters.Insert("end" , ConvertDate(Date1)); - Parameters.Insert("attachments", Attachments); - - URLParameters = New Structure; - URLParameters.Insert("sendUpdates" , ?(Notifications, "all", "none")); - URLParameters.Insert("supportsAttachments" , ?(ValueFilled(Attachments), "true", "false")); - - URL = URL + OPI_Tools.RequestParametersToString(URLParameters); - - OPI_Tools.RemoveEmptyCollectionFields(Parameters); - - If Existing Then - Response = OPI_Tools.Patch(URL, Parameters, Headers, True); - Else - Response = OPI_Tools.Post(URL, Parameters, Headers, True); - EndIf; - - Return Response; - -EndFunction - -Procedure GetCalendarsListRecursively(Val Headers, ArrayOfCalendars, Page = "") - - Items = "items"; - NPT = "nextPageToken"; - Parameters = New Structure; - - If ValueFilled(Page) Then - Parameters.Insert("pageToken", Page); - EndIf; - - Result = OPI_Tools.Get("https://www.googleapis.com/calendar/v3/users/me/calendarList" - , Parameters - , Headers); - - Calendars = Result[Items]; - Page = Result[NPT]; - - For Each Calendar In Calendars Do - ArrayOfCalendars.Add(Calendar); - EndDo; - - If Calendars.Quantity() > 0 And ValueFilled(Page) Then - GetCalendarsListRecursively(Headers, ArrayOfCalendars, Page); - EndIf; - -EndProcedure - -Procedure GetEventsListRecursively(Val Headers, Val Calendar, ArrayOfEvents, Page = "") - - Items = "items"; - NPT = "nextPageToken"; - Parameters = New Structure; - - If ValueFilled(Page) Then - Parameters.Insert("pageToken", Page); - EndIf; - - Result = OPI_Tools.Get("https://www.googleapis.com/calendar/v3/calendars/" + Calendar + "/events" - , Parameters - , Headers); - - Events = Result[Items]; - Page = Result[NPT]; - - For Each Event In Events Do - ArrayOfEvents.Add(Event); - EndDo; - - If Events.Quantity() > 0 And ValueFilled(Page) Then - GetEventsListRecursively(Headers, ArrayOfEvents, Page); - EndIf; - -EndProcedure - -#EndRegion diff --git a/service/interim/en/OPI/src/CommonModules/OPI_GoogleCalendar/OPI_GoogleCalendar.mdo b/service/interim/en/OPI/src/CommonModules/OPI_GoogleCalendar/OPI_GoogleCalendar.mdo deleted file mode 100644 index aefdff4c4f..0000000000 --- a/service/interim/en/OPI/src/CommonModules/OPI_GoogleCalendar/OPI_GoogleCalendar.mdo +++ /dev/null @@ -1,11 +0,0 @@ - - - OPI_GoogleCalendar - - - OPI google calendar - - true - true - true - diff --git a/service/interim/en/OPI/src/CommonModules/OPI_GoogleDrive/Module.bsl b/service/interim/en/OPI/src/CommonModules/OPI_GoogleDrive/Module.bsl deleted file mode 100644 index 4e775dd3a3..0000000000 --- a/service/interim/en/OPI/src/CommonModules/OPI_GoogleDrive/Module.bsl +++ /dev/null @@ -1,719 +0,0 @@ -// Location OS: ./OInt/core/Modules/OPI_GoogleDrive.os -// Library: Google Drive -// CLI Command: gdrive - -// MIT License - -// Copyright (c) 2023 Anton Tsitavets - -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: - -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. - -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -// https://github.com/Bayselonarrend/OpenIntegrations - -// BSLLS:LatinAndCyrillicSymbolInWord-off -// BSLLS:IncorrectLineBreak-off - -// Uncomment if OneScript is executed -// #Use "../../tools" - -#Region ProgrammingInterface - -#Region FileAndDirectoryManagement - -// Get object information -// Gets information about a folder or file by ID -// -// Parameters: -// Token - String - Token - token -// Identifier - String - Identifier of the file or folder - object -// -// Return value: -// Key-Value Pair - serialized JSON response from Google -Function GetObjectInformation(Val Token, Val Identifier) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Identifier); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://www.googleapis.com/drive/v3/files/" + Identifier; - - Parameters = New Structure; - Parameters.Insert("fields", "*"); - - Response = OPI_Tools.Get(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Get list of directories -// Gets the list of drive directories -// -// Parameters: -// Token - String - Token - token -// NameContains - String - Filter by name - querry -// Detailed - Boolean - Adds a list of files to the directory fields - depth -// -// Return value: -// Key-Value Pair - Array of directory mappings -Function GetDirectoriesList(Val Token, Val NameContains = "", Val Detailed = False) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(NameContains); - OPI_TypeConversion.GetBoolean(Detailed); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - ArrayOfObjects = New Array; - Filter = New Array; - - Filter.Add("mimeType = 'application/vnd.google-apps.folder'"); - - If ValueFilled(NameContains) Then - Filter.Add("name contains '" + NameContains + "'"); - EndIf; - - GetObjectsListRecursively(Headers, ArrayOfObjects, Detailed, Filter); - - If Detailed Then - BreakDownObjectsInDetail(Token, ArrayOfObjects); - EndIf; - - Return ArrayOfObjects; - -EndFunction - -// Get list of files -// Gets the list of files -// -// Parameters: -// Token - String - Token - token -// NameContains - String - Filter by name - querry -// Directory - String - Filter by parent directory ID - catalog -// -// Return value: -// Key-Value Pair - Array of file mappings -Function GetFilesList(Val Token, Val NameContains = "", Val Directory = "") Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(NameContains); - OPI_TypeConversion.GetLine(Directory); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - ArrayOfObjects = New Array; - Filter = New Array; - - Filter.Add("mimeType != 'application/vnd.google-apps.folder'"); - - If ValueFilled(NameContains) Then - Filter.Add("name contains '" + NameContains + "'"); - EndIf; - - If ValueFilled(Directory) Then - Filter.Add("'" + Directory + "' in parents"); - EndIf; - - GetObjectsListRecursively(Headers, ArrayOfObjects, , Filter); - - Return ArrayOfObjects; - -EndFunction - -// Upload file -// Uploads a file to the drive -// -// Parameters: -// Token - String - Token - token -// File - BinaryData,String - File to be uploaded - file -// Description - Key-Value Pair - See GetFileDescription - props - JSON description or path to .json -// -// Return value: -// Key-Value Pair - serialized JSON response from Google -Function UploadFile(Val Token, Val File, Val Description) Export - Return FileManagement(Token, File, Description); -EndFunction - -// Create folder -// Creates an empty directory on the drive -// -// Parameters: -// Token - String - Token - token -// Name - String - Folder name - title -// Parent - String - Parent - catalog -// -// Return value: -// Key-Value Pair - serialized JSON response from Google -Function CreateFolder(Val Token, Val Name, Val Parent = "") Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Name); - OPI_TypeConversion.GetLine(Parent); - - Description = New Match; - Description.Insert("MIME" , "application/vnd.google-apps.folder"); - Description.Insert("Name" , Name); - Description.Insert("Description", ""); - Description.Insert("Parent", ?(ValueFilled(Parent), Parent, "root")); - - Return FileManagement(Token, , Description); - -EndFunction - -// Download file -// Gets file by ID -// -// Parameters: -// Token - String - Token - token -// Identifier - String - File identifier - object -// SavePath - String - File save path - out -// -// Return value: -// BinaryData,String - Binary data or file path when SavePath parameter is specified -Function DownloadFile(Val Token, Val Identifier, Val SavePath = "") Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Identifier); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://www.googleapis.com/drive/v3/files/" + Identifier; - - Parameters = New Match; - Parameters.Insert("alt", "media"); - - Response = OPI_Tools.Get(URL, Parameters , Headers, SavePath); - - Return Response; - -EndFunction - -// Copy object -// Copies file or directory -// -// Parameters: -// Token - String - Token - token -// Identifier - String - Object identifier - object -// NewName - String - New object name - title -// NewParent - String - New parent directory - catalog -// -// Return value: -// Key-Value Pair - serialized JSON response from Google -Function CopyObject(Val Token, Val Identifier, Val NewName = "", Val NewParent = "") Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(NewName); - OPI_TypeConversion.GetLine(Identifier); - OPI_TypeConversion.GetLine(NewParent); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://www.googleapis.com/drive/v3/files/" + Identifier + "/copy"; - - Parameters = New Structure; - - If ValueFilled(NewName) Then - Parameters.Insert("name", NewName); - EndIf; - - If ValueFilled(NewParent) Then - - ArrayOfParents = New Array; - ArrayOfParents.Add(NewParent); - Parameters.Insert("parents", ArrayOfParents); - - EndIf; - - Response = OPI_Tools.Post(URL, Parameters , Headers, True); - - Return Response; - -EndFunction - -// Update file -// Updates file binary data -// -// Parameters: -// Token - String - Token - token -// Identifier - String - Identifier of the object to update - object -// File - BinaryData,String - File source for update - file -// NewName - String - Nоinое имя file (еwithли необхоdимо) - title -// -// Return value: -// Key-Value Pair - serialized JSON response from Google -Function UpdateFile(Val Token, Val Identifier, Val File, Val NewName = "") Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Identifier); - OPI_TypeConversion.GetLine(NewName); - OPI_TypeConversion.GetBinaryData(File); - - If ValueFilled(NewName) Then - Description = New Match; - Description.Insert("Name", NewName); - Else - Description = ""; - EndIf; - - Return FileManagement(Token, File, Description, Identifier); - -EndFunction - -// Delete object -// Deletes file or directory by ID -// -// Parameters: -// Token - String - Token - token -// Identifier - String - Identifier of the object to delete - object -// -// Return value: -// Key-Value Pair - serialized JSON response from Google -Function DeleteObject(Val Token, Val Identifier) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Identifier); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://www.googleapis.com/drive/v3/files/" + Identifier; - Response = OPI_Tools.Delete(URL, , Headers); - - Return Response; - -EndFunction - -// Get file description !NOCLI -// -// Return value: -// Key-Value Pair - File description -Function GetFileDescription() Export - - Description = New Match; - Description.Insert("MIME" , "image/jpeg"); // MIME-type uploading file - Description.Insert("Name" , "New file.jpg"); // File name with extension - Description.Insert("Description" , "This is a new file"); // File description - Description.Insert("Parent" , "root"); // ID directory upload or "root" for upload in root - - Return Description; - -EndFunction - -#EndRegion - -#Region CommentManagement - -// Create comment -// Creates a comment for a file or directory -// -// Parameters: -// Token - String - Token - token -// Identifier - String - Identifier of the object that needs a comment - object -// Comment - String - Comment text - text -// -// Return value: -// Key-Value Pair - serialized JSON response from Google -Function CreateComment(Val Token, Val Identifier, Val Comment) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Identifier); - OPI_TypeConversion.GetLine(Comment); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://www.googleapis.com/drive/v3/files/" + Identifier + "/comments?fields=*"; - - Parameters = New Structure; - Parameters.Insert("content", Comment); - - Response = OPI_Tools.POST(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Get comment -// Gets comment by ID -// -// Parameters: -// Token - String - Token - token -// ObjectID - String - Identifier of the file or directory where the comment is located - object -// CommentID - String - Comment identifier - comment -// -// Return value: -// Key-Value Pair - serialized JSON response from Google -Function GetComment(Val Token, Val ObjectID, Val CommentID) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(ObjectID); - OPI_TypeConversion.GetLine(CommentID); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://www.googleapis.com/drive/v3/files/" + ObjectID + "/comments/" + CommentID; - - Parameters = New Structure; - Parameters.Insert("fields", "*"); - - Response = OPI_Tools.Get(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Get list of comments -// Gets the list of all comments of the object -// -// Parameters: -// Token - String - Token - token -// ObjectID - String - Object identifier - object -// -// Return value: -// Key-Value Pair - serialized JSON response from Google -Function GetCommentList(Val Token, Val ObjectID) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(ObjectID); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://www.googleapis.com/drive/v3/files/" + ObjectID + "/comments"; - - Parameters = New Structure; - Parameters.Insert("fields", "*"); - - Response = OPI_Tools.Get(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Delete comment -// Deletes comment by ID -// -// Parameters: -// Token - String - Token - token -// ObjectID - String - Identifier of the file or directory where the comment is located - object -// CommentID - String - Comment identifier - comment -// -// Return value: -// Key-Value Pair - serialized JSON response from Google -Function DeleteComment(Val Token, Val ObjectID, Val CommentID) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(ObjectID); - OPI_TypeConversion.GetLine(CommentID); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://www.googleapis.com/drive/v3/files/" + ObjectID + "/comments/" + CommentID; - - Response = OPI_Tools.Delete(URL, , Headers); - - Return Response; - -EndFunction - -#EndRegion - -#EndRegion - -#Region ServiceProceduresAndFunctions - -Procedure GetObjectsListRecursively(Val Headers, ArrayOfObjects, Detailed = False, Filter = "", Page = "") - - URL = "https://www.googleapis.com/drive/v3/files"; - Files = "files"; - NPT = "nextPageToken"; - Parameters = New Structure; - Parameters.Insert("fields", "*"); - - If ValueFilled(Page) Then - Parameters.Insert("pageToken", Page); - EndIf; - - If ValueFilled(Filter) And TypeValue(Filter) = Type("Array") Then - FilterString = StrJoin(Filter, " and "); - Parameters.Insert("q", FilterString); - EndIf; - - Result = OPI_Tools.Get(URL, Parameters, Headers); - - Objects = Result[Files]; - Page = Result[NPT]; - - For Each CurrentObject In Objects Do - ArrayOfObjects.Add(CurrentObject); - EndDo; - - If Objects.Quantity() > 0 And ValueFilled(Page) Then - GetObjectsListRecursively(Headers, ArrayOfObjects, Detailed, Filter, Page); - EndIf; - -EndProcedure - -Procedure BreakDownObjectsInDetail(Val Token, ArrayOfObjects) - - For Each CurrentObject In ArrayOfObjects Do - - ArrayOfFiles = New Array; - CurrentID = CurrentObject["id"]; - - Result = GetFilesList(Token, , CurrentID); - - For Each File In Result Do - ArrayOfFiles.Add(File); - EndDo; - - CurrentObject.Insert("files", ArrayOfFiles); - - EndDo; - -EndProcedure - -Procedure FormFileUploadParameters(Description) - - FormedDescription = New Match; - OPI_Tools.RemoveEmptyCollectionFields(Description); - - FieldMapping = New Match; - FieldMapping.Insert("MIME" , "mimeType"); - FieldMapping.Insert("Name" , "name"); - FieldMapping.Insert("Description" , "description"); - FieldMapping.Insert("Parent" , "parents"); - FieldMapping.Insert("Extension", "fileExtension"); - - For Each Element In Description Do - - If Element.Key = "Parent" Then - - CurrentValue = New Array; - CurrentValue.Add(Element.Value); - - Else - - CurrentValue = Element.Value; - - EndIf; - - FieldName = FieldMapping.Get(Element.Key); - FormedDescription.Insert(FieldName, CurrentValue); - - EndDo; - - Description = FormedDescription; - -EndProcedure - -Function FileManagement(Val Token, Val File = "", Val Description = "", Val Identifier = "") - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Identifier); - - If ValueFilled(Description) Then - OPI_TypeConversion.GetCollection(Description); - EndIf; - - MimeType = "mimeType"; - - If ValueFilled(Identifier) Then - MIME = GetObjectInformation(Token, Identifier)[MimeType]; - Else - MIME = Description["MIME"]; - EndIf; - - If Not ValueFilled(Description) Then - Description = New Match; - EndIf; - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - FormFileUploadParameters(Description); - JSONDescription = OPI_Tools.JSONString(Description); - - FileMapping = New Match; - - If ValueFilled(File) Then - - ChunkSize = 268435457; - Size = OPI_Tools.ConvertDataWithSizeRetrieval(File, ChunkSize); - - FileMapping.Insert(File, MIME); - - If Size < ChunkSize And TypeValue(File) = Type("BinaryData") Then - Response = UploadSmallFile(JSONDescription, FileMapping, Headers, Identifier); - Else - Response = UploadLargeFile(Description, FileMapping, Headers, Identifier); - EndIf; - - Else - Response = UploadSmallFile(JSONDescription, FileMapping, Headers, Identifier); - EndIf; - - Return Response; - -EndFunction - -Function UploadSmallFile(Val Description, Val FileMapping, Val Headers, Val Identifier = "") - - URL = "https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart"; - - If ValueFilled(Identifier) Then - URL = StringReplace(URL, "/files", "/files/" + Identifier); - Response = OPI_Tools.PatchMultipartRelated(URL, Description, FileMapping, Headers); - Else - Response = OPI_Tools.PostMultipartRelated(URL, Description, FileMapping, Headers); - EndIf; - - Return Response; - -EndFunction - -Function UploadLargeFile(Val Description, Val FileMapping, Val Headers, Val Identifier = "") - - For Each File In FileMapping Do - Binary = File.Key; - Break; - EndDo; - - URL = "https://www.googleapis.com/upload/drive/v3/files?uploadType=resumable"; - - If ValueFilled(Identifier) Then - URL = StringReplace(URL, "/files", "/files/" + Identifier); - Response = OPI_Tools.Patch(URL, Description, Headers, True, True); - Else - Response = OPI_Tools.Post(URL, Description, Headers, True, True); - EndIf; - - UploadURL = Response.Headers["Location"]; - - If Not ValueFilled(UploadURL) Then - OPI_Tools.ProcessResponse(Response); - Return Response; - EndIf; - - UploadResponse = UploadFileInParts(Binary, UploadURL); - Response = ?(ValueFilled(UploadResponse), UploadResponse, Response); - - OPI_Tools.ProcessResponse(Response); - Return Response; - -EndFunction - -Function UploadFileInParts(Val Binary, Val UploadURL) - - Response = ""; - ChunkSize = 268435456; - BytesRead = 0; - CurrentPosition = 0; - TotalSize = Binary.Size(); - StrTotalSize = OPI_Tools.NumberToString(TotalSize); - ReadingData = New ReadingData(Binary); - SourceStream = ReadingData.SourceStream(); - - WHile BytesRead < TotalSize Do - - BytesRead = SourceStream.CurrentPosition(); - Result = ReadingData.Read(ChunkSize); - Current data = Result.GetBinaryData(); - CurrentSize = Current data.Size(); - NextPosition = CurrentPosition + CurrentSize - 1; - - If Not ValueFilled(Current data) Then - Break; - EndIf; - - StreamHeader = "bytes " - + OPI_Tools.NumberToString(CurrentPosition) - + "-" - + OPI_Tools.NumberToString(NextPosition) - + "/" - + StrTotalSize; - - AdditionalHeaders = New Match; - AdditionalHeaders.Insert("Content-Length", OPI_Tools.NumberToString(CurrentSize)); - AdditionalHeaders.Insert("Content-Range" , StreamHeader); - AdditionalHeaders.Insert("Content-Type" , "application/octet-stream"); - - Response = OPI_Tools.Put(UploadURL, Current data, AdditionalHeaders, False, True); - - CheckResult = CheckPartUpload(Response, StrTotalSize, AdditionalHeaders, UploadURL, CurrentPosition); - - If ValueFilled(CheckResult) Then - Return CheckResult; - EndIf; - - // !OInt KBytes = 1024; - // !OInt MByte = KBytes * KBytes; - // !OInt Notify(OPI_Tools.ProgressInformation(CurrentPosition, TotalSize, "MB", MByte)); - - // !OInt PerformGarbageCollection(); - // !OInt ReleaseObject(Current data); - - EndDo; - - Return Response; - -EndFunction - -Function CheckPartUpload(Response, StrTotalSize, AdditionalHeaders, UploadURL, CurrentPosition) - - StartOfErrorCodes = 400; - EndOfFailureCodes = 600; - StartOfSuccessCodes = 200; - EndOfSuccessCodes = 300; - Redirection = 308; - - If Response.StatusCode >= StartOfErrorCodes And Response.StatusCode < EndOfFailureCodes Then - - StreamHeader = "bytes */" + StrTotalSize; - AdditionalHeaders.Insert("Content-Range" , StreamHeader); - - CheckResponse = OPI_Tools.Put(UploadURL, "", AdditionalHeaders, False, True); - - If CheckResponse.StatusCode >= StartOfSuccessCodes And CheckResponse.StatusCode < EndOfSuccessCodes Then - - OPI_Tools.ProcessResponse(CheckResponse); - Return CheckResponse; - - ElsIf CheckResponse.StatusCode = Redirection Then - - UploadedData = Response.Headers["Range"]; - - Else - - OPI_Tools.ProcessResponse(Response); - Return Response; - - EndIf; - - Else - UploadedData = Response.Headers["Range"]; - EndIf; - - If Not ValueFilled(UploadedData) Then - OPI_Tools.ProcessResponse(Response); - Return Response; - EndIf; - - UploadedData = StringReplace(UploadedData, "bytes=", ""); - ArrayOfInformation = StrSplit(UploadedData, "-", False); - PartsRequired = 2; - - If Not ArrayOfInformation.Quantity() = PartsRequired Then - OPI_Tools.ProcessResponse(Response); - Return Response; - EndIf; - - CurrentPosition = Number(ArrayOfInformation[1]) + 1; - - Return ""; - -EndFunction - -#EndRegion diff --git a/service/interim/en/OPI/src/CommonModules/OPI_GoogleDrive/OPI_GoogleDrive.mdo b/service/interim/en/OPI/src/CommonModules/OPI_GoogleDrive/OPI_GoogleDrive.mdo deleted file mode 100644 index 1cc27c5aac..0000000000 --- a/service/interim/en/OPI/src/CommonModules/OPI_GoogleDrive/OPI_GoogleDrive.mdo +++ /dev/null @@ -1,11 +0,0 @@ - - - OPI_GoogleDrive - - - OPI google drive - - true - true - true - diff --git a/service/interim/en/OPI/src/CommonModules/OPI_GoogleSheets/Module.bsl b/service/interim/en/OPI/src/CommonModules/OPI_GoogleSheets/Module.bsl deleted file mode 100644 index fe61a908f8..0000000000 --- a/service/interim/en/OPI/src/CommonModules/OPI_GoogleSheets/Module.bsl +++ /dev/null @@ -1,409 +0,0 @@ -// Location OS: ./OInt/core/Modules/OPI_GoogleSheets.os -// Library: Google Sheets -// CLI Command: gsheets - -// MIT License - -// Copyright (c) 2023 Anton Tsitavets - -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: - -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. - -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -// https://github.com/Bayselonarrend/OpenIntegrations - -// BSLLS:LatinAndCyrillicSymbolInWord-off -// BSLLS:IncorrectLineBreak-off - -// Uncomment if OneScript is executed -// #Use "../../tools" - -#Region ProgrammingInterface - -#Region BookWork - -// CreateBook -// Creates a new book -// -// Parameters: -// Token - String - Token - token -// Name - String - Name - title -// ArrayOfSheetNames - Array of Strings - Array of names to add new sheets to the book - sheets -// -// Return value: -// Key-Value Pair - serialized JSON response from Google -Function CreateBook(Val Token, Val Name, Val ArrayOfSheetNames) Export - - OPI_TypeConversion.GetLine(Name); - OPI_TypeConversion.GetCollection(ArrayOfSheetNames); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://sheets.googleapis.com/v4/spreadsheets"; - - Properties = New Structure("title" , Name); - Sheets = New Array; - - FillSheetArray(ArrayOfSheetNames, Sheets); - - Parameters = New Structure; - OPI_Tools.AddField("properties", Properties, "Collection", Parameters); - OPI_Tools.AddField("sheets" , Sheets , "Collection", Parameters); - - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// GetBook -// Gets information about the book by ID -// -// Parameters: -// Token - String - Token - token -// Identifier - String - BookIdentifier - spreadsheet -// -// Return value: -// Key-Value Pair - serialized JSON response from Google -Function GetBook(Val Token, Val Identifier) Export - - OPI_TypeConversion.GetLine(Identifier); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://sheets.googleapis.com/v4/spreadsheets/" + Identifier; - - Response = OPI_Tools.Get(URL, , Headers); - - Return Response; - -EndFunction - -// ChangeBookName -// Changes the name of the existing book -// -// Parameters: -// Token - String - Token - token -// Book - String - BookID - spreadsheet -// Name - String - New name - title -// -// Return value: -// Key-Value Pair - serialized JSON response from Google -Function EditBookTitle(Val Token, Val Book, Val Name) Export - - OPI_TypeConversion.GetLine(Book); - OPI_TypeConversion.GetLine(Name); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://sheets.googleapis.com/v4/spreadsheets/" + Book + ":batchUpdate"; - - Change = New Structure("title", Name); - ChangeRequest = New Structure("properties,fields", Change, "title"); - Request = New Structure("updateSpreadsheetProperties", ChangeRequest); - - ArrayOfRequests = New Array; - ArrayOfRequests.Add(Request); - - Parameters = New Structure("requests", ArrayOfRequests); - - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - -EndFunction - -#EndRegion - -#Region SheetWork - -// AddSheet -// Adds a new sheet to the book -// -// -// Parameters: -// Token - String - Token - token -// Book - String - BookIdentifier - spreadsheet -// Name - String - NewSheetName - title -// -// Return value: -// Key-Value Pair - serialized JSON response from Google -Function AddSheet(Val Token, Val Book, Val Name) Export - - OPI_TypeConversion.GetLine(Book); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://sheets.googleapis.com/v4/spreadsheets/" + Book + ":batchUpdate"; - Sheet = CreateSheet(Name); - - Requests = New Array; - Change = New Structure("addSheet", Sheet); - Requests.Add(Change); - - Parameters = New Structure("requests", Requests); - - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// DeleteSheet -// Deletes a sheet from the book -// -// Parameters: -// Token - String - Token - token -// Book - String - BookIdentifier - spreadsheet -// Sheet - String - IdentifierOfSheetToDelete - sheet -// -// Return value: -// Key-Value Pair - serialized JSON response from Google -Function DeleteSheet(Val Token, Val Book, Val Sheet) Export - - OPI_TypeConversion.GetLine(Book); - OPI_TypeConversion.GetLine(Sheet); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://sheets.googleapis.com/v4/spreadsheets/" + Book + ":batchUpdate"; - - Requests = New Array; - Sheet = New Structure("sheetId" , Sheet); - Change = New Structure("deleteSheet", Sheet); - Requests.Add(Change); - - Parameters = New Structure("requests", Requests); - - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// CopySheet -// Copies a sheet from one book to another -// -// Parameters: -// Token - String - Token - token -// From - String - SourceBookID - from -// To - String - DestinationBookID - to -// Sheet - String - CopiedSheetID - sheet -// -// Return value: -// Key-Value Pair - serialized JSON response from Google -Function CopySheet(Val Token, Val From, Val To, Val Sheet) Export - - OPI_TypeConversion.GetLine(From); - OPI_TypeConversion.GetLine(To); - OPI_TypeConversion.GetLine(Sheet); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://sheets.googleapis.com/v4/spreadsheets/" - + From - + "/sheets/" - + Sheet - + ":copyTo"; - - Parameters = New Structure("destinationSpreadsheetId", To); - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - -EndFunction - -#EndRegion - -#Region DataWork - -// SetCellValues -// Sets sheet cell values -// -// Parameters: -// Token - String - Token - token -// Book - String - BookID - spreadsheet -// ValueMapping - Key-Value Pair - Fill data where the key is the cell name like A1 - data -// Sheet - String - Name лиwithта (перinый лиwithт по умолчанию) - sheetname -// MajorDimension - String - Main dimension when filling the array range - dim -// -// Return value: -// Key-Value Pair - serialized JSON response from Google -Function SetCellValues(Val Token - , Val Book - , Val ValueMapping - , Val Sheet = "" - , Val MajorDimension = "COLUMNS") Export - - OPI_TypeConversion.GetLine(Book); - OPI_TypeConversion.GetCollection(ValueMapping); - - If Not TypeValue(ValueMapping) = Type("Structure") - And Not TypeValue(ValueMapping) = Type("Match") Then - Return "Failed to convert the structure of values to a collection"; - EndIf; - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://sheets.googleapis.com/v4/spreadsheets/" + Book + "/values:batchUpdate"; - Data array = FormCellDataArray(ValueMapping, MajorDimension, Sheet); - - Parameters = New Structure("data,valueInputOption", Data array, "USER_ENTERED"); - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Clear cells -// Clears the value in cells -// -// Parameters: -// Token - String - Token - token -// Book - String - BookID - spreadsheet -// Cell array - Array of Strings - Array of cells like A1 to be cleared - cells -// Sheet - String - Name лиwithта (перinый лиwithт по умолчанию) - sheetname -// -// Return value: -// Key-Value Pair - serialized JSON response from Google -Function ClearCells(Val Token, Val Book, Val Cell array, Val Sheet = "") Export - - OPI_TypeConversion.GetLine(Book); - OPI_TypeConversion.GetCollection(Cell array); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://sheets.googleapis.com/v4/spreadsheets/" + Book + "/values:batchClear"; - - FormCellNameArray(Cell array, Sheet); - - Parameters = New Structure("ranges", Cell array); - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Get cell values -// Gets cell values of the table -// -// Parameters: -// Token - String - Token - token -// Book - String - BookID - spreadsheet -// Cell array - Array of Strings - Array ячееto inиdа А1 for получения (inеwithь лиwithт, еwithли не заполнено) - cells -// Sheet - String - Name лиwithта (перinый лиwithт по умолчанию) - sheetname -// -// Return value: -// Key-Value Pair - serialized JSON response from Google -Function GetCellValues(Val Token, Val Book, Val Cell array = "", Val Sheet = "") Export - - OPI_TypeConversion.GetLine(Book); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://sheets.googleapis.com/v4/spreadsheets/" + Book + "/values:batchGet"; - - If ValueFilled(Cell array) Then - OPI_TypeConversion.GetCollection(Cell array); - FormCellNameArray(Cell array, Sheet); - - First = True; - For Each Cell In Cell array Do - Delimiter = ?(First, "?", "&"); - URL = URL + Delimiter + "ranges=" + Cell; - First = False; - EndDo; - Else - URL = URL + "?ranges='" + Sheet + "'"; - EndIf; - - Response = OPI_Tools.Get(URL, , Headers); - - Return Response; - -EndFunction - -#EndRegion - -#EndRegion - -#Region ServiceProceduresAndFunctions - -Procedure FillSheetArray(Val ArrayOfNames, SheetArray) - - For Each SheetName In ArrayOfNames Do - - Sheet = CreateSheet(SheetName); - SheetArray.Add(Sheet); - - EndDo; - -EndProcedure - -Procedure AddSheetName(Cell, Val Sheet) - - If ValueFilled(Sheet) Then - Cell = "'" + Sheet + "'!" + Cell; - EndIf; - -EndProcedure - -Function CreateSheet(Val Name) - - OPI_TypeConversion.GetLine(Name); - - Sheet properties = New Structure("title" , Name); - Sheet = New Structure("properties", Sheet properties); - - Return Sheet; - -EndFunction - -Function FormCellDataArray(Val ValueStructure, Val MajorDimension, Val Sheet) - - OPI_TypeConversion.GetLine(Sheet); - - Data array = New Array; - - For Each CellData In ValueStructure Do - - CurrentValue = CellData.Value; - Current key = CellData.Key; - - AddSheetName(Current key, Sheet); - - OPI_TypeConversion.GetArray(CurrentValue); - - Current data = New Match; - Current array = New Array; - - Current array.Add(CurrentValue); - - OPI_Tools.AddField("range" , Current key , "String", Current data); - OPI_Tools.AddField("values" , Current array , "Array", Current data); - OPI_Tools.AddField("majorDimension", MajorDimension, "String", Current data); - - Data array.Add(Current data); - - EndDo; - - Return Data array; - -EndFunction - -Procedure FormCellNameArray(Val ArrayOfNames, Val Sheet) - - OPI_TypeConversion.GetLine(Sheet); - - For N = 0 For ArrayOfNames.WithinBoundary() Do - AddSheetName(ArrayOfNames[N], Sheet); - EndDo; - -EndProcedure - -#EndRegion diff --git a/service/interim/en/OPI/src/CommonModules/OPI_GoogleSheets/OPI_GoogleSheets.mdo b/service/interim/en/OPI/src/CommonModules/OPI_GoogleSheets/OPI_GoogleSheets.mdo deleted file mode 100644 index cf32e69a19..0000000000 --- a/service/interim/en/OPI/src/CommonModules/OPI_GoogleSheets/OPI_GoogleSheets.mdo +++ /dev/null @@ -1,11 +0,0 @@ - - - OPI_GoogleSheets - - - OPI google sheets - - true - true - true - diff --git a/service/interim/en/OPI/src/CommonModules/OPI_GoogleWorkspace/Module.bsl b/service/interim/en/OPI/src/CommonModules/OPI_GoogleWorkspace/Module.bsl deleted file mode 100644 index 7161529741..0000000000 --- a/service/interim/en/OPI/src/CommonModules/OPI_GoogleWorkspace/Module.bsl +++ /dev/null @@ -1,173 +0,0 @@ -// Location OS: ./OInt/core/Modules/OPI_GoogleWorkspace.os -// Library: Google Workspace -// CLI command: google - -// MIT License - -// Copyright (c) 2023 Anton Tsitavets - -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: - -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. - -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -// https://github.com/Bayselonarrend/OpenIntegrations - -// BSLLS:LatinAndCyrillicSymbolInWord-off -// BSLLS:IncorrectLineBreak-off - -// Uncomment if OneScript is executed -// #Use "../../tools" - -#Region ProgrammingInterface - -// Generate code retrieval link -// Returns URL for browser authorization -// -// Parameters: -// ClientID - String - Client ID - id -// Calendar - Boolean - Calendar methods permission - calendar -// Drive - Boolean - Drive methods permission - drive -// Sheets - Boolean - Sheets methods permission - sheets -// -// Return value: -// String - Code retrieval link -Function FormCodeRetrievalLink(Val ClientID - , Val Calendar = True - , Val Drive = True - , Val Sheets = True) Export - - OPI_TypeConversion.GetLine(ClientID); - OPI_TypeConversion.GetBoolean(Calendar); - OPI_TypeConversion.GetBoolean(Sheets); - OPI_TypeConversion.GetBoolean(Drive); - - URL = "https://accounts.google.com/o/oauth2/auth"; - - URLParameters = New Structure; - URLParameters.Insert("response_type", "code"); - URLParameters.Insert("client_id" , ClientID); - URLParameters.Insert("redirect_uri" , "http://localhost"); - URLParameters.Insert("access_type" , "offline"); - URLParameters.Insert("scope" , GetPermissionsList(Calendar, Drive, Sheets)); - - URL = URL + OPI_Tools.RequestParametersToString(URLParameters); - - Return URL; - -EndFunction - -// Get token by code -// Gets token by code from browser authorization -// -// Parameters: -// ClientID - String - Client ID - id -// ClientSecret - String - Client secret - secret -// Code - String - Code from browser - code -// -// Return value: -// Key-Value Pair - serialized JSON response from Google -Function GetTokenByCode(Val ClientID, Val ClientSecret, Val Code) Export - - OPI_TypeConversion.GetLine(ClientID); - OPI_TypeConversion.GetLine(ClientSecret); - OPI_TypeConversion.GetLine(Code); - - URL = "https://accounts.google.com/o/oauth2/token"; - - URLParameters = New Structure; - URLParameters.Insert("grant_type" , "authorization_code"); - URLParameters.Insert("client_id" , ClientID); - URLParameters.Insert("client_secret", ClientSecret); - URLParameters.Insert("redirect_uri" , "http://localhost"); - URLParameters.Insert("code" , Code); - - Response = OPI_Tools.Post(URL, URLParameters, , False); - - Return Response; - -EndFunction - -// Refresh token -// Updates token by Refresh token -// -// Parameters: -// ClientID - String - Client ID - id -// ClientSecret - String - Client secret - secret -// RefreshToken - String - Refresh token - refresh -// -// Return value: -// Key-Value Pair - serialized JSON response from Google -Function RefreshToken(Val ClientID, Val ClientSecret, Val RefreshToken) Export - - OPI_TypeConversion.GetLine(ClientID); - OPI_TypeConversion.GetLine(ClientSecret); - OPI_TypeConversion.GetLine(RefreshToken); - - URL = "https://accounts.google.com/o/oauth2/token"; - - URLParameters = New Structure; - URLParameters.Insert("grant_type" , "refresh_token"); - URLParameters.Insert("client_id" , ClientID); - URLParameters.Insert("client_secret", ClientSecret); - URLParameters.Insert("refresh_token", RefreshToken); - - Response = OPI_Tools.Post(URL, URLParameters, , False); - - Return Response; - -EndFunction - -#EndRegion - -#Region ServiceProgramInterface - -Function GetAuthorizationHeader(Val Token) Export - - OPI_TypeConversion.GetLine(Token); - - Headers = New Match; - Headers.Insert("Authorization", "Bearer " + Token); - - Return Headers; - -EndFunction - -#EndRegion - -#Region ServiceProceduresAndFunctions - -Function GetPermissionsList(Calendar, Drive, Sheets) - - Permissions array = New Array; - - If Calendar Then - Permissions array.Add("https://www.googleapis.com/auth/calendar"); - EndIf; - - If Drive Then - Permissions array.Add("https://www.googleapis.com/auth/drive"); - EndIf; - - If Sheets Then - Permissions array.Add("https://www.googleapis.com/auth/spreadsheets"); - EndIf; - - Return StrJoin(Permissions array, " "); - -EndFunction - -#EndRegion diff --git a/service/interim/en/OPI/src/CommonModules/OPI_GoogleWorkspace/OPI_GoogleWorkspace.mdo b/service/interim/en/OPI/src/CommonModules/OPI_GoogleWorkspace/OPI_GoogleWorkspace.mdo deleted file mode 100644 index 7f7001eaea..0000000000 --- a/service/interim/en/OPI/src/CommonModules/OPI_GoogleWorkspace/OPI_GoogleWorkspace.mdo +++ /dev/null @@ -1,11 +0,0 @@ - - - OPI_GoogleWorkspace - - - OPI google workspace - - true - true - true - diff --git a/service/interim/en/OPI/src/CommonModules/OPI_Notion/Module.bsl b/service/interim/en/OPI/src/CommonModules/OPI_Notion/Module.bsl deleted file mode 100644 index 2e77d4863b..0000000000 --- a/service/interim/en/OPI/src/CommonModules/OPI_Notion/Module.bsl +++ /dev/null @@ -1,889 +0,0 @@ -// Location OS: ./OInt/core/Modules/OPI_Notion.os -// Library: Notion -// CLI command: notion - -// MIT License - -// Copyright (c) 2023 Anton Tsitavets - -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: - -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. - -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -// https://github.com/Bayselonarrend/OpenIntegrations - -// BSLLS:LatinAndCyrillicSymbolInWord-off -// BSLLS:IncorrectLineBreak-off -// BSLLS:NumberOfOptionalParams-off -// BSLLS:UsingServiceTag-off - -// @skip-check method-too-many-params - -// Uncomment if OneScript is executed -// #Use "../../tools" - -#Region ProgrammingInterface - -#Region PageManagement - -// Create page -// Creates a child page above another parent page -// -// Parameters: -// Token - String - Token - token -// Parent - String - Parent ID - page -// Title - String - Page title - title -// -// Return value: -// Key-Value Pair - Serialized JSON response from Notion -Function CreatePage(Val Token, Val Parent, Val Title) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Parent); - OPI_TypeConversion.GetLine(Title); - - Headers = CreateRequestHeaders(Token); - Properties = New Structure; - Parameters = New Structure; - - AddPageHeader(Title, Properties); - AddPageParent(Parent, False, Parameters); - - Parameters.Insert("properties", Properties); - - Response = OPI_Tools.Post("https://api.notion.com/v1/pages", Parameters, Headers); - - Return Response; - -EndFunction - -// Create page in database -// Creates a page in the parent database -// -// Parameters: -// Token - String - Token - token -// Parent - String - Parent database ID - base -// Data - Key-Value Pair - Properties match - data -// -// Return value: -// Key-Value Pair - Serialized JSON response from Notion -Function CreatePageInDatabase(Val Token, Val Parent, Val Data) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Parent); - OPI_TypeConversion.GetCollection(Data); - - Headers = CreateRequestHeaders(Token); - Parameters = New Structure; - - AddPageParent(Parent, True, Parameters); - - Properties = FillDataBySchema(Parent, Data, Token); - Parameters.Insert("properties", Properties); - - Response = OPI_Tools.Post("https://api.notion.com/v1/pages", Parameters, Headers); - - Return Response; - -EndFunction - -// Get page -// Gets information about the page by ID -// -// Parameters: -// Token - String - Token - token -// Page - String - Page ID - page -// -// Return value: -// Key-Value Pair - Serialized JSON response from Notion -Function GetPage(Val Token, Val Page) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Page); - - Headers = CreateRequestHeaders(Token); - ConvertID(Page); - - Response = OPI_Tools.Get("https://api.notion.com/v1/pages/" + Page, , Headers); - - Return Response; - -EndFunction - -// Edit page properties. -// -// Parameters: -// Token - String - Token - token -// Page - String - ID of the page being modified - page -// Data - Key-Value Pair - Matching of editable parameters - data -// Icon - String - URL of the page icon image - icon -// Cover - String - URL of the page cover image - cover -// Archived - Boolean - Archive page or нет (boolean) - archive -// -// Return value: -// Key-Value Pair - Serialized JSON response from Notion -Function EditPageProperties(Val Token - , Val Page - , Val Data = "" - , Val Icon = "" - , Val Cover = "" - , Val Archived = False) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Page); - OPI_TypeConversion.GetLine(Icon); - OPI_TypeConversion.GetLine(Cover); - OPI_TypeConversion.GetBoolean(Archived); - OPI_TypeConversion.GetCollection(Data); - - Headers = CreateRequestHeaders(Token); - Parameters = New Structure; - Files = "files"; - - If ValueFilled(Data) - And (TypeValue(Data) = Type("Match") Or TypeValue(Data) = Type("Structure")) Then - Properties = FillDataBySchema(Page, Data, Token, False); - Else - Properties = New Match; - EndIf; - - If ValueFilled(Icon) Then - Icon match = New Match; - Icon match.Insert("Icon", Icon); - - Icon object = ConvertValueByType(Files, Icon match); - Icon object = Icon object[Files][0]; - Icon object.Delete("name"); - - Parameters.Insert("icon", Icon object); - EndIf; - - If ValueFilled(Cover) Then - Cover match = New Match; - Cover match.Insert("Cover", Cover); - - Cover object = ConvertValueByType(Files, Cover match); - Cover object = Cover object[Files][0]; - Cover object.Delete("name"); - - Parameters.Insert("cover", Cover object); - EndIf; - - Parameters.Insert("properties", Properties); - Parameters.Insert("archived" , Archived); - - ConvertID(Page); - - Response = OPI_Tools.Patch("https://api.notion.com/v1/pages/" + Page, Parameters, Headers); - - Return Response; - -EndFunction - -#EndRegion - -#Region DatabaseManagement - -// Create database -// Creates a database -// -// Parameters: -// Token - String - Token - token -// Parent - String - Parent page ID - page -// Title - String - Database title - title -// Properties - Structure Of String - Database properties - props -// -// Return value: -// Key-Value Pair - Serialized JSON response from Notion -Function CreateDatabase(Val Token, Val Parent, Val Title, Val Properties = "") Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Parent); - OPI_TypeConversion.GetLine(Title); - OPI_TypeConversion.GetCollection(Properties); - - // Example structure/property map - - // Name : title - // Description : rich_text - // In progress : checkbox - // Quantity : number - // Date : date - // Status : Map - // Active : green - // Inactive : red - // Archive : yellow - - // All pages created as children must have parent base properties - - If Not TypeValue(Properties) = Type("Structure") And Not TypeValue(Properties) = Type("Match") Then - Properties = New Structure("Name", "title"); - EndIf; - - Headers = CreateRequestHeaders(Token); - Parameters = New Structure; - - AddDatabaseParent(Parent, False, Parameters); - AddDatabaseHeader(Title, Parameters); - AddDatabaseProperties(Properties, Parameters); - - Response = OPI_Tools.Post("https://api.notion.com/v1/databases", Parameters, Headers); - - Return Response; - -EndFunction - -// Get database -// Get database information -// -// Parameters: -// Token - String - Token - token -// Base - String - Database ID - base -// -// Return value: -// Key-Value Pair - Serialized JSON response from Notion -Function GetDatabase(Val Token, Val Base) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Base); - - Headers = CreateRequestHeaders(Token); - ConvertID(Base); - - Response = OPI_Tools.Get("https://api.notion.com/v1/databases/" + Base, , Headers); - - Return Response; - -EndFunction - -// Edit database properties -// Edits properties of an existing database -// -// Parameters: -// Token - String - Token - token -// Base - String - Target database ID - base -// Properties - Map from KeyAndValue - New or modified database properties - props -// Title - String - New database title - title -// Description - String - New database description - description -// -// Return value: -// Key-Value Pair - Serialized JSON response from Notion -Function EditDatabaseProperties(Val Token, Val Base, Val Properties = "", Val Title = "", Val Description = "") Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Base); - OPI_TypeConversion.GetLine(Title); - OPI_TypeConversion.GetLine(Description); - OPI_TypeConversion.GetCollection(Properties); - - Parameters = New Structure; - Headers = CreateRequestHeaders(Token); - ConvertID(Base); - - If ValueFilled(Title) Then - AddDatabaseHeader(Title, Parameters); - EndIf; - - If ValueFilled(Description) Then - AddDatabaseDescription(Description, Parameters); - EndIf; - - If TypeValue(Properties) = Type("Structure") Or TypeValue(Properties) = Type("Match") Then - AddDatabaseProperties(Properties, Parameters); - EndIf; - - Response = OPI_Tools.Patch("https://api.notion.com/v1/databases/" + Base, Parameters, Headers); - - Return Response; - -EndFunction - -#EndRegion - -#Region BlockWork - -// Create block -// Creates a new block based on an existing block -// -// Parameters: -// Token - String - Token - token -// Parent - String - Parent block or page ID - page -// Block - String, Map From KeyAndValue - Block ID or block sample itself - block -// InsertAfter - String - Block ID after which to insert the new one - prev -// -// Return value: -// Key-Value Pair - Serialized JSON response from Notion -Function CreateBlock(Val Token, Val Parent, Val Block, Val InsertAfter = "") Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Parent); - OPI_TypeConversion.GetLine(InsertAfter); - OPI_TypeConversion.GetCollection(Block); - - If TypeValue(Block) = Type("Array") Then - Block = Block[0]; - EndIf; - - Headers = CreateRequestHeaders(Token); - ConvertID(Parent); - - If TypeValue(Block) = Type("String") Then - ConvertID(Block); - Block = ReturnBlock(Token, Block); - EndIf; - - BlockArray = New Array; - BlockArray.Add(Block); - - Parameters = New Match; - Parameters.Insert("children", BlockArray); - - If ValueFilled(InsertAfter) Then - Parameters.Insert("after", InsertAfter); - EndIf; - - URL = "https://api.notion.com/v1/blocks/" + Parent + "/children"; - Response = OPI_Tools.Patch(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Inернуть блоto. -// -// Parameters: -// Token - String - Token - token -// BlockID - String - Block ID - block -// OnlyBase - Boolean - True > service fields are deleted, only the block itself remains - core -// -// Return value: -// Key-Value Pair - Serialized JSON response from Notion -Function ReturnBlock(Val Token, Val BlockID, Val OnlyBase = True) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(BlockID); - OPI_TypeConversion.GetBoolean(OnlyBase); - - ConvertID(BlockID); - - Headers = CreateRequestHeaders(Token); - Response = OPI_Tools.Get("https://api.notion.com/v1/blocks/" + BlockID, , Headers); - - If OnlyBase Then - RemoveExtraBlockFields(Response); - EndIf; - - Return Response; - -EndFunction - -// Return child blocks -// Returns list of child blocks of parent block -// -// Parameters: -// Token - String - Token - token -// BlockID - String - Parent block ID - block -// -// Return value: -// Key-Value Pair - Serialized JSON response from Notion -Function ReturnChildBlocks(Val Token, Val BlockID) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(BlockID); - - ConvertID(BlockID); - - Headers = CreateRequestHeaders(Token); - Response = OPI_Tools.Get("https://api.notion.com/v1/blocks/" + BlockID + "/children", , Headers); - - Return Response; - -EndFunction - -// Delete block -// Deletes block by ID -// -// Parameters: -// Token - String - Token - token -// BlockID - String - Block ID - block -// -// Return value: -// Key-Value Pair - Serialized JSON response from Notion -Function DeleteBlock(Val Token, Val BlockID) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(BlockID); - - ConvertID(BlockID); - - Headers = CreateRequestHeaders(Token); - Response = OPI_Tools.Delete("https://api.notion.com/v1/blocks/" + BlockID, , Headers); - - Return Response; - -EndFunction - -#EndRegion - -#Region Users - -// User list -// Returns a list of workspace users -// -// Parameters: -// Token - String - Token - token -// -// Return value: -// Key-Value Pair - Serialized JSON response from Notion -Function UserList(Val Token) Export - - OPI_TypeConversion.GetLine(Token); - - Headers = CreateRequestHeaders(Token); - Response = OPI_Tools.Get("https://api.notion.com/v1/users", , Headers); - - Return Response; - -EndFunction - -// Get user data -// Gets user data by ID -// -// Parameters: -// Token - String - Token - token -// UserID - String - Target user ID - user -// -// Return value: -// Key-Value Pair - Serialized JSON response from Notion -Function GetUserData(Val Token, Val UserID) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(UserID); - - ConvertID(UserID); - - Headers = CreateRequestHeaders(Token); - Response = OPI_Tools.Get("https://api.notion.com/v1/users/" + UserID, , Headers); - - Return Response; - -EndFunction - -#EndRegion - -#EndRegion - -#Region ServiceProceduresAndFunctions - -Function CreateRequestHeaders(Val Token) - - OPI_TypeConversion.GetLine(Token); - - Headers = New Match; - Headers.Insert("Authorization" , "Bearer " + Token); - Headers.Insert("Notion-Version", "2022-06-28"); - - Return Headers; - -EndFunction - -Procedure ConvertID(Identifier) - - OPI_TypeConversion.GetLine(Identifier); - - Identifier = StringReplace(Identifier, "-", ""); - -EndProcedure - -Procedure AddPageParent(Val Parent, Val ParentBase, MainStructure) - - OPI_TypeConversion.GetLine(ParentBase); - - ConvertID(Parent); - - IdentifierField = ?(ParentBase, "database_id", "page_id"); - ParentStructure = New Structure(IdentifierField, Parent); - - MainStructure.Insert("parent", ParentStructure); - -EndProcedure - -Procedure AddDatabaseParent(Val Parent, Val ParentBase, MainStructure) - - OPI_TypeConversion.GetLine(ParentBase); - - ConvertID(Parent); - - IdentifierField = ?(ParentBase, "database_id", "page_id"); - - ParentStructure = New Structure(); - ParentStructure.Insert("type" , IdentifierField); - ParentStructure.Insert(IdentifierField, Parent); - - MainStructure.Insert("parent", ParentStructure); - -EndProcedure - -Procedure AddPageHeader(Val Title, MainStructure) - - OPI_TypeConversion.GetLine(Title); - - SubordinateStructure = New Structure; - DataStructure = New Structure; - TextStructure = New Structure; - Data array = New Array; - Title = "title"; - - TextStructure.Insert("content", Title); - TextStructure.Insert("link" , Undefined); - - DataStructure.Insert("text", TextStructure); - DataStructure.Insert("type", "text"); - - Data array.Add(DataStructure); - - SubordinateStructure.Insert("id" , Title); - SubordinateStructure.Insert("type" , Title); - SubordinateStructure.Insert(Title , Data array); - - MainStructure.Insert(Title, SubordinateStructure); - -EndProcedure - -Procedure AddDatabaseHeader(Val Title, MainStructure) - - OPI_TypeConversion.GetLine(Title); - - Title = ConvertHeader(Title); - MainStructure.Insert("title", Title["title"]); - -EndProcedure - -Procedure AddDatabaseDescription(Val Description, MainStructure) - - OPI_TypeConversion.GetLine(Description); - - Title = ConvertHeader(Description); - MainStructure.Insert("description", Title["title"]); - -EndProcedure - -Procedure AddDatabaseProperties(Val Properties, MainStructure) - - If Properties.Quantity() = 0 Then - MainStructure.Insert("properties", New Structure); - Return; - EndIf; - - ParameterMap = New Match; - - For Each Property In Properties Do - - If TypeValue(Property.Value) = Type("String") Then - - ParameterMap.Insert(Property.Key, New Structure(Property.Value, New Structure)); - - ElsIf TypeValue(Property.Value) = Type("Structure") - Or TypeValue(Property.Value) = Type("Match") Then - - ValueSelection = FormSelectionValues(Property.Value); - ParameterMap.Insert(Property.Key, New Structure("select", ValueSelection)); - - Else - - ParameterMap.Insert(Property.Key, Property.Value); - - EndIf; - - EndDo; - - MainStructure.Insert("properties", ParameterMap); - -EndProcedure - -Function FormSelectionValues(Val VariantStructure) - - OptionArray = New Array; - - For Each Option In VariantStructure Do - - OptionMap = New Match; - OptionMap.Insert("name" , Option.Key); - OptionMap.Insert("color", Option.Value); - - OptionArray.Add(OptionMap); - - EndDo; - - Return New Structure("options", OptionArray); - -EndFunction - -Function FillDataBySchema(Val Scheme, Val Data, Val Token, Val ThisIsBase = True) - - If ThisIsBase Then - SchemaData = GetDatabase(Token, Scheme); - Else - SchemaData = GetPage(Token, Scheme); - EndIf; - - BaseFields = SchemaData["properties"]; - Properties = New Match; - - If ValueFilled(BaseFields) Then - - For Each Field In BaseFields Do - - FieldData = Field.Value; - FieldType = FieldData["type"]; - - FillableData = Data.Get(Field.Key); - - If FillableData = Undefined Then - Continue; - EndIf; - - ConvertedData = ConvertValueByType(FieldType, FillableData); - - If ConvertedData = Undefined Then - Continue; - EndIf; - - Properties.Insert(FieldData["id"], ConvertedData); - - EndDo; - - EndIf; - - Return Properties; - -EndFunction - -Procedure RemoveExtraBlockFields(Val Block) - - ExtraArray = New Array; - ExtraArray.Add("request_id"); - ExtraArray.Add("archived"); - ExtraArray.Add("created_by"); - ExtraArray.Add("last_edited_time"); - ExtraArray.Add("created_time"); - ExtraArray.Add("has_children"); - ExtraArray.Add("parrent"); - ExtraArray.Add("last_edited_by"); - ExtraArray.Add("id"); - - For Each Field In ExtraArray Do - - If Not Block.Get(Field) = Undefined Then - Block.Delete(Field); - EndIf; - - EndDo; - -EndProcedure - -#Region TypeConversion - -Function ConvertValueByType(Val Type, Val Value) - - If Type = "title" Then - Return ConvertHeader(Value); - ElsIf Type = "rich_text" Then - Return ConvertText(Value); - ElsIf Type = "number" Then - Return ConvertNumber(Value); - ElsIf Type = "select" Then - Return ConvertSelectionOption(Value); - ElsIf Type = "multi_select" Then - Return ConvertMultipleChoice(Value); - ElsIf Type = "status" Then - Return ConvertStatus(Value); - ElsIf Type = "date" Then - Return ConvertDate(Value); - ElsIf Type = "relation" Then - Return ConvertLink(Value); - ElsIf Type = "people" Then - Return ConvertUsers(Value); - ElsIf Type = "files" Then - Return ConvertFiles(Value); - ElsIf Type = "checkbox" Then - Return ConvertBoolean(Value); - ElsIf Type = "url" Then - Return ConvertLink(Value); - ElsIf Type = "email" Then - Return ConvertEmail(Value); - ElsIf Type = "phone_number" Then - Return ConvertPhone(Value); - Else - Return Undefined; - EndIf; - -EndFunction - -Function ConvertHeader(Val Title) - - DataStructure = New Structure; - TextStructure = New Structure; - Data array = New Array; - - TextStructure.Insert("content", Title); - TextStructure.Insert("link" , Undefined); - - DataStructure.Insert("type", "text"); - DataStructure.Insert("text", TextStructure); - - Data array.Add(DataStructure); - - Return New Structure("title", Data array); - -EndFunction - -Function ConvertText(Val Text) - - TextArray = New Array; - TextStructure = New Structure; - - TextStructure.Insert("type", "text"); - TextStructure.Insert("text", New Structure("content", Text)); - - TextArray.Add(TextStructure); - - Return New Structure("rich_text", TextArray); - -EndFunction - -Function ConvertNumber(Val Number) - Return New Structure("number", Number); -EndFunction - -Function ConvertSelectionOption(Val Option) - - ChoiceStructure = New Structure; - ChoiceStructure.Insert("select", New Structure("name", Option)); - - Return ChoiceStructure; - -EndFunction - -Function ConvertStatus(Val Status) - - StatusStructure = New Structure; - StatusStructure.Insert("status", New Structure("name", Status)); - - Return StatusStructure; - -EndFunction - -Function ConvertMultipleChoice(Val OptionArray) - - ChoiceOptionArray = New Array; - - For Each Option In OptionArray Do - ChoiceOptionArray.Add(New Structure("name", Option)); - EndDo; - - Return New Structure("multi_select", ChoiceOptionArray); - -EndFunction - -Function ConvertDate(Val Date) - - DateStructure = New Structure; - - If Date = StartOfDay(Date) Then - DateFormat = "DF=yyyy-MM-dd"; - Else - DateFormat = "ISO8601Datetime"; - EndIf; - - Date = Format(Date, DateFormat); - DateStructure.Insert("start", Date); - - Return New Structure("date", DateStructure); - -EndFunction - -Function ConvertLink(Val Identifier) - - LinkArray = New Array; - LinkArray.Add(New Structure("id", Identifier)); - - Return New Structure("relation", LinkArray); - -EndFunction - -Function ConvertUsers(Val IDArray) - - If Not TypeValue(IDArray) = Type("Array") Then - ArrayID_ = New Array; - ArrayID_.Add(IDArray); - IDArray = ArrayID_; - EndIf; - - ArrayOfUsers = New Array; - - For Each Identifier In IDArray Do - - UserStructure = New Structure; - UserStructure.Insert("object", "user"); - UserStructure.Insert("id" , Identifier); - ArrayOfUsers.Add(UserStructure); - - EndDo; - - Return New Structure("people", ArrayOfUsers); - -EndFunction - -Function ConvertFiles(Val FileMapping) - - ArrayOfFiles = New Array; - - For Each File In FileMapping Do - - FileStructure = New Structure; - FileStructure.Insert("type" , "external"); - FileStructure.Insert("name" , File.Key); - FileStructure.Insert("external", New Structure("url", File.Value)); - - ArrayOfFiles.Add(FileStructure); - - EndDo; - - Return New Structure("files", ArrayOfFiles); - -EndFunction - -Function ConvertBoolean(Val Boolean) - Return New Structure("checkbox", Boolean); -EndFunction - -Function ConvertLink(Val URL) - Return New Structure("url", URL); -EndFunction - -Function ConvertEmail(Val Email) - Return New Structure("email", Email); -EndFunction - -Function ConvertPhone(Val Phone) - Return New Structure("phone_number", Phone); -EndFunction - -#EndRegion - -#EndRegion diff --git a/service/interim/en/OPI/src/CommonModules/OPI_Notion/OPI_Notion.mdo b/service/interim/en/OPI/src/CommonModules/OPI_Notion/OPI_Notion.mdo deleted file mode 100644 index 159dbf1812..0000000000 --- a/service/interim/en/OPI/src/CommonModules/OPI_Notion/OPI_Notion.mdo +++ /dev/null @@ -1,11 +0,0 @@ - - - OPI_Notion - - ru - Methodы work with Notion (OPI) - - true - true - true - diff --git a/service/interim/en/OPI/src/CommonModules/OPI_Slack/Module.bsl b/service/interim/en/OPI/src/CommonModules/OPI_Slack/Module.bsl deleted file mode 100644 index 52f0a4464e..0000000000 --- a/service/interim/en/OPI/src/CommonModules/OPI_Slack/Module.bsl +++ /dev/null @@ -1,1055 +0,0 @@ -// Location OS: ./OInt/core/Modules/OPI_Slack.os -// Library: Slack -// CLI command: slack - -// MIT License - -// Copyright (c) 2023 Anton Tsitavets - -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: - -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. - -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -// https://github.com/Bayselonarrend/OpenIntegrations - -// BSLLS:IncorrectLineBreak-off -// BSLLS:Typo-off - -// Uncomment if OneScript is executed -// #Use "../../tools" - -#Region ProgrammingInterface - -#Region ManagementAndSettings - -// Get bot information -// Gets basic information about the bot -// -// Parameters: -// Token - String - Bot token - token -// -// Return value: -// Key-Value Pair - Serialized JSON response from Slack -Function GetBotInformation(Val Token) Export - - URL = "https://slack.com/api/auth.test"; - Headers = GetAuthorizationHeader(Token); - - Response = OPI_Tools.Get(URL, , Headers); - - Return Response; - -EndFunction - -// Get workspace list -// Gets a list of workspaces where the bot is connected -// -// Parameters: -// Token - String - Bot token - token -// Cursor - String - Pointer from the previous request, if the result rows > 100 - cursor -// -// Return value: -// Key-Value Pair - Serialized JSON response from Slack -Function GetWorkspaceList(Val Token, Val Cursor = "") Export - - URL = "https://slack.com/api/auth.teams.list"; - Response = GeneralDataRetrieval(Token, URL, Cursor); - - Return Response; - -EndFunction - -// Get user list -// Gets a list of users in the workspace -// -// Parameters: -// Token - String - Bot token - token -// Cursor - String - Pointer from the previous request, if the result rows > 100 - cursor -// -// Return value: -// Key-Value Pair - Serialized JSON response from Slack -Function GetUserList(Val Token, Val Cursor = "") Export - - URL = "https://slack.com/api/users.list"; - Response = GeneralDataRetrieval(Token, URL, Cursor); - - Return Response; - -EndFunction - -#EndRegion - -#Region MessageManagement - -// Send message -// Sends a message at a selected hour -// -// Parameters: -// Token - String - Bot token - token -// Channel - String - Channel ID - channel -// Text - String - Message text - text -// Sending date - Date - Sending date for delayed message - date -// Blocks - Array of Structures - Array of block descriptions - blocks - JSON array of block descriptions -// -// Return value: -// Key-Value Pair - Serialized JSON response from Slack -Function SendMessage(Val Token, Val Channel, Val Text = "", Val Sending date = "", Val Blocks = "") Export - - String_ = "String"; - HasDate = ValueFilled(Sending date); - Headers = GetAuthorizationHeader(Token); - - If ValueFilled(Blocks) And TypeValue(Blocks) = Type(String_) Then - OPI_TypeConversion.GetCollection(Blocks); - - If TypeValue(Blocks) = Type("Array") Then - - For N = 0 For Blocks.WithinBoundary() Do - OPI_TypeConversion.GetCollection(Blocks[N]); - EndDo; - - EndIf; - - EndIf; - - Parameters = New Structure; - OPI_Tools.AddField("channel", Channel, String_ , Parameters); - OPI_Tools.AddField("text" , Text, String_ , Parameters); - OPI_Tools.AddField("blocks" , Blocks, "Array" , Parameters); - - If HasDate Then - - URL = "https://slack.com/api/chat.scheduleMessage"; - OPI_Tools.AddField("post_at", Sending date, "Date", Parameters); - - Else - - URL = "https://slack.com/api/chat.postMessage"; - - EndIf; - - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Send ephemeral message -// Sends a message that arrives in the channel but is visible -// only to a specific user -// -// Parameters: -// Token - String - Bot token - token -// Channel - String - Channel ID - channel -// Text - String - Message text - text -// User - String - User ID - user -// Blocks - Array of Structures - Array of block descriptions - blocks - JSON array of block descriptions -// -// Return value: -// Key-Value Pair - Serialized JSON response from Slack -Function SendEphemeralMessage(Val Token - , Val Channel - , Val Text = "" - , Val User = "" - , Val Blocks = "") Export - - String_ = "String"; - - If ValueFilled(Blocks) And Not TypeValue(Blocks) = Type(String_) Then - OPI_TypeConversion.GetArray(Blocks); - EndIf; - - Headers = GetAuthorizationHeader(Token); - - Parameters = New Structure; - OPI_Tools.AddField("channel", Channel , String_ , Parameters); - OPI_Tools.AddField("text" , Text , String_ , Parameters); - OPI_Tools.AddField("user" , User, String_ , Parameters); - OPI_Tools.AddField("blocks" , Blocks , "Collection", Parameters); - - URL = "https://slack.com/api/chat.postEphemeral"; - - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Edit message -// Edits the content of an existing message -// -// Parameters: -// Token - String - Bot token - token -// Channel - String - Channel ID - channel -// Timestamp - String - Message timestamp - stamp -// Text - String - New message text - text -// BlockArray - Array of Structures - Array of block descriptions - blocks - JSON array of block descriptions -// -// Return value: -// Key-Value Pair - Serialized JSON response from Slack -Function EditMessage(Val Token, Val Channel, Val Timestamp, Val Text = "", Val BlockArray = "") Export - - String_ = "String"; - URL = "https://slack.com/api/chat.update"; - Headers = GetAuthorizationHeader(Token); - - Parameters = New Structure; - OPI_Tools.AddField("channel", Channel , String_ , Parameters); - OPI_Tools.AddField("text" , Text , String_ , Parameters); - OPI_Tools.AddField("ts" , Timestamp , String_ , Parameters); - OPI_Tools.AddField("blocks" , BlockArray, "Collection", Parameters); - - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Delete message -// Deletes a channel message by timestamp -// -// Parameters: -// Token - String - Bot token - token -// Channel - String - Channel ID - channel -// Timestamp - String - Timestamp or message ID - stamp -// IsDelayed - Boolean - Indicator of deleting a delayed message - issheduled -// -// Return value: -// Key-Value Pair - Serialized JSON response from Slack -Function DeleteMessage(Val Token, Val Channel, Val Timestamp, Val IsDelayed = False) Export - - OPI_TypeConversion.GetBoolean(IsDelayed); - - Headers = GetAuthorizationHeader(Token); - - If IsDelayed Then - URL = "https://slack.com/api/chat.deleteScheduledMessage"; - TimestampField = "scheduled_message_id"; - Else - URL = "https://slack.com/api/chat.delete"; - TimestampField = "ts"; - EndIf; - - Parameters = New Structure; - OPI_Tools.AddField("channel" , Channel , "String", Parameters); - OPI_Tools.AddField(TimestampField, Timestamp, "String", Parameters); - - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Get list of delayed messages -// Gets a list of delayed channel messages -// -// Parameters: -// Token - String - Bot token - token -// Channel - String - Channel ID - channel -// Cursor - String - Pointer from the previous request, if the result rows > 100 - cursor -// -// Return value: -// Key-Value Pair - Serialized JSON response from Slack -Function GetDelayedMessageList(Val Token, Val Channel, Val Cursor = "") Export - - URL = "https://slack.com/api/chat.scheduledMessages.list"; - Headers = GetAuthorizationHeader(Token); - - Parameters = New Structure; - OPI_Tools.AddField("channel", Channel , "String", Parameters); - OPI_Tools.AddField("cursor" , Cursor, "String", Parameters); - - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Get message link -// Gets a permanent URL to the channel message -// -// Parameters: -// Token - String - Bot token - token -// Channel - String - Channel ID - channel -// Timestamp - String - Timestamp or message ID - stamp -// -// Return value: -// Key-Value Pair - Serialized JSON response from Slack -Function GetMessageLink(Val Token, Val Channel, Val Timestamp) Export - - URL = "https://slack.com/api/chat.getPermalink"; - Headers = GetAuthorizationHeader(Token); - - Parameters = New Structure; - OPI_Tools.AddField("channel" , Channel , "String", Parameters); - OPI_Tools.AddField("message_ts", Timestamp, "String", Parameters); - - Response = OPI_Tools.Get(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Get list of message replies -// Gets an array of messages that are replies to the specified -// -// Parameters: -// Token - String - Bot token - token -// Channel - String - Channel ID - channel -// Timestamp - String - Timestamp or message ID - stamp -// Cursor - String - Pointer from the previous request, if the result rows > 100 - cursor -// -// Return value: -// Key-Value Pair - Serialized JSON response from Slack -Function GetMessageReplyList(Val Token, Val Channel, Val Timestamp, Val Cursor = "") Export - - String_ = "String"; - URL = "https://slack.com/api/conversations.replies"; - Headers = GetAuthorizationHeader(Token); - - Parameters = New Structure; - OPI_Tools.AddField("channel", Channel , String_, Parameters); - OPI_Tools.AddField("cursor" , Cursor , String_, Parameters); - OPI_Tools.AddField("ts" , Timestamp, String_, Parameters); - - Response = OPI_Tools.Get(URL, Parameters, Headers); - - Return Response; - -EndFunction - -#EndRegion - -#Region ChannelManagement - -// Get channel list -// Gets a list of available channels -// -// Parameters: -// Token - String - Bot token - token -// ExcludeArchived - Boolean - Indicator of excluding archived channels - notarchived -// Cursor - String - Pointer from the previous request, if the result rows > 100 - cursor -// -// Return value: -// Key-Value Pair - Serialized JSON response from Slack -Function GetChannelList(Val Token, Val ExcludeArchived = False, Val Cursor = "") Export - - URL = "https://slack.com/api/conversations.list"; - Headers = GetAuthorizationHeader(Token); - - Parameters = New Structure; - OPI_Tools.AddField("exclude_archived", ExcludeArchived, "Boolean", Parameters); - OPI_Tools.AddField("cursor" , Cursor , "String", Parameters); - - Response = OPI_Tools.Get(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Get channel user list -// Gets a list of users in the specified channel -// -// Parameters: -// Token - String - Bot token - token -// Channel - String - Channel ID - channel -// Cursor - String - Pointer from the previous request, if the result rows > 100 - cursor -// -// Return value: -// Key-Value Pair - Serialized JSON response from Slack -Function GetChannelUserList(Val Token, Val Channel, Val Cursor = "") Export - - URL = "https://slack.com/api/conversations.members"; - Headers = GetAuthorizationHeader(Token); - - Parameters = New Structure; - OPI_Tools.AddField("channel", Channel , "String", Parameters); - OPI_Tools.AddField("cursor" , Cursor, "String", Parameters); - - Response = OPI_Tools.Get(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Create channel -// Creates a new channel -// -// Parameters: -// Token - String - Bot token - token -// Name - String - Channel name - title -// Private - Boolean - Create channel as private - private -// -// Return value: -// Key-Value Pair - Serialized JSON response from Slack -Function CreateChannel(Val Token, Val Name, Val Private = False) Export - - URL = "https://slack.com/api/conversations.create"; - Headers = GetAuthorizationHeader(Token); - - Parameters = New Structure; - OPI_Tools.AddField("name" , Name , "String", Parameters); - OPI_Tools.AddField("is_private", Private, "Boolean", Parameters); - - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Archive channel -// Archives an active channel -// -// Parameters: -// Token - String - Bot token - token -// Channel - String - Channel ID - channel -// -// Return value: -// Key-Value Pair - Serialized JSON response from Slack -Function ArchiveChannel(Val Token, Val Channel) Export - - URL = "https://slack.com/api/conversations.archive"; - Response = DialogManagement(Token, Channel, URL); - Return Response; - -EndFunction - -// Get channel -// Gets information about the channel -// -// Parameters: -// Token - String - Bot token - token -// Channel - String - Channel ID - channel -// -// Return value: -// Key-Value Pair - Serialized JSON response from Slack -Function GetChannel(Val Token, Val Channel) Export - - URL = "https://slack.com/api/conversations.info"; - Response = DialogManagement(Token, Channel, URL, "GET"); - Return Response; - -EndFunction - -// Get channel history -// Gets information about channel events -// -// Parameters: -// Token - String - Bot token - token -// Channel - String - Channel ID - channel -// -// Return value: -// Key-Value Pair - Serialized JSON response from Slack -Function GetChannelHistory(Val Token, Val Channel) Export - - URL = "https://slack.com/api/conversations.history"; - Response = DialogManagement(Token, Channel, URL, "GET"); - Return Response; - -EndFunction - -// Invite users to channel -// Adds specified users to the channel -// -// Parameters: -// Token - String - Bot token - token -// Channel - String - Channel ID - channel -// ArrayOfUsers - Array Of String - User ID Array - users -// -// Return value: -// Key-Value Pair - Serialized JSON response from Slack -Function InviteUsersToChannel(Val Token, Val Channel, Val ArrayOfUsers) Export - - URL = "https://slack.com/api/conversations.invite"; - Headers = GetAuthorizationHeader(Token); - - OPI_TypeConversion.GetCollection(ArrayOfUsers); - ArrayOfUsers = StrJoin(ArrayOfUsers, ","); - - Parameters = New Structure; - OPI_Tools.AddField("channel", Channel , "String", Parameters); - OPI_Tools.AddField("users" , ArrayOfUsers, "String", Parameters); - - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Kick user from channel -// Removes specified user from channel -// -// Parameters: -// Token - String - Bot token - token -// Channel - String - Channel ID - channel -// User - String - User ID - user -// -// Return value: -// Key-Value Pair - Serialized JSON response from Slack -Function KickUserFromChannel(Val Token, Val Channel, Val User) Export - - URL = "https://slack.com/api/conversations.kick"; - Headers = GetAuthorizationHeader(Token); - - Parameters = New Structure; - OPI_Tools.AddField("channel", Channel , "String", Parameters); - OPI_Tools.AddField("user" , User, "String", Parameters); - - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Join channel -// Adds the current bot to the channel -// -// Parameters: -// Token - String - Bot token - token -// Channel - String - Channel ID - channel -// -// Return value: -// Key-Value Pair - Serialized JSON response from Slack -Function JoinChannel(Val Token, Val Channel) Export - - URL = "https://slack.com/api/conversations.join"; - Response = DialogManagement(Token, Channel, URL); - Return Response; - -EndFunction - -// Leave channel -// Removes the current bot from the channel -// -// Parameters: -// Token - String - Bot token - token -// Channel - String - Channel ID - channel -// -// Return value: -// Key-Value Pair - Serialized JSON response from Slack -Function LeaveChannel(Val Token, Val Channel) Export - - URL = "https://slack.com/api/conversations.leave"; - Response = DialogManagement(Token, Channel, URL); - Return Response; - -EndFunction - -// Set channel topic -// Sets the channel topic -// -// Parameters: -// Token - String - Bot token - token -// Channel - String - Channel ID - channel -// Topic - String - Channel topic - theme -// -// Return value: -// Key-Value Pair - Serialized JSON response from Slack -Function SetChannelTopic(Val Token, Val Channel, Val Topic) Export - - URL = "https://slack.com/api/conversations.setTopic"; - Headers = GetAuthorizationHeader(Token); - - Parameters = New Structure; - OPI_Tools.AddField("channel", Channel , "String", Parameters); - OPI_Tools.AddField("topic" , Topic , "String", Parameters); - - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Set channel purpose -// Sets the channel purpose (description) -// -// Parameters: -// Token - String - Bot token - token -// Channel - String - Channel ID - channel -// Purpose - String - Channel purpose - purpose -// -// Return value: -// Key-Value Pair - Serialized JSON response from Slack -Function SetChannelGoal(Val Token, Val Channel, Val Purpose) Export - - URL = "https://slack.com/api/conversations.setPurpose"; - Headers = GetAuthorizationHeader(Token); - - Parameters = New Structure; - OPI_Tools.AddField("channel", Channel , "String", Parameters); - OPI_Tools.AddField("purpose", Purpose , "String", Parameters); - - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Rename channel -// Changes the name of the channel -// -// Parameters: -// Token - String - Bot token - token -// Channel - String - Channel ID - channel -// Name - String - New channel name - title -// -// Return value: -// Key-Value Pair - Serialized JSON response from Slack -Function RenameChannel(Val Token, Val Channel, Val Name) Export - - URL = "https://slack.com/api/conversations.rename"; - Headers = GetAuthorizationHeader(Token); - - Parameters = New Structure; - OPI_Tools.AddField("channel", Channel , "String", Parameters); - OPI_Tools.AddField("name" , Name, "String", Parameters); - - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - -EndFunction - -#EndRegion - -#Region DialogManagement - -// Open dialog -// Opens a new dialog with one or more users -// -// Parameters: -// Token - String - Bot token - token -// ArrayOfUsers - Array of Strings - User ID Array - users -// -// Return value: -// Key-Value Pair - Serialized JSON response from Slack -Function OpenDialog(Val Token, Val ArrayOfUsers) Export - - URL = "https://slack.com/api/conversations.open"; - Headers = GetAuthorizationHeader(Token); - - OPI_TypeConversion.GetCollection(ArrayOfUsers); - ArrayOfUsers = StrJoin(ArrayOfUsers, ","); - - Parameters = New Structure; - OPI_Tools.AddField("users", ArrayOfUsers, "String", Parameters); - - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Close dialog -// Closes an existing dialog -// -// Parameters: -// Token - String - Bot token - token -// Dialog - String - Dialog ID - conv -// -// Return value: -// Key-Value Pair - Serialized JSON response from Slack -Function CloseDialog(Val Token, Val Dialog) Export - - URL = "https://slack.com/api/conversations.close"; - Response = DialogManagement(Token, Dialog, URL); - Return Response; - -EndFunction - -#EndRegion - -#Region FileWork - -// Get list of files -// Gets a list of files of the bot or channel -// -// Parameters: -// Token - String - Bot token - token -// Channel - String - Channel for selection - channel -// PageNumber - Number, String - Page number - page -// -// Return value: -// Key-Value Pair - Serialized JSON response from Slack -Function GetFilesList(Val Token, Val Channel = "", Val PageNumber = 1) Export - - URL = "https://slack.com/api/files.list"; - Headers = GetAuthorizationHeader(Token); - - Parameters = New Structure; - OPI_Tools.AddField("channel", Channel , "String", Parameters); - OPI_Tools.AddField("page" , PageNumber, "String", Parameters); - - Response = OPI_Tools.Get(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Upload file -// Uploads a file to Slack servers -// -// Parameters: -// Token - String - Bot token - token -// File - String, BinaryData - File for upload - file -// FileName - String - File name with extension - filename -// Title - String - File name in Slack - title -// Channel - String - Channel ID - channel -// -// Return value: -// Key-Value Pair - Serialized JSON response from Slack -Function UploadFile(Val Token, Val File, Val FileName, Val Title, Val Channel = "") Export - - OPI_TypeConversion.GetBinaryData(File); - OPI_TypeConversion.GetLine(FileName); - OPI_TypeConversion.GetLine(Title); - - String_ = "String"; - Upload_url = "upload_url"; - File_id = "file_id"; - URL = "https://slack.com/api/files.getUploadURLExternal"; - Headers = GetAuthorizationHeader(Token); - Size = File.Size(); - - Parameters = New Structure; - OPI_Tools.AddField("filename", FileName, String_, Parameters); - OPI_Tools.AddField("length" , Size , String_, Parameters); - - Response = OPI_Tools.Get(URL, Parameters, Headers); - URL = Response[Upload_url]; - Identifier = Response[File_id]; - - If Not ValueFilled(URL) Or Not ValueFilled(Identifier) Then - Return Response; - EndIf; - - Files = New Match; - Files.Insert(FileName, File); - - Response = OPI_Tools.PostMultipart(URL, , Files, , Headers); - URL = "https://slack.com/api/files.completeUploadExternal"; - SlackFile = New Structure("id, title", Identifier, Title); - - Parameters = New Structure; - OPI_Tools.AddField("filename" , FileName, String_, Parameters); - OPI_Tools.AddField("channel_id", Channel , String_, Parameters); - OPI_Tools.AddField("files" , SlackFile, "Array", Parameters); - - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Get file data -// Gets information about the file -// -// Parameters: -// Token - String - Bot token - token -// FileID - String - File identifier - fileid -// -// Return value: -// Key-Value Pair - Serialized JSON response from Slack -Function GetFileData(Val Token, Val FileID) Export - - URL = "https://slack.com/api/files.info"; - Response = FileManagement(Token, FileID, URL, "GET"); - - Return Response; - -EndFunction - -// Delete file -// Deletes a file on Slack -// -// Parameters: -// Token - String - Bot token - token -// FileID - String - File identifier - fileid -// -// Return value: -// Key-Value Pair - Serialized JSON response from Slack -Function DeleteFile(Val Token, Val FileID) Export - - URL = "https://slack.com/api/files.delete"; - Response = FileManagement(Token, FileID, URL); - - Return Response; - -EndFunction - -// Make file public -// Creates a public URL for the file. Requires user token -// -// Parameters: -// Token - String - User token - token -// FileID - String - File identifier - fileid -// -// Return value: -// Key-Value Pair - Serialized JSON response from Slack -Function MakeFilePublic(Val Token, Val FileID) Export - - URL = "https://slack.com/api/files.sharedPublicURL"; - Response = FileManagement(Token, FileID, URL); - - Return Response; - -EndFunction - -// Make file private -// Removes the public URL from the file. Requires user token -// -// Parameters: -// Token - String - User token - token -// FileID - String - File identifier - fileid -// -// Return value: -// Key-Value Pair - Serialized JSON response from Slack -Function MakeFilePrivate(Val Token, Val FileID) Export - - URL = "https://slack.com/api/files.revokePublicURL"; - Response = FileManagement(Token, FileID, URL); - - Return Response; - -EndFunction - -#EndRegion - -#Region DeletedFilesManagement - -// Get list of external files -// Gets a list of external files of a user or channel -// -// Parameters: -// Token - String - Bot token - token -// Channel - String - Channel for selection - channel -// Cursor - String - Pointer from the previous request, if the result rows > 100 - cursor -// -// Return value: -// Key-Value Pair - Serialized JSON response from Slack -Function GetExternalFileList(Val Token, Val Channel = "", Val Cursor = "") Export - - URL = "https://slack.com/api/files.remote.list"; - Headers = GetAuthorizationHeader(Token); - - Parameters = New Structure; - OPI_Tools.AddField("channel", Channel , "String", Parameters); - OPI_Tools.AddField("cursor" , Cursor, "String", Parameters); - - Response = OPI_Tools.Get(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Get external file -// Gets information about the external file -// -// Parameters: -// Token - String - Bot token - token -// FileID - String - File identifier - fileid -// -// Return value: -// Key-Value Pair - Serialized JSON response from Slack -Function GetExternalFile(Val Token, Val FileID) Export - - URL = "https://slack.com/api/files.remote.info"; - Response = ExternalFileManagement(Token, FileID, URL); - - Return Response; - -EndFunction - -// Add external file -// Adds a new external file -// -// Parameters: -// Token - String - Bot token - token -// URL - String - URL to external file - url -// Title - String - File title for Slack - title -// -// Return value: -// Key-Value Pair - Serialized JSON response from Slack -Function AddExternalFile(Val Token, Val URL, Val Title) Export - - String_ = "String"; - URL = "https://slack.com/api/files.remote.add"; - Headers = GetAuthorizationHeader(Token); - UID = String(New UniqueIdentifier()); - - Parameters = New Structure; - OPI_Tools.AddField("external_url", URL , String_, Parameters); - OPI_Tools.AddField("external_id" , UID , String_, Parameters); - OPI_Tools.AddField("title" , Title , String_, Parameters); - - Response = OPI_Tools.Get(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Send external file -// Sends an external file to a list of channels -// -// Parameters: -// Token - String - Bot token - token -// FileID - String - File identifier - fileid -// ChannelArray - Array Of String - Array of channels for sending - channels -// -// Return value: -// Key-Value Pair - Serialized JSON response from Slack -Function SendExternalFile(Val Token, Val FileID, Val ChannelArray) Export - - URL = "https://slack.com/api/files.remote.share"; - Headers = GetAuthorizationHeader(Token); - - OPI_TypeConversion.GetCollection(ChannelArray); - ChannelArray = StrJoin(ChannelArray, ","); - - Parameters = New Structure; - OPI_Tools.AddField("file" , FileID , "String", Parameters); - OPI_Tools.AddField("channels", ChannelArray , "String", Parameters); - - Response = OPI_Tools.Get(URL, Parameters, Headers); - - Return Response; - -EndFunction - -// Delete external file -// Deletes an external file from Slack -// -// Parameters: -// Token - String - Bot token - token -// FileID - String - File identifier - fileid -// -// Return value: -// Key-Value Pair - Serialized JSON response from Slack -Function DeleteExternalFile(Val Token, Val FileID) Export - - URL = "https://slack.com/api/files.remote.remove"; - Response = ExternalFileManagement(Token, FileID, URL); - - Return Response; - -EndFunction - -#EndRegion - -#Region BlockFormation - -// Generate image block -// Generates a block with an image to add to the message block array -// -// Parameters: -// URL - String - Image URL - picture -// AlternateText - String - Alternate text of the image - alt -// -// Return value: -// Key-Value Pair - Image block -Function GenerateImageBlock(Val URL, Val AlternateText = "") Export - - String_ = "String"; - - Block = New Match; - OPI_Tools.AddField("type" , "image" , String_, Block); - OPI_Tools.AddField("image_url", URL , String_, Block); - OPI_Tools.AddField("alt_text" , AlternateText , String_, Block); - - Return Block; - -EndFunction - -#EndRegion - -#EndRegion - -#Region ServiceProceduresAndFunctions - -Function GetAuthorizationHeader(Val Token) - - OPI_TypeConversion.GetLine(Token); - - Headers = New Match; - Headers.Insert("Authorization", "Bearer " + Token); - Return Headers; - -EndFunction - -Function DialogManagement(Val Token, Val Channel, Val URL, Val RequestType = "POST") - - Headers = GetAuthorizationHeader(Token); - RequestType = inReg(RequestType); - - Parameters = New Structure; - OPI_Tools.AddField("channel", Channel, "String", Parameters); - - If RequestType = "POST" Then - Response = OPI_Tools.Post(URL, Parameters, Headers); - Else - Response = OPI_Tools.Get(URL, Parameters, Headers); - EndIf; - - Return Response; - -EndFunction - -Function FileManagement(Val Token, Val FileID, Val URL, Val RequestType = "POST") - - Headers = GetAuthorizationHeader(Token); - RequestType = inReg(RequestType); - - Parameters = New Structure; - OPI_Tools.AddField("file", FileID , "String", Parameters); - - If RequestType = "POST" Then - Response = OPI_Tools.Post(URL, Parameters, Headers); - Else - Response = OPI_Tools.Get(URL, Parameters, Headers); - EndIf; - - Return Response; - -EndFunction - -Function GeneralDataRetrieval(Val Token, Val URL, Val Cursor) - - Headers = GetAuthorizationHeader(Token); - - Parameters = New Structure; - OPI_Tools.AddField("cursor", Cursor, "String", Parameters); - - Response = OPI_Tools.Get(URL, Parameters, Headers); - - Return Response; - -EndFunction - -Function ExternalFileManagement(Val Token, Val FileID, Val URL) - - Headers = GetAuthorizationHeader(Token); - - Parameters = New Structure; - OPI_Tools.AddField("file", FileID , "String", Parameters); - - Response = OPI_Tools.Get(URL, Parameters, Headers); - - Return Response; - -EndFunction - -#EndRegion diff --git a/service/interim/en/OPI/src/CommonModules/OPI_Slack/OPI_Slack.mdo b/service/interim/en/OPI/src/CommonModules/OPI_Slack/OPI_Slack.mdo deleted file mode 100644 index c81e3953ae..0000000000 --- a/service/interim/en/OPI/src/CommonModules/OPI_Slack/OPI_Slack.mdo +++ /dev/null @@ -1,11 +0,0 @@ - - - OPI_Slack - - ru - Slack - - true - true - true - diff --git a/service/interim/en/OPI/src/CommonModules/OPI_Telegram/Module.bsl b/service/interim/en/OPI/src/CommonModules/OPI_Telegram/Module.bsl deleted file mode 100644 index bdf1fc4a16..0000000000 --- a/service/interim/en/OPI/src/CommonModules/OPI_Telegram/Module.bsl +++ /dev/null @@ -1,1253 +0,0 @@ -// Location OS: ./OInt/core/Modules/OPI_Telegram.os -// Library: Telegram -// CLI command: telegram - -// MIT License - -// Copyright (c) 2023 Anton Tsitavets - -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: - -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. - -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -// https://github.com/Bayselonarrend/OpenIntegrations - -// BSLLS:Typo-off -// BSLLS:LatinAndCyrillicSymbolInWord-off -// BSLLS:IncorrectLineBreak-off -// BSLLS:UnreachableCode-off -// BSLLS:CommentedCode-off - -// Uncomment if OneScript is executed -// #Use "../../tools" - -#Region ProgrammingInterface - -#Region DataRetrievalAndSettings - -// Get bot information -// Inыполняет запроwith /getMe, inозinращающий базоinую информацию о боте: имя, id, inозможноwithть dобаinлять бота in группы и т.d. -// -// Parameters: -// Token - String - Bot token - token -// -// Return value: -// Key-Value Pair - Serialized JSON response from Telegram -Function GetBotInformation(Val Token) Export - - OPI_TypeConversion.GetLine(Token); - - URL = "api.telegram.org/bot" + Token + "/getMe"; - Response = OPI_Tools.Get(URL); - - Return Response; - -EndFunction - -// Get updates -// Executes a request /getUpdates, returning information about bot events. Used in polling mode -// -// Parameters: -// Token - String - Bot token - token -// Timeout - String, Number - Waiting time for new events - timeout -// Offset - String, Number - Offset in the list of received messages - offset -// -// Return value: -// Key-Value Pair - Serialized JSON response from Telegram -Function GetUpdates(Val Token, Val Timeout = 0, Val Offset = "") Export - - OPI_TypeConversion.GetLine(Token); - - URL = "api.telegram.org/bot" + Token + "/getUpdates"; - - Parameters = New Structure; - OPI_Tools.AddField("timeout", Timeout , "String", Parameters); - OPI_Tools.AddField("offset" , Offset, "String", Parameters); - - Response = OPI_Tools.Get(URL, Parameters); - Return Response; - -EndFunction - -// Set Webhook -// Set webhook URL for bot event handling in webhook mode -// -// Parameters: -// Token - String - Bot token - token -// URL - String - Address processing запроwithоin от Telegram (with https:) - url -// -// Return value: -// Key-Value Pair - Serialized JSON response from Telegram -Function SetWebhook(Val Token, Val URL) Export - - OPI_TypeConversion.GetLine(Token); - - Parameters = New Structure; - OPI_Tools.AddField("url", URL, "String", Parameters); - - URL = "api.telegram.org/bot" + Token + "/setWebHook"; - Response = OPI_Tools.Get(URL, Parameters); - - Return Response; - -EndFunction - -// Delete webhook -// Deletes the bot event handler URL for webhook operation -// -// Parameters: -// Token - String - Bot token - token -// -// Return value: -// Key-Value Pair - Serialized JSON response from Telegram -Function DeleteWebhook(Val Token) Export - - OPI_TypeConversion.GetLine(Token); - - URL = "api.telegram.org/bot" + Token + "/deleteWebHook"; - Response = OPI_Tools.Get(URL); - - Return Response; - -EndFunction - -// Download file -// Download file from Telegram servers -// -// Parameters: -// Token - String - Token - token -// FileID - String - File ID for downloading - fileid -// -// Return value: -// Key-Value Pair - Serialized JSON response from Telegram -Function DownloadFile(Val Token, Val FileID) Export - - Result = "result"; - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(FileID); - - Parameters = New Structure("file_id", FileID); - - URL = "api.telegram.org/bot" + Token + "/getFile"; - Response = OPI_Tools.Get(URL, Parameters); - - Path = Response[Result]["file_path"]; - - If Not ValueFilled(Path) Then - Return Response; - EndIf; - - URL = "api.telegram.org/file/bot" + Token + "/" + Path; - Response = OPI_Tools.Get(URL, Parameters); - - Return Response; - -EndFunction - -// Process Telegram Mini App data -// Processes TMA data and determines its validity -// -// Parameters: -// DataString - String - Query from Telegram.WebApp.initData -// Token - String - Bot token -// -// Return value: -// Map from String - Map of data with the result of verification in the passed field -Function ProcessTMAData(Val DataString, Val Token) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(DataString); - - DataString = DecodeString(DataString, StringEncodingMethod.URLencoding); - DataStructure = OPI_Tools.RequestParametersToMatch(DataString); - Key = "WebAppData"; - Hash = ""; - BinaryKey = GetBinaryDataFromString(Key); - - Result = OPI_Cryptography.HMACSHA256(BinaryKey, GetBinaryDataFromString(Token)); - - TValue = New ValueTable; - TValue.Columns.Add("Key"); - TValue.Columns.Add("Value"); - - For Each Data In DataStructure Do - - NewLine = TValue.Add(); - NewLine.Key = Data.Key; - NewLine.Value = Data.Value; - - EndDo; - - TValue.Sort("Key"); - - ReturnMapping = New Match; - DCS = ""; - - For Each DataString In TValue Do - - If DataString.Key <> "hash" Then - DCS = DCS + DataString.Key + "=" + DataString.Value + Symbols.PS; - ReturnMapping.Insert(DataString.Key, DataString.Value); - Else - Hash = DataString.Value; - EndIf; - - EndDo; - - DCS = Left(DCS, StrLength(DCS) - 1); - Signature = OPI_Cryptography.HMACSHA256(Result, GetBinaryDataFromString(DCS)); - - Final = GetHexStringFromBinaryData(Signature); - - If Final = inReg(Hash) Then - Response = True; - Else - Response = False; - EndIf; - - ReturnMapping.Insert("passed", Response); - - Return ReturnMapping; - -EndFunction - -#EndRegion - -#Region DataSending - -// Send text message -// Sends a text message to a chat or channel -// -// Parameters: -// Token - String - Bot token - token -// ChatID - String, Number - Target chat ID or ChatID*TopicID - chat -// Text - String - Message text - text -// Keyboard - String - See GenerateKeyboardFromArray - keyboard - Keyboard JSON or path to .json -// Markup - String - View processing textа (HTML, Markdown, MarkdownV2) - parsemode -// -// Return value: -// Key-Value Pair - Serialized JSON response from Telegram -Function SendTextMessage(Val Token - , Val ChatID - , Val Text - , Val Keyboard = "" - , Val Markup = "Markdown") Export - - OPI_TypeConversion.GetLine(Token); - OPI_Tools.ReplaceSpecialCharacters(Text, Markup); - - Parameters = New Structure; - OPI_Tools.AddField("parse_mode" , Markup , "String" , Parameters); - OPI_Tools.AddField("text" , Text , "String" , Parameters); - OPI_Tools.AddField("reply_markup", Keyboard, "FileString", Parameters); - - AddChatIdentifier(ChatID, Parameters); - - URL = "api.telegram.org/bot" + Token + "/sendMessage"; - Response = OPI_Tools.Get(URL, Parameters); - - Return Response; - -EndFunction - -// Send image -// Sends an image to a chat or channel -// -// Parameters: -// Token - String - Bot token - token -// ChatID - String, Number - Target chat ID or ChatID*TopicID - chat -// Text - String - Message text - text -// Image - BinaryData,String - Image file - picture -// Keyboard - String - See GenerateKeyboardFromArray - keyboard - Keyboard JSON or path to .json -// Markup - String - View processing textа (HTML, Markdown, MarkdownV2) - parsemode -// -// Return value: -// Key-Value Pair - Serialized JSON response from Telegram -Function SendImage(Val Token - , Val ChatID - , Val Text - , Val Image - , Val Keyboard = "" - , Val Markup = "Markdown") Export - - Return SendFile(Token, ChatID, Text, Image, "photo", Keyboard, Markup); - -EndFunction - -// Send video -// Sends a video to a chat or channel -// -// Parameters: -// Token - String - Bot token - token -// ChatID - String, Number - Target chat ID or ChatID*TopicID - chat -// Text - String - Message text - text -// Video - BinaryData,String - Video file - video -// Keyboard - String - See GenerateKeyboardFromArray - keyboard - Keyboard JSON or path to .json -// Markup - String - View processing textа (HTML, Markdown, MarkdownV2) - parsemode -// -// Return value: -// Key-Value Pair - Serialized JSON response from Telegram -Function SendVideo(Val Token - , Val ChatID - , Val Text - , Val Video - , Val Keyboard = "" - , Val Markup = "Markdown") Export - - Return SendFile(Token, ChatID, Text, Video, "video", Keyboard, Markup); - -EndFunction - -// Send audio -// Sends an audio file to a chat or channel -// -// Parameters: -// Token - String - Bot token - token -// ChatID - String, Number - Target chat ID or ChatID*TopicID - chat -// Text - String - Message text - text -// Audio - BinaryData,String - Audio file - audio -// Keyboard - String - See GenerateKeyboardFromArray - keyboard - Keyboard JSON or path to .json -// Markup - String - View processing textа (HTML, Markdown, MarkdownV2) - parsemode -// -// Return value: -// Key-Value Pair - Serialized JSON response from Telegram -Function SendAudio(Val Token - , Val ChatID - , Val Text - , Val Audio - , Val Keyboard = "" - , Val Markup = "Markdown") Export - - Return SendFile(Token, ChatID, Text, Audio, "audio", Keyboard, Markup); - -EndFunction - -// Send document -// Sends a document to a chat or channel -// -// Parameters: -// Token - String - Bot token - token -// ChatID - String, Number - Target chat ID or ChatID*TopicID - chat -// Text - String - Message text - text -// Document - BinaryData,String - Document file - doc -// Keyboard - String - See GenerateKeyboardFromArray - keyboard - Keyboard JSON or path to .json -// Markup - String - View processing textа (HTML, Markdown, MarkdownV2) - parsemode -// -// Return value: -// Key-Value Pair - Serialized JSON response from Telegram -Function SendDocument(Val Token - , Val ChatID - , Val Text - , Val Document - , Val Keyboard = "" - , Val Markup = "Markdown") Export - - Return SendFile(Token, ChatID, Text, Document, "document", Keyboard, Markup); - -EndFunction - -// Send GIF -// Sends a GIF to a chat or channel -// -// Parameters: -// Token - String - Bot token - token -// ChatID - String, Number - Target chat ID or ChatID*TopicID - chat -// Text - String - Message text - text -// GIF - BinaryData,String - GIF file - gif -// Keyboard - String - See GenerateKeyboardFromArray - keyboard - Keyboard JSON or path to .json -// Markup - String - View processing textа (HTML, Markdown, MarkdownV2) - parsemode -// -// Return value: -// Key-Value Pair - Serialized JSON response from Telegram -Function SendGif(Val Token - , Val ChatID - , Val Text - , Val GIF - , Val Keyboard = "" - , Val Markup = "Markdown") Export - - Return SendFile(Token, ChatID, Text, GIF, "animation", Keyboard, Markup); - -EndFunction - -// Send media group -// Sends a set of files to a chat or channel. Media types: audio, document, photo, video -// -// Parameters: -// Token - String - Bot token - token -// ChatID - String, Number - Target chat ID or ChatID*TopicID - chat -// Text - String - Message text - text -// FileMapping - Map from String - File collection - media - File JSON or path to .json -// Keyboard - String - See GenerateKeyboardFromArray - keyboard - Keyboard JSON or path to .json -// Markup - String - View processing textа (HTML, Markdown, MarkdownV2) - parsemode -// -// Return value: -// Key-Value Pair - Serialized JSON response from Telegram -Function SendMediaGroup(Val Token - , Val ChatID - , Val Text - , Val FileMapping - , Val Keyboard = "" - , Val Markup = "Markdown") Export - - // FileMapping - // Key - File, Value - Type - // Types: audio, document, photo, video - // Different types cannot be mixed! - - String_ = "String"; - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(ChatID); - OPI_TypeConversion.GetCollection(FileMapping); - - OPI_Tools.ReplaceSpecialCharacters(Text, Markup); - - URL = "api.telegram.org/bot" + Token + "/sendMediaGroup"; - FileStructure = New Structure; - Media = New Array; - Parameters = New Structure; - - AddChatIdentifier(ChatID, Parameters); - FormMediaArray(FileMapping, Text, FileStructure, Media); - - OPI_Tools.AddField("parse_mode" , Markup , String_ , Parameters); - OPI_Tools.AddField("caption" , Text , String_ , Parameters); - OPI_Tools.AddField("media" , Media , String_ , Parameters); - OPI_Tools.AddField("reply_markup", Keyboard, "FileString", Parameters); - - Response = OPI_Tools.PostMultipart(URL, Parameters, FileStructure, "mixed"); - - Return Response; - -EndFunction - -// Send location -// Sends location by geographic latitude and longitude to a chat or channel -// -// Parameters: -// Token - String - Bot token - token -// ChatID - String, Number - Target chat ID or ChatID*TopicID - chat -// Latitude - String, Number - Geographic latitude - lat -// Longitude - String, Number - Geographic longitude - long -// Keyboard - String - See GenerateKeyboardFromArray - keyboard - Keyboard JSON or path to .json -// -// Return value: -// Key-Value Pair - Serialized JSON response from Telegram -Function SendLocation(Val Token, Val ChatID, Val Latitude, Val Longitude, Val Keyboard = "") Export - - String_ = "String"; - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(ChatID); - - URL = "api.telegram.org/bot" + Token + "/sendLocation"; - - Parameters = New Structure; - OPI_Tools.AddField("parse_mode" , "Markdown" , String_ , Parameters); - OPI_Tools.AddField("latitude" , Latitude , String_ , Parameters); - OPI_Tools.AddField("longitude" , Longitude , String_ , Parameters); - OPI_Tools.AddField("reply_markup", Keyboard , "FileString", Parameters); - - AddChatIdentifier(ChatID, Parameters); - - Response = OPI_Tools.Get(URL, Parameters); - - Return Response; - -EndFunction - -// Send contact -// Sends a contact with name and phone number -// -// Parameters: -// Token - String - Bot token - token -// ChatID - String, Number - Target chat ID or ChatID*TopicID - chat -// Name - String - Contact name - name -// Last name - String - Contact last name - surname -// Phone - String - Contact phone number - phone -// Keyboard - String - See GenerateKeyboardFromArray - keyboard - Keyboard JSON or path to .json -// -// Return value: -// Key-Value Pair - Serialized JSON response from Telegram -Function SendContact(Val Token, Val ChatID, Val Name, Val Last name, Val Phone, Val Keyboard = "") Export - - String_ = "String"; - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(ChatID); - - URL = "api.telegram.org/bot" + Token + "/sendContact"; - - Parameters = New Structure; - OPI_Tools.AddField("parse_mode" , "Markdown", String_ , Parameters); - OPI_Tools.AddField("first_name" , Name , String_ , Parameters); - OPI_Tools.AddField("last_name" , Last name , String_ , Parameters); - OPI_Tools.AddField("phone_number", Phone , String_ , Parameters); - OPI_Tools.AddField("reply_markup", Keyboard, "FileString", Parameters); - - AddChatIdentifier(ChatID, Parameters); - - Response = OPI_Tools.Get(URL, Parameters); - - Return Response; - -EndFunction - -// Send poll -// Sends a poll with answer options -// -// Parameters: -// Token - String - Bot token - token -// ChatID - String, Number - Target chat ID or ChatID*TopicID - chat -// Question - String - Poll question - question -// AnswersArray - Array of Strings - Array of answer options - options -// Anonymous - Boolean - Poll anonymity - anonymous -// -// Return value: -// Key-Value Pair - Serialized JSON response from Telegram -Function SendPoll(Val Token, Val ChatID, Val Question, Val AnswersArray, Val Anonymous = True) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(ChatID); - OPI_TypeConversion.GetCollection(AnswersArray); - - OPI_TypeConversion.GetBoolean(Anonymous); - - URL = "api.telegram.org/bot" + Token + "/sendPoll"; - - Parameters = New Structure; - OPI_Tools.AddField("parse_mode", "Markdown" , "String" , Parameters); - OPI_Tools.AddField("question" , Question , "String" , Parameters); - OPI_Tools.AddField("options" , AnswersArray, "FileString", Parameters); - - Parameters.Insert("is_anonymous", ?(Anonymous, 1, 0)); - AddChatIdentifier(ChatID, Parameters); - - Response = OPI_Tools.Get(URL, Parameters); - - Return Response; - -EndFunction - -// Forward message -// Forwards a message between chats or within a chat -// -// Parameters: -// Token - String - Bot token - token -// OriginalID - String, Number - Original message ID - message -// FromID - String, Number - Chat ID of the original message - from -// ToID - String, Number - Target chat ID or ChatID*TopicID - to -// -// Return value: -// Key-Value Pair - Serialized JSON response from Telegram -Function ForwardMessage(Val Token, Val OriginalID, Val FromID, Val ToID) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(OriginalID); - OPI_TypeConversion.GetLine(FromID); - OPI_TypeConversion.GetLine(ToID); - - URL = "api.telegram.org/bot" + Token + "/forwardMessage"; - - Parameters = New Structure; - OPI_Tools.AddField("from_chat_id", FromID , "String", Parameters); - OPI_Tools.AddField("message_id" , OriginalID, "String", Parameters); - - AddChatIdentifier(ToID, Parameters); - - Response = OPI_Tools.Get(URL, Parameters); - - Return Response; - -EndFunction - -// Generate keyboard from array of buttons -// Generates a simple JSON keyboard from an array of buttons for a message or bottom panel -// -// Parameters: -// ButtonArray - Array of Strings - Array of buttons - buttons -// UnderMessage - Boolean - Keyboard under the message or on the bottom panel - under -// OneByOne - Boolean - True > buttons are displayed in a column, False > in a row - column -// -// Return value: -// String - Keyboard JSON -Function FormKeyboardFromButtonArray(Val ButtonArray - , Val UnderMessage = False - , Val OneByOne = True) Export - - OPI_TypeConversion.GetBoolean(UnderMessage); - OPI_TypeConversion.GetBoolean(OneByOne); - OPI_TypeConversion.GetCollection(ButtonArray); - - If OneByOne Then - Strings = CreateTallKeyboard(ButtonArray); - Else - Strings = CreateLongKeyboard(ButtonArray); - EndIf; - - If UnderMessage Then - ParameterStructure = New Structure("inline_keyboard,rows", Strings, 1); - Else - ParameterStructure = New Structure("keyboard,resize_keyboard", Strings, True); - EndIf; - - Keyboard = OPI_Tools.JSONString(ParameterStructure); - - Return Keyboard; - -EndFunction - -#EndRegion - -#Region Administration - -// Ban -// Bans a user in the selected chat -// -// Parameters: -// Token - String - Bot token - token -// ChatID - String, Number - Target chat ID or ChatID*TopicID - chat -// UserID - String, Number - Target user ID - user -// -// Return value: -// Key-Value Pair - Serialized JSON response from Telegram -Function Ban(Val Token, Val ChatID, Val UserID) Export - - String_ = "String"; - OPI_TypeConversion.GetLine(Token); - - URL = "api.telegram.org/bot" + Token + "/banChatMember"; - - Parameters = New Structure; - OPI_Tools.AddField("parse_mode", "Markdown" , String_, Parameters); - OPI_Tools.AddField("chat_id" , ChatID , String_, Parameters); - OPI_Tools.AddField("user_id" , UserID, String_, Parameters); - - Response = OPI_Tools.Get(URL, Parameters); - - Return Response; - -EndFunction - -// Unban -// Unbans a previously banned user -// -// Parameters: -// Token - String - Bot token - token -// ChatID - String, Number - Target chat ID or ChatID*TopicID - chat -// UserID - String, Number - Target user ID - user -// -// Return value: -// Key-Value Pair - Serialized JSON response from Telegram -Function Unban(Val Token, Val ChatID, Val UserID) Export - - String_ = "String"; - OPI_TypeConversion.GetLine(Token); - - URL = "api.telegram.org/bot" + Token + "/unbanChatMember"; - - Parameters = New Structure; - OPI_Tools.AddField("parse_mode" , "Markdown" , String_ , Parameters); - OPI_Tools.AddField("chat_id" , ChatID , String_ , Parameters); - OPI_Tools.AddField("user_id" , UserID, String_ , Parameters); - OPI_Tools.AddField("only_if_banned", False , "Boolean", Parameters); - - Response = OPI_Tools.Get(URL, Parameters); - - Return Response; - -EndFunction - -// Create invitation link -// Creates a link for joining a closed chat -// -// Parameters: -// Token - String - Bot token - token -// ChatID - String, Number - Target chat ID or ChatID*TopicID - chat -// Title - String - Invitation title - title -// ExpirationDate - Date - Date of end жfromни withwithылtoи (withoutwithрочно, еwithли не уtoазано) - expire -// UserLimit - Number - Limit пользоinателей (беwithtoонечно, еwithли не уtoазано) - limit -// -// Return value: -// Key-Value Pair - Serialized JSON response from Telegram -Function CreateInvitationLink(Val Token - , Val ChatID - , Val Title = "" - , Val ExpirationDate = "" - , Val UserLimit = 0) Export - - String_ = "String"; - OPI_TypeConversion.GetLine(Token); - - URL = "api.telegram.org/bot" + Token + "/createChatInviteLink"; - - Parameters = New Structure; - OPI_Tools.AddField("parse_mode" , "Markdown" , String_ , Parameters); - OPI_Tools.AddField("chat_id" , ChatID , String_ , Parameters); - OPI_Tools.AddField("name" , Title , String_ , Parameters); - OPI_Tools.AddField("member_limit" , UserLimit, String_ , Parameters); - OPI_Tools.AddField("expire_date" , ExpirationDate , "Date" , Parameters); - - Response = OPI_Tools.Get(URL, Parameters); - - Return Response; - -EndFunction - -// Pin message -// Pins a message in the chat header -// -// Parameters: -// Token - String - Token - token -// ChatID - String, Number - Target chat ID - chat -// MessageID - String, Number - Target message ID - message -// -// Return value: -// Key-Value Pair - Serialized JSON response from Telegram -Function PinMessage(Val Token, Val ChatID, Val MessageID) Export - - String_ = "String"; - OPI_TypeConversion.GetLine(Token); - - URL = "api.telegram.org/bot" + Token + "/pinChatMessage"; - - Parameters = New Structure; - OPI_Tools.AddField("parse_mode" , "Markdown" , String_ , Parameters); - OPI_Tools.AddField("chat_id" , ChatID , String_ , Parameters); - OPI_Tools.AddField("message_id" , MessageID, String_ , Parameters); - OPI_Tools.AddField("disable_notification", False , "Boolean", Parameters); - - Response = OPI_Tools.Get(URL, Parameters); - - Return Response; - -EndFunction - -// Unpin message -// Unpins a message in the chat header -// -// Parameters: -// Token - String - Bot token - token -// ChatID - String, Number - Target chat ID - chat -// MessageID - String, Number - Target message ID - message -// -// Return value: -// Key-Value Pair - Serialized JSON response from Telegram -Function UnpinMessage(Val Token, Val ChatID, Val MessageID) Export - - String_ = "String"; - OPI_TypeConversion.GetLine(Token); - - URL = "api.telegram.org/bot" + Token + "/unpinChatMessage"; - - Parameters = New Structure; - OPI_Tools.AddField("parse_mode", "Markdown" , String_, Parameters); - OPI_Tools.AddField("chat_id" , ChatID , String_, Parameters); - OPI_Tools.AddField("message_id", MessageID, String_, Parameters); - - Response = OPI_Tools.Get(URL, Parameters); - - Return Response; - -EndFunction - -// Get participant count -// Gets the total number of chat participants -// -// Parameters: -// Token - String - Bot token - token -// ChatID - String, Number - Target chat ID - chat -// -// Return value: -// Key-Value Pair - Serialized JSON response from Telegram -Function GetParticipantCount(Val Token, Val ChatID) Export - - OPI_TypeConversion.GetLine(Token); - - URL = "api.telegram.org/bot" + Token + "/getChatMemberCount"; - - Parameters = New Structure; - OPI_Tools.AddField("parse_mode", "Markdown" , "String", Parameters); - OPI_Tools.AddField("chat_id" , ChatID , "String", Parameters); - - Response = OPI_Tools.Get(URL, Parameters); - - Return Response; - -EndFunction - -#EndRegion - -#Region ForumTopicManagement - -// Get avatar icon list -// Gets the mapping of Emoji IDs for setting as forum theme icons -// -// Parameters: -// Token - String - Token - token -// -// Return value: -// Key-Value Pair - Key > ID, Value > Emoji -Function GetAvatarIconList(Val Token) Export - - OPI_TypeConversion.GetLine(Token); - - Result = "result"; - URL = "api.telegram.org/bot" + Token + "/getForumTopicIconStickers"; - Response = OPI_Tools.Get(URL); - Icons = Response[Result]; - - If Not ValueFilled(Icons) Then - Return Response; - EndIf; - - Collection = New Match; - - For Each Icon In Icons Do - Collection.Insert(Icon["custom_emoji_id"], Icon["emoji"]); - EndDo; - - Return Collection; - -EndFunction - -// Create forum thread -// Creates a new thread in the group with theme functionality enabled -// -// Parameters: -// Token - String - Token - token -// ChatID - String, Number - Thread creation chat ID - forum -// Title - String - Thread title - title -// IconID - String - See GetAvatarIconList - icon -// -// Return value: -// Key-Value Pair - Serialized JSON response from Telegram -Function CreateForumThread(Val Token, Val ChatID, Val Title, Val IconID = "") Export - Return ForumTopicManagement(Token, ChatID, Title, IconID); -EndFunction - -// Edit forum thread -// Creates a new thread in the group with theme functionality enabled -// -// Parameters: -// Token - String - Token - token -// ChatID - String, Number - Thread creation chat ID - forum -// ThreadID - String, Number - Thread ID - topic -// Title - String - New title - title -// IconID - String - See GetAvatarIconList - icon -// -// Return value: -// Key-Value Pair - Serialized JSON response from Telegram -Function EditForumTopic(Val Token - , Val ChatID - , Val ThreadID - , Val Title = Undefined - , Val IconID = Undefined) Export - - Return ForumTopicManagement(Token, ChatID, Title, IconID, ThreadID); -EndFunction - -// Close forum thread -// Closes the thread for new messages -// -// Parameters: -// Token - String - Token - token -// ChatID - String, Number - Thread chat ID - forum -// ThreadID - String, Number - Thread ID - topic -// -// Return value: -// Key-Value Pair - Serialized JSON response from Telegram -Function CloseForumThread(Val Token, Val ChatID, Val ThreadID = "") Export - Return ManageForumThreadState(Token, ChatID, 2, ThreadID); -EndFunction - -// Open forum thread -// Reopens a previously closed forum thread -// -// Parameters: -// Token - String - Token - token -// ChatID - String, Number - Thread chat ID - forum -// ThreadID - String, Number - Thread ID - topic -// -// Return value: -// Key-Value Pair - Serialized JSON response from Telegram -Function OpenForumThread(Val Token, Val ChatID, Val ThreadID = "") Export - Return ManageForumThreadState(Token, ChatID, 1, ThreadID); -EndFunction - -// Delete forum thread -// Deletes a forum thread -// -// Parameters: -// Token - String - Token - token -// ChatID - String, Number - Thread chat ID - forum -// ThreadID - String, Number - Thread ID - topic -// -// Return value: -// Key-Value Pair - Serialized JSON response from Telegram -Function DeleteForumTopic(Val Token, Val ChatID, Val ThreadID) Export - Return ManageForumThreadState(Token, ChatID, 3, ThreadID); -EndFunction - -// Hide main forum thread -// Hides the main forum thread -// -// Parameters: -// Token - String - Token - token -// ChatID - String, Number - Thread chat ID - forum -// -// Return value: -// Key-Value Pair - Serialized JSON response from Telegram -Function HideMainForumTopic(Val Token, Val ChatID) Export - Return ManageMainTopicVisibility(Token, ChatID, True); -EndFunction - -// Show main forum thread -// Shows a previously hidden main forum thread -// -// Parameters: -// Token - String - Token - token -// ChatID - String, Number - Thread chat ID - forum -// -// Return value: -// Key-Value Pair - Serialized JSON response from Telegram -Function ShowMainForumTopic(Val Token, Val ChatID) Export - Return ManageMainTopicVisibility(Token, ChatID, False); -EndFunction - -// Edit main forum thread name -// Edits the name of the main forum thread -// -// Parameters: -// Token - String - Token - token -// ChatID - String, Number - Thread chat ID - forum -// Title - String - New main thread name - title -// -// Return value: -// Key-Value Pair - Serialized JSON response from Telegram -Function EditMainForumTopicName(Val Token, Val ChatID, Val Title) Export - - OPI_TypeConversion.GetLine(Token); - - URL = "api.telegram.org/bot" + Token + "/editGeneralForumTopic"; - - Parameters = New Structure; - OPI_Tools.AddField("chat_id", ChatID , "String", Parameters); - OPI_Tools.AddField("name" , Title, "String", Parameters); - - Response = OPI_Tools.Get(URL, Parameters); - - Return Response; - -EndFunction - -// Clear thread's pinned messages list -// Clears the list of pinned messages in the forum thread -// -// Parameters: -// Token - String - Token - token -// ChatID - String, Number - Thread chat ID - forum -// ThreadID - String, Number - Thread ID. Main if not filled - topic -// -// Return value: -// Key-Value Pair - Serialized JSON response from Telegram -Function ClearThreadPinnedMessagesList(Val Token, Val ChatID, Val ThreadID = "") Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(ChatID); - OPI_TypeConversion.GetLine(ThreadID); - - Parameters = New Structure; - OPI_Tools.AddField("chat_id" , ChatID, "String", Parameters); - OPI_Tools.AddField("message_thread_id", ThreadID, "String", Parameters); - - If ValueFilled(ThreadID) Then - Method = "/unpinAllForumTopicMessages"; - Else - Method = "/unpinAllGeneralForumTopicMessages"; - EndIf; - - URL = "api.telegram.org/bot" + Token + Method; - Response = OPI_Tools.Get(URL, Parameters); - - Return Response; - -EndFunction - -#EndRegion - -#EndRegion - -#Region ServiceProceduresAndFunctions - -Function SendFile(Val Token, Val ChatID, Val Text, Val File, Val View, Val Keyboard, Val Markup) - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(ChatID); - OPI_TypeConversion.GetLine(View); - - Extension = ""; - Method = ""; - - DetermineSendMethod(View, Method, Extension); - ConvertFileData(File, Extension, View); - OPI_Tools.ReplaceSpecialCharacters(Text, Markup); - - Parameters = New Structure; - OPI_Tools.AddField("parse_mode" , Markup , "String" , Parameters); - OPI_Tools.AddField("caption" , Text , "String" , Parameters); - OPI_Tools.AddField("reply_markup", Keyboard, "FileString", Parameters); - - AddChatIdentifier(ChatID, Parameters); - - FileStructure = New Structure; - FileStructure.Insert(View + Extension, File); - - URL = "api.telegram.org/bot" + Token + Method; - Response = OPI_Tools.PostMultipart(URL, Parameters, FileStructure, "mixed"); - - Return Response; - -EndFunction - -Function ForumTopicManagement(Val Token - , Val ChatID - , Val Title = Undefined - , Val IconID = Undefined - , Val ThreadID = "") - - String_ = "String"; - OPI_TypeConversion.GetLine(Token); - - Parameters = New Structure; - OPI_Tools.AddField("name" , Title, String_, Parameters); - OPI_Tools.AddField("chat_id" , ChatID , String_, Parameters); - OPI_Tools.AddField("icon_custom_emoji_id", IconID , String_, Parameters); - OPI_Tools.AddField("message_thread_id" , ThreadID , String_, Parameters); - - If ValueFilled(ThreadID) Then - Method = "/editForumTopic"; - Else - Method = "/createForumTopic"; - EndIf; - - OPI_Tools.RemoveEmptyCollectionFields(Parameters); - Response = OPI_Tools.Get("api.telegram.org/bot" + Token + Method, Parameters); - - Return Response; - -EndFunction - -Function ManageForumThreadState(Val Token, Val ChatID, Val Status, Val ThreadID = "") - - OPI_TypeConversion.GetLine(Token); - - If ValueFilled(ThreadID) Then - Forum = "Forum"; - Else - Forum = "GeneralForum"; - EndIf; - - Method = DetermineForumManagementMethod(Status, Forum); - - Parameters = New Structure; - OPI_Tools.AddField("chat_id" , ChatID, "String", Parameters); - OPI_Tools.AddField("message_thread_id", ThreadID, "String", Parameters); - - URL = "api.telegram.org/bot" + Token + Method; - Response = OPI_Tools.Get(URL, Parameters); - - Return Response; - -EndFunction - -Function ManageMainTopicVisibility(Val Token, Val ChatID, Val Hide) - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetBoolean(Hide); - - If Hide Then - Method = "/hideGeneralForumTopic"; - Else - Method = "/unhideGeneralForumTopic"; - EndIf; - - Parameters = New Structure; - OPI_Tools.AddField("chat_id", ChatID, "String", Parameters); - - URL = "api.telegram.org/bot" + Token + Method; - Response = OPI_Tools.Get(URL, Parameters); - - Return Response; - -EndFunction - -Function DetermineForumManagementMethod(Val Status, Val Forum) - - Open = 1; - Close = 2; - Delete = 3; - - If Status = Open Then - Method = "/reopen" + Forum + "Topic"; - ElsIf Status = Close Then - Method = "/close" + Forum + "Topic"; - ElsIf Status = Delete Then - Method = "/deleteForumTopic"; - Else - Raise "Incorrect forum management status"; - EndIf; - - Return Method; - -EndFunction - -Function CreateTallKeyboard(Val ButtonArray) - - Strings = New Array; - - For Each Button In ButtonArray Do - Buttons = New Array; - Button = OPI_Tools.NumberToString(Button); - Buttons.Add(New Structure("text,callback_data", Button, Button)); - Strings.Add(Buttons); - EndDo; - - Return Strings; - -EndFunction - -Function CreateLongKeyboard(Val ButtonArray) - - Strings = New Array; - Buttons = New Array; - - For Each Button In ButtonArray Do - Button = OPI_Tools.NumberToString(Button); - Buttons.Add(New Structure("text,callback_data", Button, Button)); - EndDo; - - Strings.Add(Buttons); - - Return Strings; - -EndFunction - -Procedure FormMediaArray(Val FileMapping, Val Text, FileStructure, Media) - - Counter = 0; - - OPI_TypeConversion.GetCollection(FileMapping); - OPI_TypeConversion.GetLine(Text); - - If TypeValue(FileMapping) <> Type("Match") Then - // !OInt Raise("Failed to Retrieve Information from JSON media!"); - Return; - EndIf; - - For Each CurrentFile In FileMapping Do - - If Not TypeValue(CurrentFile.Key) = Type("BinaryData") Then - - Binary = CurrentFile.Key; - OPI_TypeConversion.GetBinaryData(Binary); - - ThisFile = New File(CurrentFile.Key); - MediaName = CurrentFile.Value - + String(Counter) - + ?(CurrentFile.Value = "document", ThisFile.Extension, ""); - - FullMediaName = StringReplace(MediaName, ".", "___"); - - Else - Binary = CurrentFile.Key; - MediaName = CurrentFile.Value + String(Counter); - FullMediaName = MediaName; - EndIf; - - FileStructure.Insert(FullMediaName, Binary); - - MediaStructure = New Structure; - MediaStructure.Insert("type" , CurrentFile.Value); - MediaStructure.Insert("media", "attach://" + MediaName); - - If Counter = 0 Then - MediaStructure.Insert("caption", Text); - EndIf; - - Media.Add(MediaStructure); - - Counter = Counter + 1; - - EndDo; - - Media = OPI_Tools.JSONString(Media); - -EndProcedure - -Procedure AddChatIdentifier(Val ChatID, Parameters) - - ChatID = OPI_Tools.NumberToString(ChatID); - ChatArray = StrSplit(ChatID, "*", False); - - If ChatArray.Quantity() > 1 Then - - ChatID = ChatArray[0]; - ThreadID = ChatArray[1]; - - Parameters.Insert("message_thread_id", ThreadID); - - EndIf; - - Parameters.Insert("chat_id", ChatID); - -EndProcedure - -Procedure DetermineSendMethod(Val View, Method, Extension) - - If View = "photo" Then - Method = "/sendPhoto"; - ElsIf View = "video" Then - Method = "/sendVideo"; - ElsIf View = "audio" Then - Method = "/sendAudio"; - ElsIf View = "document" Then - Method = "/sendDocument"; - ElsIf View = "animation" Then - Method = "/sendAnimation"; - Extension = ".gif"; - Else - Raise "Incorrect sending view"; - EndIf; - -EndProcedure - -Procedure ConvertFileData(File, Extension, View) - - If Not TypeValue(File) = Type("BinaryData") Then - - CurrentFile = New File(File); - Extension = ?(View = "document", CurrentFile.Extension, Extension); - OPI_TypeConversion.GetBinaryData(File); - - EndIf; - - Extension = StringReplace(Extension, ".", "___"); - -EndProcedure - -#EndRegion diff --git a/service/interim/en/OPI/src/CommonModules/OPI_Telegram/OPI_Telegram.mdo b/service/interim/en/OPI/src/CommonModules/OPI_Telegram/OPI_Telegram.mdo deleted file mode 100644 index 51643d7cc5..0000000000 --- a/service/interim/en/OPI/src/CommonModules/OPI_Telegram/OPI_Telegram.mdo +++ /dev/null @@ -1,11 +0,0 @@ - - - OPI_Telegram - - ru - Methodы интеграции with Telegram (OPI) - - true - true - true - diff --git a/service/interim/en/OPI/src/CommonModules/OPI_Twitter/Module.bsl b/service/interim/en/OPI/src/CommonModules/OPI_Twitter/Module.bsl deleted file mode 100644 index c60177beed..0000000000 --- a/service/interim/en/OPI/src/CommonModules/OPI_Twitter/Module.bsl +++ /dev/null @@ -1,682 +0,0 @@ -// Location OS: ./OInt/core/Modules/OPI_Twitter.os -// Library: Twitter -// CLI Command: twitter - -// MIT License - -// Copyright (c) 2023 Anton Tsitavets - -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: - -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. - -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -// https://github.com/Bayselonarrend/OpenIntegrations -// If in не зtoете with чего toчать, то withтоит toйти метоd GetStandardParameters() -// and read comments - -// BSLLS:Typo-off -// BSLLS:LatinAndCyrillicSymbolInWord-off -// BSLLS:IncorrectLineBreak-off -// BSLLS:NumberOfOptionalParams-off -// BSLLS:UsingServiceTag-off - -//@skip-check method-too-many-params - -// Uncomment if OneScript is executed -// #Use "../../tools" - -#Region ProgrammingInterface - -#Region DataAndSettings - -// Get authorization link -// Forms a link for authorization via the browser -// -// Parameters: -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// String - URL for browser transition -Function GetAuthorizationLink(Parameters = "") Export - - Parameters_ = GetStandardParameters(Parameters); - - URLParameters = New Structure; - - URLParameters.Insert("response_type" , "code"); - URLParameters.Insert("client_id" , Parameters_["client_id"]); - URLParameters.Insert("redirect_uri" , Parameters_["redirect_uri"]); - URLParameters.Insert("scope" , Parameters_["scope"]); - URLParameters.Insert("state" , "state"); - URLParameters.Insert("code_challenge" , "challenge"); - URLParameters.Insert("code_challenge_method", "plain"); - - URLParameters = OPI_Tools.RequestParametersToString(URLParameters); - Link = "https://twitter.com/i/oauth2/authorize" + URLParameters; - - Return Link; - -EndFunction - -// Get token -// Gets the token by the code obtained during authorization via the link from GetAuthorizationLink -// -// Parameters: -// Code - String - Code obtained from authorization See GetAuthorizationLink - code -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - serialized JSON response from Twitter -Function GetToken(Val Code, Val Parameters = "") Export - - OPI_TypeConversion.GetLine(Code); - - Parameters_ = GetStandardParameters(Parameters); - - RequestParameters = New Structure; - RequestParameters.Insert("code" , Code); - RequestParameters.Insert("grant_type" , "authorization_code"); - RequestParameters.Insert("client_id" , Parameters_["client_id"]); - RequestParameters.Insert("redirect_uri" , Parameters_["redirect_uri"]); - RequestParameters.Insert("code_verifier", "challenge"); - - Response = OPI_Tools.Post("https://api.twitter.com/2/oauth2/token" - , RequestParameters, , False); - - Return Response; - -EndFunction - -// Refresh token -// Updates the v2 token using the refresh_token -// -// Parameters: -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - serialized JSON response from Twitter -Function RefreshToken(Val Parameters = "") Export - - Parameters_ = GetStandardParameters(Parameters); - Refresh = "refresh_token"; - - RequestParameters = New Structure; - RequestParameters.Insert(Refresh , Parameters_[Refresh]); - RequestParameters.Insert("grant_type" , Refresh); - RequestParameters.Insert("client_id" , Parameters_["client_id"]); - - Response = OPI_Tools.Post("https://api.twitter.com/2/oauth2/token" - , RequestParameters, , False); - - Return Response; - -EndFunction - -// !NOCLI -// Method for insertion into an http service, the address of which is specified in redirect_uri -// Calls the token acquisition method, as for obtaining a token from the code received -// on redirect_uri after authorization via the browser is only 30 seconds -// -// Parameters: -// Request - HTTPServiceRequest - Request coming to the http service -// -// Return value: -// HTTPResponse, Arbitrary, BinaryData - Result of reading the JSON response from the server -Function HandleIncomingRequestAfterAuthorization(Request) Export - - Code = Request.RequestParameters["code"]; - TokenResponse = GetToken(Code); - - // BSLLS:CommentedCode-off - // Preferred token storage - // Constants.TwitterRefresh.Уwithтаноinить(TokenResponse["refresh_token"]); - // Constants.TwitterToken.Уwithтаноinить(TokenResponse["access_token"]); - // BSLLS:CommentedCode-on - - Return TokenResponse; - -EndFunction - -#EndRegion - -#Region Tweets - -// !NOCLI -// Create custom tweet -// -// Parameters: -// Text - String - Tweet text -// MediaArray - Array from String, BinaryData - Array of binary data or file paths -// PollOptionsArray - Array of Strings - Array of poll options, if necessary -// PollDuration - String, Number - Poll duration, еwithли необхоdимо (опроwith without dлительноwithти не withозdаетwithя) -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - serialized JSON response from Twitter -Function CreateCustomTweet(Val Text = "" - , Val MediaArray = "" - , Val PollOptionsArray = "" - , Val PollDuration = "" - , Val Parameters = "") Export - - OPI_TypeConversion.GetLine(Text); - OPI_TypeConversion.GetLine(PollDuration); - - If ValueFilled(MediaArray) Then - OPI_TypeConversion.GetCollection(MediaArray); - EndIf; - - If ValueFilled(PollOptionsArray) Then - OPI_TypeConversion.GetCollection(PollOptionsArray); - EndIf; - - Parameters_ = GetStandardParameters(Parameters); - URL = "https://api.twitter.com/2/tweets"; - Array = "Array"; - Fields = New Match; - - If ValueFilled(Text) Then - Fields.Insert("text", Text); - EndIf; - - If TypeValue(PollOptionsArray) = Type(Array) And ValueFilled(PollDuration) Then - - PollDuration = Number(PollDuration); - - If PollOptionsArray.Quantity() > 0 Then - - OptionStructure = New Structure("options,duration_minutes", PollOptionsArray, PollDuration); - Fields.Insert("poll", OptionStructure); - - EndIf; - - EndIf; - - If TypeValue(MediaArray) = Type(Array) Then - If MediaArray.Quantity() > 0 Then - Fields.Insert("media", New Structure("media_ids", MediaArray)); - EndIf; - EndIf; - - Authorization = CreateAuthorizationHeaderV2(Parameters_); - Response = OPI_Tools.Post(URL, Fields, Authorization); - - Return Response; - -EndFunction - -// Create text tweet -// Creates a tweet without attachments -// -// Parameters: -// Text - String - Tweet text - text -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - serialized JSON response from Twitter -Function CreateTextTweet(Val Text, Val Parameters = "") Export - Return CreateCustomTweet(Text, , , , Parameters); -EndFunction - -// Create image tweet -// Creates a tweet with an image attachment -// -// Parameters: -// Text - String - Tweet text - text -// ImageArray - Array from String, BinaryData - Image files array - pictures -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - serialized JSON response from Twitter -Function Create image tweet(Val Text, Val ImageArray, Val Parameters = "") Export - - MediaArray = Upload attachments array(ImageArray, "tweet_image", Parameters); - Return CreateCustomTweet(Text, MediaArray, , , Parameters); - -EndFunction - -// Create gif tweet -// Creates a tweet with a gif attachment -// -// Parameters: -// Text - String - Tweet text - text -// Gif array - Array from String, BinaryData - Gif files array - gifs -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - serialized JSON response from Twitter -Function CreateGifTweet(Val Text, Val Gif array, Val Parameters = "") Export - - MediaArray = Upload attachments array(Gif array, "tweet_gif", Parameters); - Return CreateCustomTweet(Text, MediaArray, , , Parameters); - -EndFunction - -// Create video tweet -// Creates a tweet with a video attachment -// -// Parameters: -// Text - String - Tweet text - text -// Video array - Array from String, BinaryData - Video files array - videos -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - serialized JSON response from Twitter -Function CreateVideoTweet(Val Text, Val Video array, Val Parameters = "") Export - - MediaArray = Upload attachments array(Video array, "tweet_video", Parameters); - Return CreateCustomTweet(Text, MediaArray, , , Parameters); - -EndFunction - -// Create poll tweet -// Creates a tweet with a poll -// -// Parameters: -// Text - String - Tweet text - text -// OptionArray - Array of Strings - Poll options array - options -// Duration - String, Number - Poll duration - duration -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - serialized JSON response from Twitter -Function CreatePollTweet(Val Text, Val OptionArray, Val Duration, Val Parameters = "") Export - Return CreateCustomTweet(Text, , OptionArray, Duration, Parameters); -EndFunction - -// Upload attachments array !NOCLI -// Uploads files to the server and returns their IDs -// -// Parameters: -// ArrayOfFiles - Array from String, BinaryData - Files array -// AttachmentsType - String - Attachments type -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Array Of String - Media ID array -Function Upload attachments array(Val ArrayOfFiles, Val AttachmentsType, Val Parameters = "") Export - - OPI_TypeConversion.GetLine(AttachmentsType); - OPI_TypeConversion.GetCollection(ArrayOfFiles); - - MediaArray = New Array; - Parameters_ = GetStandardParameters(Parameters); - MIS = "media_id_string"; - - If ValueFilled(ArrayOfFiles) Then - - For Each SendingFile In ArrayOfFiles Do - - OPI_TypeConversion.GetBinaryData(SendingFile); - - Response = UploadMediaFile(SendingFile, AttachmentsType, Parameters_); - MediaID = Response[MIS]; - - If Not ValueFilled(MediaID) Then - Return Response; - EndIf; - - MediaArray.Add(MediaID); - - EndDo; - - EndIf; - - Return MediaArray; - -EndFunction - -#EndRegion - -#EndRegion - -#Region ServiceProceduresAndFunctions - -Function UploadMediaFile(Val File, Val Type, Val Parameters) - - OPI_TypeConversion.GetBinaryData(File); - - RequestType = "POST"; - Parameters_ = GetStandardParameters(Parameters); - URL = "https://upload.twitter.com/1.1/media/upload.json"; - - If Type = "tweet_image" Then - - Fields = New Structure; - Fields.Insert("media_data" , Base64String(File)); - Fields.Insert("media_category", Type); - - Authorization = CreateAuthorizationHeaderV1(Parameters_, Fields, RequestType, URL); - Response = OPI_Tools.Post(URL, Fields, Authorization, False); - - Else - - Response = UploadMediaInParts(File, Type, RequestType, URL, Parameters_); - - EndIf; - - Return Response; - -EndFunction - -Function UploadMediaInParts(Val File, Val Type, Val RequestType, Val URL, Parameters) - - Unit = 1024; - Quantity = 4; - MediaKey = "media_key"; - MIS = "media_id_string"; - Command = "command"; - Size = File.Size(); - - MIMETypeMapping = New Match; - MIMETypeMapping.Insert("tweet_image", "image/jpeg"); - MIMETypeMapping.Insert("tweet_video", "video/mp4"); - MIMETypeMapping.Insert("tweet_gif" , "image/gif"); - - ChunkSize = Quantity * Unit * Unit; - ArrayReading = SplitBinaryData(File, ChunkSize); - - Fields = New Structure; - Fields.Insert(Command , "INIT"); - Fields.Insert("total_bytes" , OPI_Tools.NumberToString(Size)); - Fields.Insert("media_type" , MIMETypeMapping.Get(Type)); - Fields.Insert("media_category" , Type); - - Authorization = CreateAuthorizationHeaderV1(Parameters, Fields, RequestType, URL); - - InitializationResponse = OPI_Tools.Post(URL, Fields, Authorization, False); - InitializationKey = InitializationResponse[MediaKey]; - InitializationID = InitializationResponse[MIS]; - - If Not ValueFilled(InitializationKey) Or Not ValueFilled(InitializationID) Then - Return InitializationResponse; - EndIf; - - Counter = 0; - - For Each Part In ArrayReading Do - - Fields = New Structure; - Fields.Insert(Command , "APPEND"); - Fields.Insert("media_key" , InitializationKey); - Fields.Insert("segment_index" , OPI_Tools.NumberToString(Counter)); - Fields.Insert("media" , Part); - - Authorization = CreateAuthorizationHeaderV1(Parameters, New Structure, RequestType, URL); - - OPI_Tools.PostMultipart(URL, Fields, , , Authorization); - - Counter = Counter + 1; - - EndDo; - - Fields = New Structure; - Fields.Insert(Command , "FINALIZE"); - Fields.Insert("media_id", InitializationID); - - ProcessingStatus = GetProcessingStatus(Parameters, Fields, URL); - - If Not TypeValue(ProcessingStatus) = Type("String") Then - Return ProcessingStatus; - EndIf; - - Response = WaitForProcessingCompletion(ProcessingStatus, InitializationID, URL, Parameters); - - Return Response; - -EndFunction - -Function WaitForProcessingCompletion(Val ProcessingStatus, Val InitializationID, Val URL, Val Parameters) - - ProcessingInfo = "processing_info"; - Command = "command"; - Fields = New Structure; - - Fields.Insert(Command , "STATUS"); - Fields.Insert("media_id", InitializationID); - - WHile String(ProcessingStatus) = "pending" Or String(ProcessingStatus) = "in_progress" Do - - Authorization = CreateAuthorizationHeaderV1(Parameters, Fields, "GET", URL); - Response = OPI_Tools.Get(URL, Fields, Authorization); - Information = Response[ProcessingInfo]; - - If Not ValueFilled(Information) Then - Return Response; - EndIf; - - ProcessingStatus = Information["state"]; - - If Not ValueFilled(ProcessingStatus) Then - Return Response; - EndIf; - - EndDo; - - If ProcessingStatus = "failed" Then - Raise "Twitter could not process the video you uploaded"; - EndIf; - - Return Response; - -EndFunction - -Function GetStandardParameters(Val Parameters = "") - - // Зdеwithь withобрано опреdеление data, необхоdимых for work. - // For Twitter this dоinольно зtoчительный toбор, which is due to the presence of two at once API, - // toоторые, при thisм, withозdаны не for разныз заdач, но проwithто яinляютwithя inерwithиями dруг dруга. - // Аtoтуальной inерwithией API яinляетwithя v2 и оto требует получения inременных тоtoеноin. Notwithмотря to то, - // that Twitter insists on using this latest version, they somehow managed not to transfer - // file upload mechanism and some others from the old version - v1.1. Therefore, something needs to be done - // to inерwithии 1.1, and something on 2: up to the point that they removed the ability to post tweets from v1.1, - // but only through it you can add a picture to the tweet. At the same time, their authentication methods and tokens are different - - // Мироinая гигоtoорпорация Andлоto Маwithtoа, towithтати, toпомиtoю ;) - - // P.S Далее чаwithто упомиtoетwithя "withтраница towithтроеto Twitter Developer" - this - // https://developer.twitter.com/en/portal/dashboard и inыбор toонtoретного проеtoта from withпиwithtoа (зtoчеto c toлючем) - - Parameters_ = New Match; - Permissions = "tweet.read tweet.write tweet.moderate.write users.read " - + "follows.read follows.write offline.access space.read mute.read " - + "mute.write like.read like.write list.read list.write block.read " - + "block.write bookmark.read bookmark.write"; - - // Data for API v2 - - // redirect_uri - URL of your http service (or other request handler) for authorization - // scope - a set of permissions for the received key. Can be any, but offline.access is mandatory - // client_id - From OAuth 2.0 Client ID and Client Secret settings page of Twitter Developer - // client_secret - From OAuth 2.0 Client ID and Client Secret settings page of Twitter Developer - // access_token - GetAuthorizationLink() -> Браузер -> code приdет to redirect_uri -> GetToken(code) - // refresh_token - Comes together with access_token and is used to refresh it (access_token lifetime - 2 ч) - // Обноinление проиwithхоdит метоdом RefreshToken with ноinыми access_token и refresh_token. - // For the next update, you need to use a new refresh_token, so hardcode - // не получитwithя (access_token тоже не получитwithя) - - // |--> RefreshToken() ->| access_token --> Used in the interval of 2 hours for requests - // | |refresh_token --| - // |--------[after 2 hrs.]-------------------| - - // Data for API v1.1 - - // oauth_token - From Authentication Tokens -> Access Token and Secret settings page of Twitter Developer - // oauth_token_secret - From Authentication Tokens -> Access Token and Secret settings page of Twitter Developer - // oauth_consumer_key - From Consumer Keys -> Access Token and Secret settings page of Twitter Developer - // oauth_consumer_secret - From Consumer Keys -> Access Token and Secret settings page of Twitter Developer - - // These tokens do not need to be updated - - Parameters_.Insert("redirect_uri" , ""); - Parameters_.Insert("scope" , Permissions); - Parameters_.Insert("client_id" , ""); - Parameters_.Insert("client_secret" , ""); - Parameters_.Insert("access_token" , ""); // Should be something like Constants.TwitterToken.Get() - Parameters_.Insert("refresh_token" , ""); // Should be something like Constants.TwitterRefresh.Get() - Parameters_.Insert("oauth_token" , ""); - Parameters_.Insert("oauth_token_secret" , ""); - Parameters_.Insert("oauth_consumer_key" , ""); - Parameters_.Insert("oauth_consumer_secret", ""); - - OPI_TypeConversion.GetCollection(Parameters); - - If TypeValue(Parameters) = Type("Structure") Or TypeValue(Parameters) = Type("Match") Then - For Each PassedParameter In Parameters Do - Parameters_.Insert(PassedParameter.Key, OPI_Tools.NumberToString(PassedParameter.Value)); - EndDo; - EndIf; - - Return Parameters_; - -EndFunction - -Function CreateAuthorizationHeaderV1(Val Parameters, Val Fields, Val RequestType, Val URL) - - CurrentDate = OPI_Tools.GetCurrentDate(); - AuthorizationHeader = ""; - HashingMethod = "HMAC-SHA1"; - APIVersion = "1.0"; - SignatureString = ""; - Signature = ""; - OCK = "oauth_consumer_key"; - OTK = "oauth_token"; - CurrentUNIXDate = OPI_Tools.UNIXTime(CurrentDate); - CurrentUNIXDate = OPI_Tools.NumberToString(CurrentUNIXDate); - ParametersTable = New ValueTable; - ParametersTable.Columns.Add("Key"); - ParametersTable.Columns.Add("Value"); - - For Each Field In Fields Do - - NewLine = ParametersTable.Add(); - NewLine.Key = Field.Key; - NewLine.Value = Field.Value; - - EndDo; - - NewLine = ParametersTable.Add(); - NewLine.Key = OCK; - NewLine.Value = Parameters[OCK]; - - NewLine = ParametersTable.Add(); - NewLine.Key = OTK; - NewLine.Value = Parameters[OTK]; - - NewLine = ParametersTable.Add(); - NewLine.Key = "oauth_version"; - NewLine.Value = APIVersion; - - NewLine = ParametersTable.Add(); - NewLine.Key = "oauth_signature_method"; - NewLine.Value = HashingMethod; - - NewLine = ParametersTable.Add(); - NewLine.Key = "oauth_timestamp"; - NewLine.Value = CurrentUNIXDate; - - NewLine = ParametersTable.Add(); - NewLine.Key = "oauth_nonce"; - NewLine.Value = CurrentUNIXDate; - - For Each TableRow In ParametersTable Do - - TableRow.Key = EncodeString(TableRow.Key, StringEncodingMethod.URLencoding); - TableRow.Value = EncodeString(TableRow.Value, StringEncodingMethod.URLencoding); - - EndDo; - - ParametersTable.Sort("Key"); - - For Each TableRow In ParametersTable Do - - SignatureString = SignatureString - + TableRow.Key - + "=" - + TableRow.Value - + "&"; - - EndDo; - - SignatureString = Left(SignatureString, StrLength(SignatureString) - 1); - SignatureString = inReg(RequestType) - + "&" - + EncodeString(URL, StringEncodingMethod.URLencoding) - + "&" - + EncodeString(SignatureString, StringEncodingMethod.URLencoding); - - Signature = EncodeString(Parameters["oauth_consumer_secret"], StringEncodingMethod.URLencoding) - + "&" - + EncodeString(Parameters["oauth_token_secret"], StringEncodingMethod.URLencoding); - - Signature = OPI_Cryptography.HMAC(GetBinaryDataFromString(Signature) - , GetBinaryDataFromString(SignatureString) - , HashFunction.SHA1 - , 64); - - Signature = EncodeString(Base64String(Signature), StringEncodingMethod.URLencoding); - - Delimiter = ""","; - AuthorizationHeader = AuthorizationHeader - + "OAuth " - + "oauth_consumer_key=""" + Parameters[OCK] + Delimiter - + "oauth_token=""" + Parameters[OTK] + Delimiter - + "oauth_signature_method=""" + HashingMethod + Delimiter - + "oauth_timestamp=""" + CurrentUNIXDate + Delimiter - + "oauth_nonce=""" + CurrentUNIXDate + Delimiter - + "oauth_version=""" + APIVersion + Delimiter - + "oauth_signature=""" + Signature; - - HeaderMapping = New Match; - HeaderMapping.Insert("authorization", AuthorizationHeader); - - Return HeaderMapping; - -EndFunction - -Function CreateAuthorizationHeaderV2(Val Parameters) - - ReturnMapping = New Match; - ReturnMapping.Insert("Authorization", "Bearer " + Parameters["access_token"]); - - Return ReturnMapping; - -EndFunction - -Function GetProcessingStatus(Val Parameters, Val Fields, Val URL) - - ProcessingInfo = "processing_info"; - Authorization = CreateAuthorizationHeaderV1(Parameters, Fields, "POST", URL); - - Response = OPI_Tools.Post(URL, Fields, Authorization, False); - Information = Response[ProcessingInfo]; - - If Not ValueFilled(Information) Then - Return Response; - EndIf; - - ProcessingStatus = Information["state"]; - - If Not ValueFilled(ProcessingStatus) Then - Return Response; - Else - Return ProcessingStatus; - EndIf; - -EndFunction - -#EndRegion diff --git a/service/interim/en/OPI/src/CommonModules/OPI_Twitter/OPI_Twitter.mdo b/service/interim/en/OPI/src/CommonModules/OPI_Twitter/OPI_Twitter.mdo deleted file mode 100644 index c6382a73c3..0000000000 --- a/service/interim/en/OPI/src/CommonModules/OPI_Twitter/OPI_Twitter.mdo +++ /dev/null @@ -1,11 +0,0 @@ - - - OPI_Twitter - - ru - Methodы work with Twitter (OPI) - - true - true - true - diff --git a/service/interim/en/OPI/src/CommonModules/OPI_VK/Module.bsl b/service/interim/en/OPI/src/CommonModules/OPI_VK/Module.bsl deleted file mode 100644 index 4881808620..0000000000 --- a/service/interim/en/OPI/src/CommonModules/OPI_VK/Module.bsl +++ /dev/null @@ -1,2190 +0,0 @@ -// Location OS: ./OInt/core/Modules/OPI_VK.os -// Library: VK -// CLI Command: vk - -// MIT License - -// Copyright (c) 2023 Anton Tsitavets - -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: - -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. - -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -// https://github.com/Bayselonarrend/OpenIntegrations -// If in не зtoете with чего toчать, то withтоит toйти метоd GetStandardParameters() -// and read comments - -// BSLLS:NumberOfOptionalParams-off -// BSLLS:LatinAndCyrillicSymbolInWord-off -// BSLLS:IncorrectLineBreak-off -// BSLLS:NumberOfOptionalParams-off -// BSLLS:UsingServiceTag-off -// BSLLS:UnusedLocalVariable-off - -//@skip-check method-too-many-params -//@skip-check wrong-string-literal-content - -// Uncomment if OneScript is executed -// #Use "../../tools" - -#Region ProgrammingInterface - -#Region TokenRetrieval - -// Create token retrieval link -// Getting a link for interactive token retrieval (access_token), which is necessary -// for further actions -// -// Parameters: -// app_id - String, Number - app_id from application settings - app -// -// Return value: -// String - URL to go to in the browser -Function CreateTokenRetrievalLink(Val App_id) Export - - OPI_TypeConversion.GetLine(App_id); - - // access_token will need to be taken from the parameter in the browser address bar - Return "https://oauth.vk.com/authorize?client_id=" + App_id - + "&scope=offline,wall,groups,photos,stats,stories,ads,market,video" - + "&v=5.131&response_type=token&redirect_uri=https://api.vk.com/blank.html"; - -EndFunction - -#EndRegion - -#Region GroupWork - -// Create post -// Creates a post with images -// -// Parameters: -// Text - String - Post text - text -// ImageArray - Array from String, BinaryData - Array of images - pictures -// Advertisement - Boolean - Indication ""Это реtoлама"" - ad -// LinkUnderPost - String - Link (URL) under the post - url -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - Serialized JSON response from VK -Function CreatePost(Val Text - , Val ImageArray - , Val Advertisement = False - , Val LinkUnderPost = "" - , Val Parameters = "") Export - - OPI_TypeConversion.GetCollection(ImageArray); - - Parameters_ = GetStandardParameters(Parameters); - AttachmentsArray = New Array; - - For Each PostImage In ImageArray Do - - Parameters_ = GetStandardParameters(Parameters); - ResponseCorrespondence = GetImageCorrespondence(PostImage, Parameters_, "Post"); - - OwnerId = ResponseCorrespondence.Get("owner_id"); - ObjectId = ResponseCorrespondence.Get("id"); - - If Not ValueFilled(OwnerId) Or Not ValueFilled(ObjectId) Then - Return ResponseCorrespondence; - EndIf; - - OwnerId = OPI_Tools.NumberToString(OwnerId); - ObjectId = OPI_Tools.NumberToString(ObjectId); - - PhotoID = "photo" + OwnerId + "_" + ObjectId; - - AttachmentsArray.Add(PhotoID); - - EndDo; - - Response = CreateCompositePost(Text, AttachmentsArray, Advertisement, LinkUnderPost, Parameters); - - Return Response; - -EndFunction - -// Create composite post -// Созdает поwithт to mainоinе маwithwithиinа иdетифиtoатороin объеtoтоin (toартиноto, inиdео и dр.) -// -// Parameters: -// Text - String - Post text - text -// Objects - Array of Strings - Array of identifiers like photo123_123 - objects -// Advertisement - Boolean - Indication ""Это реtoлама"" - ad -// LinkUnderPost - String - Link (URL) under the post - url -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - Serialized JSON response from VK -Function CreateCompositePost(Val Text - , Val Objects - , Val Advertisement = False - , Val LinkUnderPost = "" - , Val Parameters = "") Export - - OPI_TypeConversion.GetLine(Text); - OPI_TypeConversion.GetLine(LinkUnderPost); - OPI_TypeConversion.GetBoolean(Advertisement); - - Parameters = GetStandardParameters(Parameters); - AttachmentsString = StrJoin(Objects, ","); - AttachmentsString = AttachmentsString + LinkUnderPost; - - Parameters.Insert("message" , Text); - Parameters.Insert("attachments" , AttachmentsString); - Parameters.Insert("mark_as_ads" , ?(Advertisement, 1, 0)); - Parameters.Insert("close_comments" , ?(Advertisement, 1, 0)); - - Response = OPI_Tools.Get("api.vk.com/method/wall.post", Parameters); - - Return Response; - -EndFunction - -// Delete post -// Deletes a post by ID -// -// Parameters: -// PostID - String, Number - Post ID - post -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - Serialized JSON response from VK -Function DeletePost(Val PostID, Val Parameters = "") Export - - OPI_TypeConversion.GetLine(PostID); - - Parameters_ = GetStandardParameters(Parameters); - Parameters_.Insert("post_id", PostID); - - Response = OPI_Tools.Get("api.vk.com/method/wall.delete", Parameters_); - - Return Response; - -EndFunction - -// Create poll -// Creates a poll with answer options -// -// Parameters: -// Question - String - Poll question - question -// AnswersArray - Array of Strings - Array of answer options - options -// Image - String, BinaryData - Poll image - picture -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - Serialized JSON response from VK -Function CreatePoll(Val Question, Val AnswersArray, Val Image = "", Val Parameters = "") Export - - OPI_TypeConversion.GetLine(Question); - OPI_TypeConversion.GetCollection(AnswersArray); - - Parameters_ = GetStandardParameters(Parameters); - Response = "response"; - - If ValueFilled(Image) Then - - Response = UploadPhotoToServer(Image, Parameters_, "Poll"); - - Photo = Response.Get(Response); - - If ValueFilled(Photo) Then - - PhotoID = Photo["id"]; - - If Not ValueFilled(PhotoID) Then - Return Response; - EndIf; - - Else - Return Response; - EndIf; - - EndIf; - - Parameters_.Insert("is_anonymous", 1); - Parameters_.Insert("is_multiple" , 0); - - Answers = StrJoin(AnswersArray, ""","""); - Answers = "[""" + Answers + """]"; - - Parameters_.Insert("add_answers", Answers); - Parameters_.Insert("photo_id" , OPI_Tools.NumberToString(PhotoID)); - Parameters_.Insert("question" , Question); - - Poll = OPI_Tools.Get("api.vk.com/method/polls.create", Parameters_); - PollCorrespondence = Poll.Get(Response); - - If Not ValueFilled(PollCorrespondence) Then - Return Poll; - EndIf; - - OwnerId = PollCorrespondence.Get("owner_id"); - ObjectId = PollCorrespondence.Get("id"); - - If Not ValueFilled(OwnerId) Or Not ValueFilled(ObjectId) Then - Return Poll; - EndIf; - - PollID = "poll" - + OPI_Tools.NumberToString(OwnerId) - + "_" - + OPI_Tools.NumberToString(ObjectId); - - Parameters_.Insert("attachments", PollID); - - Response = OPI_Tools.Get("api.vk.com/method/wall.post", Parameters_); - - Return Response; - -EndFunction - -// Create album -// Creates an album to store images -// -// Parameters: -// Name - String - Album name - title -// Description - String - Album description - description -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - Serialized JSON response from VK -Function CreateAlbum(Val Name, Val Description = "", Val Parameters = "") Export - - OPI_TypeConversion.GetLine(Name); - OPI_TypeConversion.GetLine(Description); - - Parameters_ = GetStandardParameters(Parameters); - - Parameters_.Insert("title" , Name); - Parameters_.Insert("description" , Description); - Parameters_.Insert("upload_by_admins_only", 1); - - Response = OPI_Tools.Get("api.vk.com/method/photos.createAlbum", Parameters_); - - Return Response; - -EndFunction - -// Delete album -// Deletes a previously created album -// -// Parameters: -// AlbumID - String, Number - Album ID - album -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - Serialized JSON response from VK -Function DeleteAlbum(Val AlbumID, Val Parameters = "") Export - - OPI_TypeConversion.GetLine(AlbumID); - - Parameters_ = GetStandardParameters(Parameters); - Parameters_.Insert("album_id", OPI_Tools.NumberToString(AlbumID)); - - Response = OPI_Tools.Get("api.vk.com/method/photos.deleteAlbum", Parameters_); - - Return Response; - -EndFunction - -// Create story -// Creates a story from an image -// -// Parameters: -// Image - String, BinaryData - Story background - picture -// URL - String - URL for button under the story - url -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - Serialized JSON response from VK -Function CreateStory(Val Image, Val URL = "", Val Parameters = "") Export - - OPI_TypeConversion.GetLine(URL); - - Parameters_ = GetStandardParameters(Parameters); - Parameters_.Insert("link_text" , "more"); - Parameters_.Insert("link_url" , URL); - Parameters_.Insert("add_to_news", "1"); - - Response = UploadPhotoToServer(Image, Parameters_, "Story"); - Return Response; - -EndFunction - -// Save image to album -// Saves an image to the community album -// -// Parameters: -// AlbumID - String, Number - Album ID - album -// Image - BinaryData,String - Image file - picture -// Description - String - Image description - description -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - Serialized JSON response from VK -Function SaveImageToAlbum(Val AlbumID, Val Image, Val Description = "", Val Parameters = "") Export - - OPI_TypeConversion.GetLine(AlbumID); - OPI_TypeConversion.GetLine(Description); - - Parameters_ = GetStandardParameters(Parameters); - - Parameters_.Insert("album_id", AlbumID); - Parameters_.Insert("caption" , Description); - - Return UploadPhotoToServer(Image, Parameters_, "Album"); - -EndFunction - -// Delete image -// Deletes an image from the album -// -// Parameters: -// ImageID - String, Number - Image ID - pictureid -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - Serialized JSON response from VK -Function DeleteImage(Val ImageID, Val Parameters = "") Export - - OPI_TypeConversion.GetLine(ImageID); - - Parameters_ = GetStandardParameters(Parameters); - Parameters_.Insert("photo_id", ImageID); - - Response = OPI_Tools.Get("api.vk.com/method/photos.delete", Parameters_); - - Return Response; - -EndFunction - -// Upload video to server -// Uploads video to the group for further use -// -// Parameters: -// Video - String, BinaryData - Video file - file -// Name - String - Video name - title -// Description - String - Video description - description -// Album - String - Album ID, if necessary - album -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - Serialized JSON response from VK -Function UploadVideoToServer(Val Video - , Val Name - , Val Description = "" - , Val Album = "" - , Val Parameters = "") Export - - String_ = "String"; - Parameters = GetStandardParameters(Parameters); - - OPI_Tools.AddField("name" , Name, String_, Parameters); - OPI_Tools.AddField("description", Description , String_, Parameters); - OPI_Tools.AddField("album_id" , Album , String_, Parameters); - - Response = OPI_Tools.Get("api.vk.com/method/video.save", Parameters); - - Result = Response["response"]; - - If Not ValueFilled(Result) Then - Return Response; - EndIf; - - URL = Result["upload_url"]; - - If Not ValueFilled(URL) Then - Return Response; - EndIf; - - FileMapping = New Match; - OPI_Tools.AddField("video_file.mp4", Video, "BinaryData", FileMapping); - - DataSize = FileMapping["video_file.mp4"].Size(); - DataSize = OPI_Tools.NumberToString(DataSize); - - Response = OPI_Tools.PostMultipart(URL, , FileMapping, "video/mp4"); - - Return Response; - -EndFunction - -// Upload photo to server -// Uploads photo to server for further use -// -// Parameters: -// Image - String, BinaryData - Image file - file -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// View - String - View upload (Post, Product, Story, Poll, Miscellaneous) - type -// -// Return value: -// Key-Value Pair - Serialized JSON response from VK -Function UploadPhotoToServer(Val Image, Val Parameters = "", Val View = "Post") Export - - Parameters = GetStandardParameters(Parameters); - Method = DetermineImageUploadMethod(View); - Files = New Match; - - Response = "response"; - URL = "api.vk.com/method/"; - Upload = URL + Method["Upload"]; - Save = URL + Method["Save"]; - - If TypeValue(Image) = Type("String") Then - ImageKey = StringReplace(Image, ".", "___"); - OPI_TypeConversion.GetBinaryData(Image); - Else - ImageKey = "image___jpeg"; - EndIf; - - Files.Insert(ImageKey, Image); - - For N = 1 For 5 Do - - Response = OPI_Tools.Get(Upload, Parameters); - Result = Response[Response]; - - If ValueFilled(Result) Then - - URL = Result["upload_url"]; - - If Not ValueFilled(URL) Then - Return Response; - EndIf; - - Else - Return Response; - EndIf; - - Parameters.Insert("upload_url", URL); - Response = OPI_Tools.PostMultipart(URL, Parameters, Files); - - If TypeValue(Response) = Type("Match") Then - Break; - EndIf; - - EndDo; - - If TypeValue(Response) <> Type("Match") Then - Return GetStringFromBinaryData(Response); - EndIf; - - FillPhotoUploadParameters(Method, Response, Parameters); - - Response = OPI_Tools.Get(Save, Parameters); - - Return Response; - -EndFunction - -#EndRegion - -#Region DiscussionManagement - -// Create discussion -// Creates a new discussion -// -// Parameters: -// Name - String - Discussion name - title -// Text of the first message - String - Text of the first message - text -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - Serialized JSON response from VK -Function CreateDiscussion(Val Name, Val Text of the first message, Val Parameters = "") Export - - OPI_TypeConversion.GetLine(Name); - OPI_TypeConversion.GetLine(Text of the first message); - - Parameters_ = GetStandardParameters(Parameters); - Parameters_.Insert("title", Name); - Parameters_.Insert("text" , Text of the first message); - - Response = OPI_Tools.Get("api.vk.com/method/board.addTopic", Parameters_); - - Return Response; - -EndFunction - -// Close discussion -// Close or delete discussion -// -// Parameters: -// DiscussionID - String, Number - Discussion ID - topic -// Delete completely - Boolean - Delete completely (True) or close - remove -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - Serialized JSON response from VK -Function CloseDiscussion(Val DiscussionID, Val Delete completely = False, Val Parameters = "") Export - - OPI_TypeConversion.GetLine(DiscussionID); - OPI_TypeConversion.GetBoolean(Delete completely); - - Parameters_ = GetStandardParameters(Parameters); - Parameters_.Insert("topic_id", DiscussionID); - - Method = ?(Delete completely, "deleteTopic", "closeTopic"); - Response = OPI_Tools.Get("api.vk.com/method/board." + Method, Parameters_); - - Return Response; - -EndFunction - -// Open discussion -// Opens a previously closed discussion -// -// Parameters: -// DiscussionID - String, Number - Discussion ID - topic -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - Serialized JSON response from VK -Function OpenDiscussion(Val DiscussionID, Val Parameters = "") Export - - OPI_TypeConversion.GetLine(DiscussionID); - - Parameters_ = GetStandardParameters(Parameters); - Parameters_.Insert("topic_id", DiscussionID); - - Response = OPI_Tools.Get("api.vk.com/method/board.openTopic", Parameters_); - - Return Response; - -EndFunction - -// Write in discussion -// Adds a message to the discussion on behalf of the group -// -// Parameters: -// DiscussionID - String, Number - Discussion ID - topic -// Text - String - Message text - text -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - Serialized JSON response from VK -Function WriteInDiscussion(Val DiscussionID, Val Text, Val Parameters = "") Export - - OPI_TypeConversion.GetLine(DiscussionID); - OPI_TypeConversion.GetLine(Text); - - Parameters_ = GetStandardParameters(Parameters); - Parameters_.Insert("topic_id", DiscussionID); - Parameters_.Insert("message" , Text); - - Response = OPI_Tools.Get("api.vk.com/method/board.createComment", Parameters_); - - Return Response; - -EndFunction - -#EndRegion - -#Region InteractiveActions - -// Like -// Likes a post -// -// Parameters: -// PostID - String, Number - Post ID - post -// WallID - String, Number - ID of the wall where the post is located - wall -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - Serialized JSON response from VK -Function LikePost(Val PostID, Val WallID = "", Val Parameters = "") Export - - OPI_TypeConversion.GetLine(PostID); - OPI_TypeConversion.GetLine(WallID); - - Parameters_ = GetStandardParameters(Parameters); - WallID = ?(ValueFilled(WallID), WallID, Parameters_["owner_id"]); - VKObject = "wall" + WallID + "_" + OPI_Tools.NumberToString(PostID); - - Parameters_.Insert("type" , "post"); - Parameters_.Insert("object" , VKObject); - Parameters_.Insert("item_id" , OPI_Tools.NumberToString(PostID)); - Parameters_.Insert("owner_id" , OPI_Tools.NumberToString(WallID)); - Parameters_.Insert("from_group" , 0); - - Response = OPI_Tools.Get("api.vk.com/method/likes.add", Parameters_); - - Return Response; - -EndFunction - -// Make repost -// Reposts the record -// -// Parameters: -// PostID - String, Number - Post ID - post -// WallID - String, Number - ID of the wall where the post is located - from -// Target wall - String, Number - ID of the target wall or group - to -// Advertising - Boolean - Sign of an advertising post - ad -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - Serialized JSON response from VK -Function MakeRepost(Val PostID - , Val WallID = "" - , Val Target wall = "" - , Val Advertising = False - , Val Parameters = "") Export - - Parameters_ = GetStandardParameters(Parameters); - GroupId = Parameters_["group_id"]; - - OPI_TypeConversion.GetLine(GroupId); - OPI_TypeConversion.GetLine(PostID); - OPI_TypeConversion.GetLine(WallID); - OPI_TypeConversion.GetLine(Target wall); - OPI_TypeConversion.GetBoolean(Advertising); - - Source = ?(ValueFilled(WallID), WallID, GroupId); - Receiver = ?(ValueFilled(Target wall), Target wall, GroupId); - - Parameters_.Insert("object" , "wall" + Source + "_" + OPI_Tools.NumberToString(PostID)); - Parameters_.Insert("group_id" , StringReplace(Receiver, "-", "")); - Parameters_.Insert("mark_as_ads" , ?(Advertising, 1, 0)); - - Response = OPI_Tools.Get("api.vk.com/method/wall.repost", Parameters_); - - Return Response; - -EndFunction - -// Write a message -// Write a message to a user in the community's dialog -// -// Parameters: -// Text - String - Message text - text -// UserID - String - Recipient user ID - user -// Communitytoken - String - Community chat bot token, which can be obtained in the settings - ct -// Keyboard - String - JSON keyboard. See FormKeyboard - keyboard -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - Serialized JSON response from VK -Function WriteMessage(Val Text - , Val UserID - , Val Communitytoken - , Val Keyboard = "" - , Val Parameters = "") Export - - OPI_TypeConversion.GetLine(Text); - OPI_TypeConversion.GetLine(UserID); - OPI_TypeConversion.GetLine(Communitytoken); - OPI_TypeConversion.GetLine(Keyboard); - - Parameters_ = GetStandardParameters(Parameters); - Parameters_.Insert("access_token", Communitytoken); - - Parameters_.Insert("user_id" , UserID); - Parameters_.Insert("peer_id" , UserID); - Parameters_.Insert("parse_mode" , "Markdown"); - Parameters_.Insert("random_id" , 0); - Parameters_.Insert("message" , Text); - - If ValueFilled(Keyboard) Then - Parameters_.Insert("keyboard", Keyboard); - EndIf; - - Response = OPI_Tools.Get("api.vk.com/method/messages.send", Parameters_); - - Return Response; - -EndFunction - -// Write a comment -// Creates a comment under the selected record -// -// Parameters: -// PostID - String, Number - ID of the target post - post -// WallID - String, Number - ID of the wall where the post is located - wall -// Text - String - Comment text - text -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - Serialized JSON response from VK -Function WriteComment(Val PostID, Val WallID, Val Text, Val Parameters = "") Export - - Parameters_ = GetStandardParameters(Parameters); - GroupId = Parameters_["group_id"]; - - OPI_TypeConversion.GetLine(GroupId); - OPI_TypeConversion.GetLine(PostID); - OPI_TypeConversion.GetLine(WallID); - OPI_TypeConversion.GetLine(Text); - - Parameters_.Insert("owner_id" , WallID); - Parameters_.Insert("from_group" , GroupId); - Parameters_.Insert("post_id" , PostID); - Parameters_.Insert("message" , Text); - - Parameters_.Delete("group_id"); - - Response = OPI_Tools.Get("api.vk.com/method/wall.createComment", Parameters_); - - Return Response; - -EndFunction - -// Shorten link -// Creates a shortened URL from a regular one -// -// Parameters: -// URL - String - URL for shortening - url -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// String - Shortened URL -Function ShortenLink(Val URL, Val Parameters = "") Export - - OPI_TypeConversion.GetLine(URL); - - Response = "response"; - Parameters_ = New Structure; - Parameters_ = GetStandardParameters(Parameters); - Parameters_.Insert("url", URL); - - Response = OPI_Tools.Get("https://api.vk.com/method/utils.getShortLink", Parameters_); - Result = Response[Response]; - - If ValueFilled(Result) Then - - URL = Result["short_url"]; - - If ValueFilled(URL) Then - Return URL; - Else - Return Response; - EndIf; - - Else - Return Response; - EndIf; - -EndFunction - -#EndRegion - -#Region Statistics - -// Get statistics -// Gets the overall community statistics for a period -// -// Parameters: -// StartDate - Date - Start date of the period - datefrom -// EndDate - Date - End date of the period - dateto -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - Serialized JSON response from VK -Function GetStatistics(Val StartDate, Val EndDate, Val Parameters = "") Export - - OPI_TypeConversion.GetDate(StartDate); - OPI_TypeConversion.GetDate(EndDate); - - Parameters_ = GetStandardParameters(Parameters); - - StartDate = OPI_Tools.UNIXTime(StartDate); - EndDate = OPI_Tools.UNIXTime(EndDate); - - Parameters_.Insert("timestamp_from", StartDate); - Parameters_.Insert("timestamp_to" , EndDate); - Parameters_.Insert("stats_groups" , "visitors, reach, activity"); - - Response = OPI_Tools.Get("api.vk.com/method/stats.get", Parameters_); - - Return Response; - -EndFunction - -// Get post statistics -// Gets statistics in terms of posts -// -// Parameters: -// Array of post IDs - Array of String,Number - Array of post IDs - posts -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Array of Arbitrary - Array of post statistics data -Function GetPostStatistics(Val Array of post IDs, Val Parameters = "") Export - - OPI_TypeConversion.GetCollection(Array of post IDs); - - Parameters_ = GetStandardParameters(Parameters); - AnswersArray = New Array; - Array of Sets = New Array; - MaximumPosts = 30; - Response = "response"; - - For Each Post In Array of post IDs Do - - Array of Sets.Add(OPI_Tools.NumberToString(Post)); - - If Array of Sets.Quantity() = MaximumPosts Then - - NumbersString = StrJoin(Array of Sets, ","); - Parameters_.Insert("post_ids", NumbersString); - - Statistics = OPI_Tools.Get("api.vk.com/method/stats.getPostReach", Parameters_); - Array of Statistics = Statistics[Response]; - - For Each StatisticsItem In Array of Statistics Do - AnswersArray.Add(StatisticsItem); - EndDo; - - Array of Sets = New Array; - - EndIf; - - EndDo; - - NumbersString = StrJoin(Array of Sets, ","); - Parameters_.Insert("post_ids", NumbersString); - - Statistics = OPI_Tools.Get("api.vk.com/method/stats.getPostReach", Parameters_); - Array of Statistics = Statistics[Response]; - - If TypeValue(Array of Statistics) = Type("Array") Then - For Each StatisticsItem In Array of Statistics Do - AnswersArray.Add(StatisticsItem); - EndDo; - EndIf; - - Return AnswersArray; - -EndFunction - -#EndRegion - -#Region AdAccountManagement - -// Create advertising campaign -// Creates a campaign in the selected advertising account -// -// Parameters: -// AccountID - String, Number - Advertising account ID - cabinet -// Name - String - Campaign name - title -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - Serialized JSON response from VK -Function CreateAdvertisingCampaign(Val AccountID, Val Name, Val Parameters = "") Export - - OPI_TypeConversion.GetLine(AccountID); - OPI_TypeConversion.GetLine(Name); - - CurrentDate = OPI_Tools.GetCurrentDate(); - EndDate = AddMonth(CurrentDate, 24); - - Parameters_ = GetStandardParameters(Parameters); - Parameters_.Insert("account_id", AccountID); - - Array of Structures = New Array; - StartDate = OPI_Tools.UNIXTime(CurrentDate); - EndDate = OPI_Tools.UNIXTime(EndDate); - - CampaignStructure = New Structure; - CampaignStructure.Insert("type" , "promoted_posts"); - CampaignStructure.Insert("name" , Name); - CampaignStructure.Insert("day_limit" , 0); - CampaignStructure.Insert("all_limit" , 0); - CampaignStructure.Insert("start_time" , StartDate); - CampaignStructure.Insert("stop_time" , EndDate); - CampaignStructure.Insert("status" , 1); - - Array of Structures.Add(CampaignStructure); - - JSONDate = OPI_Tools.JSONString(Array of Structures); - - Parameters_.Insert("data", JSONDate); - - Response = OPI_Tools.Get("api.vk.com/method/ads.createCampaigns", Parameters_); - - Return Response; - -EndFunction - -// Create advertising post -// Creates an advertising post based on a post -// -// Parameters: -// CampaignNumber - String, Number - Advertising campaign ID - campaign -// DailyLimit - String, Number - Daily limit in rubles - limit -// CategoryNumber - String, Number - Advertising category number - category -// PostID - String, Number - ID of the post used for advertising - post -// AccountID - String, Number - Advertising account ID - cabinet -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - Serialized JSON response from VK -Function CreateAd(Val CampaignNumber - , Val DailyLimit - , Val CategoryNumber - , Val PostID - , Val AccountID - , Val Parameters = "") Export - - Parameters_ = GetStandardParameters(Parameters); - GroupId = Parameters_["group_id"]; - - OPI_TypeConversion.GetLine(GroupId); - OPI_TypeConversion.GetLine(CampaignNumber); - OPI_TypeConversion.GetLine(DailyLimit); - OPI_TypeConversion.GetLine(CategoryNumber); - OPI_TypeConversion.GetLine(PostID); - OPI_TypeConversion.GetLine(AccountID); - - Link = "https://vk.com/wall-" + GroupId + "_" + PostID; - - Array of Structures = New Array; - CampaignStructure = New Structure; - CampaignStructure.Insert("campaign_id" , CampaignNumber); - CampaignStructure.Insert("ad_format" , 9); - CampaignStructure.Insert("conversion_event_id" , 1); - CampaignStructure.Insert("autobidding" , 1); - CampaignStructure.Insert("cost_type" , 3); - CampaignStructure.Insert("goal_type" , 2); - CampaignStructure.Insert("ad_platform" , "all"); - CampaignStructure.Insert("publisher_platforms" , "vk"); - CampaignStructure.Insert("publisher_platforms_auto" , "1"); - CampaignStructure.Insert("day_limit" , DailyLimit); - CampaignStructure.Insert("all_limit" , "0"); - CampaignStructure.Insert("category1_id" , CategoryNumber); - CampaignStructure.Insert("age_restriction" , 0); - CampaignStructure.Insert("status" , 1); - CampaignStructure.Insert("name" , "Ad"); - CampaignStructure.Insert("link_url" , Link); - - Array of Structures.Add(CampaignStructure); - - OPI_TypeConversion.GetLine(Array of Structures, True); - - Parameters_.Insert("data" , Array of Structures); - Parameters_.Insert("account_id" , AccountID); - - Response = OPI_Tools.Get("api.vk.com/method/ads.createAds", Parameters_); - - Return Response; - -EndFunction - -// Pause advertising post -// Pauses the display of the advertising post -// -// Parameters: -// AccountID - String, Number - Advertising account ID - cabinet -// AdID - String, Number - Ad ID - adv -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - Serialized JSON response from VK -Function PauseAdvertisingAd(Val AccountID, Val AdID, Val Parameters = "") Export - - OPI_TypeConversion.GetLine(AccountID); - OPI_TypeConversion.GetLine(AdID); - - Parameters_ = GetStandardParameters(Parameters); - - Parameters_.Insert("account_id", AccountID); - - Array of Structures = New Array; - CampaignStructure = New Structure; - - CampaignStructure.Insert("ad_id" , AdID); - CampaignStructure.Insert("status" , 0); - - Array of Structures.Add(CampaignStructure); - - OPI_TypeConversion.GetLine(Array of Structures, True); - - Parameters_.Insert("data", Array of Structures); - - Response = OPI_Tools.Get("api.vk.com/method/ads.updateAds", Parameters_); - - Return Response; - -EndFunction - -// Get a list of advertising categories -// Gets a list of advertising category IDs for creating an advertising post -// -// Parameters: -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - Serialized JSON response from VK -Function GetAdvertisingCategoryList(Val Parameters = "") Export - - Parameters_ = GetStandardParameters(Parameters); - Response = OPI_Tools.Get("api.vk.com/method/ads.getCategories", Parameters_); - - Return Response; - -EndFunction - -#EndRegion - -#Region ProductManagement - -// Get a list of product categories -// Gets a list of product category IDs to specify when creating a product -// -// Parameters: -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Compliance From String - Key - ID, Value - Name -Function GetProductCategoryList(Val Parameters = "") Export - - Response = "response"; - Parameters_ = GetStandardParameters(Parameters); - Response = OPI_Tools.Get("api.vk.com/method/market.getCategories", Parameters_); - Result = Response[Response]; - - If ValueFilled(Result) Then - - Quantity = Result["count"]; - - If Not ValueFilled(Quantity) Then - Return Response; - EndIf; - - Else - Return Response; - EndIf; - - Parameters_.Insert("count", Quantity); - Response = OPI_Tools.Get("api.vk.com/method/market.getCategories", Parameters_); - Result = Response[Response]; - - If ValueFilled(Result) Then - - Categories = Result["items"]; - - If Not ValueFilled(Categories) Then - Return Response; - EndIf; - - Else - Return Response; - EndIf; - - CategoryCorrespondence = New Match; - - For Each Category In Categories Do - CategoryCorrespondence.Insert(Category["id"], Category["name"]); - EndDo; - - Return CategoryCorrespondence; - -EndFunction - -// Get product list -// Gets the community's product list -// -// Parameters: -// Selection - String, Number - Selection ID, if filtering is needed - sel -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - Array of product matches -Function GetProductList(Val Selection = "", Val Parameters = "") Export - - OPI_TypeConversion.GetLine(Selection); - - Parameters_ = GetStandardParameters(Parameters); - Parameters_.Insert("count" , 200); - Parameters_.Insert("extended" , 1); - Parameters_.Insert("with_disabled", 1); - - If ValueFilled(Selection) Then - Parameters_.Insert("album_id", Selection); - EndIf; - - Array of products = New Array; - GetProductListRecursively(Array of products, Parameters_); - - Return Array of products; - -EndFunction - -// Get products by ID -// Gets information about products by array of IDs -// -// Parameters: -// Products - String, Array of Strings - Array of product IDs - items -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - Serialized JSON response from VK -Function GetProductsByID(Val Products, Val Parameters = "") Export - - OPI_TypeConversion.GetCollection(Products); - - Parameters_ = GetStandardParameters(Parameters); - ProductsString = ""; - Owner = "owner_id"; - - For Each Product In Products Do - CurrentProduct = Parameters_[Owner] + "_" + Product; - CurrentProduct = OPI_Tools.NumberToString(CurrentProduct); - ProductsString = ProductsString + CurrentProduct + ","; - EndDo; - - ProductsString = Left(ProductsString, StrLength(ProductsString) - 1); - Parameters_.Insert("item_ids", ProductsString); - Parameters_.Insert("extended", 1); - - Response = OPI_Tools.Get("api.vk.com/method/market.getById", Parameters_); - - Return Response; - -EndFunction - -// Add product -// Adds a new product to the community's catalog -// -// Parameters: -// ProductDescription - Key-Value Pair - See GetProductDescription - product - JSON description of the product or path -// Selection - String - Selection ID for placing the product, if needed - sel -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - Serialized JSON response from VK -Function AddProduct(Val ProductDescription, Val Selection = "", Val Parameters = "") Export - Return ProductManagement(ProductDescription, , Selection, Parameters); -EndFunction - -// Edit product -// Edits a previously created product -// -// Parameters: -// Product - Number, String - Identifier of the product being edited - item -// ProductDescription - Key-Value Pair - See GetProductDescription - product - JSON description of the product or path -// Selection - String - Identifier of the new selection, if needed - sel -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - Serialized JSON response from VK -Function EditProduct(Val Product, Val ProductDescription, Val Selection = "", Val Parameters = "") Export - Return ProductManagement(ProductDescription, Product, Selection, Parameters); -EndFunction - -// Delete product -// Deletes a previously created product -// -// Parameters: -// Product - String, Number - Product ID - item -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - Serialized JSON response from VK -Function DeleteProduct(Val Product, Val Parameters = "") Export - - OPI_TypeConversion.GetLine(Product); - - Parameters_ = GetStandardParameters(Parameters); - Parameters_.Insert("item_id", Product); - - Response = OPI_Tools.Get("api.vk.com/method/market.delete", Parameters_); - - Return Response; - -EndFunction - -// Group products -// Groups products based on similar sets of properties -// -// Parameters: -// Array of products - Array Of String - Array of product IDs - items -// ExistingGroup - String - ID of the existing group, if needed - sellgroup -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - Serialized JSON response from VK -Function GroupProducts(Val Array of products, Val ExistingGroup = "", Val Parameters = "") Export - - OPI_TypeConversion.GetLine(ExistingGroup); - OPI_TypeConversion.GetCollection(Array of products); - - Parameters_ = GetStandardParameters(Parameters); - Array_of_Products = New Array; - - For Each Product In Array of products Do - Array_of_Products.Add(OPI_Tools.NumberToString(Product)); - EndDo; - - Products = StrJoin(Array_of_Products, ","); - - Parameters_.Insert("item_ids", Products); - - If ValueFilled(ExistingGroup) Then - Parameters_.Insert("item_group_id", ExistingGroup); - EndIf; - - Response = OPI_Tools.Get("api.vk.com/method/market.groupItems", Parameters_); - - Return Response; - -EndFunction - -// Get product description. !NOCLI -// -// Return value: -// Key-Value Pair - Empty product description: -// *Name - String - Product name -// *Description - String - Product description -// *Category - String - See GetProductCategoryList -// *Price - Number - Product price -// *OldPrice - Number - For displaying discount/changing price -// *MainPhoto - String, BinaryData - Binary data or path to photo -// *URL - String - Link to the store's website page -// *AdditionalPhotos - Array Of String - Binary Data or Photo Paths -// *PropertyValues - Array Of String - See AddPropertyVariant -// *MainInGroup - Boolean - Main in the group, if exists in the group -// *Width - Number - Width product in мм. -// *Height - Number - Height product in мм. -// *Depth - Number - Depth product in мм. -// *Weight - Number - Weight in гр. -// *SKU - String - SKU -// *AvailableBalance - Number - Balance. -1 - unlimited -Function GetProductDescription() Export - - Product = New Match(); - Product.Insert("Name" , "New product"); // Product name - Product.Insert("Description" , "Product description"); // Product description - Product.Insert("Category" , "20173"); // See GetProductCategoryList() - Product.Insert("Price" , 1); // Price. - Product.Insert("OldPrice" , Undefined); // For reflection change price - Product.Insert("MainPhoto" , Undefined); // BD or path to main. photo - Product.Insert("URL" , Undefined); // Link to page store - Product.Insert("AdditionalPhotos" , New Array); // Array paths or BD for add. photo - Product.Insert("PropertyValues" , New Array); // Values properties (variants). Maximum 2 - Product.Insert("MainInGroup" , False); // Make main in of its group - Product.Insert("Width" , Undefined); // In millimeters - Product.Insert("Height" , Undefined); // In millimeters - Product.Insert("Depth" , Undefined); // In millimeters - Product.Insert("Weight" , Undefined); // In grams - Product.Insert("SKU" , Undefined); // SKU - Product.Insert("AvailableBalance" , 1); - - Return Product; - -EndFunction - -#EndRegion - -#Region ProductSelectionManagement - -// Get selection list -// Gets the list of product selections -// -// Parameters: -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - Array of selection matches -Function GetSelectionList(Val Parameters = "") Export - - Parameters_ = GetStandardParameters(Parameters); - Parameters_.Insert("count", 100); - - ArrayOfAlbums = New Array; - GetAlbumListRecursively(ArrayOfAlbums, Parameters_); - - Return ArrayOfAlbums; - -EndFunction - -// Get selections by ID -// Gets the list of selections by array of IDs -// -// Parameters: -// Selections - String, Array of Strings - Selection IDs - sels -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - Serialized JSON response from VK -Function GetSelectionsByID(Val Selections, Val Parameters = "") Export - - OPI_TypeConversion.GetCollection(Selections); - - Parameters_ = GetStandardParameters(Parameters); - Selections_ = New Array; - SelectionsString = ""; - - For Each Selection In Selections Do - Selections_.Add(OPI_Tools.NumberToString(Selection)); - EndDo; - - SelectionsString = StrJoin(Selections_, ","); - - Parameters_.Insert("album_ids", SelectionsString); - - Response = OPI_Tools.Get("api.vk.com/method/market.getAlbumById", Parameters_); - - Return Response; - -EndFunction - -// Create product selection -// Creates an empty product selection -// -// Parameters: -// Name - String - Selection name - title -// Image - String, BinaryData - Image file - picture -// Main - Boolean - Main - main -// Hidden - Boolean - Hidden - hidden -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - Serialized JSON response from VK -Function CreateProductCollection(Val Name - , Val Image - , Val Main = False - , Val Hidden = False - , Val Parameters = "") Export - - Return SelectionManagement(Name, Image, , Main, Hidden, Parameters); - -EndFunction - -// Edit product selection -// Edits the properties of a product selection -// -// Parameters: -// Name - String - New selection name - title -// Selection - String - Selection ID - sel -// Image - String, BinaryData - New selection image - picture -// Main - Boolean - Main - main -// Hidden - Boolean - Hidden - hidden -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - Serialized JSON response from VK -Function EditProductCollection(Val Name - , Val Selection - , Val Image = "" - , Val Main = False - , Val Hidden = False - , Val Parameters = "") Export - - Return SelectionManagement(Name, Image, Selection, Main, Hidden, Parameters); - -EndFunction - -// Add product to selection -// Adds a product to the selection -// -// Parameters: -// Array of products - Array of string, number - Array of products or product - items -// Selection - String - Selection ID - sel -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - Serialized JSON response from VK -Function AddProductToSelection(Val Array of products, Val Selection, Val Parameters = "") Export - - OPI_TypeConversion.GetCollection(Array of products); - OPI_TypeConversion.GetLine(Selection); - - Parameters_ = GetStandardParameters(Parameters); - Array_of_Products = New Array; - - For Each Product In Array of products Do - Array_of_Products.Add(OPI_Tools.NumberToString(Product)); - EndDo; - - ProductList = StrJoin(Array_of_Products, ","); - - Parameters_.Insert("item_ids" , ProductList); - Parameters_.Insert("album_ids", Selection); - - Response = OPI_Tools.Get("api.vk.com/method/market.addToAlbum", Parameters_); - - Return Response; - -EndFunction - -// Remove product from selection -// Removes a previously added product from the selection -// -// Parameters: -// Product - String - Product ID - item -// Selection - String - Selection ID - sel -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - Serialized JSON response from VK -Function RemoveProductFromSelection(Val Product, Val Selection, Val Parameters = "") Export - - OPI_TypeConversion.GetLine(Product); - OPI_TypeConversion.GetLine(Selection); - - Parameters_ = GetStandardParameters(Parameters); - - Parameters_.Insert("item_id" , Product); - Parameters_.Insert("album_ids", Selection); - - Response = OPI_Tools.Get("api.vk.com/method/market.removeFromAlbum", Parameters_); - - Return Response; - -EndFunction - -// DeleteSelection -// Deletes the selection by ID -// -// Parameters: -// Selection - String - Selection ID - sel -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - Serialized JSON response from VK -Function DeleteSelection(Val Selection, Val Parameters = "") Export - - OPI_TypeConversion.GetLine(Selection); - - Parameters_ = GetStandardParameters(Parameters); - Parameters_.Insert("album_id", Selection); - - Response = OPI_Tools.Get("api.vk.com/method/market.deleteAlbum", Parameters_); - - Return Response; - -EndFunction - -#EndRegion - -#Region ProductPropertiesManagement - -// Get property list -// Gets the list of properties of group products -// -// Parameters: -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - Serialized JSON response from VK -Function GetPropertyList(Val Parameters = "") Export - - Response = "response"; - Parameters_ = GetStandardParameters(Parameters); - - Response = OPI_Tools.Get("api.vk.com/method/market.getProperties", Parameters_); - Properties = Response[Response]["items"]; - - Return Properties; - -EndFunction - -// Create product property -// Creates a new property for use in products -// -// Parameters: -// Name - String - Property name - title -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - Serialized JSON response from VK -Function CreateProductProperty(Val Name, Val Parameters = "") Export - - OPI_TypeConversion.GetLine(Name); - - Parameters_ = GetStandardParameters(Parameters); - Parameters_.Insert("title", Name); - - Response = OPI_Tools.Get("api.vk.com/method/market.addProperty", Parameters_); - - Return Response; - -EndFunction - -// Edit product property -// Edits the existing product property -// -// Parameters: -// Name - String - New name - title -// Property - String, Number - Property ID - prop -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - Serialized JSON response from VK -Function EditProductProperty(Val Name, Val Property, Val Parameters = "") Export - - OPI_TypeConversion.GetLine(Name); - OPI_TypeConversion.GetLine(Property); - - Parameters_ = GetStandardParameters(Parameters); - Parameters_.Insert("title" , Name); - Parameters_.Insert("property_id", Property); - Parameters_.Insert("type" , "text"); - - Response = OPI_Tools.Get("api.vk.com/method/market.editProperty", Parameters_); - - Return Response; - -EndFunction - -// Delete product property -// Deletes the existing product property -// -// Parameters: -// Property - String, Number - Property ID - prop -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - Serialized JSON response from VK -Function DeleteProductProperty(Val Property, Val Parameters = "") Export - - OPI_TypeConversion.GetLine(Property); - - Parameters_ = GetStandardParameters(Parameters); - Parameters_.Insert("property_id", Property); - - Response = OPI_Tools.Get("api.vk.com/method/market.deleteProperty", Parameters_); - - Return Response; - -EndFunction - -// Add product property variant -// Adds a variant for an existing property -// -// Parameters: -// Value - String - Property value - value -// Property - String, Number - Property ID where the variant is added - prop -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - Serialized JSON response from VK -Function AddProductPropertyVariant(Val Value, Val Property, Val Parameters = "") Export - - OPI_TypeConversion.GetLine(Property); - OPI_TypeConversion.GetLine(Value); - - Parameters_ = GetStandardParameters(Parameters); - Parameters_.Insert("property_id", Property); - Parameters_.Insert("title" , Value); - - Response = OPI_Tools.Get("api.vk.com/method/market.addPropertyVariant", Parameters_); - - Return Response; - -EndFunction - -// Edit product property variant -// Edits the value of an existing product property variant -// -// Parameters: -// Value - String - New property value - value -// Property - String, Number - Property ID - prop -// Option - String, Number - Variant ID - option -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - Serialized JSON response from VK -Function EditProductPropertyVariant(Val Value, Val Property, Val Option, Val Parameters = "") Export - - OPI_TypeConversion.GetLine(Value); - OPI_TypeConversion.GetLine(Property); - OPI_TypeConversion.GetLine(Option); - - Parameters_ = GetStandardParameters(Parameters); - Parameters_.Insert("property_id", Property); - Parameters_.Insert("variant_id" , Option); - Parameters_.Insert("title" , Value); - - Response = OPI_Tools.Get("api.vk.com/method/market.editPropertyVariant", Parameters_); - - Return Response; - -EndFunction - -// Delete product property variant -// Deletes the previously created product property variant -// -// Parameters: -// Option - String, Number - Variant ID - option -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - Serialized JSON response from VK -Function DeleteProductPropertyVariant(Val Option, Val Parameters = "") Export - - OPI_TypeConversion.GetLine(Option); - - Parameters_ = GetStandardParameters(Parameters); - Parameters_.Insert("variant_id", Option); - - Response = OPI_Tools.Get("api.vk.com/method/market.deletePropertyVariant", Parameters_); - - Return Response; - -EndFunction - -#EndRegion - -#Region OrderManagement - -// Get order list -// Returns the community's order list -// -// Parameters: -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// -// Return value: -// Key-Value Pair - Serialized JSON response from VK -Function GetOrderList(Val Parameters = "") Export - - Parameters = GetStandardParameters(Parameters); - Parameters.Insert("count", 50); - - ArrayOfOrders = New Array; - GetOrderListRecursively(ArrayOfOrders, Parameters); - - Return ArrayOfOrders; - -EndFunction - -#EndRegion - -#Region Others - -// Create keyboard -// Forms a keyboard from an array of buttons -// -// Parameters: -// ButtonArray - Array of Strings - Array of button titles - buttons -// -// Return value: -// String - Keyboard JSON -Function FormKeyboard(Val ButtonArray) Export - - OPI_TypeConversion.GetCollection(ButtonArray); - - Keyboard = New Structure; - KeyboardArray = New Array; - ArrayBlock = New Array; - - For Each Action In ButtonArray Do - - Button = New Structure; - Expression = New Structure; - - Expression.Insert("type" , "text"); - Expression.Insert("label", Action); - - Button.Insert("action", Expression); - ArrayBlock.Add(Button); - - EndDo; - - KeyboardArray.Add(ArrayBlock); - - Keyboard.Insert("buttons" , KeyboardArray); - Keyboard.Insert("one_time", False); - - Return OPI_Tools.JSONString(Keyboard); - -EndFunction - -#EndRegion - -#EndRegion - -#Region ServiceProceduresAndFunctions - -Function GetStandardParameters(Val Parameters = "") - - // Here is a collection of data definitions for working with the VK API - // You can override them by passing them as a parameter - // Matching fields will be overwritten with the parameter of the function - - Parameters_ = New Structure; - - // access_token - можно получить in браузере по URL from фунtoции CreateTokenRetrievalLink() - // from_group - actions will be performed on behalf of the group - // owner_id - group ID with "-" at the beginning. Can be found in the settings of the VK group or in its URL if not set - // set your - // app_id - application ID that needs to be created in the profile on the developer page - // group_id - owner_id, но without "-" - - Parameters_.Insert("access_token" , ""); - Parameters_.Insert("from_group" , "1"); - Parameters_.Insert("owner_id" , ""); - Parameters_.Insert("v" , "5.131"); - Parameters_.Insert("app_id" , ""); - Parameters_.Insert("group_id" , ""); - - OPI_TypeConversion.GetCollection(Parameters); - - If TypeValue(Parameters) = Type("Structure") Or TypeValue(Parameters) = Type("Match") Then - For Each PassedParameter In Parameters Do - Parameters_.Insert(PassedParameter.Key, OPI_Tools.NumberToString(PassedParameter.Value)); - EndDo; - EndIf; - - Return Parameters_; - -EndFunction - -Function GetImageID(Val Image, Val Parameters, Val View) - - Response = "response"; - Response = UploadPhotoToServer(Image, Parameters, View); - Result = Response[Response]; - - If ValueFilled(Result) Then - PhotoID = Result["photo_id"]; - - If Not ValueFilled(PhotoID) Then - Return Response; - EndIf; - - Else - Return Response; - EndIf; - - PhotoID = OPI_Tools.NumberToString(PhotoID); - Return PhotoID; - -EndFunction - -Function GetImageCorrespondence(Val Image, Val Parameters, Val View) - - Response = UploadPhotoToServer(Image, Parameters, View); - ResponseArray = Response.Get("response"); - - If Not ValueFilled(ResponseArray) Or Not TypeValue(ResponseArray) = Type("Array") Then - Return Response; - Else - If ResponseArray.Quantity() = 0 Then - Return Response; - Else - ResponseCorrespondence = ResponseArray[0]; - EndIf; - EndIf; - - Return ResponseCorrespondence; - -EndFunction - -Function GetSelectionArray(Val Selections, Val Parameters = "") - - Response = "response"; - Selections = GetSelectionsByID(Selections, Parameters); - Result = Selections[Response]; - - If ValueFilled(Result) Then - - SelectionArray = Result["items"]; - - If Not ValueFilled(SelectionArray) Then - Return Selections; - EndIf; - - Else - Return Selections; - EndIf; - - Return SelectionArray; - -EndFunction - -Function DetermineImageUploadMethod(Val View) - - MethodCorrespondence = New Match; - Upload = "Upload"; - Save = "Save"; - Method = "Method"; - Photo = "Photo"; - - If View = "Post" Then - - MethodCorrespondence.Insert(Upload , "photos.getWallUploadServer"); - MethodCorrespondence.Insert(Save, "photos.saveWallPhoto"); - MethodCorrespondence.Insert(Photo , "photo"); - MethodCorrespondence.Insert(Method , 1); - - ElsIf View = "Product" Then - - MethodCorrespondence.Insert(Upload , "market.getProductPhotoUploadServer"); - MethodCorrespondence.Insert(Save, "market.saveProductPhoto"); - MethodCorrespondence.Insert(Method , 2); - - ElsIf View = "Story" Then - - MethodCorrespondence.Insert(Upload , "stories.getPhotoUploadServer"); - MethodCorrespondence.Insert(Save, "stories.save"); - MethodCorrespondence.Insert(Method , 3); - - ElsIf View = "Poll" Then - - MethodCorrespondence.Insert(Upload , "polls.getPhotoUploadServer"); - MethodCorrespondence.Insert(Save, "polls.savePhoto"); - MethodCorrespondence.Insert(Photo , "photo"); - MethodCorrespondence.Insert(Method , 1); - - Else - - MethodCorrespondence.Insert(Upload , "photos.getUploadServer"); - MethodCorrespondence.Insert(Save, "photos.save"); - MethodCorrespondence.Insert(Photo , "photos_list"); - MethodCorrespondence.Insert(Method , 1); - - EndIf; - - Return MethodCorrespondence; - -EndFunction - -Function GetProductParameterMapping() - - Fields = New Match(); - Fields.Insert("Name" , "name"); - Fields.Insert("Description" , "description"); - Fields.Insert("Category" , "category_id"); - Fields.Insert("Price" , "price"); - Fields.Insert("OldPrice" , "old_price"); - Fields.Insert("URL" , "url"); - Fields.Insert("MainInGroup" , "is_main_variant"); - Fields.Insert("Width" , "dimension_width"); - Fields.Insert("Height" , "dimension_height"); - Fields.Insert("Depth" , "dimension_length"); - Fields.Insert("Weight" , "weight"); - Fields.Insert("SKU" , "sku"); - Fields.Insert("AvailableBalance" , "stock_amount"); - - Return Fields; - -EndFunction - -Function ProductManagement(Val ProductDescription, Val ProductID = "", Val Selection = "", Val Parameters = "") - - OPI_TypeConversion.GetLine(ProductID); - OPI_TypeConversion.GetLine(Selection); - OPI_TypeConversion.GetCollection(ProductDescription); - - Parameters_ = GetStandardParameters(Parameters); - Parameters_.Insert("v", "5.199"); - - Response = "response"; - - FillProductRequestFields(ProductDescription, Parameters_); - - If ValueFilled(ProductID) Then - Parameters_.Insert("item_id", ProductID); - Method = "edit"; - Else - Method = "add"; - EndIf; - - Response = OPI_Tools.Get("api.vk.com/method/market." + Method, Parameters_); - Result = Response[Response]; - - If Not ValueFilled(ProductID) And ValueFilled(Result) Then - - ProductID = Result["market_item_id"]; - - If Not ValueFilled(ProductID) Then - Return Response; - EndIf; - - Else - Return Response; - EndIf; - - If ValueFilled(Selection) And ValueFilled(ProductID) Then - AddProductToSelection(ProductID, Selection, Parameters_); - EndIf; - - Return Response; - -EndFunction - -Function SelectionManagement(Val Name - , Val Image = "" - , Val SelectionID = "" - , Val Main = False - , Val Hidden = False - , Val Parameters = "") - - OPI_TypeConversion.GetLine(Name); - OPI_TypeConversion.GetLine(SelectionID); - OPI_TypeConversion.GetBoolean(Main); - OPI_TypeConversion.GetBoolean(Hidden); - - Parameters_ = GetStandardParameters(Parameters); - Response = AddImageParameter(Image, SelectionID, Parameters_); - - If ValueFilled(Response) Then - Return Response; - EndIf; - - Parameters_.Insert("title" , Name); - Parameters_.Insert("main_album" , ?(Main, 1, 0)); - Parameters_.Insert("is_hidden" , ?(Hidden, 1, 0)); - - If ValueFilled(SelectionID) Then - Parameters_.Insert("album_id", SelectionID); - Method = "editAlbum"; - Else - Method = "addAlbum"; - EndIf; - - Response = OPI_Tools.Get("api.vk.com/method/market." + Method, Parameters_); - - Return Response; - -EndFunction - -Function AddImageParameter(Val Image, Val SelectionID, Parameters) - - PhotoID = "photo_id"; - - If ValueFilled(Image) Then - - PhotoID = GetImageID(Image, Parameters, "Product"); - - If Not TypeValue(PhotoID) = Type("String") Then - Return PhotoID; - EndIf; - - Parameters.Insert(PhotoID, PhotoID); - - Else - - If ValueFilled(SelectionID) Then - - Selections = GetSelectionArray(SelectionID, Parameters); - - If Not TypeValue(Selections) = Type("Array") Then - Return Selections; - EndIf; - - If Not Selections.Quantity() = 0 Then - PhotoID = Selections[0]["photo"]["id"]; - OPI_TypeConversion.GetLine(PhotoID); - Parameters.Insert(PhotoID, PhotoID); - EndIf; - - EndIf; - - EndIf; - - Return ""; - -EndFunction - -Procedure FillPhotoUploadParameters(Val Method, Val Response, Parameters) - - Response = "response"; - Method = Method["Method"]; - StandardMethod = 1; - NewMethod = 2; - - If Method = StandardMethod Then - - Hash = "hash"; - Serv = "server"; - Aid = "aid"; - Photo = Method["Photo"]; - - Parameters.Insert(Hash, Response[Hash]); - Parameters.Insert(Photo, Response[Photo]); - - PhotoServer = Response.Get(Serv); - - If ValueFilled(PhotoServer) Then - PhotoServer = OPI_Tools.NumberToString(PhotoServer); - Parameters.Insert(Serv, PhotoServer); - EndIf; - - Identifier = Response.Get(Aid); - - If ValueFilled(Identifier) Then - Identifier = OPI_Tools.NumberToString(Identifier); - Parameters.Insert(Aid , Identifier); - EndIf; - - ElsIf Method = NewMethod Then - - ResponseString = OPI_Tools.JSONString(Response); - Parameters.Insert("upload_response", ResponseString); - - Else - - Parameters.Insert("upload_results", Response[Response]["upload_result"]); - - EndIf; - -EndProcedure - -Procedure FillProductRequestFields(Val ProductDescription, Parameters) - - Response = "response"; - MainPhoto = ProductDescription["MainPhoto"]; - AdditionalPhoto = ProductDescription["AdditionalPhotos"]; - Properties = ProductDescription["PropertyValues"]; - - If ValueFilled(MainPhoto) Then - - Response = UploadPhotoToServer(MainPhoto, Parameters, "Product"); - Result = Response[Response]; - - If ValueFilled(Result) Then - PhotoID = Result["photo_id"]; - - If Not ValueFilled(PhotoID) Then - Return; - EndIf; - - Else - Return; - EndIf; - - PhotoID = OPI_Tools.NumberToString(PhotoID); - Parameters.Insert("main_photo_id", PhotoID); - - EndIf; - - If TypeValue(Properties) = Type("Array") Then - - Properties_ = New Array; - - For Each Property In Properties Do - Properties_.Add(OPI_Tools.NumberToString(Property)); - EndDo; - - Properties = StrJoin(Properties_, ","); - - EndIf; - - If ValueFilled(Properties) Then - Parameters.Insert("variant_ids", OPI_Tools.NumberToString(Properties)); - EndIf; - - AddAdditionalProductPhotos(AdditionalPhoto, Parameters); - - For Each Field In GetProductParameterMapping() Do - - Value = ProductDescription[Field.Key]; - - If Value <> Undefined Then - Parameters.Insert(Field.Value, ProductDescription[Field.Key]); - EndIf; - - EndDo; - -EndProcedure - -Procedure AddAdditionalProductPhotos(Val PhotoArray, Parameters) - - If TypeValue(PhotoArray) = Type("Array") Then - If PhotoArray.Quantity() > 0 Then - - PhotoString = ""; - - For Each Photo In PhotoArray Do - - PhotoID = GetImageID(Photo, Parameters, "Product"); - - If Not TypeValue(PhotoID) = Type("String") Then - Return; - EndIf; - - PhotoString = PhotoString + PhotoID + ","; - - EndDo; - - PhotoString = Left(PhotoString, StrLength(PhotoString) - 1); - Parameters.Insert("photo_ids", PhotoString); - EndIf; - EndIf; - -EndProcedure - -Procedure GetProductListRecursively(Array of products, Parameters, Shift = 0) - - Response = "response"; - MaxInRequest = 200; - Response = OPI_Tools.Get("api.vk.com/method/market.get", Parameters); - Products = Response[Response]["items"]; - - If Products.Quantity() = 0 Then - Return; - EndIf; - - For Each Product In Products Do - Array of products.Add(Product); - EndDo; - - Shift = Shift + MaxInRequest; - Parameters.Insert("offset", Shift); - GetProductListRecursively(Array of products, Parameters, Shift); - -EndProcedure - -Procedure GetAlbumListRecursively(ArrayOfAlbums, Parameters, Shift = 0) - - Response = "response"; - MaxInRequest = 100; - Response = OPI_Tools.Get("api.vk.com/method/market.getAlbums", Parameters); - Albums = Response[Response]["items"]; - - If Albums.Quantity() = 0 Then - Return; - EndIf; - - For Each Album In Albums Do - ArrayOfAlbums.Add(Album); - EndDo; - - Shift = Shift + MaxInRequest; - Parameters.Insert("offset", Shift); - GetAlbumListRecursively(ArrayOfAlbums, Parameters, Shift); - -EndProcedure - -Procedure GetOrderListRecursively(ArrayOfOrders, Parameters, Shift = 0) - - Response = "response"; - MaxInRequest = 50; - Response = OPI_Tools.Get("api.vk.com/method/market.getGroupOrders", Parameters); - Orders = Response[Response]["items"]; - - If Orders.Quantity() = 0 Then - Return; - EndIf; - - For Each Order In Orders Do - ArrayOfOrders.Add(Order); - EndDo; - - Shift = Shift + MaxInRequest; - Parameters.Insert("offset", Shift); - GetOrderListRecursively(ArrayOfOrders, Parameters, Shift); - -EndProcedure - -#EndRegion diff --git a/service/interim/en/OPI/src/CommonModules/OPI_VK/OPI_VK.mdo b/service/interim/en/OPI/src/CommonModules/OPI_VK/OPI_VK.mdo deleted file mode 100644 index c7eca11ad8..0000000000 --- a/service/interim/en/OPI/src/CommonModules/OPI_VK/OPI_VK.mdo +++ /dev/null @@ -1,11 +0,0 @@ - - - OPI_VK - - ru - Methodы интеграции with VK (OPI) - - true - true - true - diff --git a/service/interim/en/OPI/src/CommonModules/OPI_Viber/Module.bsl b/service/interim/en/OPI/src/CommonModules/OPI_Viber/Module.bsl deleted file mode 100644 index 2bcd2a9418..0000000000 --- a/service/interim/en/OPI/src/CommonModules/OPI_Viber/Module.bsl +++ /dev/null @@ -1,414 +0,0 @@ -// Location OS: ./OInt/core/Modules/OPI_Viber.os -// Library: Viber -// CLI Command: viber - -// MIT License - -// Copyright (c) 2023 Anton Tsitavets - -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: - -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. - -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -// https://github.com/Bayselonarrend/OpenIntegrations - -// BSLLS:LatinAndCyrillicSymbolInWord-off -// BSLLS:IncorrectLineBreak-off - -// Uncomment if OneScript is executed -// #Use "../../tools" - -#Region ProgrammingInterface - -#Region SettingsAndInformation - -// Set Webhook -// InАЖNО: Уwithтаноintoа Webhook обязательto по праinилам Viber. For thisго todо иметь withinобоdный URL, -// which will return 200 and a genuine SSL certificate. If there is a certificate and the database is published -// on the server - you can use an HTTP service. Information about new messages will also be sent there -// Viber periodically knocks on the Webhook address, so if it is inactive, everything will stop working -// -// Parameters: -// Token - String - Viber Token - token -// URL - String - URL for setting up Webhook - url -// -// Return value: -// Key-Value Pair - serialized JSON response from Viber -Function SetWebhook(Val Token, Val URL) Export - - Parameters = New Structure; - OPI_Tools.AddField("url" , URL , "String", Parameters); - OPI_Tools.AddField("auth_token" , Token, "String", Parameters); - - Return OPI_Tools.Post("https://chatapi.viber.com/pa/set_webhook", Parameters); - -EndFunction - -// Get channel information -// Here you can get the channel's user IDs. Bot IDs need to be obtained from the Webhook arrivals -// The user ID from channel information is not suitable for sending messages through the bot - they are different -// -// Parameters: -// Token - String - Token - token -// -// Return value: -// Key-Value Pair - serialized JSON response from Viber -Function GetChannelInformation(Val Token) Export - - URL = "https://chatapi.viber.com/pa/get_account_info"; - Return OPI_Tools.Get(URL, , TokenInHeaders(Token)); - -EndFunction - -// Get user data -// Gets user information by ID -// -// Parameters: -// Token - String - Token - token -// UserID - String, Number - Viber User ID - user -// -// Return value: -// Key-Value Pair - serialized JSON response from Viber -Function GetUserData(Val Token, Val UserID) Export - - URL = "https://chatapi.viber.com/pa/get_user_details"; - - Parameters = New Structure; - OPI_Tools.AddField("id", UserID, "String", Parameters); - - Response = OPI_Tools.Post(URL, Parameters, TokenInHeaders(Token)); - - Return Response; - -EndFunction - -// Get online users -// Gets the status of a user or several users by ID -// -// Parameters: -// Token - String - Viber Token - token -// UserIDs - String,Number,Array of String,Number - Viber User(s) ID - users -// -// Return value: -// Key-Value Pair - serialized JSON response from Viber -Function GetOnlineUsers(Val Token, Val UserIDs) Export - - URL = "https://chatapi.viber.com/pa/get_online"; - - Parameters = New Structure; - OPI_Tools.AddField("ids", UserIDs, "Collection", Parameters); - - Response = OPI_Tools.Post(URL, Parameters, TokenInHeaders(Token)); - - Return Response; - -EndFunction - -#EndRegion - -#Region MessageSending - -// Send text message -// Sends a text message to a chat or channel -// -// Parameters: -// Token - String - Token - token -// Text - String - Message text - text -// UserID - String, Number - User ID. For channel > administrator, for bot > recipient - user -// SendingToChannel - Boolean - Sending to channel or bot chat - ischannel -// Keyboard - Structure Of String - See CreateKeyboardFromArrayButton - keyboard -// -// Return value: -// Key-Value Pair - serialized JSON response from Viber -Function SendTextMessage(Val Token - , Val Text - , Val UserID - , Val SendingToChannel - , Val Keyboard = "") Export - - Return SendMessage(Token, "text", UserID, SendingToChannel, , Text, Keyboard); - -EndFunction - -// Send image -// Sends an image to a chat or channel -// -// Parameters: -// Token - String - Token - token -// URL - String - Image URL - picture -// UserID - String, Number - User ID. For channel > administrator, for bot > recipient - user -// SendingToChannel - boolean - Sending to channel or bot chat - ischannel -// Description - String - Image annotation - description -// -// Return value: -// Key-Value Pair - serialized JSON response from Viber -Function SendImage(Val Token, Val URL, Val UserID, Val SendingToChannel, Val Description = "") Export - - Return SendMessage(Token, "picture", UserID, SendingToChannel, URL, Description); - -EndFunction - -// SendFile -// Sends a file (document) to a chat or channel -// -// Parameters: -// Token - String - Token - token -// URL - String - File URL - file -// UserID - String, Number - User ID. For channel > administrator, for bot > recipient - user -// SendingToChannel - Boolean - Sending to channel or bot chat - ischannel -// Extension - String - File extension - ext -// Size - Number - File size. If not filled in > determined automatically by downloading the file - size -// -// Return value: -// Key-Value Pair - serialized JSON response from Viber -Function SendFile(Val Token - , Val URL - , Val UserID - , Val SendingToChannel - , Val Extension - , Val Size = "") Export - - If Not ValueFilled(Size) Then - - Response = OPI_Tools.Get(URL); - Size = Response.Size(); - - EndIf; - - String_ = "String"; - Extension = StringReplace(Extension, ".", ""); - - Parameters = New Structure; - OPI_Tools.AddField("URL" , URL , String_, Parameters); - OPI_Tools.AddField("Size" , Size , String_, Parameters); - OPI_Tools.AddField("Extension", Extension, String_, Parameters); - - Return SendMessage(Token, "file", UserID, SendingToChannel, Parameters); - -EndFunction - -// Send contact -// Sends a contact with a phone number to a chat or channel -// -// Parameters: -// Token - String - Token - token -// ContactName - String - Contact name - name -// PhoneNumber - String - Phone number - phone -// UserID - String, Number - User ID. For channel > administrator, for bot > recipient - user -// SendingToChannel - Boolean - Sending to channel or bot chat - ischannel -// -// Return value: -// Key-Value Pair - serialized JSON response from Viber -Function SendContact(Val Token - , Val ContactName - , Val PhoneNumber - , Val UserID - , Val SendingToChannel) Export - - Parameters = New Structure; - OPI_Tools.AddField("name" , ContactName , "String", Parameters); - OPI_Tools.AddField("phone_number", PhoneNumber, "String", Parameters); - - Return SendMessage(Token, "contact", UserID, SendingToChannel, Parameters); - -EndFunction - -// SendLocation -// Sends geographic coordinates to a chat or channel -// -// Parameters: -// Token - String - Token - token -// Latitude - String, Number - Geographic latitude - lat -// Longitude - String, Number - Geographic longitude - long -// UserID - String, Number - User ID. For channel > administrator, for bot > recipient - user -// SendingToChannel - Boolean - Sending to channel or bot chat - ischannel -// -// Return value: -// Key-Value Pair - serialized JSON response from Viber -Function SendLocation(Val Token, Val Latitude, Val Longitude, Val UserID, Val SendingToChannel) Export - - Parameters = New Structure; - OPI_Tools.AddField("lat", Latitude , "String", Parameters); - OPI_Tools.AddField("lon", Longitude, "String", Parameters); - - Return SendMessage(Token, "location", UserID, SendingToChannel, Parameters); - -EndFunction - -// SendLink -// Sends a URL with a preview to a chat or channel -// -// Parameters: -// Token - String - Token - token -// URL - String - SentLink - url -// UserID - String, Number - User ID. For channel > administrator, for bot > recipient - user -// SendingToChannel - Boolean - Sending to channel or bot chat - ischannel -// -// Return value: -// Key-Value Pair - serialized JSON response from Viber -Function SendLink(Val Token, Val URL, Val UserID, Val SendingToChannel) Export - - Return SendMessage(Token, "url", UserID, SendingToChannel, URL); - -EndFunction - -// Create a keyboard from an array of buttons -// Returns a keyboard structure for messages -// -// Parameters: -// ButtonArray - Array of Strings - Array of buttons - buttons -// ButtonColor - String - HEX color of buttons with # at the beginning - color -// -// Return value: -// Structure - Create a keyboard from an array of buttons: -// * Buttons - Array of Structure - Array of formed buttons -// * Type - String - KeyboardType -Function CreateKeyboardFromArrayButton(Val ButtonArray, Val ButtonColor = "#2db9b9") Export - - OPI_TypeConversion.GetLine(ButtonColor); - OPI_TypeConversion.GetCollection(ButtonArray); - - ArrayOfButtonStructures = New Array; - KeyboardStructure = New Structure; - - For Each ButtonText In ButtonArray Do - - ButtonStructure = New Structure; - ButtonStructure.Insert("ActionType", "reply"); - ButtonStructure.Insert("ActionBody", ButtonText); - ButtonStructure.Insert("Text" , ButtonText); - ButtonStructure.Insert("BgColor" , ButtonColor); - ButtonStructure.Insert("Coloumns" , 3); - - ArrayOfButtonStructures.Add(ButtonStructure); - - EndDo; - - KeyboardStructure.Insert("Buttons", ArrayOfButtonStructures); - KeyboardStructure.Insert("Type" , "keyboard"); - - Return KeyboardStructure; - -EndFunction - -#EndRegion - -#EndRegion - -#Region ServiceProceduresAndFunctions - -// Send message. -// -// Parameters: -// Token - String - Token -// Type - String - TypeOfSentMessage -// UserID - String, Number - Viber User ID -// IsChannel - Boolean - Sending to channel or bot chat -// Value - String, Structure - Value: -// * URL - String - When sending URL -// * Size - Number, String - File size in case of sending -// * Extension - String - File extension in case of sending -// Text - String - Message text -// Keyboard - Structure Of String - Keyboard, if needed, see CreateKeyboardFromArrayButton -// -// Return value: -// Arbitrary, HTTP Response - Send message -Function SendMessage(Val Token - , Val Type - , Val UserID - , Val IsChannel - , Val Value = "" - , Val Text = "" - , Val Keyboard = "") - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Type); - OPI_TypeConversion.GetLine(UserID); - OPI_TypeConversion.GetLine(Text); - OPI_TypeConversion.GetBoolean(IsChannel); - OPI_TypeConversion.GetCollection(Keyboard); - - ParametersStructure = ReturnStandardParameters(); - ParametersStructure.Insert("type", Type); - - If (Type = "text" Or Type = "picture") And ValueFilled(Text) Then - ParametersStructure.Insert("text", Text); - EndIf; - - If TypeValue(Keyboard) = Type("Structure") Then - ParametersStructure.Insert("keyboard", Keyboard); - EndIf; - - If ValueFilled(Value) Then - - If Type = "file" Then - ParametersStructure.Insert("media" , Value["URL"]); - ParametersStructure.Insert("size" , Value["Size"]); - ParametersStructure.Insert("file_name", "File." + Value["Extension"]); - ElsIf Type = "contact" Then - ParametersStructure.Insert("contact" , Value); - ElsIf Type = "location" Then - ParametersStructure.Insert("location" , Value); - Else - ParametersStructure.Insert("media" , Value); - EndIf; - - EndIf; - - If IsChannel Then - ParametersStructure.Insert("from", UserID); - URL = "https://chatapi.viber.com/pa/post"; - Else - ParametersStructure.Insert("receiver", UserID); - URL = "https://chatapi.viber.com/pa/send_message"; - EndIf; - - Response = OPI_Tools.Post(URL, ParametersStructure, TokenInHeaders(Token)); - - Try - Return OPI_Tools.JsonToStructure(Response.GetBodyAsBinaryData()); - Except - Return Response; - EndTry; - -EndFunction - -Function ReturnStandardParameters() - - SenderStructure = New Structure; - SenderStructure.Insert("name" , "Bot"); - SenderStructure.Insert("avatar", ""); - - ParametersStructure = New Structure; - ParametersStructure.Insert("sender", SenderStructure); - ParametersStructure.Insert("min_api_version", 1); - - Return ParametersStructure; - -EndFunction - -Function TokenInHeaders(Val Token) - - OPI_TypeConversion.GetLine(Token); - - HeadersStructure = New Match; - HeadersStructure.Insert("X-Viber-Auth-Token", Token); - Return HeadersStructure; - -EndFunction - -#EndRegion diff --git a/service/interim/en/OPI/src/CommonModules/OPI_Viber/OPI_Viber.mdo b/service/interim/en/OPI/src/CommonModules/OPI_Viber/OPI_Viber.mdo deleted file mode 100644 index ec0d881730..0000000000 --- a/service/interim/en/OPI/src/CommonModules/OPI_Viber/OPI_Viber.mdo +++ /dev/null @@ -1,11 +0,0 @@ - - - OPI_Viber - - ru - Methodы интеграции with Viber (OPI) - - true - true - true - diff --git a/service/interim/en/OPI/src/CommonModules/OPI_YandexDisk/Module.bsl b/service/interim/en/OPI/src/CommonModules/OPI_YandexDisk/Module.bsl deleted file mode 100644 index a22b6dc525..0000000000 --- a/service/interim/en/OPI/src/CommonModules/OPI_YandexDisk/Module.bsl +++ /dev/null @@ -1,635 +0,0 @@ -// OS Location: ./OInt/core/Modules/OPI_YandexDisk.os -// Library: Yandex Disk -// CLI command: yadisk - -// MIT License - -// Copyright (c) 2023 Anton Tsitavets - -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: - -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. - -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -// https://github.com/Bayselonarrend/OpenIntegrations - -// BSLLS:LatinAndCyrillicSymbolInWord-off -// BSLLS:IncorrectLineBreak-off -// BSLLS:NumberOfOptionalParams-off -// BSLLS:UsingServiceTag-off - -//@skip-check method-too-many-params - -// Uncomment if OneScript is executed -// #Use "../../tools" - -#Region ProgrammingInterface - -#Region FileAndFolderManagement - -// Get disk information -// Gets information about the current disk -// -// Parameters: -// Token - String - Token - token -// -// Return value: -// Key-Value Pair - serialized JSON response from Yandex -Function GetDiskInformation(Val Token) Export - - OPI_TypeConversion.GetLine(Token); - - Headers = AuthorizationHeader(Token); - Response = OPI_Tools.Get("https://cloud-api.yandex.net/v1/disk", , Headers); - - Return Response; - -EndFunction - -// Create folder -// Creates a directory on the disk -// -// Parameters: -// Token - String - Token - token -// Path - String - Path to the created folder - path -// -// Return value: -// Key-Value Pair - serialized JSON response from Yandex -Function CreateFolder(Val Token, Val Path) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Path); - - Headers = AuthorizationHeader(Token); - URL = "https://cloud-api.yandex.net/v1/disk/resources"; - Href = "href"; - - Parameters = New Structure; - Parameters.Insert("path", Path); - - Parameters = OPI_Tools.RequestParametersToString(Parameters); - Response = OPI_Tools.Put(URL + Parameters, , Headers, False); - - ResponseURL = Response[Href]; - - If Not ValueFilled(ResponseURL) Then - Return Response; - EndIf; - - Response = OPI_Tools.Get(ResponseURL, , Headers); - - Return Response; - -EndFunction - -// Get object -// Gets information about a disk object at the specified path -// -// Parameters: -// Token - String - Token - token -// Path - String - Path to folder or file - path -// -// Return value: -// Key-Value Pair - serialized JSON response from Yandex -Function GetObject(Val Token, Val Path) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Path); - - Headers = AuthorizationHeader(Token); - Parameters = New Structure; - Parameters.Insert("path", Path); - - Response = OPI_Tools.Get("https://cloud-api.yandex.net/v1/disk/resources", Parameters, Headers); - - Return Response; - -EndFunction - -// Delete object -// Deletes an object at the specified path -// -// Parameters: -// Token - String - Token - token -// Path - String - Path to the folder or file to be deleted - path -// ToCart - Boolean - To cart - can -// -// Return value: -// Key-Value Pair - serialized JSON response from Yandex -Function DeleteObject(Val Token, Val Path, Val ToCart = True) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Path); - OPI_TypeConversion.GetBoolean(ToCart); - - Headers = AuthorizationHeader(Token); - - Parameters = New Structure; - Parameters.Insert("path" , Path); - Parameters.Insert("permanently", Not ToCart); - - Response = OPI_Tools.Delete("https://cloud-api.yandex.net/v1/disk/resources", Parameters, Headers); - - Return Response; - -EndFunction - -// Create object copy -// Creates a copy of the object at the specified path and path to the original -// -// Parameters: -// Token - String - Token - token -// Original - String - Path to the original file or directory - from -// Path - String - Destination path for the copy - to -// Overwrite - Boolean - Overwrite if a file with the same name already exists - rewrite -// -// Return value: -// Key-Value Pair - serialized JSON response from Yandex -Function CreateObjectCopy(Val Token, Val Original, Val Path, Val Overwrite = False) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Original); - OPI_TypeConversion.GetLine(Path); - OPI_TypeConversion.GetBoolean(Overwrite); - - Headers = AuthorizationHeader(Token); - URL = "https://cloud-api.yandex.net/v1/disk/resources/copy"; - Href = "href"; - - Parameters = New Structure; - Parameters.Insert("from" , Original); - Parameters.Insert("path" , Path); - Parameters.Insert("overwrite" , Overwrite); - - Parameters = OPI_Tools.RequestParametersToString(Parameters); - Response = OPI_Tools.Post(URL + Parameters, , Headers, False); - - ResponseURL = Response[Href]; - - If Not ValueFilled(ResponseURL) Then - Return Response; - EndIf; - - Response = OPI_Tools.Get(ResponseURL, , Headers); - - Return Response; - -EndFunction - -// Get download link -// Gets a download link for the file -// -// Parameters: -// Token - String - Token - token -// Path - String - Path to the file for downloading - path -// -// Return value: -// Key-Value Pair - serialized JSON response from Yandex -Function GetDownloadLink(Val Token, Val Path) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Path); - - Headers = AuthorizationHeader(Token); - - Parameters = New Structure; - Parameters.Insert("path", Path); - - Response = OPI_Tools.Get("https://cloud-api.yandex.net/v1/disk/resources/download", Parameters, Headers); - - Return Response; - -EndFunction - -// Download file -// Downloads a file at the specified path -// -// Parameters: -// Token - String - Token - token -// Path - String - Path to the file for downloading - path -// SavePath - String - File save path - out -// -// Return value: -// BinaryData,String - Binary data or file path when SavePath parameter is specified -Function DownloadFile(Val Token, Val Path, Val SavePath = "") Export - - OPI_TypeConversion.GetLine(SavePath); - Response = GetDownloadLink(Token, Path); - URL = Response["href"]; - - If Not ValueFilled(URL) Then - Return Response; - EndIf; - - Response = OPI_Tools.Get(URL, , , SavePath); - - Return Response; - -EndFunction - -// Get list of files -// Gets a list of files with or without filtering by type -// List available typeоin: audio, backup, book, compressed, data, development, -// diskimage, document, encoded, executable, flash, font, -// mage, settings, spreadsheet, text, unknown, video, web -// -// Parameters: -// Token - String - Token - token -// Quantity - Number, String - Number of returned objects - amount -// OffsetFromStart - Number - Offset for getting objects not from the beginning of the list - offset -// FilterByType - String - Filter by file type - type -// SortByDate - Boolean - True > sort by date, False > alphabetically - datesort -// -// Return value: -// Key-Value Pair - serialized JSON response from Yandex -Function GetFilesList(Val Token - , Val Quantity = 0 - , Val OffsetFromStart = 0 - , Val FilterByType = "" - , Val SortByDate = False) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Quantity); - OPI_TypeConversion.GetLine(OffsetFromStart); - OPI_TypeConversion.GetLine(FilterByType); - OPI_TypeConversion.GetBoolean(SortByDate); - - Headers = AuthorizationHeader(Token); - - Parameters = New Structure; - - If ValueFilled(Quantity) Then - Parameters.Insert("limit", OPI_Tools.NumberToString(Quantity)); - EndIf; - - If ValueFilled(OffsetFromStart) Then - Parameters.Insert("offset", OPI_Tools.NumberToString(OffsetFromStart)); - EndIf; - - If ValueFilled(FilterByType) Then - Parameters.Insert("media_type", FilterByType); - EndIf; - - If SortByDate Then - Destination = "last-uploaded"; - Else - Destination = "files"; - EndIf; - - Response = OPI_Tools.Get("https://cloud-api.yandex.net/v1/disk/resources/" + Destination, Parameters, Headers); - - Return Response; - -EndFunction - -// Move object -// Moves the object to the specified path and path to the original -// -// Parameters: -// Token - String - Token - token -// Original - String - Path to the original file or folder - from -// Path - String - Destination path for moving - to -// Overwrite - Boolean - Overwrite if a file with the same name already exists - rewrite -// -// Return value: -// Key-Value Pair - serialized JSON response from Yandex -Function MoveObject(Val Token, Val Original, Val Path, Val Overwrite = False) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Original); - OPI_TypeConversion.GetLine(Path); - OPI_TypeConversion.GetBoolean(Overwrite); - - Headers = AuthorizationHeader(Token); - URL = "https://cloud-api.yandex.net/v1/disk/resources/move"; - Href = "href"; - - Parameters = New Structure; - Parameters.Insert("from" , Original); - Parameters.Insert("path" , Path); - Parameters.Insert("overwrite" , Overwrite); - - Parameters = OPI_Tools.RequestParametersToString(Parameters); - Response = OPI_Tools.Post(URL + Parameters, , Headers, False); - ResponseURL = Response[Href]; - - If Not ValueFilled(ResponseURL) Then - Return Response; - EndIf; - - Response = OPI_Tools.Get(ResponseURL, , Headers); - - Return Response; - -EndFunction - -// Upload file -// Uploads a file to disk at the specified path -// -// Parameters: -// Token - String - Token - token -// Path - String - Path for saving the file to disk - path -// File - String, BinaryData - File for upload - file -// Overwrite - Boolean - Overwrite if a file with the same name already exists - rewrite -// -// Return value: -// Key-Value Pair - serialized JSON response from Yandex -Function UploadFile(Val Token, Val Path, Val File, Val Overwrite = False) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Path); - OPI_TypeConversion.GetBoolean(Overwrite); - OPI_TypeConversion.GetBinaryData(File); - - Headers = AuthorizationHeader(Token); - Href = "href"; - File = New Structure("file", File); - - Parameters = New Structure; - Parameters.Insert("path" , Path); - Parameters.Insert("overwrite" , Overwrite); - - Response = OPI_Tools.Get("https://cloud-api.yandex.net/v1/disk/resources/upload", Parameters, Headers); - URL = Response[Href]; - - If Not ValueFilled(URL) Then - Return Response; - EndIf; - - Response = OPI_Tools.PutMultipart(URL, New Structure(), File, "multipart", Headers); - - Return Response; - -EndFunction - -// Upload file by URL -// Downloads a file to disk from the specified URL -// -// Parameters: -// Token - String - Token - token -// Path - String - Path to place the downloaded file - path -// Address - String - File URL - url -// -// Return value: -// Key-Value Pair - serialized JSON response from Yandex -Function UploadFileByURL(Val Token, Val Path, Val Address) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Path); - OPI_TypeConversion.GetLine(Address); - - Headers = AuthorizationHeader(Token); - URL = "https://cloud-api.yandex.net/v1/disk/resources/upload"; - - Parameters = New Structure; - Parameters.Insert("url" , EncodeString(Address, StringEncodingMethod.URLInURLEncoding)); - Parameters.Insert("path", Path); - - Parameters = OPI_Tools.RequestParametersToString(Parameters); - Response = OPI_Tools.Post(URL + Parameters, , Headers, False); - - Return Response; - -EndFunction - -#EndRegion - -#Region ManagePublicAccess - -// Publish object -// Publishes the disk object for public access -// -// Parameters: -// Token - String - Token - token -// Path - String - Path to the object to be published - path -// -// Return value: -// Key-Value Pair - serialized JSON response from Yandex -Function PublishObject(Val Token, Val Path) Export - Return TogglePublicAccess(Token, Path, True); -EndFunction - -// Unpublish object -// Unpublishes a previously published object -// -// Parameters: -// Token - String - Token - token -// Path - String - Path to the previously published object - path -// -// Return value: -// Key-Value Pair - serialized JSON response from Yandex -Function CancelObjectPublication(Val Token, Val Path) Export - Return TogglePublicAccess(Token, Path, False); -EndFunction - -// Get published list объеtoтоin. -// Gets a list of published objects -// -// Parameters: -// Token - String - Token - token -// Quantity - Number - Number of returned objects - amount -// OffsetFromStart - Number - Offset for getting objects not from the beginning of the list - offset -// -// Return value: -// Key-Value Pair - serialized JSON response from Yandex -Function GetPublishedObjectsList(Val Token, Val Quantity = 0, Val OffsetFromStart = 0) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Quantity); - OPI_TypeConversion.GetLine(OffsetFromStart); - - Headers = AuthorizationHeader(Token); - - Parameters = New Structure; - - If ValueFilled(Quantity) Then - Parameters.Insert("limit", Quantity); - EndIf; - - If ValueFilled(OffsetFromStart) Then - Parameters.Insert("offset", OffsetFromStart); - EndIf; - - Response = OPI_Tools.Get("https://cloud-api.yandex.net/v1/disk/resources/public", Parameters, Headers); - - Return Response; - -EndFunction - -// Get public object -// Gets information about the published object by its URL -// -// Parameters: -// Token - String - Token - token -// URL - String - Object address - url -// Quantity - Number - Quantity inозinращаемых inложенных объеtoтоin (for directory) - amount -// OffsetFromStart - Number - Offset for getting nested objects not from the beginning of the list - offset -// -// Return value: -// Key-Value Pair - serialized JSON response from Yandex -Function GetPublicObject(Val Token, Val URL, Val Quantity = 0, Val OffsetFromStart = 0) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(URL); - OPI_TypeConversion.GetLine(Quantity); - OPI_TypeConversion.GetLine(OffsetFromStart); - - Headers = AuthorizationHeader(Token); - - Parameters = New Structure; - - If ValueFilled(Quantity) Then - Parameters.Insert("limit", OPI_Tools.NumberToString(Quantity)); - EndIf; - - If ValueFilled(OffsetFromStart) Then - Parameters.Insert("offset", OPI_Tools.NumberToString(OffsetFromStart)); - EndIf; - - Parameters.Insert("public_key", URL); - - Response = OPI_Tools.Get("https://cloud-api.yandex.net/v1/disk/public/resources", Parameters, Headers); - - Return Response; - -EndFunction - -// Get download link for public object -// Gets a direct link to download the public object -// -// Parameters: -// Token - String - Token - token -// URL - String - Object address - url -// Path - String - Path inside the object - path -// -// Return value: -// Key-Value Pair - serialized JSON response from Yandex -Function GetDownloadLinkForPublicObject(Val Token, Val URL, Val Path = "") Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(URL); - OPI_TypeConversion.GetLine(Path); - - Headers = AuthorizationHeader(Token); - - Parameters = New Structure; - - If ValueFilled(Path) Then - Parameters.Insert("path", Path); - EndIf; - - Parameters.Insert("public_key", URL); - - Response = OPI_Tools.Get("https://cloud-api.yandex.net/v1/disk/public/resources/download", Parameters, Headers); - - Return Response; - -EndFunction - -// Save public object to disk -// Saves the public object to your disk -// -// Parameters: -// Token - String - Token - token -// URL - String - Object address - url -// From - String - Path inнутри публичного directory (тольtoо for папоto) - from -// To - String - File save path - to -// -// Return value: -// Key-Value Pair - serialized JSON response from Yandex -Function SavePublicObjectToDisk(Val Token, Val URL, From = "", To = "") Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(URL); - OPI_TypeConversion.GetLine(From); - OPI_TypeConversion.GetLine(To); - - Headers = AuthorizationHeader(Token); - Address = "https://cloud-api.yandex.net/v1/disk/public/resources/save-to-disk"; - Href = "href"; - - Parameters = New Structure; - Parameters.Insert("public_key", URL); - - If ValueFilled(From) Then - Parameters.Insert("path", From); - EndIf; - - If ValueFilled(To) Then - Parameters.Insert("save_path", To); - EndIf; - - Parameters = OPI_Tools.RequestParametersToString(Parameters); - Response = OPI_Tools.Post(Address + Parameters, , Headers, False); - - ResponseURL = Response[Href]; - - If Not ValueFilled(ResponseURL) Then - Return Response; - EndIf; - - Response = OPI_Tools.Get(ResponseURL, , Headers); - - Return Response; - -EndFunction - -#EndRegion - -#EndRegion - -#Region ServiceProceduresAndFunctions - -Function AuthorizationHeader(Val Token) - - Headers = New Match; - Headers.Insert("Authorization", "OAuth " + Token); - - Return Headers; - -EndFunction - -Function TogglePublicAccess(Val Token, Val Path, Val PublicAccess) - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Path); - OPI_TypeConversion.GetBoolean(PublicAccess); - - Headers = AuthorizationHeader(Token); - Destination = ?(PublicAccess, "publish", "unpublish"); - Href = "href"; - - URL = "https://cloud-api.yandex.net/v1/disk/resources/" + Destination; - - Parameters = New Structure; - Parameters.Insert("path", Path); - - Parameters = OPI_Tools.RequestParametersToString(Parameters); - Response = OPI_Tools.Put(URL + Parameters, , Headers, False); - - ResponseURL = Response[Href]; - - If Not ValueFilled(ResponseURL) Then - Return Response; - EndIf; - - Response = OPI_Tools.Get(ResponseURL, , Headers); - - Return Response; - -EndFunction - -#EndRegion diff --git a/service/interim/en/OPI/src/CommonModules/OPI_YandexDisk/OPI_YandexDisk.mdo b/service/interim/en/OPI/src/CommonModules/OPI_YandexDisk/OPI_YandexDisk.mdo deleted file mode 100644 index 08aea07cf7..0000000000 --- a/service/interim/en/OPI/src/CommonModules/OPI_YandexDisk/OPI_YandexDisk.mdo +++ /dev/null @@ -1,11 +0,0 @@ - - - OPI_YandexDisk - - ru - Methodы work with Yandex Disk (OPI) - - true - true - true - diff --git a/service/interim/en/OPI/src/CommonModules/OPI_YandexID/Module.bsl b/service/interim/en/OPI/src/CommonModules/OPI_YandexID/Module.bsl deleted file mode 100644 index a62bc29112..0000000000 --- a/service/interim/en/OPI/src/CommonModules/OPI_YandexID/Module.bsl +++ /dev/null @@ -1,112 +0,0 @@ -// Location OS: ./OInt/core/Modules/OPI_YandexID.os -// Library: Yandex ID -// CLI Command: yandex - -// MIT License - -// Copyright (c) 2023 Anton Tsitavets - -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: - -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. - -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -// https://github.com/Bayselonarrend/OpenIntegrations - -// BSLLS:LatinAndCyrillicSymbolInWord-off -// BSLLS:IncorrectLineBreak-off - -// Uncomment if OneScript is executed -// #Use "../../tools" - -#Region ProgrammingInterface - -// Get confirmation code -// Gets the confirmation code and the address of the page where it needs to be entered -// -// Parameters: -// ClientId - String - Client id - id -// -// Return value: -// Key-Value Pair - serialized JSON response from Yandex -Function GetConfirmationCode(Val ClientId) Export - - OPI_TypeConversion.GetLine(ClientId); - - Parameters = New Structure("client_id", ClientId); - Response = OPI_Tools.Post("https://oauth.yandex.ru/device/code", Parameters, , False); - - Return Response; - -EndFunction - -// Convert code to token -// Converts the code to a token after entering the code when executing GetConfirmationCode -// -// Parameters: -// ClientId - String - Client id - id -// ClientSecret - String - Client secret - secret -// DeviceCode - String - device_code from GetConfirmationCode() - device -// -// Return value: -// Key-Value Pair - serialized JSON response from Yandex -Function ConvertCodeToToken(Val ClientId, Val ClientSecret, Val DeviceCode) Export - - OPI_TypeConversion.GetLine(ClientId); - OPI_TypeConversion.GetLine(ClientSecret); - OPI_TypeConversion.GetLine(DeviceCode); - - Parameters = New Structure; - Parameters.Insert("grant_type" , "device_code"); - Parameters.Insert("code" , DeviceCode); - Parameters.Insert("client_id" , ClientId); - Parameters.Insert("client_secret" , ClientSecret); - - Response = OPI_Tools.Post("https://oauth.yandex.ru/token", Parameters, , False); - - Return Response; - -EndFunction - -// Refresh token -// Updates token by Refresh token -// -// Parameters: -// ClientId - String - Client id - id -// ClientSecret - String - Client secret - secret -// RefreshToken - String - Refresh token - refresh -// -// Return value: -// Key-Value Pair - serialized JSON response from Yandex -Function RefreshToken(Val ClientId, Val ClientSecret, Val RefreshToken) Export - - OPI_TypeConversion.GetLine(ClientId); - OPI_TypeConversion.GetLine(ClientSecret); - OPI_TypeConversion.GetLine(RefreshToken); - - Parameters = New Structure; - Parameters.Insert("grant_type" , "refresh_token"); - Parameters.Insert("refresh_token" , RefreshToken); - Parameters.Insert("client_id" , ClientId); - Parameters.Insert("client_secret" , ClientSecret); - - Response = OPI_Tools.Post("https://oauth.yandex.ru/token", Parameters, , False); - - Return Response; - -EndFunction - -#EndRegion diff --git a/service/interim/en/OPI/src/CommonModules/OPI_YandexID/OPI_YandexID.mdo b/service/interim/en/OPI/src/CommonModules/OPI_YandexID/OPI_YandexID.mdo deleted file mode 100644 index 6329dbbaf4..0000000000 --- a/service/interim/en/OPI/src/CommonModules/OPI_YandexID/OPI_YandexID.mdo +++ /dev/null @@ -1,11 +0,0 @@ - - - OPI_YandexID - - ru - Methodы work with Yandex ID (OPI) - - true - true - true - diff --git a/service/interim/en/OPI/src/CommonModules/OPI_Инструменты/Module.bsl b/service/interim/en/OPI/src/CommonModules/OPI_Инструменты/Module.bsl deleted file mode 100644 index a7b02db477..0000000000 --- a/service/interim/en/OPI/src/CommonModules/OPI_Инструменты/Module.bsl +++ /dev/null @@ -1,1229 +0,0 @@ -// Location OS: ./OInt/tools/Modules/internal/Modules/OPI_Tools.os - -// MIT License - -// Copyright (c) 2023 Anton Tsitavets - -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: - -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. - -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -// https://github.com/Bayselonarrend/OpenIntegrations - -// BSLLS:Typo-off -// BSLLS:LatinAndCyrillicSymbolInWord-off -// BSLLS:IncorrectLineBreak-off -// BSLLS:UnusedLocalVariable-off -// BSLLS:UsingServiceTag-off -// BSLLS:NumberOfOptionalParams-off - -//@skip-check module-unused-local-variable -//@skip-check method-too-many-params - -#Region ServiceProgramInterface - -#Region HTTPMethods - -#Region RequestsWithoutBody - -Function Get(Val URL, Val Parameters = "", Val AdditionalHeaders = "", Val ResponseFile = Undefined) Export - Return ExecuteRequestWithoutBody(URL, "GET", Parameters, AdditionalHeaders, ResponseFile); -EndFunction - -Function Delete(Val URL, Val Parameters = "", Val AdditionalHeaders = "", Val ResponseFile = Undefined) Export - Return ExecuteRequestWithoutBody(URL, "DELETE", Parameters, AdditionalHeaders, ResponseFile); -EndFunction - -#EndRegion - -#Region RequestsWithBody - -Function Post(Val URL - , Val Parameters = "" - , Val AdditionalHeaders = "" - , Val JSON = True - , Val FullResponse = False - , Val ResponseFile = Undefined) Export - - Return ExecuteRequestWithBody(URL, "POST", Parameters, AdditionalHeaders, JSON, FullResponse, ResponseFile); - -EndFunction - -Function Patch(Val URL - , Val Parameters = "" - , Val AdditionalHeaders = "" - , Val JSON = True - , Val FullResponse = False - , Val ResponseFile = Undefined) Export - - Return ExecuteRequestWithBody(URL, "PATCH", Parameters, AdditionalHeaders, JSON, FullResponse, ResponseFile); - -EndFunction - -Function Put(Val URL - , Val Parameters = "" - , Val AdditionalHeaders = "" - , Val JSON = True - , Val FullResponse = False - , Val ResponseFile = Undefined) Export - - Return ExecuteRequestWithBody(URL, "PUT", Parameters, AdditionalHeaders, JSON, FullResponse, ResponseFile); - -EndFunction - -Function PostBinary(Val URL - , Val Body - , Val AdditionalHeaders - , Val FullResponse = False - , Val DataType = "application/octet-stream") Export - - Return ExecuteRequestWithBinaryData(URL, "POST", Body, AdditionalHeaders, FullResponse, DataType); - -EndFunction - -#EndRegion - -#Region MultipartRequests - -Function PostMultipart(Val URL - , Val Parameters = "" - , Val Files = "" - , Val ContentType = "image/jpeg" - , Val AdditionalHeaders = "" - , Val ResponseFile = Undefined) Export - - Return ExecuteMultipartRequest(URL, "POST", Parameters, Files, ContentType, AdditionalHeaders, ResponseFile); - -EndFunction - -Function PutMultipart(Val URL - , Val Parameters = "" - , Val Files = "" - , Val ContentType = "image/jpeg" - , Val AdditionalHeaders = "" - , Val ResponseFile = Undefined) Export - - Return ExecuteMultipartRequest(URL, "PUT", Parameters, Files, ContentType, AdditionalHeaders, ResponseFile); - -EndFunction - -Function PostMultipartRelated(Val URL - , Val JSON = "" - , Val Files = "" - , Val AdditionalHeaders = "" - , Val ResponseFile = Undefined) Export - - Return ExecuteMultipartRelatedRequest(URL, "POST", JSON, Files, AdditionalHeaders, ResponseFile); - -EndFunction - -Function PatchMultipartRelated(Val URL - , Val JSON = "" - , Val Files = "" - , Val AdditionalHeaders = "" - , Val ResponseFile = Undefined) Export - - Return ExecuteMultipartRelatedRequest(URL, "PATCH", JSON, Files, AdditionalHeaders, ResponseFile); - -EndFunction - -#EndRegion - -#Region Miscellaneous - -Procedure ProcessResponse(Response, Val FullResponse = False) Export - - If FullResponse Or TypeValue(Response) <> Type("HTTPResponse") Then - Return; - EndIf; - - BodyFile = Response.GetBodyFileName(); - - If Not BodyFile = Undefined Then - Response = BodyFile; - Return; - EndIf; - - GZip = "gzip"; - NeedsUnpacking = - Response.Headers.Get("Content-Encoding") = GZip - Or Response.Headers.Get("content-encoding") = GZip; - - If NeedsUnpacking Then - Response = UnpackResponse(Response); - EndIf; - - Response = ?(TypeValue(Response) = Type("HTTPResponse"), Response.GetBodyAsBinaryData(), Response); - - If TypeValue(Response) = Type("BinaryData") Then - - Try - Response = JsonToStructure(Response); - Except - Return; - EndTry; - - EndIf; - -EndProcedure - -Function CreateRequest(Val Address, Val AdditionalHeaders = "", Val DataType = "") Export - - Headers = New Match; - Headers.Insert("Accept-Encoding", "gzip"); - Headers.Insert("Accept" , "*/*"); - Headers.Insert("Connection" , "keep-alive"); - Headers.Insert("Accept-Charset" , "utf-8"); - - If ValueFilled(DataType) Then - Headers.Insert("Content-Type", DataType); - EndIf; - - If TypeValue(AdditionalHeaders) = Type("Match") Then - - For Each Title In AdditionalHeaders Do - Headers.Insert(Title.Key, Title.Value); - EndDo; - - EndIf; - - NewRequest = New HTTPRequest(Address, Headers); - - Return NewRequest; - -EndFunction - -Function CreateConnection(Val Server, Val User = "", Val Password = "") Export - - Try - SSL = New SecureConnectionOpenSSL; - Return New HTTPConnection(Server, 443, User, Password, , 3000, SSL); - Except - Return New HTTPConnection(Server, 443, User, Password, , 3000); - EndTry; - -EndFunction - -#EndRegion - -#EndRegion - -#Region Service - -Function RequestParametersToString(Val Parameters) Export - - If Parameters.Quantity() = 0 Then - Return ""; - EndIf; - - ParameterString = "?"; - - For Each Parameter In Parameters Do - - ParameterValue = ConvertParameterToString(Parameter.Value); - - ParameterString = ParameterString - + Parameter.Key - + "=" - + ParameterValue - + "&"; - EndDo; - - ParameterString = Left(ParameterString, StrLength(ParameterString) - 1); - - Return ParameterString; - -EndFunction - -Function SplitURL(Val URL) Export - - URL = StringReplace(URL, "https://", ""); - URL = StringReplace(URL, "http://", ""); - URL = StringReplace(URL, ":443", ""); - - Address = Right(URL, StrLength(URL) - StrFind(URL, "/", SearchDirection.FromStart) + 1); - Server = Left(URL, StrFind(URL, "/", SearchDirection.FromStart) - 1); - - Try - SSL = New SecureConnectionOpenSSL; - Except - Server = "https://" + Server; - EndTry; - - ReturnStructure = New Structure; - ReturnStructure.Insert("Server", Server); - ReturnStructure.Insert("Address" , Address); - - Return ReturnStructure; - -EndFunction - -Function JsonToStructure(Val Text) Export - - If Not ValueFilled(Text) Then - Return ""; - EndIf; - - Text = ?(TypeValue(Text) = Type("BinaryData"), GetStringFromBinaryData(Text), Text); - - ReadingJSON = New ReadingJSON; - ReadingJSON.SetString(Text); - - Data = ReadJSON(ReadingJSON, True, Undefined, JSONDateFormat.ISO); - ReadingJSON.Close(); - - Return Data; - -EndFunction - -Function JSONString(Val Data, Val Escaping = "No") Export - - JSONParameters = New JSONWriteParameters(JSONLineBreak.Windows - , " " - , True - , EscapeJSONCharacters[Escaping] - , False - , False - , False - , False); - - Try - - WritingJSON = New WritingJSON; - WritingJSON.SetString(JSONParameters); - - WriteJSON(WritingJSON, Data); - Return WritingJSON.Close(); - - Except - Return "NOT JSON: " + String(Data); - EndTry; - -EndFunction - -Function NumberToString(Val Number) Export - Return StringReplace(String(Number), Symbols.NPP, ""); -EndFunction - -Function ReadJSONFile(Val Path) Export - - ReadingJSON = New ReadingJSON; - ReadingJSON.OpenFile(Path); - Values = ReadJSON(ReadingJSON); - - ReadingJSON.Close(); - - Return Values; - -EndFunction - -Function RequestParametersToMatch(Val ParameterString) Export - - ReturnMapping = New Match; - NumberOfParts = 2; - ParameterArray = StrSplit(ParameterString, "&", False); - - For Each Parameter In ParameterArray Do - - KeyValueArray = StrSplit(Parameter, "="); - - If KeyValueArray.Quantity() = NumberOfParts Then - ReturnMapping.Insert(KeyValueArray[0], KeyValueArray[1]); - EndIf; - - EndDo; - - Return ReturnMapping; - -EndFunction - -Function GetCurrentDate() Export - Return LocalTime(CurrentUniversalDate()); -EndFunction - -Function UNIXTime(Val Date) Export - - OTD = New TypeDescription("Date"); - Date = OTD.ConvertValue(Date); - - UNIX = Format(Date - Date(1970, 1, 1, 1, 0, 0), "HC=10; HDC=0; HG=0"); - UNIX = StringReplace(UNIX, ",", ""); - UNIX = Left(UNIX, 10); - - Return UNIX; - -EndFunction - -Function ProgressInformation(Val Current, Val Total, Val Unit, Val Divider = 1) Export - - Whole = 100; - Current = Round(Current / Divider, 2); - Total = Round(Total / Divider, 2); - Percent = Goal(Current / Total * Whole); - - StrCurrent = NumberToString(Current); - StrTotal = NumberToString(Total); - StrPercentage = NumberToString(Percent); - - Information = StrCurrent + "/" + StrTotal + " " + Unit + " ( " + StrPercentage + "% )"; - - Return Information; - -EndFunction - -Function ConvertDataWithSizeRetrieval(Data, Val MinimumStreamSize = 0) Export - - Size = 0; - - If TypeValue(Data) = Type("String") Then - - FileOnDisk = New File(Data); - - If FileOnDisk.Exists() Then - Size = FileOnDisk.Size(); - Else - OPI_TypeConversion.GetBinaryData(Data); - Size = Data.Size(); - EndIf; - - Else - OPI_TypeConversion.GetBinaryData(Data); - Size = Data.Size(); - EndIf; - - If ValueFilled(MinimumStreamSize) Then - If Size < MinimumStreamSize Then - OPI_TypeConversion.GetBinaryData(Data); - Else - OPI_TypeConversion.GetBinaryOrStream(Data); - EndIf; - Else - OPI_TypeConversion.GetBinaryOrStream(Data); - EndIf; - - Return Size; - -EndFunction - -Procedure ValueToArray(Value) Export - - Value_ = New Array; - Value_.Add(Value); - Value = Value_; - -EndProcedure - -Procedure ReplaceSpecialCharacters(Text, Markup = "Markdown") Export - - CharacterMapping = New Match; - - If Markup = "HTML" Then - - CharacterMapping.Insert("&", "&"); - - ElsIf Markup = "MarkdownV2" Then - - CharacterMapping.Insert("-", "\-"); - CharacterMapping.Insert("+", "\+"); - CharacterMapping.Insert("#", "\#"); - CharacterMapping.Insert("=", "\="); - CharacterMapping.Insert("{", "\{"); - CharacterMapping.Insert("}", "\}"); - CharacterMapping.Insert(".", "\."); - - Else - Return; - EndIf; - - For Each ArraySymbol In CharacterMapping Do - Text = StringReplace(Text, ArraySymbol.Key, ArraySymbol.Value); - EndDo; - -EndProcedure - -Procedure RemoveEmptyCollectionFields(Collection) Export - - CollectionType = TypeValue(Collection); - OutputCollection = New(CollectionType); - - If CollectionType = Type("Match") Or CollectionType = Type("Structure") Then - - RemoveEmptyKeyValues(Collection, OutputCollection); - - ElsIf CollectionType = Type("Array") Then - - RemoveEmptyArrayElements(Collection, OutputCollection); - - Else - - OutputCollection = Collection; - - EndIf; - - Collection = OutputCollection; - -EndProcedure - -Procedure Pause(Val Seconds) Export - - Connection = New HTTPConnection("1C.ru", 11111, , , , Seconds); - Try - Connection.Get(New HTTPRequest("")); - Except - Return; - EndTry; - -EndProcedure - -Procedure AddField(Val Name, Val Value, Val Type, Collection) Export - - Filled = ValueFilled(Value); - - If Not Filled Then - Return; - EndIf; - - If Type = "Date" Then - OPI_TypeConversion.GetDate(Value); - Value = UNIXTime(Value); - - ElsIf Type = "Collection" Then - OPI_TypeConversion.GetCollection(Value); - - ElsIf Type = "Boolean" Then - OPI_TypeConversion.GetBoolean(Value); - - ElsIf Type = "FileString" Then - OPI_TypeConversion.GetLine(Value, True); - - ElsIf Type = "Array" Then - OPI_TypeConversion.GetArray(Value); - - ElsIf Type = "BinaryData" Then - OPI_TypeConversion.GetBinaryData(Value); - - ElsIf Type = "Number" Then - OPI_TypeConversion.GetNumber(Value); - - Else - OPI_TypeConversion.GetLine(Value); - - EndIf; - - Collection.Insert(Name, Value); - -EndProcedure - -#EndRegion - -#EndRegion - -#Region ServiceProceduresAndFunctions - -Function ExecuteRequestWithBody(Val URL - , Val View - , Val Parameters = "" - , Val AdditionalHeaders = "" - , Val JSON = True - , Val FullResponse = False - , Val ResponseFile = Undefined) - - If Not ValueFilled(Parameters) Then - Parameters = New Structure; - EndIf; - - DataType = ?(JSON, "application/json; charset=utf-8", "application/x-www-form-urlencoded; charset=utf-8"); - URLStructure = SplitURL(URL); - Server = URLStructure["Server"]; - Address = URLStructure["Address"]; - - Request = CreateRequest(Address, AdditionalHeaders, DataType); - Connection = CreateConnection(Server); - - SetRequestBody(Request, Parameters, JSON); - - If ValueFilled(ResponseFile) Then - Response = Connection.CallHTTPMethod(View, Request, ResponseFile); - Else - Response = Connection.CallHTTPMethod(View, Request); - EndIf; - - If ThisIsRedirection(Response) Then - Response = ExecuteRequestWithBody(Response.Headers["Location"] - , View - , Parameters - , AdditionalHeaders - , JSON - , FullResponse - , ResponseFile); - Else - ProcessResponse(Response, FullResponse); - EndIf; - - Return Response; - -EndFunction - -Function ExecuteRequestWithBinaryData(Val URL - , Val View - , Val Data - , Val AdditionalHeaders - , Val FullResponse - , Val DataType) - - URLStructure = SplitURL(URL); - Server = URLStructure["Server"]; - Address = URLStructure["Address"]; - - Request = CreateRequest(Address, AdditionalHeaders, DataType); - Connection = CreateConnection(Server); - - Request.SetBodyFromBinaryData(Data); - - Response = Connection.CallHTTPMethod(View, Request); - - If ThisIsRedirection(Response) Then - Response = ExecuteRequestWithBinaryData(Response.Headers["Location"] - , View - , Data - , AdditionalHeaders - , FullResponse - , DataType); - Else - ProcessResponse(Response, FullResponse); - EndIf; - - Return Response; - -EndFunction - -Function ExecuteRequestWithoutBody(Val URL - , Val View - , Val Parameters = "" - , Val AdditionalHeaders = "" - , Val ResponseFile = Undefined) - - If Not ValueFilled(Parameters) Then - Parameters = New Structure; - EndIf; - - URLStructure = SplitURL(URL); - Server = URLStructure["Server"]; - Address = URLStructure["Address"] + RequestParametersToString(Parameters); - - Request = CreateRequest(Address, AdditionalHeaders); - Connection = CreateConnection(Server); - - If ValueFilled(ResponseFile) Then - Response = Connection.CallHTTPMethod(View, Request, ResponseFile); - Else - Response = Connection.CallHTTPMethod(View, Request); - EndIf; - - If ThisIsRedirection(Response) Then - Response = ExecuteRequestWithoutBody(Response.Headers["Location"], View, Parameters, AdditionalHeaders, ResponseFile); - Else - ProcessResponse(Response); - EndIf; - - Return Response; - -EndFunction - -Function ExecuteMultipartRequest(Val URL - , Val View - , Val Parameters = "" - , Val Files = "" - , Val ContentType = "image/jpeg" - , Val AdditionalHeaders = "" - , Val ResponseFile = Undefined) - - If Not ValueFilled(Parameters) Then - Parameters = New Structure; - EndIf; - - If Not ValueFilled(Files) Then - Files = New Match; - EndIf; - - Redirection = 300; - Error = 400; - Boundary = StringReplace(String(New UniqueIdentifier), "-", ""); - LineSeparator = Symbols.VK + Symbols.PS; - DataType = "multipart/form-data; boundary=" + Boundary; - URLStructure = SplitURL(URL); - Server = URLStructure["Server"]; - Address = URLStructure["Address"]; - - Request = CreateRequest(Address, AdditionalHeaders, DataType); - Connection = CreateConnection(Server); - - RequestBody = GetTempFileName(); - TextRecord = New DataRecording(RequestBody - , TextEncoding.UTF8 - , ByteOrder.LittleEndian - , "" - , False - , "" - , False); - - WriteMultipartParameters(TextRecord, Boundary, Parameters); - WriteMultipartFiles(TextRecord, Boundary, ContentType, Files); - - TextRecord.WriteString("--" + boundary + "--" + LineSeparator); - TextRecord.Close(); - - Request.SetBodyFileName(RequestBody); - - If ValueFilled(ResponseFile) Then - Response = Connection.CallHTTPMethod(View, Request, ResponseFile); - Else - Response = Connection.CallHTTPMethod(View, Request); - EndIf; - - ThisIsRedirection = Response.StatusCode >= Redirection And Response.StatusCode < Error; - - If ThisIsRedirection Then - Response = ExecuteMultipartRequest(Response.Headers["Location"] - , View - , Parameters - , Files - , ContentType - , AdditionalHeaders - , ResponseFile); - Else - ProcessResponse(Response); - EndIf; - - Request = Undefined; - TextRecord = Undefined; - - DeleteFiles(RequestBody); - Return Response; - -EndFunction - -Function ExecuteMultipartRelatedRequest(Val URL - , Val View - , Val JSON = "" - , Val Files = "" - , Val AdditionalHeaders = "" - , Val ResponseFile = Undefined) - - Redirection = 300; - Error = 400; - Boundary = StringReplace(String(New UniqueIdentifier), "-", ""); - LineSeparator = Symbols.VK + Symbols.PS; - DataType = "multipart/related; boundary=" + Boundary; - URLStructure = SplitURL(URL); - Server = URLStructure["Server"]; - Address = URLStructure["Address"]; - - Request = CreateRequest(Address, AdditionalHeaders, DataType); - Connection = CreateConnection(Server); - - RequestBody = GetTempFileName(); - TextRecord = New DataRecording(RequestBody - , TextEncoding.UTF8 - , ByteOrder.LittleEndian - , "" - , False - , "" - , False); - - WriteJSONMultipart(TextRecord, Boundary, JSON); - WriteRelatedFiles(TextRecord, Boundary, Files); - - TextRecord.WriteString("--" + boundary + "--" + LineSeparator); - TextRecord.Close(); - - AddContentLength(Request); - - Request.SetBodyFileName(RequestBody); - - If ValueFilled(ResponseFile) Then - Response = Connection.CallHTTPMethod(View, Request, ResponseFile); - Else - Response = Connection.CallHTTPMethod(View, Request); - EndIf; - - ThisIsRedirection = Response.StatusCode >= Redirection And Response.StatusCode < Error; - - If ThisIsRedirection Then - Response = ExecuteMultipartRelatedRequest(Response.Headers["Location"] - , View - , JSON - , Files - , AdditionalHeaders - , ResponseFile); - Else - ProcessResponse(Response); - EndIf; - - Request = Undefined; - TextRecord = Undefined; - - DeleteFiles(RequestBody); - Return Response; - -EndFunction - -Function ThisIsRedirection(Val Response) - - Redirection = 300; - Error = 400; - - ThisIsRedirection = Response.StatusCode >= Redirection - And Response.StatusCode < Error - And ValueFilled(Response.Headers["Location"]); - - Return ThisIsRedirection; - -EndFunction - -Function ConvertParameterToString(Val Value) - - If TypeValue(Value) = Type("Array") Then - Value = StrJoin(Value, ","); - Value = EncodeString(Value, StringEncodingMethod.URLencoding); - Value = "[" + Value + "]"; - Else - Value = NumberToString(Value); - Value = EncodeString(Value, StringEncodingMethod.URLencoding); - EndIf; - - Return Value; - -EndFunction - -Procedure SetRequestBody(Request, Val Parameters, Val JSON) - - Collection = TypeValue(Parameters) = Type("Structure") - Or TypeValue(Parameters) = Type("Match") - Or TypeValue(Parameters) = Type("Array"); - - If JSON Then - Data = JSONString(Parameters); - ElsIf Not Collection Then - Data = Parameters; - Else - ParameterString = RequestParametersToString(Parameters); - Data = Right(ParameterString, StrLength(ParameterString) - 1); - EndIf; - - If TypeValue(Data) = Type("String") Then - Request.SetBodyFromString(Data); - Else - //@skip-check wrong-type-expression - Request.SetBodyFromBinaryData(Data); - EndIf; - -EndProcedure - -Procedure WriteMultipartParameters(TextRecord, Val Boundary, Val Parameters) - - LineSeparator = Symbols.VK + Symbols.PS; - - For Each Parameter In Parameters Do - - If Parameter.Value = Undefined - Or Parameter.Value = NULL Then - Continue; - EndIf; - - TextRecord.WriteString("--" + boundary + LineSeparator); - TextRecord.WriteString("Content-Disposition: form-data; name=""" + Parameter.Key + """"); - TextRecord.WriteString(LineSeparator); - TextRecord.WriteString(LineSeparator); - - If TypeValue(Parameter.Value) = Type("String") - Or TypeValue(Parameter.Value) = Type("Number") Then - - ValueAsString = NumberToString(Parameter.Value); - TextRecord.WriteString(ValueAsString); - - ElsIf TypeValue(Parameter.Value) = Type("Boolean") Then - - TextRecord.WriteString(?(Parameter.Value, "true", "false")); - - Else - - TextRecord.Write(Parameter.Value); - - EndIf; - - TextRecord.WriteString(LineSeparator); - - EndDo; - -EndProcedure - -Procedure WriteMultipartFiles(TextRecord, Val Boundary, Val ContentType, Val Files) - - ContentType = ShortLP(ContentType); - LineSeparator = Symbols.VK + Symbols.PS; - DotReplacement = "___"; - - For Each File In Files Do - - FilePath = StringReplace(File.Key, DotReplacement, "."); - - If ContentType = "image/jpeg" Then - SendingFileName = "photo"; - Else - SendingFileName = StringReplace(File.Key, DotReplacement, "."); - SendingFileName = Left(SendingFileName, StrFind(SendingFileName, ".") - 1); - SendingFileName = ?(ValueFilled(SendingFileName), SendingFileName, StringReplace(File.Key, - DotReplacement, ".")); - EndIf; - - TextRecord.WriteString("--" + boundary + LineSeparator); - TextRecord.WriteString("Content-Disposition: form-data; name=""" - + SendingFileName - + """; filename=""" - + FilePath - + """"); - TextRecord.WriteString(LineSeparator); - - If ValueFilled(ContentType) Then - TextRecord.WriteString("Content-Type: " + ContentType); - EndIf; - - TextRecord.WriteString(LineSeparator); - TextRecord.WriteString(LineSeparator); - WriteBinaryData(TextRecord, File.Value); - TextRecord.WriteString(LineSeparator); - - EndDo; - -EndProcedure - -Procedure WriteRelatedFiles(TextRecord, Val Boundary, Val Files) - - If Not ValueFilled(Files) Then - Return; - EndIf; - - LineSeparator = Symbols.VK + Symbols.PS; - - If TypeValue(Files) = Type("Match") Then - For Each File In Files Do - - TextRecord.WriteString("--" + boundary + LineSeparator); - TextRecord.WriteString("Content-Type: " + File.Value); - TextRecord.WriteString(LineSeparator); - TextRecord.WriteString(LineSeparator); - WriteBinaryData(TextRecord, File.Key); - TextRecord.WriteString(LineSeparator); - TextRecord.WriteString(LineSeparator); - - EndDo; - - EndIf; - -EndProcedure - -Procedure WriteBinaryData(DataRecording, Val BinaryData) - - ChunkSize = 268435456; - BytesRead = 0; - CurrentPosition = 0; - TotalSize = BinaryData.Size(); - - WHile BytesRead < TotalSize Do - - ReadingData = New ReadingData(BinaryData); - BytesRead = ReadingData.Skip(CurrentPosition); - Result = ReadingData.Read(ChunkSize); - Current data = Result.GetBinaryData(); - CurrentSize = Current data.Size(); - - If Not ValueFilled(Current data) Then - Break; - EndIf; - - DataRecording.Write(Current data); - - // !OInt ReleaseObject(Current data); - // !OInt PerformGarbageCollection(); - - CurrentPosition = CurrentPosition + CurrentSize; - - EndDo; - -EndProcedure - -Procedure WriteJSONMultipart(TextRecord, Val Boundary, Val JSON) - - If Not ValueFilled(JSON) Then - Return; - EndIf; - - LineSeparator = Symbols.VK + Symbols.PS; - - TextRecord.WriteString("--" + boundary + LineSeparator); - TextRecord.WriteString("Content-Type: application/json; charset=UTF-8"); - TextRecord.WriteString(LineSeparator); - TextRecord.WriteString(LineSeparator); - TextRecord.WriteString(JSON); - TextRecord.WriteString(LineSeparator); - TextRecord.WriteString(LineSeparator); - -EndProcedure - -Procedure AddContentLength(Request) - - RequestBody = Request.GetBodyAsBinaryData(); - - If ValueFilled(RequestBody) Then - - Size = RequestBody.Size(); - Request.Headers.Insert("Content-Length", NumberToString(Size)); - - EndIf; - -EndProcedure - -Procedure RemoveEmptyKeyValues(Val Collection, OutputCollection) - - For Each CollectionItem In Collection Do - - If Not CollectionItem.Value = Undefined And Not CollectionItem.Value = NULL Then - OutputCollection.Insert(CollectionItem.Key, CollectionItem.Value); - EndIf; - - EndDo; - -EndProcedure - -Procedure RemoveEmptyArrayElements(Val Collection, OutputCollection) - - For Each CollectionItem In Collection Do - - If Not CollectionItem = Undefined And Not CollectionItem = NULL Then - OutputCollection.Add(CollectionItem); - EndIf; - - EndDo; - -EndProcedure - -#Region GZip - -// Description withтруtoтур withм. зdеwithь https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT -// Source: https://github.com/vbondarevsky/Connector - -// Connector: convenient HTTP client for 1C:Enterprise 8 -// -// Copyright 2017-2023 Vladimir Bondarevskiy -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// -// URL: https://github.com/vbondarevsky/Connector -// e-mail: vbondarevsky@gmail.com -// Version: 2.4.8 -// -// Requirements: 1C platform version 8.3.10 and above - -Function UnpackResponse(Response) - - Try - Return ReadGZip(Response.GetBodyAsBinaryData()); - Except - Return Response; - EndTry; - -EndFunction - -Function ReadGZip(CompressedData) Export - - GZipPrefixSize = 10; - GZipPostfixSize = 8; - - SizeDD = ZipSizeDD(); - SizeCDH = ZipSizeCDH(); - SizeESD = ZipSizeEOCD(); - SizeLFH = ZipSizeLFH(); - - ReadingData = New ReadingData(CompressedData); - ReadingData.Skip(GZipPrefixSize); - CompressedDataSize = ReadingData.SourceStream().Size() - GZipPrefixSize - GZipPostfixSize; - - ZipStream = New MemoryStream(SizeLFH - + CompressedDataSize - + SizeDD - + SizeCDH - + SizeESD); - - DataRecording = New DataRecording(ZipStream); - DataRecording.WriteBinaryDataBuffer(ZipLFH()); - ReadingData.CopyTo(DataRecording, CompressedDataSize); - - DataRecording.Close(); - DataRecording = New DataRecording(ZipStream); - - CRC32 = ReadingData.ReadInt32(); - UncompressedDataSize = ReadingData.ReadInt32(); - ReadingData.Close(); - - DataRecording.WriteBinaryDataBuffer(ZipDD(CRC32, CompressedDataSize, UncompressedDataSize)); - DataRecording.WriteBinaryDataBuffer(ZipCDH(CRC32, CompressedDataSize, UncompressedDataSize)); - DataRecording.WriteBinaryDataBuffer(ZipEOCD(CompressedDataSize)); - DataRecording.Close(); - - Return ReadZip(ZipStream); - -EndFunction - -Function ReadZip(CompressedData, ErrorText = Undefined) - - Directory = GetTempFileName(); - ReadingZip = New ReadingZipFile(CompressedData); - FileName = ReadingZip.Elements[0].Name; - Try - ReadingZip.Extract(ReadingZip.Elements[0], Directory, ZIPFilePathRecoveryMode.DoNotRestore); - Except - // Ignore archive integrity check, just read the result - ErrorText = DetailedErrorRepresentation(ErrorInformation()); - EndTry; - ReadingZip.Close(); - - Result = New BinaryData(Directory + GetPathSeparator() + FileName); - DeleteFiles(Directory); - - Return Result; - -EndFunction - -Function ZipSizeLFH() - - Return 34; - -EndFunction - -Function ZipSizeDD() - - Return 16; - -EndFunction - -Function ZipSizeCDH() - - Return 50; - -EndFunction - -Function ZipSizeEOCD() - - Return 22; - -EndFunction - -Function ZipLFH() - - // Local file header - Buffer = New BinaryDataBuffer(ZipSizeLFH()); - Buffer.WriteInt32(0, 67324752); // signature 0x04034b50 - Buffer.WriteInt16(4, 20); // version - Buffer.WriteInt16(6, 10); // bit flags - Buffer.WriteInt16(8, 8); // compression method - Buffer.WriteInt16(10, 0); // time - Buffer.WriteInt16(12, 0); // date - Buffer.WriteInt32(14, 0); // crc-32 - Buffer.WriteInt32(18, 0); // compressed size - Buffer.WriteInt32(22, 0); // uncompressed size - Buffer.WriteInt16(26, 4); // filename legth - "data" - Buffer.WriteInt16(28, 0); // extra field length - Buffer.Write(30, GetBinaryDataBufferFromString("data", "ascii", False)); - - Return Buffer; - -EndFunction - -Function ZipDD(CRC32, CompressedDataSize, UncompressedDataSize) - - // Data descriptor - Buffer = New BinaryDataBuffer(ZipSizeDD()); - Buffer.WriteInt32(0, 134695760); - Buffer.WriteInt32(4, CRC32); - Buffer.WriteInt32(8, CompressedDataSize); - Buffer.WriteInt32(12, UncompressedDataSize); - - Return Buffer; - -EndFunction - -Function ZipCDH(CRC32, CompressedDataSize, UncompressedDataSize) - - // Central directory header - Buffer = New BinaryDataBuffer(ZipSizeCDH()); - Buffer.WriteInt32(0, 33639248); // signature 0x02014b50 - Buffer.WriteInt16(4, 798); // version made by - Buffer.WriteInt16(6, 20); // version needed to extract - Buffer.WriteInt16(8, 10); // bit flags - Buffer.WriteInt16(10, 8); // compression method - Buffer.WriteInt16(12, 0); // time - Buffer.WriteInt16(14, 0); // date - Buffer.WriteInt32(16, CRC32); // crc-32 - Buffer.WriteInt32(20, CompressedDataSize); // compressed size - Buffer.WriteInt32(24, UncompressedDataSize); // uncompressed size - Buffer.WriteInt16(28, 4); // file name length - Buffer.WriteInt16(30, 0); // extra field length - Buffer.WriteInt16(32, 0); // file comment length - Buffer.WriteInt16(34, 0); // disk number start - Buffer.WriteInt16(36, 0); // internal file attributes - Buffer.WriteInt32(38, 2176057344); // external file attributes - Buffer.WriteInt32(42, 0); // relative offset of local header - Buffer.Write(46, GetBinaryDataBufferFromString("data", "ascii", False)); - - Return Buffer; - -EndFunction - -Function ZipEOCD(CompressedDataSize) - - // End of central directory - SizeCDH = 50; - Buffer = New BinaryDataBuffer(ZipSizeEOCD()); - Buffer.WriteInt32(0, 101010256); // signature 0x06054b50 - Buffer.WriteInt16(4, 0); // number of this disk - Buffer.WriteInt16(6, 0); // number of the disk with the start of the central directory - Buffer.WriteInt16(8, 1); // total number of entries in the central directory on this disk - Buffer.WriteInt16(10, 1); // total number of entries in the central directory - Buffer.WriteInt32(12, SizeCDH); // size of the central directory - // offset of start of central directory with respect to the starting disk number - Buffer.WriteInt32(16, ZipSizeLFH() + CompressedDataSize + ZipSizeDD()); - Buffer.WriteInt16(20, 0); // the starting disk number - - Return Buffer; - -EndFunction - -#EndRegion - -#EndRegion diff --git a/service/interim/en/OPI/src/CommonModules/OPI_Инструменты/OPI_Инструменты.mdo b/service/interim/en/OPI/src/CommonModules/OPI_Инструменты/OPI_Инструменты.mdo deleted file mode 100644 index 1684016796..0000000000 --- a/service/interim/en/OPI/src/CommonModules/OPI_Инструменты/OPI_Инструменты.mdo +++ /dev/null @@ -1,11 +0,0 @@ - - - OPI_Tools - - ru - OPI инwithтрументы - - true - true - true - diff --git a/service/interim/en/OPI/src/CommonModules/OPI_Криптография/Module.bsl b/service/interim/en/OPI/src/CommonModules/OPI_Криптография/Module.bsl deleted file mode 100644 index a8586b49ca..0000000000 --- a/service/interim/en/OPI/src/CommonModules/OPI_Криптография/Module.bsl +++ /dev/null @@ -1,110 +0,0 @@ -// Location OS: ./OInt/tools/Modules/internal/Modules/OPI_Cryptography.os - -// MIT License - -// Copyright (c) 2023 Anton Tsitavets - -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: - -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. - -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -// https://github.com/Bayselonarrend/OpenIntegrations - -// BSLLS:LatinAndCyrillicSymbolInWord-off -// BSLLS:IncorrectLineBreak-off -// BSLLS:UnusedLocalVariable-off - -#Region ServiceProgramInterface - -#Region BSP - -/////////////////////////////////////////////////////////////////////////////////////////////////////// -// Copyright (c) 2019, LLC 1C-Soft -// All rights reserved. This program and accompanying materials are provided -// in withоотinетwithтinии with уwithлоinиями лицензии Attribution 4.0 International (CC BY 4.0) -// License text available at: -// https://creativecommons.org/licenses/by/4.0/legalcode -/////////////////////////////////////////////////////////////////////////////////////////////////////// - -Function HMACSHA256(Val Key, Val Data) Export - - Return HMAC(Key, Data, HashFunction.SHA256, 64); - -EndFunction - -Function Hash(BinaryData, Type) Export - - Hashing = New DataHashing(Type); - Hashing.Add(BinaryData); - - Return Hashing.HashSum; - -EndFunction - -Function HMAC(Val Key, Val Data, Type, BlockSize) Export - - Twice = 2; - - If Key.Size() > BlockSize Then - Key = Hash(Key, Type); - EndIf; - - If Key.Size() <= BlockSize Then - Key = GetHexStringFromBinaryData(Key); - Key = Left(Key + RepeatString("00", BlockSize), BlockSize * Twice); - EndIf; - - Key = GetBinaryDataBufferFromBinaryData(GetBinaryDataFromHexString(Key)); - - Ipad = GetBinaryDataBufferFromHexString(RepeatString("36", BlockSize)); - Opad = GetBinaryDataBufferFromHexString(RepeatString("5c", BlockSize)); - - Ipad.WriteBitwiseExclusiveOr(0, Key); - Ikeypad = GetBinaryDataFromBinaryDataBuffer(ipad); - - Opad.WriteBitwiseExclusiveOr(0, Key); - Okeypad = GetBinaryDataFromBinaryDataBuffer(opad); - - Return Hash(ConcatenateBinaryData(okeypad, Hash(ConcatenateBinaryData(ikeypad, Data), Type)), Type); - -EndFunction - -Function ConcatenateBinaryData(BinaryData1, BinaryData2) Export - - BinaryDataArray = New Array; - BinaryDataArray.Add(BinaryData1); - BinaryDataArray.Add(BinaryData2); - - Return JoinBinaryData(BinaryDataArray); - -EndFunction - -Function RepeatString(String, Quantity) Export - - Parts = New Array(Quantity); - - For To = 1 For Quantity Do - Parts.Add(String); - EndDo; - - Return StrJoin(Parts, ""); - -EndFunction - -#EndRegion - -#EndRegion diff --git a/service/interim/en/OPI/src/CommonModules/OPI_Криптография/OPI_Криптография.mdo b/service/interim/en/OPI/src/CommonModules/OPI_Криптография/OPI_Криптография.mdo deleted file mode 100644 index c8cd120ec4..0000000000 --- a/service/interim/en/OPI/src/CommonModules/OPI_Криптография/OPI_Криптография.mdo +++ /dev/null @@ -1,11 +0,0 @@ - - - OPI_Cryptography - - ru - Toриптография (OPI) - - true - true - true - diff --git a/service/interim/en/OPI/src/CommonModules/OPI_ПолучениеДанныхТестов/Module.bsl b/service/interim/en/OPI/src/CommonModules/OPI_ПолучениеДанныхТестов/Module.bsl deleted file mode 100644 index 94e64c8822..0000000000 --- a/service/interim/en/OPI/src/CommonModules/OPI_ПолучениеДанныхТестов/Module.bsl +++ /dev/null @@ -1,470 +0,0 @@ -// Location OS: ./OInt/tools/Modules/OPI_TestDataRetrieval.os - -// MIT License - -// Copyright (c) 2023 Anton Tsitavets - -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: - -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. - -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -// https://github.com/Bayselonarrend/OpenIntegrations - -// BSLLS:LatinAndCyrillicSymbolInWord-off -// BSLLS:IncorrectLineBreak-off -// BSLLS:UsingHardcodePath-off -// BSLLS:Typo-off -// BSLLS:DeprecatedMessage-off -// BSLLS:UsingServiceTag-off -// BSLLS:ExecuteExternalCodeInCommonModule-off -// BSLLS:DuplicateStringLiteral-off - -//@skip-check use-non-recommended-method - -// Uncomment if OneScript is executed -// #Use "./internal" -// #Use asserts - -#Region ServiceProgramInterface - -Function GetTestingSectionMapping() Export - - StandardDependencies = "[Decode, Build]"; - GoogleDependencies = "Testing-GoogleWorkspace"; - - Sections = New Structure; - Sections.Insert("Telegram" , StandardDependencies); - Sections.Insert("VK" , StandardDependencies); - Sections.Insert("Viber" , StandardDependencies); - Sections.Insert("Twitter" , StandardDependencies); - Sections.Insert("YandexDisk" , StandardDependencies); - Sections.Insert("GoogleWorkspace", StandardDependencies); - Sections.Insert("GoogleCalendar" , GoogleDependencies); - Sections.Insert("GoogleDrive" , GoogleDependencies); - Sections.Insert("GoogleSheets" , GoogleDependencies); - Sections.Insert("Notion" , StandardDependencies); - Sections.Insert("Slack" , StandardDependencies); - Sections.Insert("Airtable" , StandardDependencies); - Sections.Insert("Dropbox" , StandardDependencies); - - Return Sections; - -EndFunction - -Function GetTestTable() Export - - Telegram = "Telegram"; - VK = "VK"; - YDisk = "YandexDisk"; - Calendar = "GoogleCalendar"; - Twitter = "Twitter"; - Viber = "Viber"; - Drive = "GoogleDrive"; - VSpace = "GoogleWorkspace"; - Notion = "Notion"; - Slack = "Slack"; - Tables = "GoogleSheets"; - AirT = "Airtable"; - Dropbox = "Dropbox"; - - TestTable = New ValueTable; - TestTable.Columns.Add("Method"); - TestTable.Columns.Add("Synonym"); - TestTable.Columns.Add("Section"); - - NewTest(TestTable, "Telegram_GetBotInfo" , "Get bot information" , Telegram); - NewTest(TestTable, "Telegram_GetUpdates" , "Get updates" , Telegram); - NewTest(TestTable, "Telegram_SetWebhook" , "Set Webhook" , Telegram); - NewTest(TestTable, "Telegram_SendTextMessage" , "Send text message" , Telegram); - NewTest(TestTable, "Telegram_SendImage" , "Send image" , Telegram); - NewTest(TestTable, "Telegram_SendVideo" , "Send video" , Telegram); - NewTest(TestTable, "Telegram_SendAudio" , "Send audio" , Telegram); - NewTest(TestTable, "Telegram_SendDocument" , "Send document" , Telegram); - NewTest(TestTable, "Telegram_SendGIF" , "Send GIF" , Telegram); - NewTest(TestTable, "Telegram_SendMediaGroup" , "Send media group" , Telegram); - NewTest(TestTable, "Telegram_SendLocation" , "Send location" , Telegram); - NewTest(TestTable, "Telegram_SendContact" , "Send contact" , Telegram); - NewTest(TestTable, "Telegram_SendPoll" , "Send poll" , Telegram); - NewTest(TestTable, "Telegram_ForwardMessage" , "Forward message" , Telegram); - NewTest(TestTable, "Telegram_BanUnban" , "Ban/Unban" , Telegram); - NewTest(TestTable, "Telegram_CreateInvitationLink" , "Create invitation link" , Telegram); - NewTest(TestTable, "Telegram_PinUnpinMessage" , "Pin/Unpin message" , Telegram); - NewTest(TestTable, "Telegram_GetMemberCount" , "Get participant count" , Telegram); - NewTest(TestTable, "Telegram_GetForumAvatarsList", "Get forum avatars list", Telegram); - NewTest(TestTable, "Telegram_CreateDeleteForumTopic" , "Create/Delete forum topic" , Telegram); - NewTest(TestTable, "Telegram_ChangeMainTopicName" , "Change main topic name" , Telegram); - NewTest(TestTable, "Telegram_HideShowMainTopic" , "Hide/Show main topic" , Telegram); - - NewTest(TestTable, "VK_CreateTokenLink" , "Create token retrieval link", VK); - NewTest(TestTable, "VK_CreateDeletePost" , "Create/Delete post" , VK); - NewTest(TestTable, "VK_CreateCompositePost" , "Create/Delete composite post" , VK); - NewTest(TestTable, "VK_CreatePoll" , "Create poll" , VK); - NewTest(TestTable, "VK_SaveDeleteImage" , "Add/Delete image" , VK); - NewTest(TestTable, "VK_CreateStory" , "Create story" , VK); - NewTest(TestTable, "VK_DiscussionMethods" , "Actions with discussions" , VK); - NewTest(TestTable, "VK_LikeRepostComment" , "Like/Repost/Comment" , VK); - NewTest(TestTable, "VK_GetStatistics" , "Get statistics" , VK); - NewTest(TestTable, "VK_GetPostStatistics" , "Get post statistics" , VK); - NewTest(TestTable, "VK_CreateAdCampaign" , "Create advertising campaign" , VK); - NewTest(TestTable, "VK_SendMessage" , "Send message" , VK); - NewTest(TestTable, "VK_GetProductCategories" , "Get product categories" , VK); - NewTest(TestTable, "VK_CreateProductSelection" , "Create product and selection" , VK); - NewTest(TestTable, "VK_CreateProductWithProperties" , "Create product with properties" , VK); - NewTest(TestTable, "VK_GetProductList" , "Get product list" , VK); - NewTest(TestTable, "VK_GetSelectionList" , "Get selection list" , VK); - NewTest(TestTable, "VK_GetPropertyList" , "Get property list" , VK); - NewTest(TestTable, "VK_GetOrderList" , "Get order list" , VK); - NewTest(TestTable, "VK_UploadVideo" , "Upload video" , VK); - - NewTest(TestTable, "YDisk_GetDiskInfo" , "Get disk information" , YDisk); - NewTest(TestTable, "YDisk_CreateFolder" , "Create folder" , YDisk); - NewTest(TestTable, "YDisk_UploadByUrlAndGetObject", "Upload by URL and get" , YDisk); - NewTest(TestTable, "YDisk_UploadDeleteFile" , "Upload/Delete file" , YDisk); - NewTest(TestTable, "YDisk_CreateObjectCopy" , "Create object copy" , YDisk); - NewTest(TestTable, "YDisk_GetDownloadLink" , "Get download link" , YDisk); - NewTest(TestTable, "YDisk_GetFileList" , "Get list of files" , YDisk); - NewTest(TestTable, "YDisk_MoveObject" , "Move object" , YDisk); - NewTest(TestTable, "YDisk_PublicObjectActions" , "Actions with public objects", YDisk); - NewTest(TestTable, "YDisk_GetPublishedList" , "Get published list" , YDisk); - - NewTest(TestTable, "GV_GetAuthorizationLink" , "Get authorization link" , VSpace); - NewTest(TestTable, "GV_GetToken" , "Get token" , VSpace); - NewTest(TestTable, "GV_UpdateToken" , "Refresh token" , VSpace); - - NewTest(TestTable, "GC_GetCalendarList" , "Get list of calendars" , Calendar); - NewTest(TestTable, "GC_CreateDeleteCalendar" , "Create/Delete calendar" , Calendar); - NewTest(TestTable, "GC_CreateDeleteEvent" , "Create/Delete event" , Calendar); - NewTest(TestTable, "GC_GetEventList" , "Get list of events" , Calendar); - - NewTest(TestTable, "GD_GetCatalogList" , "Get list of directories" , Drive); - NewTest(TestTable, "GD_UploadDeleteFile" , "Upload/Delete file" , Drive); - NewTest(TestTable, "GD_CreateDeleteComment" , "Create/Delete Comment" , Drive); - NewTest(TestTable, "GD_CreateCatalog" , "Create/Delete catalog" , Drive); - - NewTest(TestTable, "GT_CreateTable" , "Create table" , Tables); - NewTest(TestTable, "GT_GetTable" , "Get table" , Tables); - NewTest(TestTable, "GT_FillClearCells" , "Fill/Clear cells" , Tables); - - NewTest(TestTable, "Twitter_GetAuthorizationLink" , "Get authorization link" , Twitter); - NewTest(TestTable, "Twitter_UpdateToken" , "Refresh token" , Twitter); - NewTest(TestTable, "Twitter_CreateTextTweet" , "Text tweet" , Twitter); - NewTest(TestTable, "Twitter_CreateTweetWithImage" , "Tweet with image" , Twitter); - NewTest(TestTable, "Twitter_CreateTweetWithVideo" , "Tweet with video" , Twitter); - NewTest(TestTable, "Twitter_CreateTweetWithGif" , "Tweet with gif" , Twitter); - NewTest(TestTable, "Twitter_CreateTweetWithPoll" , "Tweet with poll" , Twitter); - - NewTest(TestTable, "Viber_GetChannelInfo" , "Get channel info" , Viber); - NewTest(TestTable, "Viber_GetUserData" , "Get user data" , Viber); - NewTest(TestTable, "Viber_GetOnlineUsers" , "Get online users" , Viber); - NewTest(TestTable, "Viber_SendTextMessage" , "Send text message" , Viber); - NewTest(TestTable, "Viber_SendImage" , "Send image" , Viber); - NewTest(TestTable, "Viber_SendFile" , "SendFile" , Viber); - NewTest(TestTable, "Viber_SendContact" , "Send contact" , Viber); - NewTest(TestTable, "Viber_SendLocation" , "SendLocation" , Viber); - NewTest(TestTable, "Viber_SendLink" , "SendLink" , Viber); - - NewTest(TestTable, "Notion_CreatePage" , "Create page" , Notion); - NewTest(TestTable, "Notion_CreateEditDatabase" , "Create/Edit database" , Notion); - NewTest(TestTable, "Notion_GetPageInfo" , "Get page info" , Notion); - NewTest(TestTable, "Notion_GetDatabaseInfo" , "Get database info" , Notion); - NewTest(TestTable, "Notion_CreatePageInDatabase" , "Create page in database" , Notion); - NewTest(TestTable, "Notion_EditPageProperties" , "Edit page properties" , Notion); - NewTest(TestTable, "Notion_CreateDeleteBlock" , "Create/Delete block" , Notion); - NewTest(TestTable, "Notion_GetUsers" , "Get users" , Notion); - NewTest(TestTable, "Notion_GetUserData" , "Get user data" , Notion); - - NewTest(TestTable, "Slack_GetBotInfo" , "Get bot information" , Slack); - NewTest(TestTable, "Slack_GetUserList" , "Get user list" , Slack); - NewTest(TestTable, "Slack_GetRegionList" , "Get region list" , Slack); - NewTest(TestTable, "Slack_SendDeleteMessage" , "Send/Delete message" , Slack); - NewTest(TestTable, "Slack_SendDeleteEphemeral" , "Send/Delete ephemeral" , Slack); - NewTest(TestTable, "Slack_GetScheduledMessages" , "Get scheduled messages" , Slack); - NewTest(TestTable, "Slack_CreateArchiveChannel" , "Create/Archive channel" , Slack); - NewTest(TestTable, "Slack_GetChannelList" , "Get channel list" , Slack); - NewTest(TestTable, "Slack_OpenCloseDialog" , "Open/Close dialog" , Slack); - NewTest(TestTable, "Slack_GetFileList" , "Get list of files" , Slack); - NewTest(TestTable, "Slack_UploadDeleteFile" , "Upload/Delete file" , Slack); - NewTest(TestTable, "Slack_GetExternalFileList" , "Get external file list" , Slack); - NewTest(TestTable, "Slack_UploadDeleteExternalFile" , "Upload/Delete external file" , Slack); - - NewTest(TestTable, "AT_CreateDatabase" , "Create/Edit database" , AirT); - NewTest(TestTable, "AT_CreateTable" , "Create/Edit table" , AirT); - NewTest(TestTable, "AT_CreateField" , "Create/Edit field" , AirT); - NewTest(TestTable, "AT_CreateDeleteRecords" , "Create/Delete records" , AirT); - - NewTest(TestTable, "Dropbox_GetUpdateToken" , "Get/Update token" , Dropbox); - NewTest(TestTable, "Dropbox_UploadFile" , "Upload file" , Dropbox); - NewTest(TestTable, "Dropbox_UploadFileByURL" , "Upload file by URL" , Dropbox); - NewTest(TestTable, "Dropbox_CreateFolder" , "Create folder" , Dropbox); - NewTest(TestTable, "Dropbox_CreateDeleteTag" , "Create/Delete tag" , Dropbox); - NewTest(TestTable, "Dropbox_GetAccount" , "Get account data" , Dropbox); - NewTest(TestTable, "Dropbox_AccessManagement" , "Access management" , Dropbox); - - Return TestTable; - -EndFunction - -Function ExpectsThat(Value) Export - - Try - - Module = GetCommonModule("UTest"); - Awaiting = TypeValue(Module) = Type("CommonModule"); - Return Module.ExpectsThat(Value); - - Except - Return Awaiting.What(Value); - EndTry; - -EndFunction - -Function FormYAXTests() Export - - Module = GetCommonModule("UTTests"); - Sections = GetTestingSectionMapping(); - TestTable = GetTestTable(); - - For Each Section In Sections Do - - CurrentSection = Section.Key; - Filter = New Structure("Section", CurrentSection); - SectionTests = TestTable.FindLines(Filter); - - Set = Module.AddTestSet(CurrentSection); - - For Each Test In SectionTests Do - Set.AddServerTest(Test.Method, Test.Synonym); - EndDo; - - EndDo; - - Return ""; - -EndFunction - -Function FormAssertsTests() Export - - TestTable = GetTestTable(); - ArrayOfTests = New Array; - - For Each Test In TestTable Do - ArrayOfTests.Add(Test.Method); - EndDo; - - Return ArrayOfTests; - -EndFunction - -Function GetParameter(Parameter) Export - - Path = DataFilePath(); - Return GetValueFromFile(Parameter, Path); - -EndFunction - -Function GetBinary(Parameter) Export - - Path = DataFilePath(); - LocalParameter = Parameter + "Local"; - MainValue = GetValueFromFile(Parameter , Path); - LocalValue = GetValueFromFile(LocalParameter, Path); - - LocalFile = New File(LocalValue); - - If LocalFile.Exists() Then - Value = New BinaryData(LocalValue); - Else - Value = MainValue; - EndIf; - - If TypeValue(Value) = Type("String") Then - Value = GetFilePath(Value, LocalParameter); - EndIf; - - Return Value; - -EndFunction - -Function GetFilePath(Val Path, LocalParameter, Val SaveLocally = True) Export - - If StrFind(Path, "http") > 0 - Or StrFind(Path, "www") > 0 Then - - AndVF = GetTempFileName(); - CopyFile(Path, AndVF); - Path = AndVF; - Binary = New BinaryData(Path); - - If SaveLocally Then - WriteParameter(LocalParameter, AndVF); - Else - DeleteFiles(AndVF); - EndIf; - - Else - - Binary = New BinaryData(Path); - - EndIf; - - Return Binary; - -EndFunction - -Procedure ParameterToCollection(Parameter, Collection) Export - - Value = GetParameter(Parameter); - Collection.Insert(Parameter, Value); - -EndProcedure - -Procedure BinaryToCollection(Parameter, Collection) Export - - Value = GetBinary(Parameter); - Collection.Insert(Parameter, Value); - -EndProcedure - -Procedure WriteParameter(Parameter, Value) Export - - Path = DataFilePath(); - WriteParameterToFile(Parameter, Value, Path); - -EndProcedure - -Procedure WriteLog(Val Result, Val Method, Val Library = "") Export - - Header = String(OPI_Tools.GetCurrentDate()) + " | " + Method; - - Try - Data = OPI_Tools.JSONString(Result); - Except - Data = "Not JSON: " + String(Result); - EndTry; - - Data = " " + Data; - - Notify(Header); - Notify(Symbols.PS); - Notify(Data); - Notify(Symbols.PS); - Notify("---------------------------------"); - Notify(Symbols.PS); - - If ValueFilled(Library) Then - WriteLogFile(Data, Method, Library); - EndIf; - -EndProcedure - -#EndRegion - -#Region ServiceProceduresAndFunctions - -Function GetValueFromFile(Parameter, Path) - - Values = OPI_Tools.ReadJSONFile(Path); - Return ?(Values.Property(Parameter), Values[Parameter], ""); - -EndFunction - -Function DataFilePath() - - Path = ""; - PossiblePaths = New Array; - PossiblePaths.Add("./data.json"); - PossiblePaths.Add("C:\GDrive\My Drive\data.json"); - PossiblePaths.Add("D:\GD\My Drive\data.json"); - - For Each PossiblePath In PossiblePaths Do - - RepositoryFile = New File(PossiblePath); - - If RepositoryFile.Exists() Then - Path = PossiblePath; - EndIf; - - EndDo; - - Return Path; - -EndFunction - -Function GetCommonModule(Val Name) - УwithтаноinитьБезопаwithныйMode(True); - Module = Calculate(Name); - УwithтаноinитьБезопаwithныйMode(False); - Return Module; -EndFunction - -Procedure NewTest(ValueTable, Val Method, Val Synonym, Val Section) - - NewTest = ValueTable.Add(); - NewTest.Method = Method; - NewTest.Synonym = Synonym; - NewTest.Section = Section; - -EndProcedure - -Procedure WriteParameterToFile(Val Parameter, Val Value, Val Path) - - Values = OPI_Tools.ReadJSONFile(Path); - Values.Insert(Parameter, Value); - - Record = New WritingJSON; - JSONWriteParameters = New JSONWriteParameters(JSONLineBreak.Auto, Symbols.Tab); - Record.OpenFile(Path, , , JSONWriteParameters); - WriteJSON(Record, Values); - Record.Close(); - -EndProcedure - -Procedure WriteLogFile(Val Data, Val Method, Val Library) - - Try - - LogPath = "./docs/results"; - LibraryLogPath = LogPath + "/" + Library; - - LogDirectory = New File(LogPath); - - If Not LogDirectory.Exists() Then - CreateDirectory(LogPath); - EndIf; - - LibraryLogCatalog = New File(LibraryLogPath); - - If Not LibraryLogCatalog.Exists() Then - CreateDirectory(LibraryLogPath); - EndIf; - - FilePath = LibraryLogPath + "/" + Method + ".log"; - LogFile = New File(FilePath); - - If Not LogFile.Exists() Then - LogDocument = New TextDocument; - LogDocument.SetText(Data); - LogDocument.Write(FilePath); - EndIf; - - Except - Notify("Failed to write log file!: " + ErrorDescription()); - EndTry; - -EndProcedure - -#EndRegion diff --git a/service/interim/en/OPI/src/CommonModules/OPI_ПолучениеДанныхТестов/OPI_ПолучениеДанныхТестов.mdo b/service/interim/en/OPI/src/CommonModules/OPI_ПолучениеДанныхТестов/OPI_ПолучениеДанныхТестов.mdo deleted file mode 100644 index 60198d8e35..0000000000 --- a/service/interim/en/OPI/src/CommonModules/OPI_ПолучениеДанныхТестов/OPI_ПолучениеДанныхТестов.mdo +++ /dev/null @@ -1,11 +0,0 @@ - - - OPI_GetTestData - - - OPI получение data tests - - true - true - true - diff --git a/service/interim/en/OPI/src/CommonModules/OPI_ПреобразованиеТипов/Module.bsl b/service/interim/en/OPI/src/CommonModules/OPI_ПреобразованиеТипов/Module.bsl deleted file mode 100644 index 3c3ddccd4d..0000000000 --- a/service/interim/en/OPI/src/CommonModules/OPI_ПреобразованиеТипов/Module.bsl +++ /dev/null @@ -1,320 +0,0 @@ -// Location OS: ./OInt/tools/Modules/OPI_TypeConversion.os - -// MIT License - -// Copyright (c) 2023 Anton Tsitavets - -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: - -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. - -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -// https://github.com/Bayselonarrend/OpenIntegrations - -// BSLLS:LatinAndCyrillicSymbolInWord-off -// BSLLS:IncorrectLineBreak-off -// BSLLS:UnusedLocalVariable-off - -// #Use "./internal" - -#Region ServiceProgramInterface - -Procedure GetBinaryData(Value) Export - - If Value = Undefined Then - Return; - EndIf; - - Try - - If TypeValue(Value) = Type("BinaryData") Then - Return; - Else - - File = New File(Value); - - If File.Exists() Then - Value = New BinaryData(Value); - - ElsIf StrFind(Value, "//") Then - - Value = OPI_Tools.Get(Value); - - Else - - Value = Base64Value(Value); - - EndIf; - - EndIf; - - Except - Raise "Error getting binary data from parameter: " + ErrorDescription(); - EndTry; - -EndProcedure - -Procedure GetBinaryOrStream(Value) Export - - If Value = Undefined Then - Return; - EndIf; - - If TypeValue(Value) <> Type("String") Then - GetBinaryData(Value); - Return; - EndIf; - - File = New File(Value); - - If File.Exists() Then - Value = New FileStream(Value, FileOpenMode.Open); - Else - GetBinaryData(Value); - EndIf; - -EndProcedure - -Procedure GetCollection(Value) Export - - If Value = Undefined Then - Return; - EndIf; - - Try - - InitialValue = Value; - - If ThisIsCollection(Value) Then - Return; - Else - - If TypeValue(Value) = Type("BinaryData") Then - Value = GetStringFromBinaryData(Value); - Else - Value = OPI_Tools.NumberToString(Value); - EndIf; - - File = New File(Value); - ReadingJSON = New ReadingJSON; - - If File.Exists() Then - - ReadingJSON.OpenFile(Value); - - ElsIf StringStartsWith(nReg(Value), "http") Then - - AndVF = GetTempFileName(); - CopyFile(Value, AndVF); - ReadingJSON.OpenFile(AndVF); - ReadingJSON.Read(); - - DeleteFiles(AndVF); - - Else - - ReadingJSON.SetString(ShortLP(Value)); - - EndIf; - - Value = ReadJSON(ReadingJSON, True, Undefined, JSONDateFormat.ISO); - ReadingJSON.Close(); - - If (Not ThisIsCollection(Value)) Or Not ValueFilled(Value) Then - - Value = InitialValue; - GetArray(Value); - - EndIf; - - EndIf; - - Except - - Value = InitialValue; - GetArray(Value); - - EndTry; - -EndProcedure - -Procedure GetArray(Value) Export - - If TypeValue(Value) = Type("Array") Then - Return; - EndIf; - - If TypeValue(Value) = Type("String") - And StringStartsWith(Value, "[") - And StrEndsWith(Value, "]") Then - - CommaInQuotes = "','"; - - Value = StringReplace(Value, "['" , ""); - Value = StringReplace(Value, "']" , ""); - Value = StringReplace(Value, "', '" , CommaInQuotes); - Value = StringReplace(Value, "' , '", CommaInQuotes); - Value = StringReplace(Value, "' ,'" , CommaInQuotes); - - Value = StrSplit(Value, CommaInQuotes, False); - - For N = 0 For Value.WithinBoundary() Do - Value[N] = ShortLP(Value[N]); - EndDo; - - Else - - If TypeValue(Value) = Type("Number") Then - Value = OPI_Tools.NumberToString(Value); - EndIf; - - OPI_Tools.ValueToArray(Value); - - EndIf; - -EndProcedure - -Procedure GetBoolean(Value) Export - - If Value = Undefined Then - Return; - EndIf; - - Try - - If TypeValue(Value) = Type("Boolean") Then - Return; - Else - Value = Boolean(Value); - EndIf; - - Except - Raise "Error getting boolean data from parameter"; - EndTry; - -EndProcedure - -Procedure GetLine(Value, Val FromSource = False) Export - - If Value = Undefined Then - Return; - EndIf; - - Try - - If ThisIsSymbolic(Value) Then - - If Not FromSource Then - Value = OPI_Tools.NumberToString(Value); - Return; - EndIf; - - Value = OPI_Tools.NumberToString(Value); - File = New File(Value); - - If File.Exists() Then - - ReadingText = New ReadingText(Value); - Value = ReadingText.Read(); - ReadingText.Close(); - - ElsIf StringStartsWith(nReg(Value), "http") Then - - AndVF = GetTempFileName(); - CopyFile(Value, AndVF); - - ReadingText = New ReadingText(AndVF); - Value = ReadingText.Read(); - ReadingText.Close(); - - DeleteFiles(AndVF); - - Else - - Return; - - EndIf; - - ElsIf TypeValue(Value) = Type("BinaryData") Then - - Value = GetStringFromBinaryData(Value); - - ElsIf ThisIsCollection(Value) Then - - Value = OPI_Tools.JSONString(Value); - - Else - Return; - EndIf; - - Except - Value = String(Value); - Return; - EndTry; - -EndProcedure - -Procedure GetDate(Value) Export - - If Value = Undefined Then - Return; - EndIf; - - Date = "Date"; - - Try - - If TypeValue(Value) = Type(Date) Then - Return; - Else - Value = XMLValue(Type(Date), Value); - EndIf; - - Except - OOD = New TypeDescription(Date); - Value = OOD.ConvertValue(Value); - EndTry; - -EndProcedure - -Procedure GetNumber(Value) Export - - TypeDescription = New TypeDescription("Number"); - Value = TypeDescription.ConvertValue(Value); - -EndProcedure - -#EndRegion - -#Region ServiceProceduresAndFunctions - -Function ThisIsCollection(Val Value) - - Return TypeValue(Value) = Type("Array") - Or TypeValue(Value) = Type("Structure") - Or TypeValue(Value) = Type("Match"); - -EndFunction - -Function ThisIsSymbolic(Val Value) - - Return TypeValue(Value) = Type("String") - Or TypeValue(Value) = Type("Number") - Or TypeValue(Value) = Type("Date"); - -EndFunction - -#EndRegion diff --git a/service/interim/en/OPI/src/CommonModules/OPI_ПреобразованиеТипов/OPI_ПреобразованиеТипов.mdo b/service/interim/en/OPI/src/CommonModules/OPI_ПреобразованиеТипов/OPI_ПреобразованиеТипов.mdo deleted file mode 100644 index e0e787b206..0000000000 --- a/service/interim/en/OPI/src/CommonModules/OPI_ПреобразованиеТипов/OPI_ПреобразованиеТипов.mdo +++ /dev/null @@ -1,11 +0,0 @@ - - - OPI_TypeConversion - - ru - Преобразоinание typeоin (OPI) - - true - true - true - diff --git a/service/interim/en/OPI/src/CommonModules/OPI_Тесты/Module.bsl b/service/interim/en/OPI/src/CommonModules/OPI_Тесты/Module.bsl deleted file mode 100644 index 70e6c2c9aa..0000000000 --- a/service/interim/en/OPI/src/CommonModules/OPI_Тесты/Module.bsl +++ /dev/null @@ -1,5307 +0,0 @@ -// Location OS: ./OInt/tests/Modules/internal/OPI_Tests.os - -// MIT License - -// Copyright (c) 2023 Anton Tsitavets - -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: - -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. - -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -// https://github.com/Bayselonarrend/OpenIntegrations - -// Test suite for YAxUnit - -// BSLLS:Typo-off -// BSLLS:LatinAndCyrillicSymbolInWord-off -// BSLLS:IncorrectLineBreak-off -// BSLLS:UsingServiceTag-off -// BSLLS:UnusedParameters-off -// BSLLS:DuplicateStringLiteral-off - -// @skip-check undefined-variable -// @skip-check wrong-string-literal-content - -// Uncomment if OneScript is executed -// #Use oint -// #Use asserts - -#Region ServiceProgramInterface - -// For YAxUnit - -Procedure ExecutableScripts() Export - - OPI_GetTestData.FormYAXTests(); - -EndProcedure - -// For Asserts - -Function GetTestList(UnitTesting) Export - - Return OPI_GetTestData.FormAssertsTests(); - -EndFunction - -#Region RunnableTests - -#Region Telegram - -Procedure Telegram_GetBotInfo() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Telegram_Token", TestParameters); - - Telegram_GetBotInformation(TestParameters); - -EndProcedure - -Procedure Telegram_GetUpdates() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Telegram_Token", TestParameters); - - Telegram_DeleteWebhook(TestParameters); - Telegram_GetUpdates(TestParameters); - -EndProcedure - -Procedure Telegram_SetWebhook() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Telegram_Token", TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_URL" , TestParameters); - - Telegram_SetWebhook(TestParameters); - Telegram_DeleteWebhook(TestParameters); - -EndProcedure - -Procedure Telegram_SendTextMessage() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChatID" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChannelID", TestParameters); - OPI_GetTestData.ParameterToCollection("String" , TestParameters); - - Telegram_SendTextMessage(TestParameters); - -EndProcedure - -Procedure Telegram_SendImage() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChatID" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChannelID", TestParameters); - OPI_GetTestData.ParameterToCollection("String" , TestParameters); - OPI_GetTestData.ParameterToCollection("Picture" , TestParameters); - - Telegram_SendPicture(TestParameters); - Telegram_DownloadFile(TestParameters); - -EndProcedure - -Procedure Telegram_SendVideo() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChatID" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChannelID", TestParameters); - OPI_GetTestData.ParameterToCollection("String" , TestParameters); - OPI_GetTestData.ParameterToCollection("Video" , TestParameters); - - Telegram_SendVideo(TestParameters); - Telegram_DownloadFile(TestParameters); - -EndProcedure - -Procedure Telegram_SendAudio() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChatID" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChannelID", TestParameters); - OPI_GetTestData.ParameterToCollection("String" , TestParameters); - OPI_GetTestData.ParameterToCollection("Audio" , TestParameters); - - Telegram_SendAudio(TestParameters); - Telegram_DownloadFile(TestParameters); - -EndProcedure - -Procedure Telegram_SendDocument() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChatID" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChannelID", TestParameters); - OPI_GetTestData.ParameterToCollection("String" , TestParameters); - OPI_GetTestData.ParameterToCollection("Document" , TestParameters); - - Telegram_SendDocument(TestParameters); - -EndProcedure - -Procedure Telegram_SendGIF() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChatID" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChannelID", TestParameters); - OPI_GetTestData.ParameterToCollection("String" , TestParameters); - OPI_GetTestData.ParameterToCollection("GIF" , TestParameters); - - Telegram_SendGif(TestParameters); - -EndProcedure - -Procedure Telegram_SendMediaGroup() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChatID" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChannelID", TestParameters); - OPI_GetTestData.ParameterToCollection("String" , TestParameters); - OPI_GetTestData.ParameterToCollection("Picture" , TestParameters); - OPI_GetTestData.ParameterToCollection("Video" , TestParameters); - - Telegram_SendMediaGroup(TestParameters); - -EndProcedure - -Procedure Telegram_SendLocation() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChatID" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChannelID", TestParameters); - OPI_GetTestData.ParameterToCollection("Long" , TestParameters); - OPI_GetTestData.ParameterToCollection("Lat" , TestParameters); - - Telegram_SendLocation(TestParameters); - -EndProcedure - -Procedure Telegram_SendContact() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChatID" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChannelID", TestParameters); - OPI_GetTestData.ParameterToCollection("Name" , TestParameters); - OPI_GetTestData.ParameterToCollection("Surname" , TestParameters); - OPI_GetTestData.ParameterToCollection("Phone" , TestParameters); - - Telegram_SendContact(TestParameters); - -EndProcedure - -Procedure Telegram_SendPoll() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChatID" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChannelID", TestParameters); - - Telegram_SendPoll(TestParameters); - -EndProcedure - -Procedure Telegram_ForwardMessage() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChatID" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChannelID" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChannelMessageID", TestParameters); - - Telegram_ForwardMessage(TestParameters); - -EndProcedure - -Procedure Telegram_BanUnban() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChatID" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChannelID" , TestParameters); - - Telegram_Ban(TestParameters); - Telegram_Unban(TestParameters); - -EndProcedure - -Procedure Telegram_CreateInvitationLink() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChannelID", TestParameters); - - Telegram_CreateInviteLink(TestParameters); - -EndProcedure - -Procedure Telegram_PinUnpinMessage() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChannelID" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChannelMessageID", TestParameters); - - Telegram_PinMessage(TestParameters); - Telegram_UnpinMessage(TestParameters); - -EndProcedure - -Procedure Telegram_GetMemberCount() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChannelID", TestParameters); - - Telegram_GetParticipantCount(TestParameters); - -EndProcedure - -Procedure Telegram_GetForumAvatarsList() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Telegram_Token", TestParameters); - - Telegram_GetForumAvatarList(TestParameters); - -EndProcedure - -Procedure Telegram_CreateDeleteForumTopic() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ForumID", TestParameters); - OPI_GetTestData.ParameterToCollection("Picture" , TestParameters); - OPI_GetTestData.ParameterToCollection("String" , TestParameters); - - Telegram_CreateForumTopic(TestParameters); - Telegram_EditForumTopic(TestParameters); - Telegram_CloseForumTopic(TestParameters); - Telegram_OpenForumTopic(TestParameters); - Telegram_ClearPinnedMessagesList(TestParameters); - Telegram_DeleteForumTopic(TestParameters); - -EndProcedure - -Procedure Telegram_HideShowMainTopic() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ForumID", TestParameters); - - Telegram_HideMainForumTopic(TestParameters); - Telegram_ShowMainForumTopic(TestParameters); - -EndProcedure - -Procedure Telegram_ChangeMainTopicName() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ForumID", TestParameters); - - Telegram_ChangeMainTopicName(TestParameters); - -EndProcedure - -#EndRegion - -#Region VK - -Procedure VK_CreateTokenLink() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("VK_AppID", TestParameters); - - VK_CreateTokenRetrievalLink(TestParameters); - -EndProcedure - -Procedure VK_CreateDeletePost() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Picture" , TestParameters); - OPI_GetTestData.ParameterToCollection("Picture2", TestParameters); - - VK_CreatePost(TestParameters); - VK_DeletePost(TestParameters); - -EndProcedure - -Procedure VK_CreateCompositePost() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Picture" , TestParameters); - OPI_GetTestData.ParameterToCollection("Video" , TestParameters); - - VK_CreateCompositePost(TestParameters); - -EndProcedure - -Procedure VK_CreatePoll() Export - - VK_CreatePoll(); - -EndProcedure - -Procedure VK_SaveDeleteImage() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Picture" , TestParameters); - - VK_CreateAlbum(TestParameters); - VK_SavePictureToAlbum(TestParameters); - VK_DeleteImage(TestParameters); - VK_DeleteAlbum(TestParameters); - -EndProcedure - -Procedure VK_CreateStory() Export - - TestParameters = New Match; - OPI_GetTestData.ParameterToCollection("Picture" , TestParameters); - - VK_CreateStory(TestParameters); - -EndProcedure - -Procedure VK_DiscussionMethods() Export - - TestParameters = New Structure; - Parameters = GetVKParameters(); - - VK_CreateDiscussion(TestParameters); - VK_CloseDiscussion(TestParameters); - VK_OpenDiscussion(TestParameters); - VK_PostToDiscussion(TestParameters); - - OPI_VK.CloseDiscussion(TestParameters["VK_ConvID"], True, Parameters); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure VK_LikeRepostComment() Export - - Parameters = GetVKParameters(); - Text = "Post from autotest"; - Message = "Message from autotest"; - TypeMatch = Type("Match"); - TypeNumber = Type("Number"); - Response = "response"; - - Result = OPI_VK.CreatePost(Text, New Array, , , Parameters); - - PostID = Result[Response]["post_id"]; - Result = OPI_VK.LikePost(PostID, , Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "LikePost"); - - OPI_Tools.Pause(5); - - OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch).Filled(); - OPI_GetTestData.ExpectsThat(Result[Response]["likes"]).HasType(TypeNumber).Filled(); - - ExternalPost = 2571; - ExternalWall = -218704372; - - Result = OPI_VK.MakeRepost(ExternalPost, ExternalWall, , , Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "MakeRepost"); - - OPI_Tools.Pause(5); - - OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch).Filled(); - OPI_GetTestData.ExpectsThat(Result[Response]["success"]).HasType(TypeNumber).Equal(1); - OPI_GetTestData.ExpectsThat(Result[Response]["wall_repost_count"]).HasType(TypeNumber).Equal(1); - - Result = OPI_VK.WriteComment(PostID, Parameters["owner_id"], Message, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "WriteComment"); - - OPI_Tools.Pause(5); - - OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch).Filled(); - OPI_GetTestData.ExpectsThat(Result[Response]["comment_id"]).HasType(TypeNumber).Filled(); - - OPI_VK.DeletePost(PostID, Parameters); - OPI_VK.DeletePost(Result[Response]["post_id"], Parameters); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure VK_GetStatistics() Export - - CurrentDate = OPI_Tools.GetCurrentDate(); - Parameters = GetVKParameters(); - Date0 = StartOfDay(CurrentDate); - Date1 = EndOfDay(Date0); - TypeMatch = Type("Match"); - - Result = OPI_VK.GetStatistics(Date0, Date1, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetStatistics"); - - OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch).Filled(); - OPI_GetTestData.ExpectsThat(Result["response"][0]["visitors"]).HasType(TypeMatch).Filled(); - OPI_GetTestData.ExpectsThat(Result["response"][0]["reach"]).HasType(TypeMatch).Filled(); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure VK_GetPostStatistics() Export - - Parameters = GetVKParameters(); - - ArrayOfPosts = New Array; - ArrayOfPosts.Add(214); - ArrayOfPosts.Add(215); - - Result = OPI_VK.GetPostStatistics(ArrayOfPosts, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetPostStatistics"); - - OPI_GetTestData.ExpectsThat(Result).HasType("Array").HasLength(2); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure VK_CreateAdCampaign() Export - - Parameters = GetVKParameters(); - CabinetID = OPI_GetTestData.GetParameter("VK_AdsCabinetID"); - Name = "TestCampaign"; - TypeMatch = Type("Match"); - TypeNumber = Type("Number"); - Response = "response"; - UID = "id"; - - Result = OPI_VK.CreateAdvertisingCampaign(CabinetID, Name, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateAdvertisingCampaign"); - - Result = Result[Response][0]; - - OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); - OPI_GetTestData.ExpectsThat(Result["error_code"]).HasType(TypeNumber).Equal(602); - OPI_GetTestData.ExpectsThat(Result[UID]).HasType(TypeNumber).Filled(); - - CampaignID = Result[UID]; - CategoryID = 126; - Limit = 150; - - Result = OPI_VK.CreatePost(Name, New Array, , , Parameters); - PostID = Result[Response]["post_id"]; - - Result = OPI_VK.CreateAd(CampaignID - , Limit - , CategoryID - , PostID - , CabinetID - , Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateAd"); - - Result = Result[Response][0]; - - OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); - OPI_GetTestData.ExpectsThat(Result["error_code"]).HasType(TypeNumber).Equal(602); - OPI_GetTestData.ExpectsThat(Result[UID]).HasType(TypeNumber).Filled(); - - AnnouncementID = Result[UID]; - Result = OPI_VK.PauseAdvertisingAd(CabinetID, AnnouncementID, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "PauseAdvertisingAd"); - - Result = Result[Response][0]; - - OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); - OPI_GetTestData.ExpectsThat(Result[UID]).HasType(TypeNumber).Filled(); - - OPI_VK.DeletePost(PostID, Parameters); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure VK_SendMessage() Export - - Parameters = GetVKParameters(); - User = OPI_GetTestData.GetParameter("VK_UserID"); - Token = OPI_GetTestData.GetParameter("VK_CommunityToken"); - Text = "Message from autotest"; - - ButtonArray = New Array; - ButtonArray.Add("Button 1"); - ButtonArray.Add("Button 2"); - - Keyboard = OPI_VK.FormKeyboard(ButtonArray); - Result = OPI_VK.WriteMessage(Text, User, Token, Keyboard, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "WriteMessage"); - - OPI_GetTestData.ExpectsThat(Result).HasType("Match"); - OPI_GetTestData.ExpectsThat(Result["response"]).HasType("Number").Filled(); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure VK_GetProductCategories() Export - - Parameters = GetVKParameters(); - Result = OPI_VK.GetProductCategoryList(Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetProductCategoryList"); - - OPI_GetTestData.ExpectsThat(Result) - .HasType("Match") - .Filled(); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure VK_CreateProductSelection() Export - - Parameters = GetVKParameters(); - TypeMatch = Type("Match"); - TypeNumber = Type("Number"); - Response = "response"; - Image = OPI_GetTestData.GetBinary("Picture"); - AndVF = GetTempFileName("png"); - Image.Write(AndVF); - - Result = OPI_VK.CreateProductCollection("TestCollection" - , Image - , True - , False - , Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateProductCollection"); - - OPI_Tools.Pause(5); - - OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); - OPI_GetTestData.ExpectsThat(Result[Response]["albums_count"]).HasType(TypeNumber).Filled(); - OPI_GetTestData.ExpectsThat(Result[Response]["market_album_id"]).HasType(TypeNumber).Filled(); - - SelectionID = Result[Response]["market_album_id"]; - - Result = OPI_VK.EditProductCollection("EditedCollection", SelectionID, , , , Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "EditProductCollection"); - - OPI_Tools.Pause(5); - - OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); - OPI_GetTestData.ExpectsThat(Result[Response]).HasType(TypeNumber).Equal(1); - - ImageArray = New Array; - ImageArray.Add(OPI_GetTestData.GetBinary("Picture")); - ImageArray.Add(OPI_GetTestData.GetBinary("Picture2")); - - Product = New Match(); - Product.Insert("Name" , "TestProduct"); - Product.Insert("Description" , "Product description"); - Product.Insert("Category" , "20173"); - Product.Insert("Price" , 1); - Product.Insert("OldPrice" , 15); - Product.Insert("MainPhoto" , Image); - Product.Insert("URL" , "https://github.com/Bayselonarrend/OpenIntegrations"); - Product.Insert("AdditionalPhotos" , ImageArray); - Product.Insert("MainInGroup" , True); - Product.Insert("Width" , 20); - Product.Insert("Height" , 30); - Product.Insert("Depth" , 40); - Product.Insert("Weight" , 100); - Product.Insert("SKU" , "12345"); - Product.Insert("AvailableBalance" , "10"); - - Result = OPI_VK.AddProduct(Product, SelectionID, Parameters); // Adding product - - // !OInt OPI_GetTestData.WriteLog(Result, "AddProduct"); - - OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); - OPI_GetTestData.ExpectsThat(Result[Response]["market_item_id"]).HasType(TypeNumber).Filled(); - - ProductID = Result[Response]["market_item_id"]; - - Product = New Match; - Product.Insert("Name", "EditedTestProduct"); - - Result = OPI_VK.EditProduct(ProductID, Product, , Parameters); // Change product - - // !OInt OPI_GetTestData.WriteLog(Result, "EditProduct"); - - Check_VKTrue(Result); - - Result = OPI_VK.AddProductToSelection(ProductID, SelectionID, Parameters); // Adding in selection - - // !OInt OPI_GetTestData.WriteLog(Result, "AddProductToSelection"); - - OPI_Tools.Pause(5); - - OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); - OPI_GetTestData.ExpectsThat(Result[Response]).HasType(TypeNumber).Filled(); - - Result = OPI_VK.RemoveProductFromSelection(ProductID, SelectionID, Parameters); // Deletes from selections - - // !OInt OPI_GetTestData.WriteLog(Result, "RemoveProductFromSelection"); - - OPI_Tools.Pause(5); - Check_VKTrue(Result); - - Result = OPI_VK.DeleteProduct(ProductID, Parameters); // Deletion product - - // !OInt OPI_GetTestData.WriteLog(Result, "DeleteProduct"); - - OPI_Tools.Pause(5); - Check_VKTrue(Result); - - Result = OPI_VK.DeleteSelection(SelectionID, Parameters); // Removal selections - - // !OInt OPI_GetTestData.WriteLog(Result, "DeleteSelection"); - - OPI_Tools.Pause(5); - Check_VKTrue(Result); - - DeleteFiles(AndVF); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure VK_CreateProductWithProperties() Export - - Parameters = GetVKParameters(); - TypeMatch = Type("Match"); - TypeNumber = Type("Number"); - MII = "market_item_id"; - Response = "response"; - Yellow = "Yellow"; - Red = "Red"; - Image = OPI_GetTestData.GetBinary("Picture"); - AndVF = GetTempFileName("png"); - Image.Write(AndVF); - - OptionArray = New Array; - OptionArray.Add(Yellow); - OptionArray.Add("Blue"); - OptionArray.Add(Red); - - Result = OPI_VK.CreateProductProperty("Color", Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateProductProperty"); - - OPI_Tools.Pause(5); - - Property = Result[Response]["property_id"]; - Property = OPI_Tools.NumberToString(Property); - - PropertyMatch = New Match; - - OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); - OPI_GetTestData.ExpectsThat(Result[Response]["property_id"]).HasType(TypeNumber).Filled(); - - Result = OPI_VK.EditProductProperty("Color (fromм.)", Property, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "EditProductProperty"); - - OPI_Tools.Pause(5); - - Check_VKTrue(Result); - - For Each Option In OptionArray Do - - Result = OPI_VK.AddProductPropertyVariant(Option, Property, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "AddProductPropertyVariant"); - - OPI_Tools.Pause(5); - - OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); - OPI_GetTestData.ExpectsThat(Result[Response]["variant_id"]).HasType(TypeNumber).Filled(); - - VariantID = Result[Response]["variant_id"]; - PropertyMatch.Insert(Option, VariantID); - - Result = OPI_VK.EditProductPropertyVariant(Option + String(New UniqueIdentifier()) - , Property - , VariantID - , Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "EditProductPropertyVariant"); - - Check_VKTrue(Result); - - EndDo; - - ImageArray = New Array; - ImageArray.Add(AndVF); - ImageArray.Add(Image); - - Product = New Match(); - Product.Insert("Name" , "TestProduct (" + Yellow + ")"); - Product.Insert("Description" , "Product description"); - Product.Insert("Category" , "20173"); - Product.Insert("Price" , 1); - Product.Insert("OldPrice" , 15); - Product.Insert("MainPhoto" , Image); - Product.Insert("URL" , "https://github.com/Bayselonarrend/OpenIntegrations"); - Product.Insert("AdditionalPhotos" , ImageArray); - Product.Insert("MainInGroup" , True); - Product.Insert("GroupNumber" , Undefined); - Product.Insert("Width" , 20); - Product.Insert("Height" , 30); - Product.Insert("Depth" , 40); - Product.Insert("Weight" , 100); - Product.Insert("SKU" , 12345); - Product.Insert("AvailableBalance" , "10"); - Product.Insert("PropertyValues" , PropertyMatch[Yellow]); - - Result = OPI_VK.AddProduct(Product, , Parameters); // Adding product - - // !OInt OPI_GetTestData.WriteLog(Result, "AddProduct"); - - OPI_Tools.Pause(5); - - YellowID = Result[Response]["market_item_id"]; - - OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); - OPI_GetTestData.ExpectsThat(Result[Response][MII]).HasType(TypeNumber).Filled(); - - Product.Insert("Name" , "TestProduct (" + Red + ")"); - Product.Insert("PropertyValues", PropertyMatch[Red]); - - Result = OPI_VK.AddProduct(Product, , Parameters); // Adding product - - // !OInt OPI_GetTestData.WriteLog(Result, "AddProduct"); - - OPI_Tools.Pause(5); - - RedID = Result[Response][MII]; - - OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); - OPI_GetTestData.ExpectsThat(Result[Response][MII]).HasType(TypeNumber).Filled(); - - Array of products = New Array; - Array of products.Add(YellowID); - Array of products.Add(RedID); - - Result = OPI_VK.GetProductsByID(Array of products, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetProductsByID"); - - OPI_Tools.Pause(5); - - OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); - OPI_GetTestData.ExpectsThat(Result[Response]["items"]).HasType("Array").HasLength(2); - - Result = OPI_VK.GroupProducts(Array of products, , Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "GroupProducts"); - - OPI_Tools.Pause(5); - - OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); - OPI_GetTestData.ExpectsThat(Result[Response]["item_group_id"]).HasType(TypeNumber).Filled(); - - OPI_VK.DeleteProduct(YellowID , Parameters); - OPI_VK.DeleteProduct(RedID, Parameters); - - For Each Option In PropertyMatch Do - - Deletion = OPI_VK.DeleteProductPropertyVariant(Option.Value, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "DeleteProductPropertyVariant"); - - OPI_Tools.Pause(5); - Check_VKTrue(Deletion); - - EndDo; - - Deletion = OPI_VK.DeleteProductProperty(Property, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "DeleteProductProperty"); - - OPI_Tools.Pause(5); - - Check_VKTrue(Deletion); - - DeleteFiles(AndVF); - -EndProcedure - -Procedure VK_GetProductList() Export - - Parameters = GetVKParameters(); - Image = OPI_GetTestData.GetBinary("Picture"); - - ImageArray = New Array; - ImageArray.Add(Image); - - Product = New Match(); - Product.Insert("Name" , "TestProduct2"); - Product.Insert("Description" , "Product description"); - Product.Insert("Category" , "20173"); - Product.Insert("Price" , 1); - Product.Insert("OldPrice" , 15); - Product.Insert("MainPhoto" , Image); - Product.Insert("URL" , "https://github.com/Bayselonarrend/OpenIntegrations"); - Product.Insert("AdditionalPhotos" , ImageArray); - Product.Insert("MainInGroup" , True); - Product.Insert("GroupNumber" , Undefined); - Product.Insert("Width" , 20); - Product.Insert("Height" , 30); - Product.Insert("Depth" , 40); - Product.Insert("Weight" , 100); - Product.Insert("SKU" , 12345); - Product.Insert("AvailableBalance" , "10"); - - Result = OPI_VK.AddProduct(Product, , Parameters); - ProductID = Result["response"]["market_item_id"]; - OPI_Tools.Pause(5); - - Result = OPI_VK.GetProductList(, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetProductList"); - - OPI_Tools.Pause(5); - - OPI_GetTestData.ExpectsThat(Result) - .HasType("Array").Filled(); - - OPI_VK.DeleteProduct(ProductID, Parameters); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure VK_GetSelectionList() Export - - Parameters = GetVKParameters(); - Image = OPI_GetTestData.GetBinary("Picture"); - Result = OPI_VK.CreateProductCollection("TestCollection" - , Image - , True - , False - , Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateProductCollection"); - - SelectionID = Result["response"]["market_album_id"]; - Result = OPI_VK.GetSelectionList(Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetSelectionList"); - - OPI_Tools.Pause(5); - - OPI_GetTestData.ExpectsThat(Result) - .HasType("Array").Filled(); - - OPI_VK.DeleteSelection(SelectionID, Parameters); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure VK_GetPropertyList() Export - - Parameters = GetVKParameters(); - Result = OPI_VK.GetPropertyList(Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetPropertyList"); - - OPI_Tools.Pause(5); - - OPI_GetTestData.ExpectsThat(Result) - .HasType("Array").Filled(); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure VK_GetOrderList() Export - - Parameters = GetVKParameters(); - Result = OPI_VK.GetOrderList(Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetOrderList"); - - OPI_Tools.Pause(5); - - OPI_GetTestData.ExpectsThat(Result) - .HasType("Array").Filled(); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure VK_UploadVideo() Export - - Parameters = GetVKParameters(); - Video = OPI_GetTestData.GetParameter("Video"); - Name = "NewVideo"; - Description = "Video description"; - - Result = OPI_VK.UploadVideoToServer(Video, Name, Description, , Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetOrderList"); - - OPI_GetTestData.ExpectsThat(Result["video_id"]).Filled(); - OPI_GetTestData.ExpectsThat(Result["video_hash"]).Filled(); - - OPI_Tools.Pause(5); - -EndProcedure - -#EndRegion - -#Region YandexDisk - -Procedure YDisk_GetDiskInfo() Export - - Token = OPI_GetTestData.GetParameter("YandexDisk_Token"); - Match = "Match"; - - Result = OPI_YandexDisk.GetDiskInformation(Token); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetDiskInformation"); - - OPI_GetTestData.ExpectsThat(Result).HasType(Match).Filled(); - OPI_GetTestData.ExpectsThat(Result["system_folders"]).HasType(Match); - OPI_GetTestData.ExpectsThat(Result["user"]).HasType(Match); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure YDisk_CreateFolder() Export - - Token = OPI_GetTestData.GetParameter("YandexDisk_Token"); - Path = "/" + String(New UniqueIdentifier); - - Result = OPI_YandexDisk.CreateFolder(Token, Path); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateFolder"); - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["type"]).Equal("dir"); - OPI_GetTestData.ExpectsThat(Result["path"]).Equal("disk:" + Path); - - OPI_YandexDisk.DeleteObject(Token, Path, False); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure YDisk_UploadByUrlAndGetObject() Export - - Token = OPI_GetTestData.GetParameter("YandexDisk_Token"); - Path = "/" + String(New UniqueIdentifier) + ".png"; - URL = "https://raw.githubusercontent.com/Bayselonarrend/OpenIntegrations/main/Media/logo.png"; - - OPI_YandexDisk.UploadFileByURL(Token, Path, URL); - OPI_Tools.Pause(5); - - Result = OPI_YandexDisk.GetObject(Token, Path); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetObject"); - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["type"]).Equal("file"); - OPI_GetTestData.ExpectsThat(Result["path"]).Equal("disk:" + Path); - - OPI_YandexDisk.DeleteObject(Token, Path, False); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure YDisk_UploadDeleteFile() Export - - Token = OPI_GetTestData.GetParameter("YandexDisk_Token"); - Path = "/" + String(New UniqueIdentifier) + ".png"; - Image = OPI_GetTestData.GetBinary("Picture"); - AndVF = GetTempFileName("png"); - Image.Write(AndVF); - - Result = OPI_YandexDisk.UploadFile(Token, Path, Image, True); - - // !OInt OPI_GetTestData.WriteLog(Result, "UploadFile"); - - Check_Empty(Result); - OPI_Tools.Pause(5); - - Result = OPI_YandexDisk.DeleteObject(Token, Path, False); - - // !OInt OPI_GetTestData.WriteLog(Result, "DeleteObject"); - - Check_Empty(Result); - - Result = OPI_YandexDisk.UploadFile(Token, Path, AndVF, True); - - // !OInt OPI_GetTestData.WriteLog(Result, "UploadFile"); - - Check_Empty(Result); - OPI_Tools.Pause(5); - - Result = OPI_YandexDisk.DeleteObject(Token, Path, False); - - // !OInt OPI_GetTestData.WriteLog(Result, "DeleteObject"); - - Check_Empty(Result); - - DeleteFiles(AndVF); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure YDisk_CreateObjectCopy() Export - - Token = OPI_GetTestData.GetParameter("YandexDisk_Token"); - OriginalPath = "/" + String(New UniqueIdentifier) + ".png"; - CopyPath = "/" + String(New UniqueIdentifier) + ".png"; - URL = "https://raw.githubusercontent.com/Bayselonarrend/" - + "OpenIntegrations/main/Media/logo.png"; - - OPI_YandexDisk.UploadFileByURL(Token, OriginalPath, URL); - OPI_Tools.Pause(5); - - Result = OPI_YandexDisk.CreateObjectCopy(Token, OriginalPath, CopyPath, True); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateObjectCopy"); - - OPI_Tools.Pause(5); - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["type"]).Equal("file"); - OPI_GetTestData.ExpectsThat(Result["path"]).Equal("disk:" + CopyPath); - - OPI_YandexDisk.DeleteObject(Token, OriginalPath, False); - OPI_YandexDisk.DeleteObject(Token, CopyPath, False); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure YDisk_GetDownloadLink() Export - - Token = OPI_GetTestData.GetParameter("YandexDisk_Token"); - Path = "/" + String(New UniqueIdentifier) + ".png"; - URL = "https://raw.githubusercontent.com/Bayselonarrend/OpenIntegrations/main/Media/logo.png"; - - OPI_YandexDisk.UploadFileByURL(Token, Path, URL); - OPI_Tools.Pause(5); - - Result = OPI_YandexDisk.GetDownloadLink(Token, Path); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetDownloadLink"); - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["method"]).Equal("GET"); - OPI_GetTestData.ExpectsThat(Result["href"]).HasType("String").Filled(); - - URL = Result["href"]; - - Result = OPI_YandexDisk.DownloadFile(Token, Path); - - OPI_GetTestData.ExpectsThat(Result).HasType("BinaryData").Filled(); - - OPI_YandexDisk.DeleteObject(Token, Path, False); - -EndProcedure - -Procedure YDisk_GetFileList() Export - - Token = OPI_GetTestData.GetParameter("YandexDisk_Token"); - Quantity = 2; - Indent = 1; - - Result = OPI_YandexDisk.GetFilesList(Token, Quantity, Indent, "image"); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetFilesList"); - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["limit"]).Equal(Quantity); - OPI_GetTestData.ExpectsThat(Result["offset"]).Equal(Indent); - OPI_GetTestData.ExpectsThat(Result["items"]).HasType("Array"); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure YDisk_MoveObject() Export - - Token = OPI_GetTestData.GetParameter("YandexDisk_Token"); - OriginalPath = "/" + String(New UniqueIdentifier) + ".png"; - CopyPath = "/" + String(New UniqueIdentifier) + ".png"; - URL = "https://raw.githubusercontent.com/Bayselonarrend/" - + "OpenIntegrations/main/Media/logo.png"; - - OPI_YandexDisk.UploadFileByURL(Token, OriginalPath, URL); - OPI_Tools.Pause(15); - - Result = OPI_YandexDisk.MoveObject(Token, OriginalPath, CopyPath, True); - - // !OInt OPI_GetTestData.WriteLog(Result, "MoveObject"); - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["type"]).Equal("file"); - OPI_GetTestData.ExpectsThat(Result["path"]).Equal("disk:" + CopyPath); - - OPI_YandexDisk.DeleteObject(Token, OriginalPath, False); - OPI_YandexDisk.DeleteObject(Token, CopyPath, False); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure YDisk_PublicObjectActions() Export - - PUrl = "public_url"; - Match = "Match"; - Token = OPI_GetTestData.GetParameter("YandexDisk_Token"); - Path = "/" + String(New UniqueIdentifier) + ".png"; - URL = "https://raw.githubusercontent.com/Bayselonarrend/OpenIntegrations/main/Media/logo.png"; - - OPI_YandexDisk.UploadFileByURL(Token, Path, URL); - OPI_Tools.Pause(5); - - ResultArray = New Array; - - ResultArray.Add(OPI_YandexDisk.PublishObject(Token, Path)); - PublicURL = ResultArray[0][PUrl]; - - Result = OPI_YandexDisk.GetDownloadLinkForPublicObject(Token, PublicURL); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetDownloadLinkForPublicObject"); - - OPI_GetTestData.ExpectsThat(Result).HasType(Match).Filled(); - OPI_GetTestData.ExpectsThat(Result["method"]).Equal("GET"); - OPI_GetTestData.ExpectsThat(Result["href"]).HasType("String").Filled(); - - Result = OPI_YandexDisk.GetPublicObject(Token, PublicURL); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetPublicObject"); - - OPI_GetTestData.ExpectsThat(Result).HasType(Match).Filled(); - OPI_GetTestData.ExpectsThat(Result["type"]).Equal("file"); - OPI_GetTestData.ExpectsThat(Result["path"]).Equal("/"); - - ResultArray.Add(OPI_YandexDisk.SavePublicObjectToDisk(Token, PublicURL)); - - ResultArray.Add(OPI_YandexDisk.CancelObjectPublication(Token, Path)); - - Counter = 0; - For Each Result In ResultArray Do - - // !OInt OPI_GetTestData.WriteLog(Result, "PublicationChange"); - - OPI_GetTestData.ExpectsThat(Result).HasType(Match).Filled(); - OPI_GetTestData.ExpectsThat(Result["type"]).Equal("file"); - OPI_GetTestData.ExpectsThat(Result["path"]).Filled(); - - If Counter = 0 Then - OPI_GetTestData.ExpectsThat(Result[PUrl]).HasType("String").Filled(); - Else - OPI_GetTestData.ExpectsThat(Result[PUrl]).HasType("Undefined"); - EndIf; - - Counter = Counter + 1; - - EndDo; - - OPI_YandexDisk.DeleteObject(Token, Path, False); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure YDisk_GetPublishedList() Export - - Token = OPI_GetTestData.GetParameter("YandexDisk_Token"); - Quantity = 2; - Indent = 1; - - Result = OPI_YandexDisk.GetPublishedObjectsList(Token, Quantity, Indent); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetPublishedObjectsList"); - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["limit"]).Equal(Quantity); - OPI_GetTestData.ExpectsThat(Result["offset"]).Equal(Indent); - OPI_GetTestData.ExpectsThat(Result["items"]).HasType("Array"); - - OPI_Tools.Pause(5); - -EndProcedure - -#EndRegion - -#Region Viber - -Procedure Viber_GetChannelInfo() Export - - Token = OPI_GetTestData.GetParameter("Viber_ChannelToken"); - Result = OPI_Viber.GetChannelInformation(Token); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetChannelInformation"); - - Check_ViberOk(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Viber_GetUserData() Export - - Token = OPI_GetTestData.GetParameter("Viber_ChannelToken"); - User = OPI_GetTestData.GetParameter("Viber_ChannelAdminID"); - Result = OPI_Viber.GetUserData(Token, User); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetUserData"); - - OPI_GetTestData.ExpectsThat(Result["chat_hostname"]).Filled(); - OPI_GetTestData.ExpectsThat(Result["status_message"]).Filled(); - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Viber_GetOnlineUsers() Export - - Token = OPI_GetTestData.GetParameter("Viber_ChannelToken"); - User = OPI_GetTestData.GetParameter("Viber_UserID"); - Result = OPI_Viber.GetOnlineUsers(Token, User); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetOnlineUsers"); - - OPI_GetTestData.ExpectsThat(Result["users"]).HasType("Array"); - Check_ViberOk(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Viber_SendTextMessage() Export - - Text = "TestMessage"; - ChannelToken = OPI_GetTestData.GetParameter("Viber_ChannelToken"); - BotToken = OPI_GetTestData.GetParameter("Viber_Token"); - User = OPI_GetTestData.GetParameter("Viber_UserID"); - Administrator = OPI_GetTestData.GetParameter("Viber_ChannelAdminID"); - - ButtonArray = New Array; - ButtonArray.Add("Button 1"); - ButtonArray.Add("Button 2"); - ButtonArray.Add("Button 3"); - - Keyboard = OPI_Viber.CreateKeyboardFromArrayButton(ButtonArray); - - Result = OPI_Viber.SendTextMessage(BotToken, Text, User, False, Keyboard); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendTextMessage"); - - OPI_GetTestData.ExpectsThat(Result["message_token"]).Filled(); - Check_ViberOk(Result); - - Result = OPI_Viber.SendTextMessage(ChannelToken, Text, Administrator, True, Keyboard); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendTextMessage"); - - OPI_GetTestData.ExpectsThat(Result["message_token"]).Filled(); - Check_ViberOk(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Viber_SendImage() Export - - Text = "TestMessage"; - Image = OPI_GetTestData.GetParameter("Picture"); - ChannelToken = OPI_GetTestData.GetParameter("Viber_ChannelToken"); - BotToken = OPI_GetTestData.GetParameter("Viber_Token"); - User = OPI_GetTestData.GetParameter("Viber_UserID"); - Administrator = OPI_GetTestData.GetParameter("Viber_ChannelAdminID"); - - Result = OPI_Viber.SendImage(BotToken, Image, User, False, Text); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendImage"); - - OPI_GetTestData.ExpectsThat(Result["message_token"]).Filled(); - Check_ViberOk(Result); - - Result = OPI_Viber.SendImage(ChannelToken, Image, Administrator, True, Text); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendImage"); - - OPI_GetTestData.ExpectsThat(Result["message_token"]).Filled(); - Check_ViberOk(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Viber_SendFile() Export - - Document = OPI_GetTestData.GetParameter("Document"); - ChannelToken = OPI_GetTestData.GetParameter("Viber_ChannelToken"); - BotToken = OPI_GetTestData.GetParameter("Viber_Token"); - User = OPI_GetTestData.GetParameter("Viber_UserID"); - Administrator = OPI_GetTestData.GetParameter("Viber_ChannelAdminID"); - - Result = OPI_Viber.SendFile(BotToken, Document, User, False, "docx"); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendFile"); - - OPI_GetTestData.ExpectsThat(Result["message_token"]).Filled(); - Check_ViberOk(Result); - - Result = OPI_Viber.SendFile(ChannelToken, Document, Administrator, True, "docx"); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendFile"); - - OPI_GetTestData.ExpectsThat(Result["message_token"]).Filled(); - Check_ViberOk(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Viber_SendContact() Export - - Name = "Petr Petrov"; - Phone = "+123456789"; - ChannelToken = OPI_GetTestData.GetParameter("Viber_ChannelToken"); - BotToken = OPI_GetTestData.GetParameter("Viber_Token"); - User = OPI_GetTestData.GetParameter("Viber_UserID"); - Administrator = OPI_GetTestData.GetParameter("Viber_ChannelAdminID"); - - Result = OPI_Viber.SendContact(BotToken, Name, Phone, User, False); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendContact"); - - OPI_GetTestData.ExpectsThat(Result["message_token"]).Filled(); - Check_ViberOk(Result); - - Result = OPI_Viber.SendContact(ChannelToken, Name, Phone, Administrator, True); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendContact"); - - OPI_GetTestData.ExpectsThat(Result["message_token"]).Filled(); - Check_ViberOk(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Viber_SendLocation() Export - - Latitude = "48.87373649724122"; - Longitude = "2.2954639195323967"; - ChannelToken = OPI_GetTestData.GetParameter("Viber_ChannelToken"); - BotToken = OPI_GetTestData.GetParameter("Viber_Token"); - User = OPI_GetTestData.GetParameter("Viber_UserID"); - Administrator = OPI_GetTestData.GetParameter("Viber_ChannelAdminID"); - - Result = OPI_Viber.SendLocation(BotToken, Latitude, Longitude, User, False); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendLocation"); - - OPI_GetTestData.ExpectsThat(Result["message_token"]).Filled(); - Check_ViberOk(Result); - - Result = OPI_Viber.SendLocation(ChannelToken, Latitude, Longitude, Administrator, True); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendLocation"); - - OPI_GetTestData.ExpectsThat(Result["message_token"]).Filled(); - Check_ViberOk(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Viber_SendLink() Export - - URL = "https://github.com/Bayselonarrend/OpenIntegrations"; - ChannelToken = OPI_GetTestData.GetParameter("Viber_ChannelToken"); - BotToken = OPI_GetTestData.GetParameter("Viber_Token"); - User = OPI_GetTestData.GetParameter("Viber_UserID"); - Administrator = OPI_GetTestData.GetParameter("Viber_ChannelAdminID"); - - Result = OPI_Viber.SendLink(BotToken, URL, User, False); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendLink"); - - OPI_GetTestData.ExpectsThat(Result["message_token"]).Filled(); - Check_ViberOk(Result); - - Result = OPI_Viber.SendLink(ChannelToken, URL, Administrator, True); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendLink"); - - OPI_GetTestData.ExpectsThat(Result["message_token"]).Filled(); - Check_ViberOk(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -#EndRegion - -#Region GoogleWorkspace - -Procedure GV_GetAuthorizationLink() Export - - ClientID = OPI_GetTestData.GetParameter("Google_ClientID"); - Result = OPI_GoogleWorkspace.FormCodeRetrievalLink(ClientID); - - OPI_GetTestData.ExpectsThat(Result) - .HasType("String") - .Filled(); - - OPI_GetTestData.WriteParameter("Google_Link", Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure GV_GetToken() Export - - ClientID = OPI_GetTestData.GetParameter("Google_ClientID"); - ClientSecret = OPI_GetTestData.GetParameter("Google_ClientSecret"); - Code = OPI_GetTestData.GetParameter("Google_Code"); - - Result = OPI_GoogleWorkspace.GetTokenByCode(ClientID, ClientSecret, Code); - - If ValueFilled(Result["access_token"]) - And ValueFilled(Result["refresh_token"]) Then - - OPI_GetTestData.WriteParameter("Google_Token" , Result["access_token"]); - OPI_GetTestData.WriteParameter("Google_Refresh", Result["refresh_token"]); - - EndIf; - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure GV_UpdateToken() Export - - ClientID = OPI_GetTestData.GetParameter("Google_ClientID"); - ClientSecret = OPI_GetTestData.GetParameter("Google_ClientSecret"); - RefreshToken = OPI_GetTestData.GetParameter("Google_Refresh"); - - Result = OPI_GoogleWorkspace.RefreshToken(ClientID, ClientSecret, RefreshToken); - - OPI_GetTestData.ExpectsThat(Result).HasType("Match"); - OPI_GetTestData.ExpectsThat(Result["access_token"]).Filled(); - - OPI_GetTestData.WriteParameter("Google_Token", Result["access_token"]); - - OPI_Tools.Pause(5); - -EndProcedure - -#EndRegion - -#Region GoogleCalendar - -Procedure GC_GetCalendarList() Export - - Token = OPI_GetTestData.GetParameter("Google_Token"); - Result = OPI_GoogleCalendar.GetCalendarList(Token); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetCalendarList"); - - OPI_GetTestData.ExpectsThat(Result) - .HasType("Array"); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure GC_CreateDeleteCalendar() Export - - Token = OPI_GetTestData.GetParameter("Google_Token"); - Name = "TestCalendar"; - Description = "TestDescription"; - EditedName = Name + " (fromм.)"; - TypeMatch = Type("Match"); - TypeString = Type("String"); - Summary = "summary"; - Black = "#000000"; - Yellow = "#ffd800"; - - Result = OPI_GoogleCalendar.CreateCalendar(Token, Name); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateCalendar"); - - OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); - OPI_GetTestData.ExpectsThat(Result[Summary]).Equal(Name); - OPI_GetTestData.ExpectsThat(Result["id"]).HasType(TypeString).Filled(); - - Calendar = Result["id"]; - - Result = OPI_GoogleCalendar.EditCalendarMetadata(Token - , Calendar - , EditedName - , Description); - - // !OInt OPI_GetTestData.WriteLog(Result, "EditCalendarMetadata"); - - Check_GKObject(Result, EditedName, Description); - - Result = OPI_GoogleCalendar.GetCalendarMetadata(Token, Calendar); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetCalendarMetadata"); - - Check_GKObject(Result, EditedName, Description); - - Result = OPI_GoogleCalendar.AddCalendarToList(Token, Calendar); - - // !OInt OPI_GetTestData.WriteLog(Result, "AddCalendarToList"); - - Check_GKObject(Result, EditedName, Description); - - Result = OPI_GoogleCalendar.EditListCalendar(Token, Calendar, Black, Yellow, False); - - // !OInt OPI_GetTestData.WriteLog(Result, "EditListCalendar"); - - OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); - OPI_GetTestData.ExpectsThat(Result[Summary]).Equal(EditedName); - OPI_GetTestData.ExpectsThat(Result["foregroundColor"]).Equal(Black); - OPI_GetTestData.ExpectsThat(Result["backgroundColor"]).Equal(Yellow); - - Result = OPI_GoogleCalendar.GetListCalendar(Token, Calendar); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetListCalendar"); - - OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); - OPI_GetTestData.ExpectsThat(Result[Summary]).Equal(EditedName); - OPI_GetTestData.ExpectsThat(Result["foregroundColor"]).Equal(Black); - OPI_GetTestData.ExpectsThat(Result["backgroundColor"]).Equal(Yellow); - - Result = OPI_GoogleCalendar.ClearMainCalendar(Token); - - // !OInt OPI_GetTestData.WriteLog(Result, "ClearMainCalendar"); - - Check_Empty(Result); - - Result = OPI_GoogleCalendar.DeleteCalendarFromList(Token, Calendar); - - // !OInt OPI_GetTestData.WriteLog(Result, "DeleteCalendarFromList"); - - Check_Empty(Result); - - Result = OPI_GoogleCalendar.DeleteCalendar(Token, Calendar); - - // !OInt OPI_GetTestData.WriteLog(Result, "DeleteCalendar"); - - Check_Empty(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure GC_CreateDeleteEvent() Export - - CurrentDate = OPI_Tools.GetCurrentDate(); - Token = OPI_GetTestData.GetParameter("Google_Token"); - Calendar = OPI_GetTestData.GetParameter("Google_CalendarID"); - Name = "New event"; - Description = "TestEventDescription"; - EditedDescription = "TestEventDescription (fromм.)"; - UID = "id"; - Hour = 3600; - - Attachments = New Match; - - Attachments.Insert("Image1" - , "https://opi.neocities.org/assets/images/logo_long-e8fdcca6ff8b32e679ea49a1ccdd3eac.png"); - Attachments.Insert("Image2" - , "https://github.com/Bayselonarrend/OpenIntegrations/raw/main/Media/logo.png?v1"); - - EventMatch = New Match; - EventMatch.Insert("Description" , Description); - EventMatch.Insert("Title" , Name); - EventMatch.Insert("Venue" , "InOffice"); - EventMatch.Insert("StartDate" , CurrentDate); - EventMatch.Insert("EndDate" , EventMatch["StartDate"] + Hour); - EventMatch.Insert("ArrayOfAttachmentURLs" , Attachments); - EventMatch.Insert("SendNotifications" , True); - - Result = OPI_GoogleCalendar.CreateEvent(Token, Calendar, EventMatch); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateEvent"); - - Event = Result[UID]; - - Check_GKObject(Result, Name, Description); - - EventMatch = New Match; - EventMatch.Insert("Description", EditedDescription); - - Result = OPI_GoogleCalendar.EditEvent(Token, Calendar, EventMatch, Event); - - // !OInt OPI_GetTestData.WriteLog(Result, "EditEvent"); - - Check_GKObject(Result, Name, EditedDescription); - - Result = OPI_GoogleCalendar.GetEvent(Token, Calendar, Event); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetEvent"); - - Check_GKObject(Result, Name, EditedDescription); - - Result = OPI_GoogleCalendar.MoveEvent(Token, Calendar, Calendar, Event); - - // !OInt OPI_GetTestData.WriteLog(Result, "MoveEvent"); - - Check_GKObject(Result, Name, EditedDescription); - - Result = OPI_GoogleCalendar.DeleteEvent(Token, Calendar, Event); - - // !OInt OPI_GetTestData.WriteLog(Result, "DeleteEvent"); - - Check_Empty(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure GC_GetEventList() Export - - Token = OPI_GetTestData.GetParameter("Google_Token"); - Calendar = OPI_GetTestData.GetParameter("Google_CalendarID"); - - Result = OPI_GoogleCalendar.GetEventList(Token, Calendar); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetEventList"); - - OPI_GetTestData.ExpectsThat(Result).HasType("Array"); - - OPI_Tools.Pause(5); - -EndProcedure - -#EndRegion - -#Region GoogleDrive - -Procedure GD_GetCatalogList() Export - - MimeType = "mimeType"; - Name = "name"; - Name = "TestFolder"; - Token = OPI_GetTestData.GetParameter("Google_Token"); - Result = OPI_GoogleDrive.GetDirectoriesList(Token, Name, True); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetDirectoriesList"); - - Result = Result[0]; - - OPI_GetTestData.ExpectsThat(Result["files"]).HasType("Array"); - OPI_GetTestData.ExpectsThat(Result[MimeType]).Equal("application/vnd.google-apps.folder"); - OPI_GetTestData.ExpectsThat(Result[Name]).Filled(); - - OPI_Tools.Pause(5); - Identifier = Result["id"]; - - OPI_GetTestData.WriteParameter("GD_Catalog", Identifier); - - Result = OPI_GoogleDrive.GetObjectInformation(Token, Identifier); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetObjectInformation"); - - OPI_GetTestData.ExpectsThat(Result[MimeType]).Equal("application/vnd.google-apps.folder"); - OPI_GetTestData.ExpectsThat(Result[Name]).Filled(); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure GD_UploadDeleteFile() Export - - ExtraBytes = 2; - - Kind = "kind"; - Content = "content"; - MIME = "MIME"; - MimeType = "mimeType"; - Name = "name"; - Id_ = "id"; - - ArrayOfDeletions = New Array; - Token = OPI_GetTestData.GetParameter("Google_Token"); - Image = OPI_GetTestData.GetBinary("Picture"); - ReplacementImage = OPI_GetTestData.GetBinary("Picture2"); - Directory = OPI_GetTestData.GetParameter("GD_Catalog"); - - Description = OPI_GoogleDrive.GetFileDescription(); - Description.Insert("Parent", Directory); - - Result = OPI_GoogleDrive.UploadFile(Token, Image, Description); - - // !OInt OPI_GetTestData.WriteLog(Result, "UploadFile"); - - OPI_GetTestData.ExpectsThat(Result[MimeType]).Equal(Description[MIME]); - OPI_GetTestData.ExpectsThat(Result[Name]).Equal(Description["Name"]); - - Identifier = Result[Id_]; - ArrayOfDeletions.Add(Identifier); - - NewName = "CopiedFile.jpeg"; - Result = OPI_GoogleDrive.CopyObject(Token, Identifier, NewName, "root"); - - // !OInt OPI_GetTestData.WriteLog(Result, "CopyObject"); - - OPI_Tools.Pause(5); - - OPI_GetTestData.ExpectsThat(Result[MimeType]).Equal(Description[MIME]); - OPI_GetTestData.ExpectsThat(Result[Name]).Equal(NewName); - - ArrayOfDeletions.Add(Result[Id_]); - - Result = OPI_GoogleDrive.DownloadFile(Token, Identifier); - - // !OInt OPI_GetTestData.WriteLog(Result, "DownloadFile"); - - OPI_GetTestData.ExpectsThat(Result.Size()).Equal(Image.Size() + ExtraBytes); - OPI_Tools.Pause(5); - - NewName = "UpdatedFile.jpg"; - Result = OPI_GoogleDrive.UpdateFile(Token, Identifier, ReplacementImage, NewName); - - // !OInt OPI_GetTestData.WriteLog(Result, "UpdateFile"); - - OPI_GetTestData.ExpectsThat(Result[MimeType]).Equal(Description[MIME]); - OPI_GetTestData.ExpectsThat(Result[Name]).Equal(NewName); - - OPI_Tools.Pause(5); - - Comment = "Yo"; - Result = OPI_GoogleDrive.CreateComment(Token, Identifier, Comment); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateComment"); - - OPI_GetTestData.ExpectsThat(Result[Content]).Equal(Comment); - OPI_GetTestData.ExpectsThat(Result[Kind]).Equal("drive#comment"); - - OPI_Tools.Pause(5); - - For Each Deletable In ArrayOfDeletions Do - Result = OPI_GoogleDrive.DeleteObject(Token, Deletable); - - // !OInt OPI_GetTestData.WriteLog(Result, "DeleteObject"); - - OPI_GetTestData.ExpectsThat(ValueFilled(Result)).Equal(False); - OPI_Tools.Pause(2); - EndDo; - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure GD_CreateDeleteComment() Export - - Kind = "kind"; - Content = "content"; - Id_ = "id"; - Comments = "comments"; - Token = OPI_GetTestData.GetParameter("Google_Token"); - Directory = OPI_GetTestData.GetParameter("GD_Catalog"); - Image = OPI_GetTestData.GetBinary("Picture"); - - Description = OPI_GoogleDrive.GetFileDescription(); - Description.Insert("Parent", Directory); - - Result = OPI_GoogleDrive.UploadFile(Token, Image, Description); - Identifier = Result[Id_]; - - Comment = "NewComment"; - ResultArray = New Array; - Result = OPI_GoogleDrive.CreateComment(Token, Identifier, Comment); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateComment"); - - CommentID = Result[Id_]; - - ResultArray.Add(Result); - - Result = OPI_GoogleDrive.GetComment(Token, Identifier, CommentID); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetComment"); - - ResultArray.Add(Result); - - Result = OPI_GoogleDrive.GetCommentList(Token, Identifier); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetCommentList"); - - Comments = Result[Comments]; - CommentObject = Comments[Comments.WithinBoundary()]; - - ResultArray.Add(CommentObject); - - For Each Result In ResultArray Do - OPI_GetTestData.ExpectsThat(Result[Content]).Equal(Comment); - OPI_GetTestData.ExpectsThat(Result[Kind]).Equal("drive#comment"); - EndDo; - - Result = OPI_GoogleDrive.DeleteComment(Token, Identifier, CommentID); - - // !OInt OPI_GetTestData.WriteLog(Result, "DeleteComment"); - - OPI_GetTestData.ExpectsThat(ValueFilled(Result)).Equal(False); - - OPI_GoogleDrive.DeleteObject(Token, Identifier); - -EndProcedure - -Procedure GD_CreateCatalog() Export - - Name = "name"; - Name = "TestFolder"; - Token = OPI_GetTestData.GetParameter("Google_Token"); - Directory = OPI_GetTestData.GetParameter("GD_Catalog"); - - ResultArray = New Array; - - ResultArray.Add(OPI_GoogleDrive.CreateFolder(Token, Name)); - ResultArray.Add(OPI_GoogleDrive.CreateFolder(Token, Name, Directory)); - - For Each Result In ResultArray Do - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateFolder"); - - CatalogID = Result["id"]; - - OPI_GetTestData.ExpectsThat(Result[Name]).Equal(Name); - - OPI_GoogleDrive.DeleteObject(Token, CatalogID); - - EndDo; - -EndProcedure - -#EndRegion - -#Region GoogleSheets - -Procedure GT_CreateTable() Export - - Token = OPI_GetTestData.GetParameter("Google_Token"); - Name = "TestTable"; - - SheetArray = New Array; - SheetArray.Add("Sheet1"); - SheetArray.Add("Sheet2"); - - Result = OPI_GoogleSheets.CreateBook(Token, Name, SheetArray); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateBook"); - - OPI_GetTestData.ExpectsThat(Result["properties"]["title"]).Equal(Name); - - For N = 0 For SheetArray.WithinBoundary() Do - - SheetName = Result["sheets"][N]["properties"]["title"]; - OPI_GetTestData.ExpectsThat(SheetName).Equal(SheetArray[N]); - Sheet = Result["sheets"][N]["properties"]["sheetId"]; - Sheet = OPI_Tools.NumberToString(Sheet); - - EndDo; - - Book = Result["spreadsheetId"]; - - OPI_GetTestData.WriteParameter("GS_Spreadsheet", Book); - OPI_GetTestData.WriteParameter("GS_Sheet" , Sheet); - - Result = OPI_GoogleSheets.CreateBook(Token, Name, SheetArray); - Book2 = Result["spreadsheetId"]; - - Result = OPI_GoogleSheets.CopySheet(Token, Book, Book2, Sheet); - - // !OInt OPI_GetTestData.WriteLog(Result, "CopySheet"); - - OPI_GetTestData.ExpectsThat(Result["title"]).Equal(SheetName + " (toопия)"); - - Name = "TestSheet"; - - Result = OPI_GoogleSheets.AddSheet(Token, Book, Name); - - // !OInt OPI_GetTestData.WriteLog(Result, "AddSheet"); - - NewSheet = Result["replies"][0]["addSheet"]["properties"]["sheetId"]; - NewSheet = OPI_Tools.NumberToString(NewSheet); - - OPI_GetTestData.ExpectsThat(Result["spreadsheetId"]).Equal(Book); - - Result = OPI_GoogleSheets.DeleteSheet(Token, Book, NewSheet); - - // !OInt OPI_GetTestData.WriteLog(Result, "DeleteSheet"); - - OPI_GetTestData.ExpectsThat(Result["spreadsheetId"]).Equal(Book); - - Name = "TestTable (fromм.)"; - - Result = OPI_GoogleSheets.EditBookTitle(Token, Book, Name); - - // !OInt OPI_GetTestData.WriteLog(Result, "EditBookTitle"); - - OPI_GetTestData.ExpectsThat(Result["spreadsheetId"]).Equal(Book); - -EndProcedure - -Procedure GT_GetTable() Export - - Token = OPI_GetTestData.GetParameter("Google_Token"); - Book = OPI_GetTestData.GetParameter("GS_Spreadsheet"); - Name = "TestTable (fromм.)"; - - Result = OPI_GoogleSheets.GetBook(Token, Book); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetTable"); - - OPI_GetTestData.ExpectsThat(Result["properties"]["title"]).Equal(Name); - -EndProcedure - -Procedure GT_FillClearCells() Export - - Token = OPI_GetTestData.GetParameter("Google_Token"); - Book = OPI_GetTestData.GetParameter("GS_Spreadsheet"); - Sheet = "Sheet2"; - - CellStructure = New Match; - CellStructure.Insert("A1", "ThisIsA1"); - CellStructure.Insert("A2", "ThisIsA2"); - CellStructure.Insert("B2", "ThisIsB2"); - CellStructure.Insert("B3", "ThisIsB3"); - CellStructure.Insert("A3", "ThisIsA3"); - CellStructure.Insert("A4", "ThisIsA4"); - CellStructure.Insert("B1", "ThisIsB1"); - CellStructure.Insert("B4", "ThisIsB4"); - - Cell array = New Array; - Cell array.Add("B2"); - Cell array.Add("A3"); - Cell array.Add("B4"); - - Result = OPI_GoogleSheets.SetCellValues(Token, Book, CellStructure, Sheet); - - // !OInt OPI_GetTestData.WriteLog(Result, "SetCellValues"); - - OPI_GetTestData.ExpectsThat(Result["spreadsheetId"]).Equal(Book); - OPI_GetTestData.ExpectsThat(Result["totalUpdatedCells"]).Equal(CellStructure.Quantity()); - - Result = OPI_GoogleSheets.GetCellValues(Token, Book, Cell array, Sheet); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetCellValues"); - - OPI_GetTestData.ExpectsThat(Result["spreadsheetId"]).Equal(Book); - OPI_GetTestData.ExpectsThat(Result["valueRanges"].Quantity()).Equal(Cell array.Quantity()); - - Result = OPI_GoogleSheets.GetCellValues(Token, Book, , Sheet); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetCellValues"); - - OPI_GetTestData.ExpectsThat(Result["spreadsheetId"]).Equal(Book); - - Cell array = New Array; - Cell array.Add("B2"); - Cell array.Add("A3"); - Cell array.Add("B4"); - - Result = OPI_GoogleSheets.ClearCells(Token, Book, Cell array, Sheet); - - // !OInt OPI_GetTestData.WriteLog(Result, "ClearCells"); - - OPI_GetTestData.ExpectsThat(Result["spreadsheetId"]).Equal(Book); - OPI_GetTestData.ExpectsThat(Result["clearedRanges"].Quantity()).Equal(Cell array.Quantity()); - -EndProcedure - -#EndRegion - -#Region Twitter - -Procedure Twitter_GetAuthorizationLink() Export - - Parameters = GetTwitterParameters(); - Result = OPI_Twitter.GetAuthorizationLink(Parameters); - - OPI_GetTestData.ExpectsThat(Result).HasType("String").Filled(); - - OPI_GetTestData.WriteParameter("Twitter_URL", Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Twitter_UpdateToken() Export - - Parameters = GetTwitterParameters(); - Result = OPI_Twitter.RefreshToken(Parameters); - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["access_token"]).Filled(); - OPI_GetTestData.ExpectsThat(Result["refresh_token"]).Filled(); - - Refresh = Result["refresh_token"]; - Token = Result["access_token"]; - - If ValueFilled(Refresh) And Not Refresh = "null" Then - OPI_GetTestData.WriteParameter("Twitter_Refresh", Refresh); - EndIf; - - If ValueFilled(Token) And Not Token = "null" Then - OPI_GetTestData.WriteParameter("Twitter_Token" , Token); - EndIf; - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Twitter_CreateTextTweet() Export - - Parameters = GetTwitterParameters(); - Text = "TestTweet" + String(New UniqueIdentifier); - - Result = OPI_Twitter.CreateTextTweet(Text, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateTextTweet"); - - Check_TwitterText(Result, Text); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Twitter_CreateTweetWithImage() Export - - Parameters = GetTwitterParameters(); - Text = "TestTweet" + String(New UniqueIdentifier); - Image = OPI_GetTestData.GetBinary("Picture"); - AndVF = GetTempFileName("png"); - Image.Write(AndVF); - - Result = OPI_Twitter.Create image tweet(Text, Image, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "Create image tweet"); - - Check_TwitterText(Result, Text); - - Result = OPI_Twitter.Create image tweet(Text, AndVF, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "Create image tweet"); - - Check_TwitterText(Result, Text); - - DeleteFiles(AndVF); - - OPI_Tools.Pause(20); - -EndProcedure - -Procedure Twitter_CreateTweetWithVideo() Export - - Parameters = GetTwitterParameters(); - Text = "TestTweet" + String(New UniqueIdentifier); - Video = OPI_GetTestData.GetBinary("Video"); - AndVF = GetTempFileName("mp4"); - Video.Write(AndVF); - - Result = OPI_Twitter.CreateVideoTweet(Text, Video, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateVideoTweet"); - - Check_TwitterText(Result, Text); - - Result = OPI_Twitter.CreateVideoTweet(Text, AndVF, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateVideoTweet"); - - Check_TwitterText(Result, Text); - - DeleteFiles(AndVF); - - OPI_Tools.Pause(20); - -EndProcedure - -Procedure Twitter_CreateTweetWithGif() Export - - Parameters = GetTwitterParameters(); - Text = "TestTweet" + String(New UniqueIdentifier); - GIF = OPI_GetTestData.GetBinary("GIF"); - AndVF = GetTempFileName("gif"); - GIF.Write(AndVF); - - Result = OPI_Twitter.CreateGifTweet(Text, GIF, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateGifTweet"); - - Check_TwitterText(Result, Text); - - Result = OPI_Twitter.CreateGifTweet(Text, AndVF, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateGifTweet"); - - Check_TwitterText(Result, Text); - - DeleteFiles(AndVF); - - OPI_Tools.Pause(20); - -EndProcedure - -Procedure Twitter_CreateTweetWithPoll() Export - - Parameters = GetTwitterParameters(); - Text = "TestTweet" + String(New UniqueIdentifier); - AnswersArray = New Array; - AnswersArray.Add("Option 1"); - AnswersArray.Add("Option 2"); - - Result = OPI_Twitter.CreatePollTweet(Text, AnswersArray, 60, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreatePollTweet"); - - Check_TwitterText(Result, Text); - - OPI_Tools.Pause(20); - -EndProcedure - -#EndRegion - -#Region Notion - -Procedure Notion_CreatePage() Export - - Token = OPI_GetTestData.GetParameter("Notion_Token"); - Parent = OPI_GetTestData.GetParameter("Notion_Parent"); - Title = "TestTitle"; - - Result = OPI_Notion.CreatePage(Token, Parent, Title); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreatePage"); - - Check_NotionObject(Result); - -EndProcedure - -Procedure Notion_CreateEditDatabase() Export - - Token = OPI_GetTestData.GetParameter("Notion_Token"); - Parent = OPI_GetTestData.GetParameter("Notion_Parent"); - Title = "TestTitle"; - - Properties = New Match; - Properties.Insert("Name" , "title"); - Properties.Insert("Description" , "rich_text"); - Properties.Insert("Number" , "number"); - Properties.Insert("Status" , "status"); - Properties.Insert("CreationDate" , "date"); - Properties.Insert("Image" , "files"); - Properties.Insert("Active" , "checkbox"); - Properties.Insert("Website" , "url"); - Properties.Insert("Email" , "email"); - Properties.Insert("Phone" , "phone_number"); - Properties.Insert("User" , "people"); - - ValueSelection = New Match; - ValueSelection.Insert("New", "green"); - ValueSelection.Insert("InProgress", "yellow"); - ValueSelection.Insert("Remote", "red"); - Properties.Insert("Status", ValueSelection); - - Result = OPI_Notion.CreateDatabase(Token, Parent, Title, Properties); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateDatabase"); - - Check_NotionObject(Result, "database"); - - Base = Result["id"]; - Title = "TestTitle"; - Description = "TestDescription"; - - Properties = New Match; - Properties.Insert("Email", "rich_text"); // Type fields "Email" will changed with email to text - Properties.Insert("Website"); // Field "Website" will deleted - - Result = OPI_Notion.EditDatabaseProperties(Token, Base, Properties, Title, Description); - - // !OInt OPI_GetTestData.WriteLog(Result, "EditDatabaseProperties"); - - Check_NotionObject(Result, "database"); - -EndProcedure - -Procedure Notion_GetPageInfo() Export - - Token = OPI_GetTestData.GetParameter("Notion_Token"); - Page = OPI_GetTestData.GetParameter("Notion_Page"); - - Result = OPI_Notion.GetPage(Token, Page); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetPage"); - - Check_NotionObject(Result); - -EndProcedure - -Procedure Notion_GetDatabaseInfo() Export - - Token = OPI_GetTestData.GetParameter("Notion_Token"); - Base = OPI_GetTestData.GetParameter("Notion_Base"); - - Result = OPI_Notion.GetDatabase(Token, Base); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetDatabase"); - - Check_NotionObject(Result, "database"); - -EndProcedure - -Procedure Notion_CreatePageInDatabase() Export - - Token = OPI_GetTestData.GetParameter("Notion_Token"); - Base = OPI_GetTestData.GetParameter("Notion_Base"); - - Image = New Match; - Image.Insert("Logo", OPI_GetTestData.GetParameter("Picture")); - - Properties = New Match; - Properties.Insert("Name" , "LLC Vector"); - Properties.Insert("Description" , "OurFirstClient"); - Properties.Insert("Number" , 1); - Properties.Insert("Status" , "Regular"); - Properties.Insert("CreationDate" , OPI_Tools.GetCurrentDate()); - Properties.Insert("Image" , Image); - Properties.Insert("Active" , True); - Properties.Insert("Website" , "https://vector.ru"); - Properties.Insert("Email" , "mail@vector.ru"); - Properties.Insert("Phone" , "88005553535"); - Properties.Insert("Status" , "New"); - - Result = OPI_Notion.CreatePageInDatabase(Token, Base, Properties); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreatePageInDatabase"); - - Check_NotionObject(Result); - - Parent = StringReplace(Result["parent"]["database_id"], "-", ""); - OPI_GetTestData.ExpectsThat(Parent).Equal(Base); - -EndProcedure - -Procedure Notion_EditPageProperties() Export - - Token = OPI_GetTestData.GetParameter("Notion_Token"); - Page = OPI_GetTestData.GetParameter("Notion_Page"); - Icon = OPI_GetTestData.GetParameter("Picture"); - Cover = OPI_GetTestData.GetParameter("Picture2"); - Archive = False; - - Properties = New Match; - Properties.Insert("Active" , False); - Properties.Insert("Email" , "vector@mail.ru"); - - Result = OPI_Notion.EditPageProperties(Token - , Page - , Properties - , Icon - , Cover - , Archive); - - // !OInt OPI_GetTestData.WriteLog(Result, "EditPageProperties"); - - Check_NotionObject(Result); - -EndProcedure - -Procedure Notion_CreateDeleteBlock() Export - - Token = OPI_GetTestData.GetParameter("Notion_Token"); - Parent = OPI_GetTestData.GetParameter("Notion_Parent"); - Block = OPI_GetTestData.GetParameter("Notion_Block"); - - Result = OPI_Notion.ReturnBlock(Token, Block); - - // !OInt OPI_GetTestData.WriteLog(Result, "ReturnBlock"); - - Check_NotionObject(Result, "block"); - - Result = OPI_Notion.CreateBlock(Token, Parent, Result); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateBlock"); - - Check_NotionObject(Result, "list"); - - Block = Result["results"][0]["id"]; - Result = OPI_Notion.ReturnChildBlocks(Token, Block); - - // !OInt OPI_GetTestData.WriteLog(Result, "ReturnChildBlocks"); - - Check_NotionObject(Result, "list"); - - Result = OPI_Notion.DeleteBlock(Token, Block); - - // !OInt OPI_GetTestData.WriteLog(Result, "DeleteBlock"); - - Check_NotionObject(Result, "block"); - -EndProcedure - -Procedure Notion_GetUsers() Export - - Token = OPI_GetTestData.GetParameter("Notion_Token"); - Result = OPI_Notion.UserList(Token); - - // !OInt OPI_GetTestData.WriteLog(Result, "UserList"); - - Check_NotionObject(Result, "list"); - -EndProcedure - -Procedure Notion_GetUserData() Export - - Token = OPI_GetTestData.GetParameter("Notion_Token"); - User = OPI_GetTestData.GetParameter("Notion_User"); - Result = OPI_Notion.GetUserData(Token, User); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetUserData"); - - Check_NotionObject(Result, "user"); - -EndProcedure - -#EndRegion - -#Region Slack - -Procedure Slack_GetBotInfo() Export - - Token = OPI_GetTestData.GetParameter("Slack_Token"); - Result = OPI_Slack.GetBotInformation(Token); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetBotInformation"); - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Result["bot_id"]).Filled(); - OPI_GetTestData.ExpectsThat(Result["user_id"]).Filled(); - -EndProcedure - -Procedure Slack_GetUserList() Export - - Token = OPI_GetTestData.GetParameter("Slack_Token"); - Result = OPI_Slack.GetUserList(Token); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetUserList"); - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Result["members"]).HasType("Array"); - -EndProcedure - -Procedure Slack_GetRegionList() Export - - Token = OPI_GetTestData.GetParameter("Slack_Token"); - Result = OPI_Slack.GetWorkspaceList(Token); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetWorkspaceList"); - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Result["teams"]).HasType("Array"); - -EndProcedure - -Procedure Slack_SendDeleteMessage() Export - - Token = OPI_GetTestData.GetParameter("Slack_Token"); - Channel = OPI_GetTestData.GetParameter("Slack_Channel"); - Text = "TestMessage1"; - Text2 = "TestMessage2"; - Tags = New Array; - Image = "https://github.com/Bayselonarrend/OpenIntegrations/raw/main/Media/logo.png?v1"; - - Result = OPI_Slack.SendMessage(Token, Channel, Text); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendMessage"); - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Result["channel"]).Equal(Channel); - OPI_GetTestData.ExpectsThat(Result["ts"]).Filled(); - OPI_GetTestData.ExpectsThat(Result["message"]["text"]).Equal(Text); - - Timestamp = Result["ts"]; - - Result = OPI_Slack.EditMessage(Token, Channel, Timestamp, Text2); - - // !OInt OPI_GetTestData.WriteLog(Result, "EditMessage"); - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Result["channel"]).Equal(Channel); - OPI_GetTestData.ExpectsThat(Result["ts"]).Filled(); - OPI_GetTestData.ExpectsThat(Result["message"]["text"]).Equal(Text2); - - Result = OPI_Slack.GetMessageReplyList(Token, Channel, Timestamp); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetMessageReplyList"); - - OPI_GetTestData.ExpectsThat(Result["messages"]).HasType("Array"); - - Result = OPI_Slack.GetMessageLink(Token, Channel, Timestamp); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetMessageLink"); - - OPI_GetTestData.ExpectsThat(Result["channel"]).Equal(Channel); - OPI_GetTestData.ExpectsThat(Result["permalink"]).Filled(); - - Check_SlackOk(Result); - - Tags.Add(Timestamp); - - BlockArray = New Array; - Block = OPI_Slack.GenerateImageBlock(Image, "Yo"); - BlockArray.Add(Block); - - Result = OPI_Slack.SendMessage(Token, Channel, Text, , BlockArray); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendMessage (toартинtoа)"); - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Result["channel"]).Equal(Channel); - OPI_GetTestData.ExpectsThat(Result["ts"]).Filled(); - - Tags.Add(Result["ts"]); - - Block = OPI_Slack.GenerateImageBlock(Image, "Yo"); - JSONBlock = OPI_Tools.JSONString(Block); - - AndVF = GetTempFileName("json"); - - TextDocument = New TextDocument(); - TextDocument.SetText(JSONBlock); - TextDocument.Write(AndVF); - - Result = OPI_Slack.SendMessage(Token, Channel, Text, , AndVF); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendMessage (json)"); - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Result["channel"]).Equal(Channel); - OPI_GetTestData.ExpectsThat(Result["ts"]).Filled(); - - Tags.Add(Result["ts"]); - - Blocks = "['" + AndVF + "','" + AndVF + "']"; - Result = OPI_Slack.SendMessage(Token, Channel, Text, , Blocks); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendMessage (json маwithwithиin)"); - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Result["channel"]).Equal(Channel); - OPI_GetTestData.ExpectsThat(Result["ts"]).Filled(); - - Tags.Add(Result["ts"]); - - DeleteFiles(AndVF); - - For Each Timestamp In Tags Do - - Result = OPI_Slack.DeleteMessage(Token, Channel, Timestamp); - - // !OInt OPI_GetTestData.WriteLog(Result, "DeleteMessage"); - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Result["channel"]).Equal(Channel); - OPI_GetTestData.ExpectsThat(Result["ts"]).Filled(); - - EndDo; - - Hour = 3600; - Day = 24; - Sending = OPI_Tools.GetCurrentDate() + (Day * Hour); - Result = OPI_Slack.SendMessage(Token, Channel, Text, Sending); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendMessage (отложенное)"); - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Result["channel"]).Equal(Channel); - OPI_GetTestData.ExpectsThat(Result["scheduled_message_id"]).Filled(); - - Timestamp = Result["scheduled_message_id"]; - Result = OPI_Slack.DeleteMessage(Token, Channel, Timestamp, True); - - // !OInt OPI_GetTestData.WriteLog(Result, "DeleteMessage"); - - Check_SlackOk(Result); - -EndProcedure - -Procedure Slack_SendDeleteEphemeral() Export - - Token = OPI_GetTestData.GetParameter("Slack_Token"); - Channel = OPI_GetTestData.GetParameter("Slack_Channel"); - User = OPI_GetTestData.GetParameter("Slack_User"); - Image = "https://github.com/Bayselonarrend/OpenIntegrations/raw/main/Media/logo.png?v1"; - Text = "TestMessage1"; - - Block = OPI_Slack.GenerateImageBlock(Image, "Yo"); - Result = OPI_Slack.SendEphemeralMessage(Token, Channel, Text, User, Block); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendMessage"); - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Result["message_ts"]).Filled(); - -EndProcedure - -Procedure Slack_GetScheduledMessages() Export - - Token = OPI_GetTestData.GetParameter("Slack_Token"); - Channel = OPI_GetTestData.GetParameter("Slack_Channel"); - - Result = OPI_Slack.GetDelayedMessageList(Token, Channel); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetDelayedMessageList"); - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Result["scheduled_messages"]).HasType("Array"); - -EndProcedure - -Procedure Slack_CreateArchiveChannel() Export - - Token = OPI_GetTestData.GetParameter("Slack_Token"); - User = OPI_GetTestData.GetParameter("Slack_User"); - Name = "testconv" + String(New UniqueIdentifier); - Topic = "TestTopic"; - Purpose = "TestGoal"; - - #Region CreateChannel - Result = OPI_Slack.CreateChannel(Token, Name); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateChannel"); - - Data = Result["channel"]; - Channel = Data["id"]; - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Data["name"]).Equal(Name); - #EndRegion - - #Region SetChannelTopic - Result = OPI_Slack.SetChannelTopic(Token, Channel, Topic); - - // !OInt OPI_GetTestData.WriteLog(Result, "SetChannelTopic"); - - Data = Result["channel"]; - Channel = Data["id"]; - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Data["name"]).Equal(Name); - OPI_GetTestData.ExpectsThat(Data["topic"]["value"]).Equal(Topic); - #EndRegion - - #Region SetChannelGoal - Result = OPI_Slack.SetChannelGoal(Token, Channel, Purpose); - - // !OInt OPI_GetTestData.WriteLog(Result, "SetChannelGoal"); - - Check_SlackOk(Result); - #EndRegion - - #Region GetChannel - Result = OPI_Slack.GetChannel(Token, Channel); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetChannel"); - - Data = Result["channel"]; - Channel = Data["id"]; - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Data["name"]).Equal(Name); - #EndRegion - - #Region InviteUsersToChannel - Result = OPI_Slack.InviteUsersToChannel(Token, Channel, User); - - // !OInt OPI_GetTestData.WriteLog(Result, "InviteUsersToChannel"); - - Data = Result["channel"]; - Channel = Data["id"]; - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Data["name"]).Equal(Name); - #EndRegion - - #Region KickUserFromChannel - Result = OPI_Slack.KickUserFromChannel(Token, Channel, User); - - // !OInt OPI_GetTestData.WriteLog(Result, "KickUserFromChannel"); - - Check_SlackOk(Result); - #EndRegion - - #Region GetChannelHistory - Result = OPI_Slack.GetChannelHistory(Token, Channel); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetChannelHistory"); - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Result["messages"]).HasType("Array"); - #EndRegion - - #Region GetChannelUserList - Result = OPI_Slack.GetChannelUserList(Token, Channel); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetChannelUserList"); - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Result["members"]).HasType("Array"); - #EndRegion - - #Region LeaveChannel - Result = OPI_Slack.LeaveChannel(Token, Channel); - - // !OInt OPI_GetTestData.WriteLog(Result, "LeaveChannel"); - - Check_SlackOk(Result); - #EndRegion - - #Region JoinChannel - Result = OPI_Slack.JoinChannel(Token, Channel); - - // !OInt OPI_GetTestData.WriteLog(Result, "JoinChannel"); - - Data = Result["channel"]; - Channel = Data["id"]; - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Data["name"]).Equal(Name); - #EndRegion - - #Region RenameChannel - NewName = "testconv" + String(New UniqueIdentifier); - Result = OPI_Slack.RenameChannel(Token, Channel, NewName); - - // !OInt OPI_GetTestData.WriteLog(Result, "RenameChannel"); - - Data = Result["channel"]; - Channel = Data["id"]; - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Data["name"]).Equal(NewName); - #EndRegion - - #Region ArchiveChannel - Result = OPI_Slack.ArchiveChannel(Token, Channel); - - // !OInt OPI_GetTestData.WriteLog(Result, "ArchiveChannel"); - - Check_SlackOk(Result); - #EndRegion - -EndProcedure - -Procedure Slack_GetChannelList() Export - - Token = OPI_GetTestData.GetParameter("Slack_Token"); - - Result = OPI_Slack.GetChannelList(Token); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetChannelList"); - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Result["channels"]).HasType("Array"); - -EndProcedure - -Procedure Slack_OpenCloseDialog() Export - - Token = OPI_GetTestData.GetParameter("Slack_Token"); - User = OPI_GetTestData.GetParameter("Slack_User"); - Text = "Yo, dude"; - - Result = OPI_Slack.OpenDialog(Token, User); - - // !OInt OPI_GetTestData.WriteLog(Result, "OpenDialog"); - - Dialog = Result["channel"]["id"]; - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Result["channel"]).HasType("Match"); - OPI_GetTestData.ExpectsThat(Dialog).Filled(); - - Result = OPI_Slack.SendMessage(Token, Dialog, Text); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendMessage"); - - Check_SlackOk(Result); - - Result = OPI_Slack.CloseDialog(Token, Dialog); - - // !OInt OPI_GetTestData.WriteLog(Result, "CloseDialog"); - - Check_SlackOk(Result); - -EndProcedure - -Procedure Slack_GetFileList() Export - - Token = OPI_GetTestData.GetParameter("Slack_Token"); - Channel = OPI_GetTestData.GetParameter("Slack_Channel"); - - Result = OPI_Slack.GetFilesList(Token, Channel); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetFilesList"); - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Result["files"]).HasType("Array"); - -EndProcedure - -Procedure Slack_UploadDeleteFile() Export - - Token = OPI_GetTestData.GetParameter("Slack_Token"); - File = OPI_GetTestData.GetBinary("Document"); - Channel = OPI_GetTestData.GetParameter("Slack_Channel"); - ArrayOfFiles = New Array; - FileName = "megadoc.docx"; - Title = "NewFile"; - - Result = OPI_Slack.UploadFile(Token, File, FileName, Title); - - // !OInt OPI_GetTestData.WriteLog(Result, "UploadFile"); - - UploadedFile = Result["files"][0]; - ArrayOfFiles.Add(UploadedFile["id"]); - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(UploadedFile["name"]).Equal(FileName); - - Result = OPI_Slack.UploadFile(Token, File, FileName, Title, Channel); - - // !OInt OPI_GetTestData.WriteLog(Result, "UploadFile (in toаtoл)"); - - UploadedFile = Result["files"][0]; - ArrayOfFiles.Add(UploadedFile["id"]); - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(UploadedFile["name"]).Equal(FileName); - - Result = OPI_Slack.GetFileData(Token, UploadedFile["id"]); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetFile"); - - UploadedFile = Result["file"]; - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(UploadedFile["name"]).Equal(FileName); - - For Each UploadedFile In ArrayOfFiles Do - - Result = OPI_Slack.DeleteFile(Token, UploadedFile); - - // !OInt OPI_GetTestData.WriteLog(Result, "DeleteFile"); - - Check_SlackOk(Result); - - EndDo; - -EndProcedure - -Procedure Slack_GetExternalFileList() Export - - Token = OPI_GetTestData.GetParameter("Slack_Token"); - Channel = OPI_GetTestData.GetParameter("Slack_Channel"); - - Result = OPI_Slack.GetExternalFileList(Token); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetExternalFileList"); - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Result["files"]).HasType("Array"); - - Result = OPI_Slack.GetExternalFileList(Token, Channel); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetExternalFileList"); - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Result["files"]).HasType("Array"); - -EndProcedure - -Procedure Slack_UploadDeleteExternalFile() Export - - Token = OPI_GetTestData.GetParameter("Slack_Token"); - File = OPI_GetTestData.GetParameter("Document"); - Channel = OPI_GetTestData.GetParameter("Slack_Channel"); - Title = "NewFile"; - - Result = OPI_Slack.AddExternalFile(Token, File, Title); - - // !OInt OPI_GetTestData.WriteLog(Result, "AddExternalFile"); - - UploadedFile = Result["file"]; - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(UploadedFile["title"]).Equal(Title); - - Result = OPI_Slack.GetExternalFile(Token, UploadedFile["id"]); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetExternalFile"); - - UploadedFile = Result["file"]; - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(UploadedFile["title"]).Equal(Title); - - Result = OPI_Slack.SendExternalFile(Token, UploadedFile["id"], Channel); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendExternalFile"); - - Check_SlackOk(Result); - - Result = OPI_Slack.DeleteExternalFile(Token, UploadedFile["id"]); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendExternalFile"); - - Check_SlackOk(Result); - -EndProcedure - -#EndRegion - -#Region Airtable - -Procedure AT_CreateDatabase() Export - - Token = OPI_GetTestData.GetParameter("Airtable_Token"); - Region = OPI_GetTestData.GetParameter("Airtable_Workspace"); - Name = "TestDatabase"; - - FieldArray = New Array; - FieldArray.Add(OPI_Airtable.GetNumberField("Number")); - FieldArray.Add(OPI_Airtable.GetStringField("String")); - - TableName = "TestTable"; - - TableMapping = New Match; - TableMapping.Insert(TableName, FieldArray); - - Result = OPI_Airtable.CreateDatabase(Token, Region, Name, TableMapping); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateDatabase"); - - OPI_GetTestData.ExpectsThat(Result["id"]).Filled(); - OPI_GetTestData.ExpectsThat(Result["tables"][0]["name"]).Equal(TableName); - - Base = Result["id"]; - OPI_GetTestData.WriteParameter("Airtable_Base", Base); - - Result = OPI_Airtable.GetDatabaseTables(Token, Base); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetDatabaseTables"); - - OPI_GetTestData.ExpectsThat(Result["tables"]).Filled(); - OPI_GetTestData.ExpectsThat(Result["tables"]).HasType("Array"); - - Result = OPI_Airtable.GetListOfBases(Token); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetListOfBases"); - - OPI_GetTestData.ExpectsThat(Result["bases"]).Filled(); - OPI_GetTestData.ExpectsThat(Result["bases"]).HasType("Array"); - -EndProcedure - -Procedure AT_CreateTable() Export - - Token = OPI_GetTestData.GetParameter("Airtable_Token"); - Base = OPI_GetTestData.GetParameter("Airtable_Base"); - - FieldArray = New Array; - FieldArray.Add(OPI_Airtable.GetNumberField("Number")); - // !OInt OPI_GetTestData.WriteLog(FieldArray[0], "GetNumberField"); - - FieldArray.Add(OPI_Airtable.GetStringField("String")); - // !OInt OPI_GetTestData.WriteLog(FieldArray[1], "GetStringField"); - - FieldArray.Add(OPI_Airtable.GetAttachmentField("Attachment")); - // !OInt OPI_GetTestData.WriteLog(FieldArray[2], "GetAttachmentField"); - - FieldArray.Add(OPI_Airtable.GetCheckboxField("Checkbox")); - // !OInt OPI_GetTestData.WriteLog(FieldArray[3], "GetCheckboxField"); - - FieldArray.Add(OPI_Airtable.GetDateField("Date")); - // !OInt OPI_GetTestData.WriteLog(FieldArray[4], "GetDateField"); - - FieldArray.Add(OPI_Airtable.GetPhoneField("Phone")); - // !OInt OPI_GetTestData.WriteLog(FieldArray[5], "GetPhoneField"); - - FieldArray.Add(OPI_Airtable.GetEmailField("Email")); - // !OInt OPI_GetTestData.WriteLog(FieldArray[6], "GetEmailField"); - - FieldArray.Add(OPI_Airtable.GetLinkField("Link")); - // !OInt OPI_GetTestData.WriteLog(FieldArray[7], "GetLinkField"); - - TableName = "TestTable2"; - Description = "NewTable"; - - Result = OPI_Airtable.CreateTable(Token, Base, TableName, FieldArray, Description); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateTable"); - - OPI_GetTestData.ExpectsThat(Result["name"]).Equal(TableName); - OPI_GetTestData.ExpectsThat(Result["description"]).Equal(Description); - - Table = Result["id"]; - TableName = "TestTable2 (fromм.)"; - Description = "NewTable (fromм.)"; - - OPI_GetTestData.WriteParameter("Airtable_Table", Table); - - Result = OPI_Airtable.ModifyTable(Token, Base, Table, TableName, Description); - - // !OInt OPI_GetTestData.WriteLog(Result, "ModifyTable"); - - OPI_GetTestData.ExpectsThat(Result["name"]).Equal(TableName); - OPI_GetTestData.ExpectsThat(Result["description"]).Equal(Description); - -EndProcedure - -Procedure AT_CreateField() Export - - Token = OPI_GetTestData.GetParameter("Airtable_Token"); - Base = OPI_GetTestData.GetParameter("Airtable_Base"); - Table = OPI_GetTestData.GetParameter("Airtable_Table"); - Name = String(New UniqueIdentifier); - - Field = OPI_Airtable.GetNumberField(Name); - - Result = OPI_Airtable.CreateField(Token, Base, Table, Field); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateField"); - - OPI_GetTestData.ExpectsThat(Result["name"]).Equal(Name); - - Field = Result["id"]; - Name = Name + "(fromм.)"; - Description = "New description"; - - Result = OPI_Airtable.ModifyField(Token, Base, Table, Field, Name, Description); - - // !OInt OPI_GetTestData.WriteLog(Result, "ModifyField"); - - OPI_GetTestData.ExpectsThat(Result["name"]).Equal(Name); - OPI_GetTestData.ExpectsThat(Result["description"]).Equal(Description); - -EndProcedure - -Procedure AT_CreateDeleteRecords() Export - - Token = OPI_GetTestData.GetParameter("Airtable_Token"); - Base = OPI_GetTestData.GetParameter("Airtable_Base"); - Table = OPI_GetTestData.GetParameter("Airtable_Table"); - - Numeric = 10; - StringType = "Hello"; - - RowDescription1 = New Structure("Number,String", Numeric, StringType); - RowDescription2 = New Structure("Number,String", Numeric, StringType); - - ArrayOfDeletions = New Array; - ArrayOfDescriptions = New Array; - ArrayOfDescriptions.Add(RowDescription1); - ArrayOfDescriptions.Add(RowDescription2); - - Result = OPI_Airtable.CreatePosts(Token, Base, Table, ArrayOfDescriptions); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreatePosts"); - - OPI_GetTestData.ExpectsThat(Result["records"]).HasType("Array"); - OPI_GetTestData.ExpectsThat(Result["records"].Quantity()).Equal(2); - - For Each Record In Result["records"] Do - ArrayOfDeletions.Add(Record["id"]); - EndDo; - - Result = OPI_Airtable.CreatePosts(Token, Base, Table, RowDescription1); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreatePosts (оdto)"); - - SingleRecord = Result["id"]; - OPI_GetTestData.ExpectsThat(SingleRecord).Filled(); - OPI_GetTestData.ExpectsThat(Result["createdTime"]).Filled(); - OPI_GetTestData.ExpectsThat(Result["fields"]["Number"]).Equal(Numeric); - OPI_GetTestData.ExpectsThat(ShortLP(Result["fields"]["String"])).Equal(StringType); - - Result = OPI_Airtable.GetRecord(Token, Base, Table, SingleRecord); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetRecord"); - - OPI_GetTestData.ExpectsThat(Result["id"]).Equal(SingleRecord); - - Text = "TestComment"; - Result = OPI_Airtable.CreateComment(Token, Base, Table, SingleRecord, Text); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateComment"); - - OPI_GetTestData.ExpectsThat(Result["text"]).Equal(Text); - - Comment = Result["id"]; - Text = "TestComment (fromм.)"; - Result = OPI_Airtable.EditComment(Token, Base, Table, SingleRecord, Comment, Text); - - // !OInt OPI_GetTestData.WriteLog(Result, "EditComment"); - - OPI_GetTestData.ExpectsThat(Result["text"]).Equal(Text); - - Result = OPI_Airtable.GetComments(Token, Base, Table, SingleRecord); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetComments"); - - OPI_GetTestData.ExpectsThat(Result["comments"]).HasType("Array"); - - Result = OPI_Airtable.DeleteComment(Token, Base, Table, SingleRecord, Comment); - - // !OInt OPI_GetTestData.WriteLog(Result, "DeleteComment"); - - OPI_GetTestData.ExpectsThat(Result["deleted"]).Equal(True); - OPI_GetTestData.ExpectsThat(Result["id"]).Equal(Comment); - - Result = OPI_Airtable.GetListOfRecords(Token, Base, Table); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetListOfRecords"); - - OPI_GetTestData.ExpectsThat(Result["records"]).HasType("Array"); - OPI_GetTestData.ExpectsThat(Result["records"]).Filled(); - - Result = OPI_Airtable.DeletePosts(Token, Base, Table, ArrayOfDeletions); - - // !OInt OPI_GetTestData.WriteLog(Result, "DeletePosts"); - - OPI_GetTestData.ExpectsThat(Result["records"]).HasType("Array"); - OPI_GetTestData.ExpectsThat(Result["records"]).Filled(); - - Result = OPI_Airtable.DeletePosts(Token, Base, Table, SingleRecord); - - // !OInt OPI_GetTestData.WriteLog(Result, "DeletePosts (оdto)"); - - OPI_GetTestData.ExpectsThat(Result["records"]).HasType("Array"); - OPI_GetTestData.ExpectsThat(Result["records"]).Filled(); - -EndProcedure - -#EndRegion - -#Region Dropbox - -Procedure Dropbox_GetUpdateToken() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Dropbox_Appkey" , TestParameters); - OPI_GetTestData.ParameterToCollection("Dropbox_Appsecret", TestParameters); - - Dropbox_GetAuthorizationLink(TestParameters); - - OPI_GetTestData.ParameterToCollection("Dropbox_Code", TestParameters); - - Dropbox_GetToken(TestParameters); - - OPI_GetTestData.ParameterToCollection("Dropbox_Refresh", TestParameters); - - Dropbox_UpdateToken(TestParameters); - -EndProcedure - -Procedure Dropbox_UploadFile() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Dropbox_Token", TestParameters); - OPI_GetTestData.ParameterToCollection("Picture", TestParameters); - - Dropbox_UploadFile(TestParameters); - Dropbox_GetObjectInformation(TestParameters); - Dropbox_GetObjectVersionList(TestParameters); - Dropbox_RestoreObjectToVersion(TestParameters); - Dropbox_GetPreview(TestParameters); - Dropbox_DownloadFile(TestParameters); - Dropbox_MoveObject(TestParameters); - Dropbox_CopyObject(TestParameters); - Dropbox_DeleteObject(TestParameters); - -EndProcedure - -Procedure Dropbox_CreateFolder() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Dropbox_Token", TestParameters); - - Dropbox_CreateFolder(TestParameters); - Dropbox_DownloadFolder(TestParameters); - -EndProcedure - -Procedure Dropbox_GetFolderFileList() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Dropbox_Token", TestParameters); - - Dropbox_GetFolderFileList(TestParameters); - -EndProcedure - -Procedure Dropbox_UploadFileByURL() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Dropbox_Token", TestParameters); - OPI_GetTestData.ParameterToCollection("Document", TestParameters); - - Dropbox_UploadFileByURL(TestParameters); - Dropbox_GetUploadStatusByURL(TestParameters); - -EndProcedure - -Procedure Dropbox_CreateDeleteTag() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Dropbox_Token", TestParameters); - - Dropbox_AddTag(TestParameters); - Dropbox_GetTagList(TestParameters); - Dropbox_DeleteTag(TestParameters); - -EndProcedure - -Procedure Dropbox_GetAccount() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Dropbox_Token", TestParameters); - - Dropbox_GetAccountInformation(TestParameters); - Dropbox_GetSpaceUsageData(TestParameters); - -EndProcedure - -Procedure Dropbox_AccessManagement() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Dropbox_Token" , TestParameters); - OPI_GetTestData.ParameterToCollection("Dropbox_OtherUser", TestParameters); - OPI_GetTestData.ParameterToCollection("Dropbox_FileID" , TestParameters); - - Dropbox_AddUsersToFile(TestParameters); - Dropbox_PublishFolder(TestParameters); - Dropbox_AddUsersToFolder(TestParameters); - Dropbox_CancelFolderPublication(TestParameters); - Dropbox_CancelFilePublication(TestParameters); - -EndProcedure - -#EndRegion - -#EndRegion - -#EndRegion - -#Region ServiceProceduresAndFunctions - -Function GetVKParameters() - - Parameters = New Structure; - GroupNumber = OPI_GetTestData.GetParameter("VK_GroupID"); - - Parameters.Insert("access_token" , OPI_GetTestData.GetParameter("VK_Token")); - Parameters.Insert("owner_id" , "-" + GroupNumber); - Parameters.Insert("app_id" , OPI_GetTestData.GetParameter("VK_AppID")); - Parameters.Insert("group_id" , GroupNumber); - - Return Parameters; - -EndFunction - -Function GetTwitterParameters() - - Parameters = New Match; - - Parameters.Insert("redirect_uri" , OPI_GetTestData.GetParameter("Twitter_Redirect")); - Parameters.Insert("client_id" , OPI_GetTestData.GetParameter("Twitter_ClinetID")); - Parameters.Insert("client_secret" , OPI_GetTestData.GetParameter("Twitter_ClientSecret")); - Parameters.Insert("access_token" , OPI_GetTestData.GetParameter("Twitter_Token")); - Parameters.Insert("refresh_token" , OPI_GetTestData.GetParameter("Twitter_Refresh")); - Parameters.Insert("oauth_token" , OPI_GetTestData.GetParameter("Twitter_OAuthToken")); - Parameters.Insert("oauth_token_secret" , OPI_GetTestData.GetParameter("Twitter_OAuthSecret")); - - Parameters.Insert("oauth_consumer_key" - , OPI_GetTestData.GetParameter("Twitter_OAuthConsumerKey")); - Parameters.Insert("oauth_consumer_secret" - , OPI_GetTestData.GetParameter("Twitter_OAuthConsumerSecret")); - - Return Parameters; - -EndFunction - -#Region Checks - -Procedure Check_Empty(Val Result) - OPI_GetTestData.ExpectsThat(ValueFilled(Result)).Equal(False); -EndProcedure - -Procedure Check_BinaryData(Val Result, Val Size = Undefined) - - MinimumSize = 500000; - - OPI_GetTestData.ExpectsThat(Result).HasType("BinaryData"); - - If Not Size = Undefined Then - OPI_GetTestData.ExpectsThat(Result.Size()).Equal(Size); - Else - OPI_GetTestData.ExpectsThat(Result.Size() > MinimumSize).Equal(True); - EndIf; - -EndProcedure - -Procedure Check_TelegramTrue(Val Result) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); - OPI_GetTestData.ExpectsThat(Result["result"]).Equal(True); - -EndProcedure - -Procedure Check_TelegramBotInformation(Val Result) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); - OPI_GetTestData.ExpectsThat(Result["result"]["username"]).Filled(); - -EndProcedure - -Procedure Check_TelegramArray(Result) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match") .Filled(); - OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); - OPI_GetTestData.ExpectsThat(Result["result"]).HasType("Array"); - -EndProcedure - -Procedure Check_TelegramWebhookSetup(Val Result) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); - OPI_GetTestData.ExpectsThat(Result["result"]).Equal(True); - OPI_GetTestData.ExpectsThat(Result["description"]).Equal("Webhook was set"); - -EndProcedure - -Procedure Check_TelegramWebhookDeletion(Val Result) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); - OPI_GetTestData.ExpectsThat(Result["result"]).Equal(True); - OPI_GetTestData.ExpectsThat(Result["description"]).Filled(); - -EndProcedure - -Procedure Check_TelegramMessage(Val Result, Val Text) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); - OPI_GetTestData.ExpectsThat(Result["result"]["text"]).Equal(Text); - -EndProcedure - -Procedure Check_TelegramImage(Val Result, Val Text) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match") .Filled(); - OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); - OPI_GetTestData.ExpectsThat(Result["result"]["caption"]).Equal(Text); - OPI_GetTestData.ExpectsThat(Result["result"]["photo"]).HasType("Array"); - -EndProcedure - -Procedure Check_TelegramVideo(Val Result, Val Text) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); - OPI_GetTestData.ExpectsThat(Result["result"]["caption"]).Equal(Text); - OPI_GetTestData.ExpectsThat(Result["result"]["video"]["mime_type"]).Equal("video/mp4"); - -EndProcedure - -Procedure Check_TelegramAudio(Val Result, Val Text) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); - OPI_GetTestData.ExpectsThat(Result["result"]["caption"]).Equal(Text); - OPI_GetTestData.ExpectsThat(Result["result"]["audio"]["mime_type"]).Equal("audio/mpeg"); - -EndProcedure - -Procedure Check_TelegramDocument(Val Result, Val Text) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); - OPI_GetTestData.ExpectsThat(Result["result"]["caption"]).Equal(Text); - OPI_GetTestData.ExpectsThat(Result["result"]["document"]).HasType("Match").Filled(); - -EndProcedure - -Procedure Check_TelegramGif(Val Result, Val Text) - - Result = "result"; - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); - OPI_GetTestData.ExpectsThat(Result[Result]["caption"]).Equal(Text); - OPI_GetTestData.ExpectsThat(Result[Result]["document"]).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result[Result]["animation"]["mime_type"]).Equal("video/mp4"); - -EndProcedure - -Procedure Check_TelegramMediaGroup(Val Result) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); - OPI_GetTestData.ExpectsThat(Result["result"]).HasType("Array"); - -EndProcedure - -Procedure Check_TelegramLocation(Val Result) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); - OPI_GetTestData.ExpectsThat(Result["result"]["location"]).HasType("Match").Filled(); - -EndProcedure - -Procedure Check_TelegramContact(Val Result, Val Name) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); - OPI_GetTestData.ExpectsThat(Result["result"]["contact"]).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["result"]["contact"]["first_name"]).Equal(Name); - -EndProcedure - -Procedure Check_TelegramPoll(Val Result, Val Question) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); - OPI_GetTestData.ExpectsThat(Result["result"]["poll"]).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["result"]["poll"]["question"]).Equal(Question); - -EndProcedure - -Procedure Check_TelegramForward(Val Result, Val MessageID) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); - OPI_GetTestData.ExpectsThat(Result["result"]["forward_origin"]["message_id"]).Equal(Number(MessageID)); - -EndProcedure - -Procedure Check_TelegramBan(Val Result) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["description"]).Equal("Bad Request: can't remove chat owner"); - -EndProcedure - -Procedure Check_TelegramInvitation(Val Result, Val Title, Val UnixExpiration) - - Result = "result"; - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); - OPI_GetTestData.ExpectsThat(Result[Result]["member_limit"]).Equal(200); - OPI_GetTestData.ExpectsThat(Result[Result]["name"]).Equal(Title); - OPI_GetTestData.ExpectsThat(Result[Result]["expire_date"]).Equal(Number(UnixExpiration)); - -EndProcedure - -Procedure Check_TelegramNumber(Val Result) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); - OPI_GetTestData.ExpectsThat(Result["result"]).HasType("Number"); - -EndProcedure - -Procedure Check_TelegramCreateTopic(Val Result, Val Name, Icon) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); - OPI_GetTestData.ExpectsThat(Result["result"]["name"]).Equal(Name); - OPI_GetTestData.ExpectsThat(Result["result"]["icon_custom_emoji_id"]).Equal(Icon); - -EndProcedure - -Procedure Check_VKPost(Val Result) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["response"]["post_id"]).HasType("Number").Filled(); - -EndProcedure - -Procedure Check_VKTrue(Val Result) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["response"]).HasType("Number").Equal(1); - -EndProcedure - -Procedure Check_VKAlbum(Val Result, Val Description) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["response"]["description"]).Equal(Description); - -EndProcedure - -Procedure Check_VKAlbumPicture(Val Result, Val ImageDescription, Val AlbumID) - - Response = "response"; - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result[Response][0]["text"]).Equal(ImageDescription); - OPI_GetTestData.ExpectsThat(Result[Response][0]["album_id"]).Equal(AlbumID); - -EndProcedure - -Procedure Check_VKStory(Val Result) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["response"]["count"]).HasType("Number").Equal(1); - OPI_GetTestData.ExpectsThat(Result["response"]["items"]).HasType("Array").Filled(); - -EndProcedure - -Procedure Check_VKDiscussion(Val Result) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["response"]).HasType("Number").Filled(); - -EndProcedure - -Procedure Check_GKObject(Val Result, Val Name, Val Description) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match"); - OPI_GetTestData.ExpectsThat(Result["summary"]).Equal(Name); - OPI_GetTestData.ExpectsThat(Result["description"]).Equal(Description); - OPI_GetTestData.ExpectsThat(Result["id"]).HasType("String").Filled(); - -EndProcedure - -Procedure Check_TwitterText(Val Result, Val Text) - - ReplyText = Result["data"]["text"]; - ReplyText = Left(ReplyText, StrLength(Text)); - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(ReplyText).Equal(Text); - -EndProcedure - -Procedure Check_ViberOk(Val Result) - - OPI_GetTestData.ExpectsThat(Result["status_message"]).Equal("ok"); - OPI_GetTestData.ExpectsThat(Result["status"]).Equal(0); - -EndProcedure - -Procedure Check_NotionObject(Val Result, Val View = "page") - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["object"]).Equal(View); - -EndProcedure - -Procedure Check_SlackOk(Val Result) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); - -EndProcedure - -Procedure Check_DropboxFile(Val Result, Val Path) - - OPI_GetTestData.ExpectsThat(Result["path_display"]).Equal(Path); - -EndProcedure - -Procedure Check_DropboxMetadata(Val Result, Val Path) - - OPI_GetTestData.ExpectsThat(Result["metadata"]["path_display"]).Equal(Path); - -EndProcedure - -Procedure Check_DropboxArray(Val Result, Val Quantity = Undefined) - - OPI_GetTestData.ExpectsThat(Result["entries"]).HasType("Array"); - - If Not Quantity = Undefined Then - OPI_GetTestData.ExpectsThat(Result["entries"].Quantity()).Equal(Quantity); - EndIf; - -EndProcedure - -Procedure Check_DropboxWork(Val Result) - OPI_GetTestData.ExpectsThat(Result["async_job_id"]).Filled(); -EndProcedure - -Procedure Check_DropboxStatus(Val Result) - OPI_GetTestData.ExpectsThat(Result[".tag"]).Equal("complete"); -EndProcedure - -Procedure Check_DropboxTags(Val Result, Val Quantity) - - OPI_GetTestData.ExpectsThat(Result["paths_to_tags"]).HasType("Array"); - OPI_GetTestData.ExpectsThat(Result["paths_to_tags"].Quantity()).Equal(Quantity); - -EndProcedure - -Procedure Check_DropboxAccount(Val Result) - OPI_GetTestData.ExpectsThat(Result["account_id"]).Filled(); -EndProcedure - -Procedure Check_DropboxSpace(Val Result) - OPI_GetTestData.ExpectsThat(Result["used"]).Filled(); -EndProcedure - -Procedure Check_DropboxMember(Val Result, Val Email, Val ViewOnly) - OPI_GetTestData.ExpectsThat(Result[0]["result"][".tag"]).Equal("success"); - OPI_GetTestData.ExpectsThat(Result[0]["member"]["email"]).Equal(Email); - OPI_GetTestData.ExpectsThat( - Result[0]["result"]["success"][".tag"]).Equal(?(ViewOnly, "viewer", "editor")); -EndProcedure - -Procedure Check_DropboxPublicFolder(Val Result) - OPI_GetTestData.ExpectsThat(Result["shared_folder_id"]).Filled(); -EndProcedure - -#EndRegion - -#Region AtomicTests - -#Region Telegram - -Procedure Telegram_GetBotInformation(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - Result = OPI_Telegram.GetBotInformation(Token); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "GetBotInformation", "Telegram"); - - Check_TelegramBotInformation(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_GetUpdates(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - Result = OPI_Telegram.GetUpdates(Token); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "GetUpdates", "Telegram"); - - Check_TelegramArray(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_SetWebhook(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - URL = FunctionParameters["Telegram_URL"]; - - Result = OPI_Telegram.SetWebhook(Token, URL); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "SetWebhook", "Telegram"); - - Check_TelegramWebhookSetup(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_DeleteWebhook(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - Result = OPI_Telegram.DeleteWebhook(Token); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "DeleteWebhook", "Telegram"); - - Check_TelegramWebhookDeletion(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_SendTextMessage(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - ChatID = FunctionParameters["Telegram_ChatID"]; - ChannelID = FunctionParameters["Telegram_ChannelID"]; - Text = FunctionParameters["String"]; - - Result = OPI_Telegram.SendTextMessage(Token, ChatID, Text); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendTextMessage", "Telegram"); - - Check_TelegramMessage(Result, Text); // SKIP - - Result = OPI_Telegram.SendTextMessage(Token, ChannelID, Text); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "SendTextMessage (toаtoл)"); - - Check_TelegramMessage(Result, Text); - - MessageID = OPI_Tools.NumberToString(Result["result"]["message_id"]); - OPI_GetTestData.WriteParameter("Telegram_ChannelMessageID", MessageID); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_SendPicture(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - ChatID = FunctionParameters["Telegram_ChatID"]; - ChannelID = FunctionParameters["Telegram_ChannelID"]; - Text = FunctionParameters["String"]; - Image = FunctionParameters["Picture"]; - - ImagePath = GetTempFileName("png"); - CopyFile(Image, ImagePath); - - ImageDD = New BinaryData(ImagePath); - - Result = OPI_Telegram.SendImage(Token, ChatID, Text, Image); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendImage", "Telegram"); - - Check_TelegramImage(Result, Text); // SKIP - - Result = OPI_Telegram.SendImage(Token, ChannelID, Text, ImagePath); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendImage (Path)"); - - Check_TelegramImage(Result, Text); // SKIP - - Result = OPI_Telegram.SendImage(Token, ChannelID, Text, ImageDD); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "SendImage (BD)"); - - Check_TelegramImage(Result, Text); - - DeleteFiles(ImagePath); - - FileID = Result["result"]["photo"][0]["file_id"]; - OPI_GetTestData.WriteParameter("Telegram_FileID", FileID); - - FunctionParameters.Insert("Telegram_FileID", FileID); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_SendVideo(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - ChatID = FunctionParameters["Telegram_ChatID"]; - ChannelID = FunctionParameters["Telegram_ChannelID"]; - Text = FunctionParameters["String"]; - Video = FunctionParameters["Video"]; - - VideoPath = GetTempFileName("mp4"); - CopyFile(Video, VideoPath); - - VideoDD = New BinaryData(VideoPath); - - Result = OPI_Telegram.SendVideo(Token, ChatID, Text, Video); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendVideo", "Telegram"); - - Check_TelegramVideo(Result, Text); // SKIP - - Result = OPI_Telegram.SendVideo(Token, ChannelID, Text, VideoPath); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendVideo (Path)"); - - Check_TelegramVideo(Result, Text); // SKIP - - Result = OPI_Telegram.SendVideo(Token, ChannelID, Text, VideoDD); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "SendVideo (BD)"); - - Check_TelegramVideo(Result, Text); - - DeleteFiles(VideoPath); - - FileID = Result["result"]["video"]["file_id"]; - OPI_GetTestData.WriteParameter("Telegram_FileID", FileID); - - FunctionParameters.Insert("Telegram_FileID", FileID); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_SendAudio(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - ChatID = FunctionParameters["Telegram_ChatID"]; - ChannelID = FunctionParameters["Telegram_ChannelID"]; - Text = FunctionParameters["String"]; - Audio = FunctionParameters["Audio"]; - - AudioPath = GetTempFileName("mp3"); - CopyFile(Audio, AudioPath); - - AudioDD = New BinaryData(AudioPath); - - Result = OPI_Telegram.SendAudio(Token, ChatID, Text, Audio); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendAudio", "Telegram"); - - Check_TelegramAudio(Result, Text); // SKIP - - Result = OPI_Telegram.SendAudio(Token, ChannelID, Text, AudioPath); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendAudio (Path)"); - - Check_TelegramAudio(Result, Text); // SKIP - - Result = OPI_Telegram.SendAudio(Token, ChannelID, Text, AudioDD); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "SendAudio (BD)"); - - Check_TelegramAudio(Result, Text); - - DeleteFiles(AudioPath); - - FileID = Result["result"]["audio"]["file_id"]; - OPI_GetTestData.WriteParameter("Telegram_FileID", FileID); - - FunctionParameters.Insert("Telegram_FileID", FileID); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_SendDocument(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - ChatID = FunctionParameters["Telegram_ChatID"]; - ChannelID = FunctionParameters["Telegram_ChannelID"]; - Text = FunctionParameters["String"]; - Document = FunctionParameters["Document"]; - - DocumentPath = GetTempFileName("docx"); - CopyFile(Document, DocumentPath); - - DocumentDD = New BinaryData(DocumentPath); - - Result = OPI_Telegram.SendDocument(Token, ChatID, Text, Document); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendDocument", "Telegram"); - - Check_TelegramDocument(Result, Text); // SKIP - - Result = OPI_Telegram.SendDocument(Token, ChannelID, Text, DocumentPath); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendDocument (Path)"); - - Check_TelegramDocument(Result, Text); // SKIP - - Result = OPI_Telegram.SendDocument(Token, ChannelID, Text, DocumentDD); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "SendDocument (BD)"); - - Check_TelegramDocument(Result, Text); - - DeleteFiles(DocumentPath); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_SendGif(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - ChatID = FunctionParameters["Telegram_ChatID"]; - ChannelID = FunctionParameters["Telegram_ChannelID"]; - Text = FunctionParameters["String"]; - GIF = FunctionParameters["GIF"]; - - GifPath = GetTempFileName("gif"); - CopyFile(GIF, GifPath); - - GifDD = New BinaryData(GifPath); - - Result = OPI_Telegram.SendGif(Token, ChatID, Text, GIF); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendGif", "Telegram"); - - Check_TelegramGif(Result, Text); // SKIP - - Result = OPI_Telegram.SendGif(Token, ChannelID, Text, GifPath); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendGif (Path)"); - - Check_TelegramGif(Result, Text); // SKIP - - Result = OPI_Telegram.SendGif(Token, ChannelID, Text, GifDD); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "SendGif (BD)"); - - Check_TelegramGif(Result, Text); - - DeleteFiles(GifPath); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_SendMediaGroup(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - ChatID = FunctionParameters["Telegram_ChatID"]; - Text = FunctionParameters["String"]; - Image = FunctionParameters["Picture"]; - Video = FunctionParameters["Video"]; - - ImagePath = GetTempFileName("png"); - CopyFile(Image, ImagePath); - - VideoPath = GetTempFileName("mp4"); - CopyFile(Video, VideoPath); - - VideoDD = New BinaryData(VideoPath); - - MediaGroup = New Match; - MediaGroup.Insert(ImagePath, "photo"); - MediaGroup.Insert(VideoDD , "video"); - - Result = OPI_Telegram.SendMediaGroup(Token, ChatID, Text, MediaGroup); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "SendMediaGroup", "Telegram"); - - Check_TelegramMediaGroup(Result); - - DeleteFiles(VideoPath); - DeleteFiles(ImagePath); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_SendLocation(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - ChatID = FunctionParameters["Telegram_ChatID"]; - ChannelID = FunctionParameters["Telegram_ChannelID"]; - Width = FunctionParameters["Lat"]; - Longitude = FunctionParameters["Long"]; - - Result = OPI_Telegram.SendLocation(Token, ChatID, Width, Longitude); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendLocation", "Telegram"); - - Check_TelegramLocation(Result); // SKIP - - Result = OPI_Telegram.SendLocation(Token, ChannelID, Width, Longitude); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "SendLocation (toаtoл)"); - - Check_TelegramLocation(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_SendContact(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - ChatID = FunctionParameters["Telegram_ChatID"]; - ChannelID = FunctionParameters["Telegram_ChannelID"]; - Name = FunctionParameters["Name"]; - Last name = FunctionParameters["Surname"]; - Phone = FunctionParameters["Phone"]; - - Result = OPI_Telegram.SendContact(Token, ChatID , Name, Last name, Phone); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendContact", "Telegram"); - - Check_TelegramContact(Result, Name); // SKIP - OPI_Tools.Pause(20); // SKIP - - Result = OPI_Telegram.SendContact(Token, ChannelID, Name, Last name, Phone); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "SendContact (toаtoл)"); - - Check_TelegramContact(Result, Name); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_SendPoll(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - ChatID = FunctionParameters["Telegram_ChatID"]; - ChannelID = FunctionParameters["Telegram_ChannelID"]; - Question = "What's your favorite color?"; - - AnswersArray = New Array; - AnswersArray.Add("Red"); - AnswersArray.Add("Yellow"); - AnswersArray.Add("Green"); - AnswersArray.Add("Blue"); - - Result = OPI_Telegram.SendPoll(Token, ChatID , Question, AnswersArray, False); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendPoll", "Telegram"); - - Check_TelegramPoll(Result, Question); // SKIP - - Result = OPI_Telegram.SendPoll(Token, ChannelID, Question, AnswersArray, True); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendPoll (toаtoл)"); - - Check_TelegramPoll(Result, Question); // SKIP - - // END - - StringArray = "['Red', 'Yellow','Green' ,'Blue']"; - - Result = OPI_Telegram.SendPoll(Token, ChannelID, Question, StringArray, True); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendPoll (withтрочный маwithwithиin)"); - - Check_TelegramPoll(Result, Question); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_DownloadFile(FunctionParameters) - - FileID = FunctionParameters["Telegram_FileID"]; - Token = FunctionParameters["Telegram_Token"]; - - Result = OPI_Telegram.DownloadFile(Token, FileID); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "DownloadFile", "Telegram"); - - OPI_GetTestData.ExpectsThat(Result).HasType("BinaryData"); - -EndProcedure - -Procedure Telegram_ForwardMessage(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - ChatID = FunctionParameters["Telegram_ChatID"]; - ChannelID = FunctionParameters["Telegram_ChannelID"]; - MessageID = FunctionParameters["Telegram_ChannelMessageID"]; - - Result = OPI_Telegram.ForwardMessage(Token, MessageID, ChannelID, ChatID); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "ForwardMessage", "Telegram"); - - Check_TelegramForward(Result, MessageID); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_Ban(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - UserID = FunctionParameters["Telegram_ChatID"]; - ChannelID = FunctionParameters["Telegram_ChannelID"]; - - Result = OPI_Telegram.Ban(Token, ChannelID, UserID); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "Ban", "Telegram"); - - Check_TelegramBan(Result); - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_Unban(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - UserID = FunctionParameters["Telegram_ChatID"]; - ChannelID = FunctionParameters["Telegram_ChannelID"]; - - Result = OPI_Telegram.Unban(Token, ChannelID, UserID); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "Unban", "Telegram"); - - Check_TelegramBan(Result); - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_CreateInviteLink(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - ChannelID = FunctionParameters["Telegram_ChannelID"]; - Day = 86400; - CurrentDate = OPI_Tools.GetCurrentDate(); - - Title = "Link " + String(CurrentDate); - Expiration = CurrentDate + Day; - UnixExpiration = OPI_Tools.UNIXTime(Expiration); - - Result = OPI_Telegram.CreateInvitationLink(Token, ChannelID, Title, Expiration, 200); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateInvitationLink", "Telegram"); - - Check_TelegramInvitation(Result, Title, UnixExpiration); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_PinMessage(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - ChannelID = FunctionParameters["Telegram_ChannelID"]; - MessageID = FunctionParameters["Telegram_ChannelMessageID"]; - - Result = OPI_Telegram.PinMessage(Token, ChannelID, MessageID); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "PinMessage", "Telegram"); - - Check_TelegramTrue(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_UnpinMessage(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - ChannelID = FunctionParameters["Telegram_ChannelID"]; - MessageID = FunctionParameters["Telegram_ChannelMessageID"]; - - Result = OPI_Telegram.UnpinMessage(Token, ChannelID, MessageID); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "UnpinMessage", "Telegram"); - - Check_TelegramTrue(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_GetParticipantCount(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - ChannelID = FunctionParameters["Telegram_ChannelID"]; - - Result = OPI_Telegram.GetParticipantCount(Token, ChannelID); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "GetParticipantCount", "Telegram"); - - Check_TelegramNumber(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_GetForumAvatarList(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - Result = OPI_Telegram.GetAvatarIconList(Token); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "GetAvatarIconList", "Telegram"); - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_CreateForumTopic(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - Chat = FunctionParameters["Telegram_ForumID"]; - Icon = "5357419403325481346"; - Name = "TestTopic " + String(New UniqueIdentifier); - - Result = OPI_Telegram.CreateForumThread(Token, Chat, Name, Icon); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateForumThread", "Telegram"); - - Topic = Result["result"]["message_thread_id"]; - - FunctionParameters.Insert("Telegram_TopicID", Topic); - OPI_Tools.AddField("Telegram_TopicID", Topic, "String", FunctionParameters); - OPI_GetTestData.WriteParameter("Telegram_TopicID", FunctionParameters["Telegram_TopicID"]); - - Check_TelegramCreateTopic(Result, Name, Icon); - - ChatTopic = Chat + "*" + Topic; - Text = FunctionParameters["String"]; - Result = OPI_Telegram.SendTextMessage(Token, ChatTopic, Text); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendTextMessage (форум)"); - - Check_TelegramMessage(Result, Text); - -EndProcedure - -Procedure Telegram_EditForumTopic(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - Chat = FunctionParameters["Telegram_ForumID"]; - Topic = FunctionParameters["Telegram_TopicID"]; - NewName = "NewTestTitle"; - NewIcon = "5310132165583840589"; - - Result = OPI_Telegram.EditForumTopic(Token, Chat, Topic, NewName, NewIcon); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "EditForumTopic", "Telegram"); - - Check_TelegramTrue(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_CloseForumTopic(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - Chat = FunctionParameters["Telegram_ForumID"]; - Topic = FunctionParameters["Telegram_TopicID"]; - - OPI_Telegram.OpenForumThread(Token, Chat); // SKIP - - Result = OPI_Telegram.CloseForumThread(Token, Chat); // Closes main topic - - // !OInt OPI_GetTestData.WriteLog(Result, "CloseForumThread (глаintoя)"); - - Check_TelegramTrue(Result); // SKIP - - Result = OPI_Telegram.CloseForumThread(Token, Chat, Topic); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "CloseForumThread", "Telegram"); - - Check_TelegramTrue(Result); - - OPI_Tools.Pause(25); - -EndProcedure - -Procedure Telegram_OpenForumTopic(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - Chat = FunctionParameters["Telegram_ForumID"]; - Topic = FunctionParameters["Telegram_TopicID"]; - - Result = OPI_Telegram.OpenForumThread(Token, Chat); // Opens main topic - - // !OInt OPI_GetTestData.WriteLog(Result, "OpenForumThread (глаintoя)"); - - Check_TelegramTrue(Result); // SKIP - - Result = OPI_Telegram.OpenForumThread(Token, Chat, Topic); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "OpenForumThread", "Telegram"); - - Check_TelegramTrue(Result); - - OPI_Tools.Pause(25); - -EndProcedure - -Procedure Telegram_DeleteForumTopic(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - Chat = FunctionParameters["Telegram_ForumID"]; - Topic = FunctionParameters["Telegram_TopicID"]; - - Result = OPI_Telegram.DeleteForumTopic(Token, Chat, Topic); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "DeleteForumTopic", "Telegram"); - - Check_TelegramTrue(Result); - - OPI_Tools.Pause(25); - -EndProcedure - -Procedure Telegram_ClearPinnedMessagesList(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - Chat = FunctionParameters["Telegram_ForumID"]; - Topic = FunctionParameters["Telegram_TopicID"]; - - Result = OPI_Telegram.ClearThreadPinnedMessagesList(Token, Chat); - - // !OInt OPI_GetTestData.WriteLog(Result, "ClearThreadPinnedMessagesList (глаintoя)"); - - Check_TelegramTrue(Result); // SKIP - - Result = OPI_Telegram.ClearThreadPinnedMessagesList(Token, Chat, Topic); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "ClearThreadPinnedMessagesList", "Telegram"); - - Check_TelegramTrue(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_HideMainForumTopic(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - Chat = FunctionParameters["Telegram_ForumID"]; - - Result = OPI_Telegram.HideMainForumTopic(Token, Chat); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "HideMainForumTopic", "Telegram"); - - Check_TelegramTrue(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_ShowMainForumTopic(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - Chat = FunctionParameters["Telegram_ForumID"]; - - Result = OPI_Telegram.ShowMainForumTopic(Token, Chat); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "ShowMainForumTopic", "Telegram"); - - Check_TelegramTrue(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_ChangeMainTopicName(FunctionParameters) - - Title = "New main thread name " + String(New UniqueIdentifier); - Token = FunctionParameters["Telegram_Token"]; - Chat = FunctionParameters["Telegram_ForumID"]; - - Result = OPI_Telegram.EditMainForumTopicName(Token, Chat, Title); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "EditMainForumTopicName", "Telegram"); - - Check_TelegramTrue(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -#EndRegion - -#Region VK - -Procedure VK_CreateTokenRetrievalLink(FunctionParameters) - - Application = FunctionParameters["VK_AppID"]; - Result = OPI_VK.CreateTokenRetrievalLink(Application); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateTokenRetrievalLink", "VK"); - - OPI_GetTestData.ExpectsThat(Result).HasType("String").Filled(); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure VK_CreatePost(FunctionParameters) - - Parameters = GetVKParameters(); - Text = "Post from autotest"; - URL = "https://github.com/Bayselonarrend/OpenIntegrations"; - - Image = FunctionParameters["Picture"]; // URL, Path or Binary Data - Image2 = FunctionParameters["Picture2"]; // URL, Path or Binary Data - - AndVF = GetTempFileName("png"); - CopyFile(Image2, AndVF); - - ImageArray = New Array; - ImageArray.Add(Image); - ImageArray.Add(AndVF); - - Result = OPI_VK.CreatePost(Text, ImageArray, True, URL, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreatePost", "VK"); - - Check_VKPost(Result); // SKIP - PostID = Result["response"]["post_id"]; // SKIP - Result = OPI_VK.DeletePost(PostID, Parameters); // SKIP - - Result = OPI_VK.CreatePost(Text, Image, False , , Parameters); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "CreatePost (оdto toартинtoа)"); - - Check_VKPost(Result); - - PostID = Result["response"]["post_id"]; - Result = OPI_VK.DeletePost(PostID, Parameters); - - OPI_Tools.Pause(5); - - Result = OPI_VK.CreatePost(Text, AndVF , True, URL, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreatePost (оdин path)"); - - Check_VKPost(Result); - - PostID = Result["response"]["post_id"]; - OPI_Tools.AddField("VK_PostID", PostID, "String", FunctionParameters); - OPI_GetTestData.WriteParameter("VK_PostID", FunctionParameters["VK_PostID"]); - - DeleteFiles(AndVF); - OPI_Tools.Pause(5); - -EndProcedure - -Procedure VK_DeletePost(FunctionParameters) - - Parameters = GetVKParameters(); - PostID = FunctionParameters["VK_PostID"]; - - Result = OPI_VK.DeletePost(PostID, Parameters); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "DeletePost", "VK"); - - Check_VKTrue(Result); - -EndProcedure - -Procedure VK_CreateCompositePost(FunctionParameters) - - Parameters = GetVKParameters(); - Text = "Post from autotest"; - URL = "https://github.com/Bayselonarrend/OpenIntegrations"; - - Image = FunctionParameters["Picture"]; // URL, Path or Binary Data - Video = FunctionParameters["Video"]; // URL, Path or Binary Data - - AndVF = GetTempFileName("png"); - CopyFile(Image, AndVF); - - ImageUpload = OPI_VK.UploadPhotoToServer(AndVF, Parameters)["response"][0]; - VideoUpload = OPI_VK.UploadVideoToServer(Video, "NewVideo", , , Parameters); - - ImageOwner = OPI_Tools.NumberToString(ImageUpload["owner_id"]); - VideoOwner = OPI_Tools.NumberToString(VideoUpload["owner_id"]); - - ImageID = OPI_Tools.NumberToString(ImageUpload["id"]); - VideoID = OPI_Tools.NumberToString(VideoUpload["video_id"]); - - AttachmentsArray = New Array; - AttachmentsArray.Add("photo" + ImageOwner + "_" + ImageID); - AttachmentsArray.Add("video" + VideoOwner + "_" + VideoID); - - Result = OPI_VK.CreateCompositePost(Text, AttachmentsArray, False, URL, Parameters); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateCompositePost", "VK"); - - Check_VKPost(Result); - DeleteFiles(AndVF); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure VK_CreatePoll() - - Parameters = GetVKParameters(); - Question = "What's your favorite color?"; - - OptionArray = New Array; - OptionArray.Add("Red"); - OptionArray.Add("Yellow"); - OptionArray.Add("Green"); - - Result = OPI_VK.CreatePoll(Question, OptionArray, , Parameters); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "CreatePoll", "VK"); - - Check_VKPost(Result); - - PostID = Result["response"]["post_id"]; - OPI_VK.DeletePost(PostID, Parameters); - - OPI_Tools.Pause(10); - -EndProcedure - -Procedure VK_CreateAlbum(FunctionParameters) - - Parameters = GetVKParameters(); - Name = "AlbumFromAutoTest"; - Description = "NewAlbumFromAutoTest"; - - Result = OPI_VK.CreateAlbum(Name, Description, Parameters); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateAlbum", "VK"); - - Check_VKAlbum(Result, Description); - - AlbumID = Result["response"]["id"]; - FunctionParameters.Insert("VK_AlbumID", AlbumID); - OPI_GetTestData.WriteParameter("VK_AlbumID", AlbumID); - -EndProcedure - -Procedure VK_SavePictureToAlbum(FunctionParameters) - - Parameters = GetVKParameters(); - ImageDescription = "AutoTestImage"; - AlbumID = FunctionParameters["VK_AlbumID"]; - - Image = FunctionParameters["Picture"]; // URL, Path to file or Binary Data - AndVF = GetTempFileName("png"); - CopyFile(Image, AndVF); - - Image = New BinaryData(AndVF); - - Result = OPI_VK.SaveImageToAlbum(AlbumID, Image, ImageDescription, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "SaveImageToAlbum", "VK"); - - Check_VKAlbumPicture(Result, ImageDescription, AlbumID); // SKIP - - ImageID = Result["response"][0]["id"]; // SKIP - Result = OPI_VK.DeleteImage(ImageID, Parameters); // SKIP - - Result = OPI_VK.SaveImageToAlbum(AlbumID, AndVF, ImageDescription, Parameters); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "SaveImageToAlbum (path)"); - - Check_VKAlbumPicture(Result, ImageDescription, AlbumID); // SKIP - - ImageID = Result["response"][0]["id"]; - FunctionParameters.Insert("VK_PictureID", ImageID); - OPI_GetTestData.WriteParameter("VK_PictureID", ImageID); - - DeleteFiles(AndVF); - OPI_Tools.Pause(5); - -EndProcedure - -Procedure VK_DeleteImage(FunctionParameters) - - Parameters = GetVKParameters(); - ImageID = FunctionParameters["VK_PictureID"]; - - Result = OPI_VK.DeleteImage(ImageID, Parameters); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "DeleteImage", "VK"); - - Check_VKTrue(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure VK_DeleteAlbum(FunctionParameters) - - Parameters = GetVKParameters(); - AlbumID = FunctionParameters["VK_AlbumID"]; - - Result = OPI_VK.DeleteAlbum(AlbumID, Parameters); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "DeleteAlbum", "VK"); - - Check_VKTrue(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure VK_CreateStory(FunctionParameters) - - Parameters = GetVKParameters(); - URL = "https://github.com/Bayselonarrend/OpenIntegrations"; - - Image = FunctionParameters["Picture"]; // URL, Path to file or Binary Data - AndVF = GetTempFileName("png"); - CopyFile(Image, AndVF); - Image = New BinaryData(AndVF); - - Result = OPI_VK.CreateStory(Image , URL, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateStory", "VK"); - - Check_VKStory(Result); // SKIP - - Result = OPI_VK.CreateStory(AndVF, , Parameters); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateStory (path)"); - - Check_VKStory(Result); - - DeleteFiles(AndVF); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure VK_CreateDiscussion(FunctionParameters) - - Parameters = GetVKParameters(); - Name = "Discussing: Which color is better?"; - Message = "Red, yellow, blue, or some other?"; - - Result = OPI_VK.CreateDiscussion(Name, Message, Parameters); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateDiscussion", "VK"); - - Check_VKDiscussion(Result); - - DiscussionID = Result["response"]; - FunctionParameters.Insert("VK_ConvID", DiscussionID); - OPI_GetTestData.WriteParameter("VK_ConvID", DiscussionID); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure VK_CloseDiscussion(FunctionParameters) - - Parameters = GetVKParameters(); - DiscussionID = FunctionParameters["VK_ConvID"]; - Result = OPI_VK.CloseDiscussion(DiscussionID, False, Parameters); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "CloseDiscussion", "VK"); - - Check_VKTrue(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure VK_OpenDiscussion(FunctionParameters) - - Parameters = GetVKParameters(); - DiscussionID = FunctionParameters["VK_ConvID"]; - Result = OPI_VK.OpenDiscussion(DiscussionID, Parameters); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "OpenDiscussion", "VK"); - - Check_VKTrue(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure VK_PostToDiscussion(FunctionParameters) - - Parameters = GetVKParameters(); - DiscussionID = FunctionParameters["VK_ConvID"]; - Message = "I like yellow more"; - - Result = OPI_VK.WriteInDiscussion(DiscussionID, Message, Parameters); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "WriteInDiscussion", "VK"); - - Check_VKDiscussion(Result); - -EndProcedure - -#EndRegion - -#Region Dropbox - -Procedure Dropbox_GetAuthorizationLink(FunctionParameters) - - AppKey = FunctionParameters["Dropbox_Appkey"]; - Result = OPI_Dropbox.GetAuthorizationLink(AppKey); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "GetAuthorizationLink", "Dropbox"); - - OPI_GetTestData.ExpectsThat(Result).HasType("String"); - -EndProcedure - -Procedure Dropbox_GetToken(FunctionParameters) - - AppKey = FunctionParameters["Dropbox_Appkey"]; - AppSecret = FunctionParameters["Dropbox_Appsecret"]; - Code = FunctionParameters["Dropbox_Code"]; - - Result = OPI_Dropbox.GetToken(AppKey, AppSecret, Code); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "GetToken"); - - Token = Result["access_token"]; - Refresh = Result["refresh_token"]; - - If ValueFilled(Token) Then - OPI_GetTestData.WriteParameter("Dropbox_Token", Token); - EndIf; - - If ValueFilled(Refresh) Then - OPI_GetTestData.WriteParameter("Dropbox_Refresh", Refresh); - EndIf; - -EndProcedure - -Procedure Dropbox_UpdateToken(FunctionParameters) - - AppKey = FunctionParameters["Dropbox_Appkey"]; - AppSecret = FunctionParameters["Dropbox_Appsecret"]; - RefreshToken = FunctionParameters["Dropbox_Refresh"]; - - Result = OPI_Dropbox.RefreshToken(AppKey, AppSecret, RefreshToken); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "RefreshToken"); - - Token = Result["access_token"]; - - OPI_GetTestData.ExpectsThat(Token).Filled(); - - OPI_GetTestData.WriteParameter("Dropbox_Token", Token); - -EndProcedure - -Procedure Dropbox_GetObjectInformation(FunctionParameters) - - Path = "/New/pic.png"; - Token = FunctionParameters["Dropbox_Token"]; - - Result = OPI_Dropbox.GetObjectInformation(Token, Path, True); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "GetObjectInformation", "Dropbox"); - - Check_DropboxFile(Result, Path); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Dropbox_GetPreview(FunctionParameters) - - Token = FunctionParameters["Dropbox_Token"]; - Path = "/New/mydoc.docx"; - - Result = OPI_Dropbox.GetPreview(Token, Path); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "GetPreview", "Dropbox"); - - Check_BinaryData(Result, 190834); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Dropbox_UploadFile(FunctionParameters) - - Path = "/New/pic.png"; - Token = FunctionParameters["Dropbox_Token"]; - Image = FunctionParameters["Picture"]; - - ImagePath = GetTempFileName("png"); - CopyFile(Image, ImagePath); - - Result = OPI_Dropbox.UploadFile(Token, ImagePath, Path, True); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "UploadFile", "Dropbox"); - - Check_DropboxFile(Result, Path); - DeleteFiles(ImagePath); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Dropbox_UploadFileByURL(FunctionParameters) - - Path = "/New/url_doc.docx"; - Token = FunctionParameters["Dropbox_Token"]; - URL = FunctionParameters["Document"]; - - Result = OPI_Dropbox.UploadFileByURL(Token, URL, Path); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "UploadFileByURL", "Dropbox"); - - Check_DropboxWork(Result); - - Work = Result["async_job_id"]; - - FunctionParameters.Insert("Dropbox_Job", Work); - OPI_GetTestData.WriteParameter("Dropbox_Job", Work); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Dropbox_GetUploadStatusByURL(FunctionParameters) - - Token = FunctionParameters["Dropbox_Token"]; - WorkID = FunctionParameters["Dropbox_Job"]; - Status = "in_progress"; - - WHile Status = "in_progress" Do - - Result = OPI_Dropbox.GetUploadStatusByURL(Token, WorkID); - Status = Result[".tag"]; - - OPI_Tools.Pause(5); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetUploadStatusByURL", "Dropbox"); - - EndDo; - - // END - - Check_DropboxStatus(Result); - - Path = "/New/url_doc.docx"; - Result = OPI_Dropbox.DeleteObject(Token, Path); - - Check_DropboxMetadata(Result, Path); - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Dropbox_DeleteObject(FunctionParameters) - - Path = "/New/pic.png"; - Token = FunctionParameters["Dropbox_Token"]; - - Result = OPI_Dropbox.DeleteObject(Token, Path); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "DeleteObject", "Dropbox"); - - Check_DropboxMetadata(Result, Path); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Dropbox_CopyObject(FunctionParameters) - - Original = "/New/pic.png"; - Copy = "/New/pic_copy.png"; - Token = FunctionParameters["Dropbox_Token"]; - - Result = OPI_Dropbox.CopyObject(Token, Original, Copy); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "CopyObject", "Dropbox"); - - Check_DropboxMetadata(Result, Copy); - - Result = OPI_Dropbox.DeleteObject(Token, Copy); - Check_DropboxMetadata(Result, Copy); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Dropbox_MoveObject(FunctionParameters) - - OriginalPath = "/New/pic.png"; - TargetPath = "/pic.png"; - Token = FunctionParameters["Dropbox_Token"]; - - Result = OPI_Dropbox.MoveObject(Token, OriginalPath, TargetPath); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "Dropbox_MoveObject", "Dropbox"); - - Check_DropboxMetadata(Result, TargetPath); - - Result = OPI_Dropbox.MoveObject(Token, TargetPath, OriginalPath); - Check_DropboxMetadata(Result, OriginalPath); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Dropbox_CreateFolder(FunctionParameters) - - Token = FunctionParameters["Dropbox_Token"]; - Path = "/New toаталог"; - - Result = OPI_Dropbox.CreateFolder(Token, Path); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateFolder", "Dropbox"); - - Check_DropboxMetadata(Result, Path); - - Result = OPI_Dropbox.DeleteObject(Token, Path); - Check_DropboxMetadata(Result, Path); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Dropbox_DownloadFile(FunctionParameters) - - Token = FunctionParameters["Dropbox_Token"]; - Path = "/New/pic.png"; - - Result = OPI_Dropbox.DownloadFile(Token, Path); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "DownloadFile", "Dropbox"); - - Check_BinaryData(Result, 2114023); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Dropbox_DownloadFolder(FunctionParameters) - - Token = FunctionParameters["Dropbox_Token"]; - Path = "/New"; - - Result = OPI_Dropbox.DownloadFolder(Token, Path); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "DownloadFolder", "Dropbox"); - - Check_BinaryData(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Dropbox_GetFolderFileList(FunctionParameters) - - Path = "/New"; - Token = FunctionParameters["Dropbox_Token"]; - - Result = OPI_Dropbox.GetListOfFolderFiles(Token, Path, True); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "GetListOfFolderFiles", "Dropbox"); - - Check_DropboxArray(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Dropbox_GetObjectVersionList(FunctionParameters) - - Token = FunctionParameters["Dropbox_Token"]; - Path = "/New/pic.png"; - - Result = OPI_Dropbox.GetObjectVersionList(Token, Path, 1); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "GetObjectVersionList", "Dropbox"); - - Check_DropboxArray(Result, 1); - - Revision = Result["entries"][0]["rev"]; - - FunctionParameters.Insert("Dropbox_FileRevision", Revision); - OPI_GetTestData.WriteParameter("Dropbox_FileRevision", Revision); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Dropbox_RestoreObjectToVersion(FunctionParameters) - - Version = FunctionParameters["Dropbox_FileRevision"]; - Token = FunctionParameters["Dropbox_Token"]; - Path = "/New/pic.png"; - - Result = OPI_Dropbox.RestoreObjectToVersion(Token, Path, Version); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "RestoreObjectToVersion", "Dropbox"); - - Check_DropboxFile(Result, Path); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Dropbox_GetTagList(FunctionParameters) - - Token = FunctionParameters["Dropbox_Token"]; - - PathsArray = New Array; - PathsArray.Add("/New/Dogs.mp3"); - PathsArray.Add("/New/mydoc.docx"); - - Result = OPI_Dropbox.GetTagList(Token, PathsArray); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "GetTagList", "Dropbox"); - - Check_DropboxTags(Result, PathsArray.Quantity()); - - Result = OPI_Dropbox.GetTagList(Token, "/New/mydoc.docx"); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetTagList (оdиночный)"); - - Check_DropboxTags(Result, 1); - - HasTag = False; - - For Each Tag In Result["paths_to_tags"][0]["tags"] Do - If Tag["tag_text"] = "important" Then - HasTag = True; - EndIf; - EndDo; - - OPI_GetTestData.ExpectsThat(HasTag).Equal(True); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Dropbox_AddTag(FunctionParameters) - - Tag = "Important"; - Token = FunctionParameters["Dropbox_Token"]; - Path = "/New/mydoc.docx"; - - Result = OPI_Dropbox.AddTag(Token, Path, Tag); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "AddTag", "Dropbox"); - - Check_Empty(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Dropbox_DeleteTag(FunctionParameters) - - Tag = "Important"; - Token = FunctionParameters["Dropbox_Token"]; - Path = "/New/mydoc.docx"; - - Result = OPI_Dropbox.DeleteTag(Token, Path, Tag); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "DeleteTag", "Dropbox"); - - Check_Empty(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Dropbox_GetAccountInformation(FunctionParameters) - - Token = FunctionParameters["Dropbox_Token"]; - - Result = OPI_Dropbox.GetAccountInformation(Token); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "GetAccountInformation", "Dropbox"); - - Check_DropboxAccount(Result); - - Result = OPI_Dropbox.GetAccountInformation(Token, Result["account_id"]); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetAccountInformation (withторонний)"); - - Check_DropboxAccount(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Dropbox_GetSpaceUsageData(FunctionParameters) - - Token = FunctionParameters["Dropbox_Token"]; - - Result = OPI_Dropbox.GetSpaceUsageData(Token); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "GetSpaceUsageData", "Dropbox"); - - Check_DropboxSpace(Result); - -EndProcedure - -Procedure Dropbox_AddUsersToFile(FunctionParameters) - - Token = FunctionParameters["Dropbox_Token"]; - Email = FunctionParameters["Dropbox_OtherUser"]; - File = FunctionParameters["Dropbox_FileID"]; - - Result = OPI_Dropbox.AddUsersToFile(Token, File, Email, False); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "AddUserToFile", "Dropbox"); - - Check_DropboxMember(Result, Email, False); - - Mails = New Array; - Mails.Add(Email); - - Result = OPI_Dropbox.AddUsersToFile(Token, File, Mails, True); - - Check_DropboxMember(Result, Email, True); - -EndProcedure - -Procedure Dropbox_PublishFolder(FunctionParameters) - - Token = FunctionParameters["Dropbox_Token"]; - Path = "/New"; - - Result = OPI_Dropbox.PublishFolder(Token, Path); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "PublishFolder", "Dropbox"); - - Check_DropboxPublicFolder(Result); - - FolderID = Result["shared_folder_id"]; - - FunctionParameters.Insert("Dropbox_SharedFolder", FolderID); - OPI_GetTestData.WriteParameter("Dropbox_SharedFolder", FolderID); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Dropbox_CancelFolderPublication(FunctionParameters) - - Token = FunctionParameters["Dropbox_Token"]; - Folder = FunctionParameters["Dropbox_SharedFolder"]; - - Result = OPI_Dropbox.CancelFolderPublication(Token, Folder); - CurrentStatus = "in_progress"; - JobID = Result["async_job_id"]; - - WHile CurrentStatus = "in_progress" Do - Result = OPI_Dropbox.GetAsynchronousChangeStatus(Token, JobID); - CurrentStatus = Result[".tag"]; - OPI_Tools.Pause(3); - EndDo; - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "CancelFolderPublication", "Dropbox"); - - Check_DropboxStatus(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Dropbox_AddUsersToFolder(FunctionParameters) - - Token = FunctionParameters["Dropbox_Token"]; - Email = FunctionParameters["Dropbox_OtherUser"]; - Folder = FunctionParameters["Dropbox_SharedFolder"]; // shared_folder_id - - Result = OPI_Dropbox.AddUsersToFolder(Token, Folder, Email, False); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "AddUserToFile", "Dropbox"); - - Check_Empty(Result); - - Mails = New Array; - Mails.Add(Email); - - Result = OPI_Dropbox.AddUsersToFolder(Token, Folder, Mails, True); - - Check_Empty(Result); - -EndProcedure - -Procedure Dropbox_CancelFilePublication(FunctionParameters) - - Token = FunctionParameters["Dropbox_Token"]; - File = FunctionParameters["Dropbox_FileID"]; - - Result = OPI_Dropbox.CancelFilePublication(Token, File); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "CancelFilePublication", "Dropbox"); - - Check_Empty(Result); - -EndProcedure - -#EndRegion - -#EndRegion - -#EndRegion diff --git a/service/interim/en/OPI/src/CommonModules/OPI_Тесты/OPI_Тесты.mdo b/service/interim/en/OPI/src/CommonModules/OPI_Тесты/OPI_Тесты.mdo deleted file mode 100644 index e8ea7bc39e..0000000000 --- a/service/interim/en/OPI/src/CommonModules/OPI_Тесты/OPI_Тесты.mdo +++ /dev/null @@ -1,15 +0,0 @@ - - - OPI_Tests - - - OPI теwithты - - - ru - Tests for YaxUnit (OPI) - - true - true - true - diff --git a/service/interim/en/OPI/src/Configuration/Configuration.mdo b/service/interim/en/OPI/src/Configuration/Configuration.mdo deleted file mode 100644 index 988bd2ceda..0000000000 --- a/service/interim/en/OPI/src/Configuration/Configuration.mdo +++ /dev/null @@ -1,70 +0,0 @@ - - - OpenIntegrations - - ru - Отtoрытый паtoет интеграций - - Adopted - - Checked - Checked - Checked - - - - - - - - - true - OPI_ - 8.3.9 - Customization - ManagedApplication - PersonalComputer - Russian - Bayselonarrend - 1.9.0 - - ru - Отtoрытый паtoет интеграций - toбор библиотеto for интеграции with неtoоторыми популярными API for 1C:Enterprise. Он withоwithтоит from общих моdулей, toажdый from toоторых отinечает за withinой API, а таtoже неwithtoольtoих моdулей-инwithтрументоin, общих for all. - - - ru - https://github.com/Bayselonarrend - - - ru - https://github.com/Bayselonarrend/OpenIntegrations - - - Руwithwithtoий - Adopted - - Checked - - ru - - Subsystem.OPI_Andнтеграция - CommonModule.OPI_Tools - CommonModule.OPI_Cryptography - CommonModule.OPI_TypeConversion - CommonModule.OPI_Telegram - CommonModule.OPI_VK - CommonModule.OPI_Viber - CommonModule.OPI_Twitter - CommonModule.OPI_Notion - CommonModule.OPI_YandexID - CommonModule.OPI_YandexDisk - CommonModule.OPI_GoogleWorkspace - CommonModule.OPI_GoogleCalendar - CommonModule.OPI_GoogleDrive - CommonModule.OPI_GoogleSheets - CommonModule.OPI_Slack - CommonModule.OPI_Airtable - CommonModule.OPI_Dropbox - CommonModule.OPI_Tests - CommonModule.OPI_GetTestData - diff --git a/service/interim/en/OPI/src/Subsystems/OPI_Интеграция/OPI_Интеграция.mdo b/service/interim/en/OPI/src/Subsystems/OPI_Интеграция/OPI_Интеграция.mdo deleted file mode 100644 index 06461b4314..0000000000 --- a/service/interim/en/OPI/src/Subsystems/OPI_Интеграция/OPI_Интеграция.mdo +++ /dev/null @@ -1,28 +0,0 @@ - - - OPI_Andнтеграция - - ru - Andнтеграция - - true - true - CommonModule.OPI_Tools - CommonModule.OPI_Cryptography - CommonModule.OPI_TypeConversion - CommonModule.OPI_VK - CommonModule.OPI_Telegram - CommonModule.OPI_Viber - CommonModule.OPI_Twitter - CommonModule.OPI_Notion - CommonModule.OPI_YandexID - CommonModule.OPI_YandexDisk - CommonModule.OPI_GoogleWorkspace - CommonModule.OPI_GoogleCalendar - CommonModule.OPI_GoogleDrive - CommonModule.OPI_GoogleSheets - CommonModule.OPI_Slack - CommonModule.OPI_Airtable - CommonModule.OPI_Tests - CommonModule.OPI_GetTestData - diff --git a/src/en/OPI/.project b/src/en/OPI/.project index 304a6b8660..244711fc30 100644 --- a/src/en/OPI/.project +++ b/src/en/OPI/.project @@ -1,18 +1,18 @@ - + - OPI - - - - - - org.eclipse.xtext.ui.shared.xtextBuilder - - - - - - org.eclipse.xtext.ui.shared.xtextNature - com._1c.g5.v8.dt.core.V8ExtensionNature - +OPI + + + + + +org.eclipse.xtext.ui.shared.xtextBuilder + + + + + +org.eclipse.xtext.ui.shared.xtextNature +com._1c.g5.v8.dt.core.V8ExtensionNature + diff --git a/src/en/OPI/.settings/org.eclipse.core.resources.prefs b/src/en/OPI/.settings/org.eclipse.core.resources.prefs index 99f26c0203..d21dc84127 100644 --- a/src/en/OPI/.settings/org.eclipse.core.resources.prefs +++ b/src/en/OPI/.settings/org.eclipse.core.resources.prefs @@ -1,2 +1,2 @@ -eclipse.preferences.version=1 +eclipse.preferences.version=1 encoding/=UTF-8 diff --git a/src/en/OPI/DT-INF/PROJECT.PMF b/src/en/OPI/DT-INF/PROJECT.PMF index 690880282e..f82b4856d1 100644 --- a/src/en/OPI/DT-INF/PROJECT.PMF +++ b/src/en/OPI/DT-INF/PROJECT.PMF @@ -1,3 +1,3 @@ -Manifest-Version: 1.0 +Manifest-Version: 1.0 Runtime-Version: 8.3.15 Base-Project: OpenIntegrations diff --git a/src/en/OPI/src/CommonModules/OPI_Airtable/Module.bsl b/src/en/OPI/src/CommonModules/OPI_Airtable/Module.bsl index d18e3352d0..864dc2411b 100644 --- a/src/en/OPI/src/CommonModules/OPI_Airtable/Module.bsl +++ b/src/en/OPI/src/CommonModules/OPI_Airtable/Module.bsl @@ -37,92 +37,92 @@ // Get list of bases // Gets the list of available bases -// +// // Parameters: -// Token - String - Token - token -// Indent - String - Next page identifier of the base list from the previous request - offset -// +// Token - String - Token - token +// Indent - String - Next page identifier of the base list from the previous request - offset +// // Return value: -// Key-Value Pair - serialized JSON response from Airtable +// Key-Value Pair - serialized JSON response from Airtable Function GetListOfBases(Val Token, Val Indent = "") Export - - OPI_TypeConversion.GetLine(Indent); - - URL = "https://api.airtable.com/v0/meta/bases"; - Headers = GetAuthorizationHeader(Token); - Parameters = New Structure; - - OPI_Tools.AddField("offset", Indent, "String", Parameters); - - Response = OPI_Tools.Get(URL, Parameters, Headers); - - Return Response; - + +OPI_TypeConversion.GetLine(Indent); + +URL = "https://api.airtable.com/v0/meta/bases"; +Headers = GetAuthorizationHeader(Token); +Parameters = New Structure; + +OPI_Tools.AddField("offset", Indent, "String", Parameters); + +Response = OPI_Tools.Get(URL, Parameters, Headers); + +Return Response; + EndFunction // Get base tables // Gets the schema of base tables -// +// // Parameters: -// Token - String - Token - token -// Base - String - Base identifier - base -// +// Token - String - Token - token +// Base - String - Base identifier - base +// // Return value: -// Key-Value Pair - serialized JSON response from Airtable +// Key-Value Pair - serialized JSON response from Airtable Function GetDatabaseTables(Val Token, Val Base) Export - - OPI_TypeConversion.GetLine(Base); - - URL = "https://api.airtable.com/v0/meta/bases/" + Base + "/tables"; - Headers = GetAuthorizationHeader(Token); - - Response = OPI_Tools.Get(URL, , Headers); - - Return Response; - + +OPI_TypeConversion.GetLine(Base); + +URL = "https://api.airtable.com/v0/meta/bases/" + Base + "/tables"; +Headers = GetAuthorizationHeader(Token); + +Response = OPI_Tools.Get(URL, , Headers); + +Return Response; + EndFunction // Create base // Creates a new database -// +// // Parameters: -// Token - String - Token - token -// Workspace - String - Workspace identifier - ws -// Name - String - New base name - title -// TableCollection - Key-Value Pair - Table description: Key > name, Value > array of fields - tablesdata -// +// Token - String - Token - token +// Workspace - String - Workspace identifier - ws +// Name - String - New base name - title +// TableCollection - Key-Value Pair - Table description: Key > name, Value > array of fields - tablesdata +// // Return value: -// Key-Value Pair - serialized JSON response from Airtable +// Key-Value Pair - serialized JSON response from Airtable Function CreateDatabase(Val Token, Val Workspace, Val Name, Val TableCollection) Export - - OPI_TypeConversion.GetCollection(TableCollection); - - If Not TypeValue(TableCollection) = Type("Structure") - And Not TypeValue(TableCollection) = Type("Match") Then - - RaiseException "Error in table collection data"; - - EndIf; - - URL = "https://api.airtable.com/v0/meta/bases"; - Headers = GetAuthorizationHeader(Token); - TableArray = New Array; - - For Each Table Of TableCollection Loop - - Description = GenerateTableDescription(Table.Key, Table.Value); - TableArray.Add(Description); - - EndOfLoop; - - Parameters = New Structure; - OPI_Tools.AddField("name" , Name , "String", Parameters); - OPI_Tools.AddField("tables" , TableArray , "Array", Parameters); - OPI_Tools.AddField("workspaceId", Workspace, "String", Parameters); - - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; + +OPI_TypeConversion.GetCollection(TableCollection); + +If Not TypeValue(TableCollection) = Type("Structure") +And Not TypeValue(TableCollection) = Type("Match") Then + +Raise "Error in table collection data"; + +EndIf; + +URL = "https://api.airtable.com/v0/meta/bases"; +Headers = GetAuthorizationHeader(Token); +TableArray = New Array; + +For Each Table In TableCollection Do + +Description = GenerateTableDescription(Table.Key, Table.Value); +TableArray.Add(Description); + +EndDo; + +Parameters = New Structure; +OPI_Tools.AddField("name" , Name , "String", Parameters); +OPI_Tools.AddField("tables" , TableArray , "Array", Parameters); +OPI_Tools.AddField("workspaceId", Workspace, "String", Parameters); + +Response = OPI_Tools.Post(URL, Parameters, Headers); + +Return Response; EndFunction @@ -132,57 +132,57 @@ EndFunction // Create table // Creates a new table in the base -// +// // Parameters: -// Token - String - Token - token -// Base - String - Base identifier - base -// Name - String - New table name - title -// FieldArray - Array of Structures - Array of field descriptions - fieldsdata -// Description - String - Table description - description -// +// Token - String - Token - token +// Base - String - Base identifier - base +// Name - String - New table name - title +// FieldArray - Array of Structures - Array of field descriptions - fieldsdata +// Description - String - Table description - description +// // Return value: -// Key-Value Pair - serialized JSON response from Airtable +// Key-Value Pair - serialized JSON response from Airtable Function CreateTable(Val Token, Val Base, Val Name, Val FieldArray, Val Description = "") Export - - OPI_TypeConversion.GetLine(Base); - - URL = "https://api.airtable.com/v0/meta/bases/" + Base + "/tables"; - Headers = GetAuthorizationHeader(Token); - Parameters = GenerateTableDescription(Name, FieldArray, Description); - - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; + +OPI_TypeConversion.GetLine(Base); + +URL = "https://api.airtable.com/v0/meta/bases/" + Base + "/tables"; +Headers = GetAuthorizationHeader(Token); +Parameters = GenerateTableDescription(Name, FieldArray, Description); + +Response = OPI_Tools.Post(URL, Parameters, Headers); + +Return Response; EndFunction // Modify table // Changes the name and/or description of the base -// +// // Parameters: -// Token - String - Token - token -// Base - String - Base identifier - base -// Table - String - Table identifier - table -// Name - String - New name - title -// Description - String - New description - description -// +// Token - String - Token - token +// Base - String - Base identifier - base +// Table - String - Table identifier - table +// Name - String - New name - title +// Description - String - New description - description +// // Return value: -// Key-Value Pair - serialized JSON response from Airtable +// Key-Value Pair - serialized JSON response from Airtable Function ModifyTable(Val Token, Val Base, Val Table, Val Name = "", Val Description = "") Export - - OPI_TypeConversion.GetLine(Base); - OPI_TypeConversion.GetLine(Table); - - URL = "https://api.airtable.com/v0/meta/bases/" + Base + "/tables/" + Table; - Headers = GetAuthorizationHeader(Token); - Parameters = New Structure; - - OPI_Tools.AddField("name" , Name, "String", Parameters); - OPI_Tools.AddField("description", Description , "String", Parameters); - - Response = OPI_Tools.Patch(URL, Parameters, Headers); - - Return Response; + +OPI_TypeConversion.GetLine(Base); +OPI_TypeConversion.GetLine(Table); + +URL = "https://api.airtable.com/v0/meta/bases/" + Base + "/tables/" + Table; +Headers = GetAuthorizationHeader(Token); +Parameters = New Structure; + +OPI_Tools.AddField("name" , Name, "String", Parameters); +OPI_Tools.AddField("description", Description , "String", Parameters); + +Response = OPI_Tools.Patch(URL, Parameters, Headers); + +Return Response; EndFunction @@ -192,183 +192,183 @@ EndFunction // Create field // Creates a new field in the table -// +// // Parameters: -// Token - String - Token - token -// Base - String - Base identifier - base -// Table - String - Table identifier - table -// FieldStructure - Structure of Key-Value - Description of the new field - fielddata -// +// Token - String - Token - token +// Base - String - Base identifier - base +// Table - String - Table identifier - table +// FieldStructure - Structure of Key-Value - Description of the new field - fielddata +// // Return value: -// Key-Value Pair - serialized JSON response from Airtable +// Key-Value Pair - serialized JSON response from Airtable Function CreateField(Val Token, Val Base, Val Table, Val FieldStructure) Export - - OPI_TypeConversion.GetLine(Base); - OPI_TypeConversion.GetLine(Table); - OPI_TypeConversion.GetCollection(FieldStructure); - - If Not TypeValue(FieldStructure) = Type("Structure") - And Not TypeValue(FieldStructure) = Type("Match") Then - - RaiseException "Error in field description data"; - - EndIf; - - URL = "https://api.airtable.com/v0/meta/bases/" + Base + "/tables/" + Table + "/fields"; - Headers = GetAuthorizationHeader(Token); - - Response = OPI_Tools.Post(URL, FieldStructure, Headers); - - Return Response; + +OPI_TypeConversion.GetLine(Base); +OPI_TypeConversion.GetLine(Table); +OPI_TypeConversion.GetCollection(FieldStructure); + +If Not TypeValue(FieldStructure) = Type("Structure") +And Not TypeValue(FieldStructure) = Type("Match") Then + +Raise "Error in field description data"; + +EndIf; + +URL = "https://api.airtable.com/v0/meta/bases/" + Base + "/tables/" + Table + "/fields"; +Headers = GetAuthorizationHeader(Token); + +Response = OPI_Tools.Post(URL, FieldStructure, Headers); + +Return Response; EndFunction // Modify field // Changes the name and/or description of an existing table field -// +// // Parameters: -// Token - String - Token - token -// Base - String - Base identifier Base - base -// Table - String - Table identifier - table -// Field - String - Field identifier - field -// Name - String - New name - title -// Description - String - New description - description -// +// Token - String - Token - token +// Base - String - Base identifier Base - base +// Table - String - Table identifier - table +// Field - String - Field identifier - field +// Name - String - New name - title +// Description - String - New description - description +// // Return value: -// Key-Value Pair - serialized JSON response from Airtable +// Key-Value Pair - serialized JSON response from Airtable Function ModifyField(Val Token, Val Base, Val Table, Val Field, Val Name = "", Val Description = "") Export - - OPI_TypeConversion.GetLine(Base); - OPI_TypeConversion.GetLine(Table); - OPI_TypeConversion.GetLine(Field); - - URL = "https://api.airtable.com/v0/meta/bases/" - + Base - + "/tables/" - + Table - + "/fields/" - + Field; - - Headers = GetAuthorizationHeader(Token); - - Parameters = New Structure(); - OPI_Tools.AddField("name" , Name, "String", Parameters); - OPI_Tools.AddField("description", Description , "String", Parameters); - - Response = OPI_Tools.Patch(URL, Parameters, Headers); - - Return Response; + +OPI_TypeConversion.GetLine(Base); +OPI_TypeConversion.GetLine(Table); +OPI_TypeConversion.GetLine(Field); + +URL = "https://api.airtable.com/v0/meta/bases/" ++ Base ++ "/tables/" ++ Table ++ "/fields/" ++ Field; + +Headers = GetAuthorizationHeader(Token); + +Parameters = New Structure(); +OPI_Tools.AddField("name" , Name, "String", Parameters); +OPI_Tools.AddField("description", Description , "String", Parameters); + +Response = OPI_Tools.Patch(URL, Parameters, Headers); + +Return Response; EndFunction // Get поле (withтроtoоinое) // Gets the description of a string field -// +// // Parameters: -// Name - String - New field name - title -// +// Name - String - New field name - title +// // Return value: -// Structure - Field description +// Structure - Field description Function GetStringField(Val Name) Export - Return PrimitiveFieldDescription(Name, "richText"); +Return PrimitiveFieldDescription(Name, "richText"); EndFunction // Get поле (чиwithлоinое) // Gets the description of a numeric field -// +// // Parameters: -// Name - String - New field name - title -// Precision - Number, String - Number of decimal places - precision -// +// Name - String - New field name - title +// Precision - Number, String - Number of decimal places - precision +// // Return value: -// Structure - Field description +// Structure - Field description Function GetNumberField(Val Name, Val Precision = 0) Export - - OPI_TypeConversion.GetNumber(Precision); - - OptionsStructure = New Structure("precision", Precision); - Return PrimitiveFieldDescription(Name, "number", OptionsStructure); - + +OPI_TypeConversion.GetNumber(Precision); + +OptionsStructure = New Structure("precision", Precision); +Return PrimitiveFieldDescription(Name, "number", OptionsStructure); + EndFunction // Get поле (file) // Gets the description of a file field -// +// // Parameters: -// Name - String - Field name - title -// +// Name - String - Field name - title +// // Return value: -// Structure - Field description +// Structure - Field description Function GetAttachmentField(Val Name) Export - Return PrimitiveFieldDescription(Name, "multipleAttachments"); +Return PrimitiveFieldDescription(Name, "multipleAttachments"); EndFunction // Get поле (флажоto) // Gets the description of a boolean field -// +// // Parameters: -// Name - String - Field name - title -// +// Name - String - Field name - title +// // Return value: -// Structure - Field description +// Structure - Field description Function GetCheckboxField(Val Name) Export - - OptionsStructure = New Structure("icon,color", "check", "yellowBright"); - Return PrimitiveFieldDescription(Name, "checkbox", OptionsStructure); - + +OptionsStructure = New Structure("icon,color", "check", "yellowBright"); +Return PrimitiveFieldDescription(Name, "checkbox", OptionsStructure); + EndFunction // Get поле (dата) // Gets the description of a date field -// +// // Parameters: -// Name - String - Field name - title -// +// Name - String - Field name - title +// // Return value: -// Structure - Field description +// Structure - Field description Function GetDateField(Val Name) Export - - FormatStructure = New Structure("format,name", "YYYY-MM-DD", "iso"); - OptionsStructure = New Structure("dateFormat", FormatStructure); - - Return PrimitiveFieldDescription(Name, "date", OptionsStructure); - + +FormatStructure = New Structure("format,name", "YYYY-MM-DD", "iso"); +OptionsStructure = New Structure("dateFormat", FormatStructure); + +Return PrimitiveFieldDescription(Name, "date", OptionsStructure); + EndFunction // Get поле (email) // Gets the description of an email field -// +// // Parameters: -// Name - String - Field name - title -// +// Name - String - Field name - title +// // Return value: -// Structure - Field description +// Structure - Field description Function GetEmailField(Val Name) Export - Return PrimitiveFieldDescription(Name, "email"); +Return PrimitiveFieldDescription(Name, "email"); EndFunction // Get поле (телефон) // Gets the description of a phone number field -// +// // Parameters: -// Name - String - Field name - title -// +// Name - String - Field name - title +// // Return value: -// Structure - Field description +// Structure - Field description Function GetPhoneField(Val Name) Export - Return PrimitiveFieldDescription(Name, "phoneNumber"); +Return PrimitiveFieldDescription(Name, "phoneNumber"); EndFunction // Get поле (url) // Gets the description of a URL field -// +// // Parameters: -// Name - String - Field name - title -// +// Name - String - Field name - title +// // Return value: -// Structure - Field description +// Structure - Field description Function GetLinkField(Val Name) Export - Return PrimitiveFieldDescription(Name, "url"); +Return PrimitiveFieldDescription(Name, "url"); EndFunction #EndRegion @@ -377,120 +377,120 @@ EndFunction // Get list of records // Gets the list of records of the selected table -// +// // Parameters: -// Token - String - Token - token -// Base - String - Database identifier - base -// Table - String - Table identifier - table -// Indent - String - Next page identifier of data from the previous request - offset -// +// Token - String - Token - token +// Base - String - Database identifier - base +// Table - String - Table identifier - table +// Indent - String - Next page identifier of data from the previous request - offset +// // Return value: -// Key-Value Pair - serialized JSON response from Airtable +// Key-Value Pair - serialized JSON response from Airtable Function GetListOfRecords(Val Token, Val Base, Val Table, Val Indent = "") Export - OPI_TypeConversion.GetLine(Base); - OPI_TypeConversion.GetLine(Table); - - URL = "https://api.airtable.com/v0/" + Base + "/" + Table; - Headers = GetAuthorizationHeader(Token); - - Parameters = New Structure(); - OPI_Tools.AddField("offset", Indent, "String", Parameters); - - Response = OPI_Tools.Get(URL, Parameters, Headers); - - Return Response; - +OPI_TypeConversion.GetLine(Base); +OPI_TypeConversion.GetLine(Table); + +URL = "https://api.airtable.com/v0/" + Base + "/" + Table; +Headers = GetAuthorizationHeader(Token); + +Parameters = New Structure(); +OPI_Tools.AddField("offset", Indent, "String", Parameters); + +Response = OPI_Tools.Get(URL, Parameters, Headers); + +Return Response; + EndFunction // Get record // Gets row data of the table by identifier -// +// // Parameters: -// Token - String - Token - token -// Base - String - Database identifier - base -// Table - String - Table identifier - table -// Record - String - Record identifier in the table - record -// +// Token - String - Token - token +// Base - String - Database identifier - base +// Table - String - Table identifier - table +// Record - String - Record identifier in the table - record +// // Return value: -// Key-Value Pair - serialized JSON response from Airtable +// Key-Value Pair - serialized JSON response from Airtable Function GetRecord(Val Token, Val Base, Val Table, Val Record) Export - - OPI_TypeConversion.GetLine(Base); - OPI_TypeConversion.GetLine(Table); - OPI_TypeConversion.GetLine(Record); - - URL = "https://api.airtable.com/v0/" + Base + "/" + Table + "/" + Record; - Headers = GetAuthorizationHeader(Token); - Response = OPI_Tools.Get(URL, , Headers); - - Return Response; - +OPI_TypeConversion.GetLine(Base); +OPI_TypeConversion.GetLine(Table); +OPI_TypeConversion.GetLine(Record); + +URL = "https://api.airtable.com/v0/" + Base + "/" + Table + "/" + Record; +Headers = GetAuthorizationHeader(Token); + +Response = OPI_Tools.Get(URL, , Headers); + +Return Response; + EndFunction // Create records // Creates one or an array of records by description or an array of field value descriptions -// +// // Parameters: -// Token - String - Token - token -// Base - String - Database identifier - base -// Table - String - Table identifier - table -// Data - Structure, Array of Structures - Set or array of sets of Key : Value pairs > Field : Indicator - data -// +// Token - String - Token - token +// Base - String - Database identifier - base +// Table - String - Table identifier - table +// Data - Structure, Array of Structures - Set or array of sets of Key : Value pairs > Field : Indicator - data +// // Return value: -// Key-Value Pair - serialized JSON response from Airtable +// Key-Value Pair - serialized JSON response from Airtable Function CreatePosts(Val Token, Val Base, Val Table, Val Data) Export - OPI_TypeConversion.GetLine(Base); - OPI_TypeConversion.GetLine(Table); - OPI_TypeConversion.GetCollection(Data); - - Parameters = New Structure(); - AddDataDescription(Data, Parameters); +OPI_TypeConversion.GetLine(Base); +OPI_TypeConversion.GetLine(Table); +OPI_TypeConversion.GetCollection(Data); - URL = "https://api.airtable.com/v0/" + Base + "/" + Table; - Headers = GetAuthorizationHeader(Token); +Parameters = New Structure(); +AddDataDescription(Data, Parameters); + +URL = "https://api.airtable.com/v0/" + Base + "/" + Table; +Headers = GetAuthorizationHeader(Token); + +Response = OPI_Tools.Post(URL, Parameters, Headers); + +Return Response; - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - EndFunction // Delete records // Deletes one or an array of records by identifiers -// +// // Parameters: -// Token - String - Token - token -// Base - String - Database identifier - base -// Table - String - Table identifier - table -// Records - String, Array of Strings - Identifier or array of record identifiers - records -// +// Token - String - Token - token +// Base - String - Database identifier - base +// Table - String - Table identifier - table +// Records - String, Array of Strings - Identifier or array of record identifiers - records +// // Return value: -// Key-Value Pair - serialized JSON response from Airtable +// Key-Value Pair - serialized JSON response from Airtable Function DeletePosts(Val Token, Val Base, Val Table, Val Records) Export - - OPI_TypeConversion.GetLine(Base); - OPI_TypeConversion.GetLine(Table); - OPI_TypeConversion.GetArray(Records); - - RecordString = ""; - - For Each Record Of Records Loop - RecordString = RecordString - + ?(ValueFilled(RecordString), "&", "?") - + "records[]=" - + OPI_Tools.NumberToString(Record); - EndOfLoop; - - URL = "https://api.airtable.com/v0/" + Base + "/" + Table + RecordString; - Headers = GetAuthorizationHeader(Token); - Response = OPI_Tools.Delete(URL, , Headers); - - Return Response; - +OPI_TypeConversion.GetLine(Base); +OPI_TypeConversion.GetLine(Table); +OPI_TypeConversion.GetArray(Records); + +RecordString = ""; + +For Each Record In Records Do +RecordString = RecordString ++ ?(ValueIsFilled(RecordString), "&", "?") ++ "records[]=" ++ OPI_Tools.NumberToString(Record); +EndDo; + +URL = "https://api.airtable.com/v0/" + Base + "/" + Table + RecordString; +Headers = GetAuthorizationHeader(Token); + +Response = OPI_Tools.Delete(URL, , Headers); + +Return Response; + EndFunction #EndRegion @@ -499,122 +499,122 @@ EndFunction // Get comments // Gets the list of comments for a record in the table -// +// // Parameters: -// Token - String - Token - token -// Base - String - Database identifier - base -// Table - String - Table identifier - table -// Record - String - Record identifier in the table - record -// Indent - String - Next page identifier of data from the previous request - offset -// +// Token - String - Token - token +// Base - String - Database identifier - base +// Table - String - Table identifier - table +// Record - String - Record identifier in the table - record +// Indent - String - Next page identifier of data from the previous request - offset +// // Return value: -// Key-Value Pair - serialized JSON response from Airtable +// Key-Value Pair - serialized JSON response from Airtable Function GetComments(Val Token, Val Base, Val Table, Val Record, Val Indent = "") Export - - OPI_TypeConversion.GetLine(Base); - OPI_TypeConversion.GetLine(Table); - OPI_TypeConversion.GetLine(Record); - - URL = "https://api.airtable.com/v0/" + Base + "/" + Table + "/" + Record + "/comments"; - Headers = GetAuthorizationHeader(Token); - - Parameters = New Structure(); - OPI_Tools.AddField("offset", Indent, "String", Parameters); - - Response = OPI_Tools.Get(URL, Parameters, Headers); - - Return Response; - + +OPI_TypeConversion.GetLine(Base); +OPI_TypeConversion.GetLine(Table); +OPI_TypeConversion.GetLine(Record); + +URL = "https://api.airtable.com/v0/" + Base + "/" + Table + "/" + Record + "/comments"; +Headers = GetAuthorizationHeader(Token); + +Parameters = New Structure(); +OPI_Tools.AddField("offset", Indent, "String", Parameters); + +Response = OPI_Tools.Get(URL, Parameters, Headers); + +Return Response; + EndFunction // Create comment // Creates a comment for a record in the table -// +// // Parameters: -// Token - String - Token - token -// Base - String - Database identifier - base -// Table - String - Table identifier - table -// Record - String - Record identifier in the table - record -// Text - String - Comment text - text -// +// Token - String - Token - token +// Base - String - Database identifier - base +// Table - String - Table identifier - table +// Record - String - Record identifier in the table - record +// Text - String - Comment text - text +// // Return value: -// Key-Value Pair - serialized JSON response from Airtable +// Key-Value Pair - serialized JSON response from Airtable Function CreateComment(Val Token, Val Base, Val Table, Val Record, Val Text) Export - - OPI_TypeConversion.GetLine(Base); - OPI_TypeConversion.GetLine(Table); - OPI_TypeConversion.GetLine(Record); - - URL = "https://api.airtable.com/v0/" + Base + "/" + Table + "/" + Record + "/comments"; - Headers = GetAuthorizationHeader(Token); - - Parameters = New Structure(); - OPI_Tools.AddField("text", Text, "String", Parameters); - - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - + +OPI_TypeConversion.GetLine(Base); +OPI_TypeConversion.GetLine(Table); +OPI_TypeConversion.GetLine(Record); + +URL = "https://api.airtable.com/v0/" + Base + "/" + Table + "/" + Record + "/comments"; +Headers = GetAuthorizationHeader(Token); + +Parameters = New Structure(); +OPI_Tools.AddField("text", Text, "String", Parameters); + +Response = OPI_Tools.Post(URL, Parameters, Headers); + +Return Response; + EndFunction // Modify comment // Changes the text of an existing comment -// +// // Parameters: -// Token - String - Token - token -// Base - String - Database identifier - base -// Table - String - Table identifier - table -// Record - String - Record identifier in the table - record -// Comment - String - Comment identifier - comment -// Text - String - New comment text - text -// +// Token - String - Token - token +// Base - String - Database identifier - base +// Table - String - Table identifier - table +// Record - String - Record identifier in the table - record +// Comment - String - Comment identifier - comment +// Text - String - New comment text - text +// // Return value: -// Key-Value Pair - serialized JSON response from Airtable +// Key-Value Pair - serialized JSON response from Airtable Function EditComment(Val Token, Val Base, Val Table, Val Record, Val Comment, Val Text) Export - - OPI_TypeConversion.GetLine(Base); - OPI_TypeConversion.GetLine(Table); - OPI_TypeConversion.GetLine(Record); - OPI_TypeConversion.GetLine(Comment); - - URL = "https://api.airtable.com/v0/" + Base + "/" + Table + "/" + Record + "/comments/" + Comment; - Headers = GetAuthorizationHeader(Token); - - Parameters = New Structure(); - OPI_Tools.AddField("text", Text, "String", Parameters); - - Response = OPI_Tools.Patch(URL, Parameters, Headers); - - Return Response; - + +OPI_TypeConversion.GetLine(Base); +OPI_TypeConversion.GetLine(Table); +OPI_TypeConversion.GetLine(Record); +OPI_TypeConversion.GetLine(Comment); + +URL = "https://api.airtable.com/v0/" + Base + "/" + Table + "/" + Record + "/comments/" + Comment; +Headers = GetAuthorizationHeader(Token); + +Parameters = New Structure(); +OPI_Tools.AddField("text", Text, "String", Parameters); + +Response = OPI_Tools.Patch(URL, Parameters, Headers); + +Return Response; + EndFunction // Delete comment // Deletes a comment for a table record -// +// // Parameters: -// Token - String - Token - token -// Base - String - Database identifier - base -// Table - String - Table identifier - table -// Record - String - Record identifier in the table - record -// Comment - String - Comment identifier - comment -// +// Token - String - Token - token +// Base - String - Database identifier - base +// Table - String - Table identifier - table +// Record - String - Record identifier in the table - record +// Comment - String - Comment identifier - comment +// // Return value: -// Key-Value Pair - serialized JSON response from Airtable +// Key-Value Pair - serialized JSON response from Airtable Function DeleteComment(Val Token, Val Base, Val Table, Val Record, Val Comment) Export - OPI_TypeConversion.GetLine(Base); - OPI_TypeConversion.GetLine(Table); - OPI_TypeConversion.GetLine(Record); - OPI_TypeConversion.GetLine(Comment); - - URL = "https://api.airtable.com/v0/" + Base + "/" + Table + "/" + Record + "/comments/" + Comment; - Headers = GetAuthorizationHeader(Token); - - Response = OPI_Tools.Delete(URL, , Headers); - - Return Response; - +OPI_TypeConversion.GetLine(Base); +OPI_TypeConversion.GetLine(Table); +OPI_TypeConversion.GetLine(Record); +OPI_TypeConversion.GetLine(Comment); + +URL = "https://api.airtable.com/v0/" + Base + "/" + Table + "/" + Record + "/comments/" + Comment; +Headers = GetAuthorizationHeader(Token); + +Response = OPI_Tools.Delete(URL, , Headers); + +Return Response; + EndFunction #EndRegion @@ -624,58 +624,58 @@ EndFunction #Region ServiceProceduresAndFunctions Function GetAuthorizationHeader(Val Token) - - OPI_TypeConversion.GetLine(Token); - - Headers = New Match; - Headers.Insert("Authorization", "Bearer " + Token); - - Return Headers; - + +OPI_TypeConversion.GetLine(Token); + +Headers = New Match; +Headers.Insert("Authorization", "Bearer " + Token); + +Return Headers; + EndFunction Function GenerateTableDescription(Val Name, Val FieldArray, Val Description = "") - - OPI_TypeConversion.GetLine(Name); - OPI_TypeConversion.GetCollection(FieldArray); - - TableDescription = New Structure("name,fields", Name, FieldArray); - - OPI_Tools.AddField("description", Description, "String", TableDescription); - - Return TableDescription; - + +OPI_TypeConversion.GetLine(Name); +OPI_TypeConversion.GetCollection(FieldArray); + +TableDescription = New Structure("name,fields", Name, FieldArray); + +OPI_Tools.AddField("description", Description, "String", TableDescription); + +Return TableDescription; + EndFunction Function PrimitiveFieldDescription(Val Name, Val Type, Val Options = "") - - FieldStructure = New Structure(); - OPI_Tools.AddField("name" , Name, "String" , FieldStructure); - OPI_Tools.AddField("type" , Type , "String" , FieldStructure); - OPI_Tools.AddField("options", Options , "Collection", FieldStructure); - - Return FieldStructure; + +FieldStructure = New Structure(); +OPI_Tools.AddField("name" , Name, "String" , FieldStructure); +OPI_Tools.AddField("type" , Type , "String" , FieldStructure); +OPI_Tools.AddField("options", Options , "Collection", FieldStructure); + +Return FieldStructure; EndFunction Procedure AddDataDescription(Val Data, Parameters) - - If TypeValue(Data) = Type("Array") Then - - SendArray = New Array; - - For Each RecordDescription Of Data Loop - SendArray.Add(New Structure("fields", RecordDescription)); - EndOfLoop; - - OPI_Tools.AddField("records", SendArray, "Array", Parameters); - - Otherwise - - OPI_Tools.AddField("fields", Data, "Collection", Parameters); - - EndIf; - + +If TypeValue(Data) = Type("Array") Then + +SendArray = New Array; + +For Each RecordDescription In Data Do +SendArray.Add(New Structure("fields", RecordDescription)); +EndDo; + +OPI_Tools.AddField("records", SendArray, "Array", Parameters); + +Else + +OPI_Tools.AddField("fields", Data, "Collection", Parameters); + +EndIf; + EndProcedure #EndRegion diff --git a/src/en/OPI/src/CommonModules/OPI_Airtable/OPI_Airtable.mdo b/src/en/OPI/src/CommonModules/OPI_Airtable/OPI_Airtable.mdo index 7dfa64ba1b..2941163208 100644 --- a/src/en/OPI/src/CommonModules/OPI_Airtable/OPI_Airtable.mdo +++ b/src/en/OPI/src/CommonModules/OPI_Airtable/OPI_Airtable.mdo @@ -1,11 +1,11 @@ - + - OPI_Airtable - - - OPI airtable - - true - true - true +OPI_Airtable + + +OPI airtable + +true +true +true diff --git a/src/en/OPI/src/CommonModules/OPI_Cryptography/Module.bsl b/src/en/OPI/src/CommonModules/OPI_Cryptography/Module.bsl index fde83150a7..05ff6bd421 100644 --- a/src/en/OPI/src/CommonModules/OPI_Cryptography/Module.bsl +++ b/src/en/OPI/src/CommonModules/OPI_Cryptography/Module.bsl @@ -34,75 +34,75 @@ /////////////////////////////////////////////////////////////////////////////////////////////////////// // Copyright (c) 2019, LLC 1C-Soft -// All rights reserved. This program and accompanying materials are provided +// All rights reserved. This program and accompanying materials are provided // in withоотinетwithтinии with уwithлоinиями лицензии Attribution 4.0 International (CC BY 4.0) // License text available at: // https://creativecommons.org/licenses/by/4.0/legalcode /////////////////////////////////////////////////////////////////////////////////////////////////////// Function HMACSHA256(Val Key, Val Data) Export - - Return HMAC(Key, Data, HashFunction.SHA256, 64); - + +Return HMAC(Key, Data, HashFunction.SHA256, 64); + EndFunction Function Hash(BinaryData, Type) Export - - Hashing = New DataHashing(Type); - Hashing.Add(BinaryData); - - Return Hashing.HashSum; - + +Hashing = New DataHashing(Type); +Hashing.Add(BinaryData); + +Return Hashing.HashSum; + EndFunction Function HMAC(Val Key, Val Data, Type, BlockSize) Export - - Twice = 2; - - If Key.Size() > BlockSize Then - Key = Hash(Key, Type); - EndIf; - - If Key.Size() <= BlockSize Then - Key = GetHexStringFromBinaryData(Key); - Key = Left(Key + RepeatString("00", BlockSize), BlockSize * Twice); - EndIf; - - Key = GetBinaryDataBufferFromBinaryData(GetBinaryDataFromHexString(Key)); - - Ipad = GetBinaryDataBufferFromHexString(RepeatString("36", BlockSize)); - Opad = GetBinaryDataBufferFromHexString(RepeatString("5c", BlockSize)); - - Ipad.WriteBitwiseExclusiveOr(0, Key); - Ikeypad = GetBinaryDataFromBinaryDataBuffer(ipad); - - Opad.WriteBitwiseExclusiveOr(0, Key); - Okeypad = GetBinaryDataFromBinaryDataBuffer(opad); - - Return Hash(ConcatenateBinaryData(okeypad, Hash(ConcatenateBinaryData(ikeypad, Data), Type)), Type); - + +Twice = 2; + +If Key.Size() > BlockSize Then +Key = Hash(Key, Type); +EndIf; + +If Key.Size() <= BlockSize Then +Key = GetHexStringFromBinaryData(Key); +Key = Left(Key + RepeatString("00", BlockSize), BlockSize * Twice); +EndIf; + +Key = GetBinaryDataBufferFromBinaryData(GetBinaryDataFromHexString(Key)); + +Ipad = GetBinaryDataBufferFromHexString(RepeatString("36", BlockSize)); +Opad = GetBinaryDataBufferFromHexString(RepeatString("5c", BlockSize)); + +Ipad.WriteBitwiseExclusiveOr(0, Key); +Ikeypad = GetBinaryDataFromBinaryDataBuffer(ipad); + +Opad.WriteBitwiseExclusiveOr(0, Key); +Okeypad = GetBinaryDataFromBinaryDataBuffer(opad); + +Return Hash(ConcatenateBinaryData(okeypad, Hash(ConcatenateBinaryData(ikeypad, Data), Type)), Type); + EndFunction Function ConcatenateBinaryData(BinaryData1, BinaryData2) Export - - BinaryDataArray = New Array; - BinaryDataArray.Add(BinaryData1); - BinaryDataArray.Add(BinaryData2); - - Return JoinBinaryData(BinaryDataArray); - + +BinaryDataArray = New Array; +BinaryDataArray.Add(BinaryData1); +BinaryDataArray.Add(BinaryData2); + +Return JoinBinaryData(BinaryDataArray); + EndFunction Function RepeatString(String, Quantity) Export - - Parts = New Array(Quantity); - - For To = 1 by Quantity Loop - Parts.Add(String); - EndOfLoop; - Return StrJoin(Parts, ""); - +Parts = New Array(Quantity); + +For To = 1 For Quantity Do +Parts.Add(String); +EndDo; + +Return StrJoin(Parts, ""); + EndFunction #EndRegion diff --git a/src/en/OPI/src/CommonModules/OPI_Cryptography/OPI_Cryptography.mdo b/src/en/OPI/src/CommonModules/OPI_Cryptography/OPI_Cryptography.mdo index 710fe257bf..df230a86fd 100644 --- a/src/en/OPI/src/CommonModules/OPI_Cryptography/OPI_Cryptography.mdo +++ b/src/en/OPI/src/CommonModules/OPI_Cryptography/OPI_Cryptography.mdo @@ -1,11 +1,11 @@ - + - OPI_Криптография - - ru - Криптография (OPI) - - true - true - true +OPI_Cryptography + +ru +Toриптография (OPI) + +true +true +true diff --git a/src/en/OPI/src/CommonModules/OPI_Dropbox/Module.bsl b/src/en/OPI/src/CommonModules/OPI_Dropbox/Module.bsl index 60f42e3d67..920366021e 100644 --- a/src/en/OPI/src/CommonModules/OPI_Dropbox/Module.bsl +++ b/src/en/OPI/src/CommonModules/OPI_Dropbox/Module.bsl @@ -37,128 +37,128 @@ // Get authorization link // Generates an authorization link for browser transition -// +// // Parameters: -// AppKey - String - Application key - appkey -// +// AppKey - String - Application key - appkey +// // Return value: -// String - URL for browser transition +// String - URL for browser transition Function GetAuthorizationLink(Val AppKey) Export - - OPI_TypeConversion.GetLine(AppKey); - Return "https://www.dropbox.com/oauth2/authorize?client_id=" - + AppKey - + "&response_type=code&token_access_type=offline"; - + +OPI_TypeConversion.GetLine(AppKey); +Return "https://www.dropbox.com/oauth2/authorize?client_id=" ++ AppKey ++ "&response_type=code&token_access_type=offline"; + EndFunction // Get token // Gets token based on the code from the GetAuthorizationLink page -// +// // Parameters: -// AppKey - String - Application key - appkey -// AppSecret - String - Application secret - appsecret -// Code - String - Code from the authorization page - code -// +// AppKey - String - Application key - appkey +// AppSecret - String - Application secret - appsecret +// Code - String - Code from the authorization page - code +// // Return value: -// Key-Value Pair - serialized JSON response from Dropbox +// Key-Value Pair - serialized JSON response from Dropbox Function GetToken(Val AppKey, Val AppSecret, Val Code) Export - - URL = "https://api.dropbox.com/oauth2/token"; - DataType = "application/x-www-form-urlencoded; charset=utf-8"; - - Parameters = New Structure; - OPI_Tools.AddField("code" , Code , "String", Parameters); - OPI_Tools.AddField("grant_type", "authorization_code", "String", Parameters); - - URLStructure = OPI_Tools.SplitURL(URL); - Server = URLStructure["Server"]; - Address = URLStructure["Address"]; - - Request = OPI_Tools.CreateRequest(Address, , DataType); - Connection = OPI_Tools.CreateConnection(Server, AppKey, AppSecret); - ParameterString = OPI_Tools.RequestParametersToString(Parameters); - Data = Right(ParameterString, StrLength(ParameterString) - 1); +URL = "https://api.dropbox.com/oauth2/token"; +DataType = "application/x-www-form-urlencoded; charset=utf-8"; + +Parameters = New Structure; +OPI_Tools.AddField("code" , Code , "String", Parameters); +OPI_Tools.AddField("grant_type", "authorization_code", "String", Parameters); + +URLStructure = OPI_Tools.SplitURL(URL); +Server = URLStructure["Server"]; +Address = URLStructure["Address"]; + +Request = OPI_Tools.CreateRequest(Address, , DataType); +Connection = OPI_Tools.CreateConnection(Server, AppKey, AppSecret); + +ParameterString = OPI_Tools.RequestParametersToString(Parameters); +Data = Right(ParameterString, StrLength(ParameterString) - 1); + +Request.SetBodyFromString(Data); + +Response = Connection.CallHTTPMethod("POST", Request); +OPI_Tools.ProcessResponse(Response); + +Return Response; - Request.SetBodyFromString(Data); - - Response = Connection.CallHTTPMethod("POST", Request); - OPI_Tools.ProcessResponse(Response); - - Return Response; - EndFunction // Refresh token // Gets a new token based on the refresh token -// +// // Parameters: -// AppKey - String - Application key - appkey -// AppSecret - String - Application secret - appsecret -// RefreshToken - String - Refresh token - refresh -// +// AppKey - String - Application key - appkey +// AppSecret - String - Application secret - appsecret +// RefreshToken - String - Refresh token - refresh +// // Return value: -// Key-Value Pair - serialized JSON response from Dropbox +// Key-Value Pair - serialized JSON response from Dropbox Function RefreshToken(Val AppKey, Val AppSecret, Val RefreshToken) Export - - String_ = "String"; - URL = "https://api.dropbox.com/oauth2/token"; - - Parameters = New Structure; - OPI_Tools.AddField("refresh_token", RefreshToken , String_, Parameters); - OPI_Tools.AddField("grant_type" , "refresh_token" , String_, Parameters); - OPI_Tools.AddField("client_id" , AppKey , String_, Parameters); - OPI_Tools.AddField("client_secret", AppSecret, String_, Parameters); - - Response = OPI_Tools.Post(URL, Parameters, , False); - - Return Response; - + +String_ = "String"; +URL = "https://api.dropbox.com/oauth2/token"; + +Parameters = New Structure; +OPI_Tools.AddField("refresh_token", RefreshToken , String_, Parameters); +OPI_Tools.AddField("grant_type" , "refresh_token" , String_, Parameters); +OPI_Tools.AddField("client_id" , AppKey , String_, Parameters); +OPI_Tools.AddField("client_secret", AppSecret, String_, Parameters); + +Response = OPI_Tools.Post(URL, Parameters, , False); + +Return Response; + EndFunction // Get account information // Gets account information -// +// // Parameters: -// Token - String - Token - token -// Account - String - Account ID. Current token account if not filled - account -// +// Token - String - Token - token +// Account - String - Account ID. Current token account if not filled - account +// // Return value: -// Key-Value Pair - serialized JSON response from Dropbox +// Key-Value Pair - serialized JSON response from Dropbox Function GetAccountInformation(Val Token, Val Account = "") Export - - If ValueFilled(Account) Then - Result = GetAccount(Token, Account); - Otherwise - Result = GetOwnAccount(Token); - EndIf; - - Return Result; - + +If ValueIsFilled(Account) Then +Result = GetAccount(Token, Account); +Else +Result = GetOwnAccount(Token); +EndIf; + +Return Result; + EndFunction // Get space usage data // Gets information on the amount of used disk space -// +// // Parameters: -// Token - String - Token - token -// +// Token - String - Token - token +// // Return value: -// Key-Value Pair - serialized JSON response from Dropbox +// Key-Value Pair - serialized JSON response from Dropbox Function GetSpaceUsageData(Val Token) Export - - URL = "https://api.dropboxapi.com/2/users/get_space_usage"; - Headers = GetRequestHeaders(Token); - - Response = OPI_Tools.PostBinary(URL - , GetBinaryDataFromString("null") - , Headers - , - , "text/plain; charset=dropbox-cors-hack"); - - Return Response; - + +URL = "https://api.dropboxapi.com/2/users/get_space_usage"; +Headers = GetRequestHeaders(Token); + +Response = OPI_Tools.PostBinary(URL +, GetBinaryDataFromString("null") +, Headers +, +, "text/plain; charset=dropbox-cors-hack"); + +Return Response; + EndFunction #EndRegion @@ -167,344 +167,344 @@ EndFunction // Get object information // Gets information about a file or directory -// +// // Parameters: -// Token - String - Token - token -// Path - String - Path to the object - path -// Detailed - Boolean - Adds additional information fields for media files - detail -// +// Token - String - Token - token +// Path - String - Path to the object - path +// Detailed - Boolean - Adds additional information fields for media files - detail +// // Return value: -// Key-Value Pair - serialized JSON response from Dropbox +// Key-Value Pair - serialized JSON response from Dropbox Function GetObjectInformation(Val Token, Val Path, Val Detailed = False) Export - - URL = "https://api.dropboxapi.com/2/files/get_metadata"; - - Parameters = New Structure; - OPI_Tools.AddField("path" , Path , "String", Parameters); - OPI_Tools.AddField("include_media_info", Detailed, "Boolean", Parameters); - - Headers = GetRequestHeaders(Token); - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - + +URL = "https://api.dropboxapi.com/2/files/get_metadata"; + +Parameters = New Structure; +OPI_Tools.AddField("path" , Path , "String", Parameters); +OPI_Tools.AddField("include_media_info", Detailed, "Boolean", Parameters); + +Headers = GetRequestHeaders(Token); +Response = OPI_Tools.Post(URL, Parameters, Headers); + +Return Response; + EndFunction // Get list of folder files // Gets the list of the first files in the directory or continues getting the next ones when the cursor is specified -// +// // Parameters: -// Token - String - Token - token -// Path - String - Path to the directory. Optional if the cursor is specified - path -// Detailed - Boolean - Adds additional information fields for media files - detail -// Cursor - String - Cursor from the previous request to get the next set of files - cursor -// +// Token - String - Token - token +// Path - String - Path to the directory. Optional if the cursor is specified - path +// Detailed - Boolean - Adds additional information fields for media files - detail +// Cursor - String - Cursor from the previous request to get the next set of files - cursor +// // Return value: -// HTTPResponse - Get list of folder files +// HTTPResponse - Get list of folder files Function GetListOfFolderFiles(Val Token, Val Path = "", Val Detailed = False, Val Cursor = "") Export - - If Not ValueFilled(Cursor) Then - - URL = "https://api.dropboxapi.com/2/files/list_folder"; - - Parameters = New Structure; - OPI_Tools.AddField("path" , Path , "String", Parameters); - OPI_Tools.AddField("include_media_info", Detailed , "Boolean", Parameters); - - Otherwise - - URL = "https://api.dropboxapi.com/2/files/list_folder/continue"; - - Parameters = New Structure; - OPI_Tools.AddField("cursor", Cursor, "String", Parameters); - - EndIf; - - Headers = GetRequestHeaders(Token); - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - +If Not ValueIsFilled(Cursor) Then + +URL = "https://api.dropboxapi.com/2/files/list_folder"; + +Parameters = New Structure; +OPI_Tools.AddField("path" , Path , "String", Parameters); +OPI_Tools.AddField("include_media_info", Detailed , "Boolean", Parameters); + +Else + +URL = "https://api.dropboxapi.com/2/files/list_folder/continue"; + +Parameters = New Structure; +OPI_Tools.AddField("cursor", Cursor, "String", Parameters); + +EndIf; + +Headers = GetRequestHeaders(Token); + +Response = OPI_Tools.Post(URL, Parameters, Headers); + +Return Response; + EndFunction // Get preview -// byлучает PDF or HTML преinью объеtoта (тольtoо for тоtoументоin) -// +// Forлучает PDF or HTML преinью объеtoта (тольtoо for тоtoументоin) +// // Parameters: -// Token - String - Token - token -// Path - String - Path to the object - path -// +// Token - String - Token - token +// Path - String - Path to the object - path +// // Return value: -// BinaryData - document preview +// BinaryData - document preview Function GetPreview(Val Token, Val Path) Export - - URL = "https://content.dropboxapi.com/2/files/get_preview"; - Response = ProcessObject(Token, URL, Path, True); - - Return Response; - + +URL = "https://content.dropboxapi.com/2/files/get_preview"; +Response = ProcessObject(Token, URL, Path, True); + +Return Response; + EndFunction // Upload file // Uploads a file to the cloud drive -// +// // Parameters: -// Token - String - Token - token -// File - String, BinaryData - Data file for upload - file -// Path - String - Save path on Dropbox - path -// Overwrite - Boolean - Overwrite file in case of path conflicts - overwrite -// +// Token - String - Token - token +// File - String, BinaryData - Data file for upload - file +// Path - String - Save path on Dropbox - path +// Overwrite - Boolean - Overwrite file in case of path conflicts - overwrite +// // Return value: -// Key-Value Pair - serialized JSON response from Dropbox +// Key-Value Pair - serialized JSON response from Dropbox Function UploadFile(Val Token, Val File, Val Path, Val Overwrite = False) Export - - OPI_TypeConversion.GetBinaryData(File); - OPI_TypeConversion.GetBoolean(Overwrite); - OPI_TypeConversion.GetLine(Path); - - Mode = ?(Overwrite, "overwrite", "add"); - Size = File.Size(); - Boundary = 100000000; - - If Size > Boundary Then - Response = UploadLargeFile(Token, File, Path, Mode); - Otherwise - Response = UploadSmallFile(Token, File, Path, Mode); - EndIf; - - Return Response; - + +OPI_TypeConversion.GetBinaryData(File); +OPI_TypeConversion.GetBoolean(Overwrite); +OPI_TypeConversion.GetLine(Path); + +Mode = ?(Overwrite, "overwrite", "add"); +Size = File.Size(); +Boundary = 100000000; + +If Size > Border Then +Response = UploadLargeFile(Token, File, Path, Mode); +Else +Response = UploadSmallFile(Token, File, Path, Mode); +EndIf; + +Return Response; + EndFunction // Upload file by URL -// Uploads a file to the cloud drive by fetching it from the specified URL -// +// Uploads a file to the cloud drive by fetching it from the specified URL +// // Parameters: -// Token - String - Token - token -// FileURL - String - URL source of the file - url -// Path - String - Save path on Dropbox - path -// +// Token - String - Token - token +// FileURL - String - URL source of the file - url +// Path - String - Save path on Dropbox - path +// // Return value: -// Key-Value Pair - serialized JSON response from Dropbox +// Key-Value Pair - serialized JSON response from Dropbox Function UploadFileByURL(Val Token, Val FileURL, Val Path) Export - - URL = "https://api.dropboxapi.com/2/files/save_url"; - - Parameters = New Structure; - OPI_Tools.AddField("path", Path , "String", Parameters); - OPI_Tools.AddField("url" , FileURL , "String", Parameters); - - Headers = GetRequestHeaders(Token); - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - + +URL = "https://api.dropboxapi.com/2/files/save_url"; + +Parameters = New Structure; +OPI_Tools.AddField("path", Path , "String", Parameters); +OPI_Tools.AddField("url" , FileURL , "String", Parameters); + +Headers = GetRequestHeaders(Token); +Response = OPI_Tools.Post(URL, Parameters, Headers); + +Return Response; + EndFunction // Get upload status by URL // Gets the upload status of the file by URL -// +// // Parameters: -// Token - String - Token - token -// JobID - String - ID of the asynchronous job from the UploadFileByURL response - job -// +// Token - String - Token - token +// JobID - String - ID of the asynchronous job from the UploadFileByURL response - job +// // Return value: -// Key-Value Pair - serialized JSON response from Dropbox +// Key-Value Pair - serialized JSON response from Dropbox Function GetUploadStatusByURL(Val Token, Val JobID) Export - - URL = "https://api.dropboxapi.com/2/files/save_url/check_job_status"; - - Parameters = New Structure; - OPI_Tools.AddField("async_job_id", JobID, "String", Parameters); - - Headers = GetRequestHeaders(Token); - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - + +URL = "https://api.dropboxapi.com/2/files/save_url/check_job_status"; + +Parameters = New Structure; +OPI_Tools.AddField("async_job_id", JobID, "String", Parameters); + +Headers = GetRequestHeaders(Token); +Response = OPI_Tools.Post(URL, Parameters, Headers); + +Return Response; + EndFunction // Delete object // Deletes an object from the cloud drive -// +// // Parameters: -// Token - String - Token - token -// Path - String - Path to the object to delete - path -// Irrecoverable - String - Delete object without the possibility of recovery - permanently -// +// Token - String - Token - token +// Path - String - Path to the object to delete - path +// Irrecoverable - String - Delete object without the possibility of recovery - permanently +// // Return value: -// Key-Value Pair - serialized JSON response from Dropbox +// Key-Value Pair - serialized JSON response from Dropbox Function DeleteObject(Val Token, Val Path, Val Irretrievably = False) Export - - OPI_TypeConversion.GetBoolean(Irretrievably); - - If Irretrievably Then - URL = "https://api.dropboxapi.com/2/files/permanently_delete"; - Otherwise - URL = "https://api.dropboxapi.com/2/files/delete_v2"; - EndIf; - - Response = ProcessObject(Token, URL, Path); - - Return Response; + +OPI_TypeConversion.GetBoolean(Irretrievably); + +If Irretrievably Then +URL = "https://api.dropboxapi.com/2/files/permanently_delete"; +Else +URL = "https://api.dropboxapi.com/2/files/delete_v2"; +EndIf; + +Response = ProcessObject(Token, URL, Path); + +Return Response; EndFunction // Copy object // Copies a file or directory to the selected path -// +// // Parameters: -// Token - String - Token - token -// From - String - Path to the original object - form -// To - String - Target path for the new object - to -// +// Token - String - Token - token +// From - String - Path to the original object - form +// To - String - Target path for the new object - to +// // Return value: -// Key-Value Pair - serialized JSON response from Dropbox +// Key-Value Pair - serialized JSON response from Dropbox Function CopyObject(Val Token, Val From, Val To) Export - - URL = "https://api.dropboxapi.com/2/files/copy_v2"; - - Parameters = New Structure; - OPI_Tools.AddField("from_path", From, "String", Parameters); - OPI_Tools.AddField("to_path" , To , "String", Parameters); - - Headers = GetRequestHeaders(Token); - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - +URL = "https://api.dropboxapi.com/2/files/copy_v2"; + +Parameters = New Structure; +OPI_Tools.AddField("from_path", From, "String", Parameters); +OPI_Tools.AddField("to_path" , To , "String", Parameters); + +Headers = GetRequestHeaders(Token); + +Response = OPI_Tools.Post(URL, Parameters, Headers); + +Return Response; + EndFunction // Move object // Moves an object to the selected path -// +// // Parameters: -// Token - String - Token - token -// From - String - Path to the original object - form -// To - String - Target path for the new object - to -// +// Token - String - Token - token +// From - String - Path to the original object - form +// To - String - Target path for the new object - to +// // Return value: -// Key-Value Pair - serialized JSON response from Dropbox +// Key-Value Pair - serialized JSON response from Dropbox Function MoveObject(Val Token, Val From, Val To) Export - URL = "https://api.dropboxapi.com/2/files/move_v2"; - - Parameters = New Structure; - OPI_Tools.AddField("from_path", From, "String", Parameters); - OPI_Tools.AddField("to_path" , To , "String", Parameters); - - Headers = GetRequestHeaders(Token); +URL = "https://api.dropboxapi.com/2/files/move_v2"; + +Parameters = New Structure; +OPI_Tools.AddField("from_path", From, "String", Parameters); +OPI_Tools.AddField("to_path" , To , "String", Parameters); + +Headers = GetRequestHeaders(Token); + +Response = OPI_Tools.Post(URL, Parameters, Headers); + +Return Response; - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - EndFunction // Create folder // Creates an empty directory at the selected path -// +// // Parameters: -// Token - String - Token - token -// Path - String - Target path for creating the directory - path -// +// Token - String - Token - token +// Path - String - Target path for creating the directory - path +// // Return value: -// Key-Value Pair - serialized JSON response from Dropbox +// Key-Value Pair - serialized JSON response from Dropbox Function CreateFolder(Val Token, Val Path) Export - - URL = "https://api.dropboxapi.com/2/files/create_folder_v2"; - Response = ProcessObject(Token, URL, Path); - - Return Response; - + +URL = "https://api.dropboxapi.com/2/files/create_folder_v2"; +Response = ProcessObject(Token, URL, Path); + +Return Response; + EndFunction // Download file // Downloads a file by the specified path or ID -// +// // Parameters: -// Token - String - Token - token -// Path - String - Path or ID of the file - path -// +// Token - String - Token - token +// Path - String - Path or ID of the file - path +// // Return value: -// BinaryData - binary data of the file +// BinaryData - binary data of the file Function DownloadFile(Val Token, Val Path) Export - - URL = "https://content.dropboxapi.com/2/files/download"; - Response = ProcessObject(Token, URL, Path, True); - - Return Response; - + +URL = "https://content.dropboxapi.com/2/files/download"; +Response = ProcessObject(Token, URL, Path, True); + +Return Response; + EndFunction // Download folder // Downloads a zip archive with the contents of the specified directory -// +// // Parameters: -// Token - String - Token - token -// Path - String - Path or ID of the directory - path -// +// Token - String - Token - token +// Path - String - Path or ID of the directory - path +// // Return value: -// BinaryData - binary data of the zip archive with the contents of the directory +// BinaryData - binary data of the zip archive with the contents of the directory Function DownloadFolder(Val Token, Val Path) Export - - URL = "https://content.dropboxapi.com/2/files/download_zip"; - Response = ProcessObject(Token, URL, Path, True); - - Return Response; - + +URL = "https://content.dropboxapi.com/2/files/download_zip"; +Response = ProcessObject(Token, URL, Path, True); + +Return Response; + EndFunction // Get list of object versions // Gets the list of versions (revisions) of the object -// +// // Parameters: -// Token - String - Token - token -// Path - String - Path to the object - path -// Quantity - String, Number - Number of the latest versions of the object to display - amount -// +// Token - String - Token - token +// Path - String - Path to the object - path +// Quantity - String, Number - Number of the latest versions of the object to display - amount +// // Return value: -// Key-Value Pair - serialized JSON response from Dropbox +// Key-Value Pair - serialized JSON response from Dropbox Function GetObjectVersionList(Val Token, Val Path, Val Quantity = 10) Export - - URL = "https://api.dropboxapi.com/2/files/list_revisions"; - - Parameters = New Structure; - OPI_Tools.AddField("path" , Path , "String", Parameters); - OPI_Tools.AddField("limit", Quantity, "Number" , Parameters); - - Headers = GetRequestHeaders(Token); - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - + +URL = "https://api.dropboxapi.com/2/files/list_revisions"; + +Parameters = New Structure; +OPI_Tools.AddField("path" , Path , "String", Parameters); +OPI_Tools.AddField("limit", Quantity, "Number" , Parameters); + +Headers = GetRequestHeaders(Token); +Response = OPI_Tools.Post(URL, Parameters, Headers); + +Return Response; + EndFunction // Restore object to version // Inоwithwithтаtoinлиinает withоwithтояние объеtoта to необхоdимой inерwithии (реinfromии) -// +// // Parameters: -// Token - String - Token - token -// Path - String - Path to the object - path -// Version - String - ID of the version (revision) for restoration - rev -// +// Token - String - Token - token +// Path - String - Path to the object - path +// Version - String - ID of the version (revision) for restoration - rev +// // Return value: -// Key-Value Pair - serialized JSON response from Dropbox +// Key-Value Pair - serialized JSON response from Dropbox Function RestoreObjectToVersion(Val Token, Val Path, Val Version) Export - - URL = "https://api.dropboxapi.com/2/files/restore"; - - Parameters = New Structure; - OPI_Tools.AddField("path", Path , "String", Parameters); - OPI_Tools.AddField("rev" , Version, "String", Parameters); - - Headers = GetRequestHeaders(Token); - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - + +URL = "https://api.dropboxapi.com/2/files/restore"; + +Parameters = New Structure; +OPI_Tools.AddField("path", Path , "String", Parameters); +OPI_Tools.AddField("rev" , Version, "String", Parameters); + +Headers = GetRequestHeaders(Token); +Response = OPI_Tools.Post(URL, Parameters, Headers); + +Return Response; + EndFunction #EndRegion @@ -513,58 +513,58 @@ EndFunction // Get list of tags // Gets the list of tags of the selected files -// +// // Parameters: -// Token - String - Token - token -// Paths - String, Array of Strings - Path or set of paths to the files - paths -// +// Token - String - Token - token +// Paths - String, Array of Strings - Path or set of paths to the files - paths +// // Return value: -// Key-Value Pair - serialized JSON response from Dropbox +// Key-Value Pair - serialized JSON response from Dropbox Function GetTagList(Val Token, Val Paths) Export - - URL = "https://api.dropboxapi.com/2/files/tags/get"; - - Parameters = New Structure; - OPI_Tools.AddField("paths", Paths, "Array", Parameters); - - Headers = GetRequestHeaders(Token); - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - +URL = "https://api.dropboxapi.com/2/files/tags/get"; + +Parameters = New Structure; +OPI_Tools.AddField("paths", Paths, "Array", Parameters); + +Headers = GetRequestHeaders(Token); + +Response = OPI_Tools.Post(URL, Parameters, Headers); + +Return Response; + EndFunction // Add tag // Adds a new text tag to a file or directory -// +// // Parameters: -// Token - String - Token - token -// Path - String - Path to the object for which the tag needs to be created - path -// Tag - String - Tag text - tag -// +// Token - String - Token - token +// Path - String - Path to the object for which the tag needs to be created - path +// Tag - String - Tag text - tag +// // Return value: -// Key-Value Pair - serialized JSON response from Dropbox +// Key-Value Pair - serialized JSON response from Dropbox Function AddTag(Val Token, Val Path, Val Tag) Export - - Return ProcessTag(Token, Path, Tag); - + +Return ProcessTag(Token, Path, Tag); + EndFunction // Delete tag // Deletes the text tag of a file or directory -// +// // Parameters: -// Token - String - Token - token -// Path - String - Path to the object whose tag needs to be deleted - path -// Tag - String - Tag text - tag -// +// Token - String - Token - token +// Path - String - Path to the object whose tag needs to be deleted - path +// Tag - String - Tag text - tag +// // Return value: -// Key-Value Pair - serialized JSON response from Dropbox +// Key-Value Pair - serialized JSON response from Dropbox Function DeleteTag(Val Token, Val Path, Val Tag) Export - - Return ProcessTag(Token, Path, Tag, True); - + +Return ProcessTag(Token, Path, Tag, True); + EndFunction #EndRegion @@ -573,195 +573,195 @@ EndFunction // Publish folder // Sets the directory to public access mode -// +// // Parameters: -// Token - String - Token - token -// Path - String - Path to the target directory - path -// +// Token - String - Token - token +// Path - String - Path to the target directory - path +// // Return value: -// Key-Value Pair - serialized JSON response from Dropbox +// Key-Value Pair - serialized JSON response from Dropbox Function PublishFolder(Val Token, Val Path) Export - - URL = "https://api.dropboxapi.com/2/sharing/share_folder"; - Response = ProcessObject(Token, URL, Path); - - Return Response; - + +URL = "https://api.dropboxapi.com/2/sharing/share_folder"; +Response = ProcessObject(Token, URL, Path); + +Return Response; + EndFunction // Unpublish folder // Cancels the public access mode for the directory -// +// // Parameters: -// Token - String - Token - token -// FolderID - String - ID публичного directory (shared folder ID) - folder -// +// Token - String - Token - token +// FolderID - String - ID публичного directory (shared folder ID) - folder +// // Return value: -// Key-Value Pair - serialized JSON response from Dropbox +// Key-Value Pair - serialized JSON response from Dropbox Function CancelFolderPublication(Val Token, Val FolderID) Export - - URL = "https://api.dropboxapi.com/2/sharing/unshare_folder"; - - Parameters = New Structure; - OPI_Tools.AddField("shared_folder_id", FolderID, "String", Parameters); - - Headers = GetRequestHeaders(Token); - Response = OPI_Tools.Post(URL, Parameters, Headers); - Return Response; +URL = "https://api.dropboxapi.com/2/sharing/unshare_folder"; + +Parameters = New Structure; +OPI_Tools.AddField("shared_folder_id", FolderID, "String", Parameters); + +Headers = GetRequestHeaders(Token); +Response = OPI_Tools.Post(URL, Parameters, Headers); + +Return Response; EndFunction // Add user to file // Defines access to the file for an external user -// +// // Parameters: -// Token - String - Token - token -// FileID - String - ID of the file to be accessed - fileid -// EmailAddresses - String, Array of Strings - List of email addresses of users being added - emails -// ViewOnly - Boolean - Prohibits file editing for the external user - readonly -// +// Token - String - Token - token +// FileID - String - ID of the file to be accessed - fileid +// EmailAddresses - String, Array of Strings - List of email addresses of users being added - emails +// ViewOnly - Boolean - Prohibits file editing for the external user - readonly +// // Return value: -// Key-Value Pair - serialized JSON response from Dropbox +// Key-Value Pair - serialized JSON response from Dropbox Function AddUsersToFile(Val Token, Val FileID, Val EmailAddresses, Val ViewOnly = True) Export - - String_ = "String"; - - OPI_TypeConversion.GetArray(EmailAddresses); - OPI_TypeConversion.GetLine(FileID); - OPI_TypeConversion.GetBoolean(ViewOnly); - - If Not StringStartsWith(FileID, "id:") Then - FileID = "id:" + FileID; - EndIf; - - URL = "https://api.dropboxapi.com/2/sharing/add_file_member"; - - ArrayOfUsers = New Array; - - For Each Address Of EmailAddresses Loop - - UserData = New Match; - OPI_Tools.AddField(".tag" , "email", String_, UserData); - OPI_Tools.AddField("email", Address , String_, UserData); - - ArrayOfUsers.Add(UserData); - EndOfLoop; - - Parameters = New Structure; - OPI_Tools.AddField("file" , FileID , String_, Parameters); - OPI_Tools.AddField("members", ArrayOfUsers , "Array", Parameters); - - Mode = ?(ViewOnly, "viewer", "editor"); - - OPI_Tools.AddField("access_level", Mode , String_, Parameters); - - Headers = GetRequestHeaders(Token); +String_ = "String"; + +OPI_TypeConversion.GetArray(EmailAddresses); +OPI_TypeConversion.GetLine(FileID); +OPI_TypeConversion.GetBoolean(ViewOnly); + +If Not StringStartsWith(FileID, "id:") Then +FileID = "id:" + FileID; +EndIf; + +URL = "https://api.dropboxapi.com/2/sharing/add_file_member"; + +ArrayOfUsers = New Array; + +For Each Address In EmailAddresses Do + +UserData = New Match; +OPI_Tools.AddField(".tag" , "email", String_, UserData); +OPI_Tools.AddField("email", Address , String_, UserData); + +ArrayOfUsers.Add(UserData); + +EndDo; + +Parameters = New Structure; +OPI_Tools.AddField("file" , FileID , String_, Parameters); +OPI_Tools.AddField("members", ArrayOfUsers , "Array", Parameters); + +Mode = ?(ViewOnly, "viewer", "editor"); + +OPI_Tools.AddField("access_level", Mode , String_, Parameters); + +Headers = GetRequestHeaders(Token); + +Response = OPI_Tools.Post(URL, Parameters, Headers); + +Return Response; - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - EndFunction // Add users to folder // Grants external users access to the directory -// +// // Parameters: -// Token - String - Token - token -// FolderID - String - ID публичного directory (shared folder ID) - folder -// EmailAddresses - String, Array of Strings - List of email addresses of users being added - emails -// ViewOnly - Boolean - Prohibits file editing for the external user - readonly -// +// Token - String - Token - token +// FolderID - String - ID публичного directory (shared folder ID) - folder +// EmailAddresses - String, Array of Strings - List of email addresses of users being added - emails +// ViewOnly - Boolean - Prohibits file editing for the external user - readonly +// // Return value: -// Undefined - empty response +// Undefined - empty response Function AddUsersToFolder(Val Token, Val FolderID, Val EmailAddresses, Val ViewOnly = True) Export - - String_ = "String"; - - OPI_TypeConversion.GetArray(EmailAddresses); - OPI_TypeConversion.GetBoolean(ViewOnly); - Mode = ?(ViewOnly, "viewer", "editor"); - - URL = "https://api.dropboxapi.com/2/sharing/add_folder_member"; - - ArrayOfUsers = New Array; - - For Each Address Of EmailAddresses Loop - - UserData = New Match; - OPI_Tools.AddField(".tag" , "email", String_, UserData); - OPI_Tools.AddField("email", Address , String_, UserData); - - UserStructure = New Structure("member,access_level", UserData, Mode); - - ArrayOfUsers.Add(UserStructure); - EndOfLoop; - - Parameters = New Structure; - OPI_Tools.AddField("shared_folder_id", FolderID , String_, Parameters); - OPI_Tools.AddField("members" , ArrayOfUsers , "Array", Parameters); - - Headers = GetRequestHeaders(Token); +String_ = "String"; - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; +OPI_TypeConversion.GetArray(EmailAddresses); +OPI_TypeConversion.GetBoolean(ViewOnly); +Mode = ?(ViewOnly, "viewer", "editor"); + +URL = "https://api.dropboxapi.com/2/sharing/add_folder_member"; + +ArrayOfUsers = New Array; + +For Each Address In EmailAddresses Do + +UserData = New Match; +OPI_Tools.AddField(".tag" , "email", String_, UserData); +OPI_Tools.AddField("email", Address , String_, UserData); + +UserStructure = New Structure("member,access_level", UserData, Mode); + +ArrayOfUsers.Add(UserStructure); + +EndDo; + +Parameters = New Structure; +OPI_Tools.AddField("shared_folder_id", FolderID , String_, Parameters); +OPI_Tools.AddField("members" , ArrayOfUsers , "Array", Parameters); + +Headers = GetRequestHeaders(Token); + +Response = OPI_Tools.Post(URL, Parameters, Headers); + +Return Response; EndFunction // Get asynchronous change status // Gets the status of the asynchronous access change job -// +// // Parameters: -// Token - String - Token - token -// JobID - String - AsynchronousJobID - job -// +// Token - String - Token - token +// JobID - String - AsynchronousJobID - job +// // Return value: -// Key-Value Pair - serialized JSON response from Dropbox +// Key-Value Pair - serialized JSON response from Dropbox Function GetAsynchronousChangeStatus(Val Token, Val JobID) Export - - URL = "https://api.dropboxapi.com/2/sharing/check_job_status"; - - Parameters = New Structure; - OPI_Tools.AddField("async_job_id", JobID, "String", Parameters); - - Headers = GetRequestHeaders(Token); - Response = OPI_Tools.Post(URL, Parameters, Headers); - Return Response; +URL = "https://api.dropboxapi.com/2/sharing/check_job_status"; + +Parameters = New Structure; +OPI_Tools.AddField("async_job_id", JobID, "String", Parameters); + +Headers = GetRequestHeaders(Token); +Response = OPI_Tools.Post(URL, Parameters, Headers); + +Return Response; EndFunction // Unpublish file // Prohibits access to the file for external users -// +// // Parameters: -// Token - String - Token - token -// FileID - String - ID of the file to be accessed - fileid -// +// Token - String - Token - token +// FileID - String - ID of the file to be accessed - fileid +// // Return value: -// Key-Value Pair - serialized JSON response from Dropbox +// Key-Value Pair - serialized JSON response from Dropbox Function CancelFilePublication(Val Token, Val FileID) Export - - OPI_TypeConversion.GetLine(FileID); - - If Not StringStartsWith(FileID, "id:") Then - FileID = "id:" + FileID; - EndIf; - - URL = "https://api.dropboxapi.com/2/sharing/unshare_file"; - - Parameters = New Structure; - OPI_Tools.AddField("file", FileID, "String", Parameters); - - Headers = GetRequestHeaders(Token); - Response = OPI_Tools.Post(URL, Parameters, Headers); - Return Response; - +OPI_TypeConversion.GetLine(FileID); + +If Not StringStartsWith(FileID, "id:") Then +FileID = "id:" + FileID; +EndIf; + +URL = "https://api.dropboxapi.com/2/sharing/unshare_file"; + +Parameters = New Structure; +OPI_Tools.AddField("file", FileID, "String", Parameters); + +Headers = GetRequestHeaders(Token); +Response = OPI_Tools.Post(URL, Parameters, Headers); + +Return Response; + EndFunction #EndRegion @@ -771,191 +771,191 @@ EndFunction #Region ServiceProceduresAndFunctions Function ProcessObject(Val Token, Val URL, Val Path, Val InHeaders = False) - - Parameters = New Structure; - OPI_Tools.AddField("path", Path, "String", Parameters); - - If InHeaders Then - Headers = GetRequestHeaders(Token, Parameters); - Response = OPI_Tools.PostBinary(URL, GetBinaryDataFromString(""), Headers); - Otherwise - Headers = GetRequestHeaders(Token); - Response = OPI_Tools.Post(URL, Parameters, Headers); - EndIf; - - Return Response; - + +Parameters = New Structure; +OPI_Tools.AddField("path", Path, "String", Parameters); + +If InHeaders Then +Headers = GetRequestHeaders(Token, Parameters); +Response = OPI_Tools.PostBinary(URL, GetBinaryDataFromString(""), Headers); +Else +Headers = GetRequestHeaders(Token); +Response = OPI_Tools.Post(URL, Parameters, Headers); +EndIf; + +Return Response; + EndFunction Function ProcessTag(Val Token, Val Path, Val Tag, Val ThisIsDeletion = False) - If ThisIsDeletion Then - URL = "https://api.dropboxapi.com/2/files/tags/remove"; - Otherwise - URL = "https://api.dropboxapi.com/2/files/tags/add"; - EndIf; - - Parameters = New Structure; - OPI_Tools.AddField("path" , Path, "String", Parameters); - OPI_Tools.AddField("tag_text" , Tag , "String", Parameters); - - Headers = GetRequestHeaders(Token); +If ThisIsDeletion Then +URL = "https://api.dropboxapi.com/2/files/tags/remove"; +Else +URL = "https://api.dropboxapi.com/2/files/tags/add"; +EndIf; + +Parameters = New Structure; +OPI_Tools.AddField("path" , Path, "String", Parameters); +OPI_Tools.AddField("tag_text" , Tag , "String", Parameters); + +Headers = GetRequestHeaders(Token); + +Response = OPI_Tools.Post(URL, Parameters, Headers); + +Return Response; - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - EndFunction Function GetRequestHeaders(Val Token, Val Parameters = "") - - OPI_TypeConversion.GetLine(Token); - - Headers = New Match; - Headers.Insert("Authorization" , "Bearer " + Token); - - If ValueFilled(Parameters) Then - - JSON = OPI_Tools.JSONString(Parameters, "No"); - JSON = StringReplace(JSON, Symbols.VK + Symbols.PS, ""); - Headers.Insert("Dropbox-API-Arg", JSON); - - EndIf; - - Return Headers; - +OPI_TypeConversion.GetLine(Token); + +Headers = New Match; +Headers.Insert("Authorization" , "Bearer " + Token); + +If ValueIsFilled(Parameters) Then + +JSON = OPI_Tools.JSONString(Parameters, "No"); +JSON = StringReplace(JSON, Symbols.VK + Symbols.PS, ""); + +Headers.Insert("Dropbox-API-Arg", JSON); + +EndIf; + +Return Headers; + EndFunction Function UploadLargeFile(Val Token, Val File, Val Path, Val Mode) - - URL = "https://content.dropboxapi.com/2/files/upload_session/append_v2"; - ChunkSize = 100000000; - CurrentPosition = 0; - BytesRead = 0; - TotalSize = File.Size(); - Session = OpenSession(Token); - - While BytesRead < TotalSize Loop - - Indent = CurrentPosition; - Cursor = New Structure("offset,session_id", Indent, Session); - - Parameters = New Structure("cursor", Cursor); - Headers = GetRequestHeaders(Token, Parameters); - - ReadingData = New ReadingData(File); - BytesRead = ReadingData.Skip(CurrentPosition); - Result = ReadingData.Read(ChunkSize); - Current data = Result.GetBinaryData(); - CurrentSize = Current data.Size(); - NextPosition = CurrentPosition + CurrentSize; - - If Not ValueFilled(Current data) Then - Interrupt; - EndIf; +URL = "https://content.dropboxapi.com/2/files/upload_session/append_v2"; + +ChunkSize = 100000000; +CurrentPosition = 0; +BytesRead = 0; +TotalSize = File.Size(); +Session = OpenSession(Token); + +WHile BytesRead < TotalSize Do + +Indent = CurrentPosition; +Cursor = New Structure("offset,session_id", Indent, Session); + +Parameters = New Structure("cursor", Cursor); +Headers = GetRequestHeaders(Token, Parameters); + +ReadingData = New ReadingData(File); +BytesRead = ReadingData.Skip(CurrentPosition); +Result = ReadingData.Read(ChunkSize); +Current data = Result.GetBinaryData(); +CurrentSize = Current data.Size(); +NextPosition = CurrentPosition + CurrentSize; + +If Not ValueIsFilled(Current data) Then +Break; +EndIf; + +Response = OPI_Tools.PostBinary(URL, Current data, Headers); + +CurrentPosition = NextPosition; + +// !OInt KBytes = 1024; +// !OInt MByte = KBytes * KBytes; +// !OInt Notify(OPI_Tools.ProgressInformation(CurrentPosition, TotalSize, "MB", MByte)); + +// !OInt PerformGarbageCollection(); +// !OInt ReleaseObject(Current data); + +EndDo; + +Response = CloseSession(Token, Path, Mode, TotalSize, Session); + +Return Response; - Response = OPI_Tools.PostBinary(URL, Current data, Headers); - - CurrentPosition = NextPosition; - - // !OInt KBytes = 1024; - // !OInt MByte = KBytes * KBytes; - // !OInt Notify(OPI_Tools.ProgressInformation(CurrentPosition, TotalSize, "MB", MByte)); - - // !OInt PerformGarbageCollection(); - // !OInt ReleaseObject(Current data); - - EndOfLoop; - - Response = CloseSession(Token, Path, Mode, TotalSize, Session); - - Return Response; - EndFunction Function UploadSmallFile(Val Token, Val File, Val Path, Val Mode) - - Boolean_ = "Boolean"; - String_ = "String"; - URL = "https://content.dropboxapi.com/2/files/upload"; - - Parameters = New Structure; - - OPI_Tools.AddField("autorename" , False , Boolean_, Parameters); - OPI_Tools.AddField("mode" , Mode, String_, Parameters); - OPI_Tools.AddField("mute" , False , Boolean_, Parameters); - OPI_Tools.AddField("path" , Path , String_, Parameters); - OPI_Tools.AddField("strict_conflict", False , Boolean_, Parameters); - - Headers = GetRequestHeaders(Token, Parameters); - Response = OPI_Tools.PostBinary(URL, File, Headers); - - Return Response; - +Boolean_ = "Boolean"; +String_ = "String"; +URL = "https://content.dropboxapi.com/2/files/upload"; + +Parameters = New Structure; + +OPI_Tools.AddField("autorename" , False , Boolean_, Parameters); +OPI_Tools.AddField("mode" , Mode, String_, Parameters); +OPI_Tools.AddField("mute" , False , Boolean_, Parameters); +OPI_Tools.AddField("path" , Path , String_, Parameters); +OPI_Tools.AddField("strict_conflict", False , Boolean_, Parameters); + +Headers = GetRequestHeaders(Token, Parameters); + +Response = OPI_Tools.PostBinary(URL, File, Headers); + +Return Response; + EndFunction Function OpenSession(Val Token) - - SessionId = "session_id"; - URL = "https://content.dropboxapi.com/2/files/upload_session/start"; - Headers = GetRequestHeaders(Token); - - Response = OPI_Tools.PostBinary(URL, GetBinaryDataFromString(""), Headers); - - Return Response[SessionId]; - + +SessionId = "session_id"; +URL = "https://content.dropboxapi.com/2/files/upload_session/start"; +Headers = GetRequestHeaders(Token); + +Response = OPI_Tools.PostBinary(URL, GetBinaryDataFromString(""), Headers); + +Return Response[SessionId]; + EndFunction Function CloseSession(Val Token, Val Path, Val Mode, Val TotalSize, Val Session) - URL = "https://content.dropboxapi.com/2/files/upload_session/finish"; - - Commit = New Structure(); - OPI_Tools.AddField("mode", Mode, "String", Commit); - OPI_Tools.AddField("path", Path, "String", Commit); - - Cursor = New Structure("offset,session_id", TotalSize, Session); - - Parameters = New Structure("commit,cursor", Commit, Cursor); - Headers = GetRequestHeaders(Token, Parameters); - - Response = OPI_Tools.PostBinary(URL, GetBinaryDataFromString(""), Headers); - - Return Response; - +URL = "https://content.dropboxapi.com/2/files/upload_session/finish"; + +Commit = New Structure(); +OPI_Tools.AddField("mode", Mode, "String", Commit); +OPI_Tools.AddField("path", Path, "String", Commit); + +Cursor = New Structure("offset,session_id", TotalSize, Session); + +Parameters = New Structure("commit,cursor", Commit, Cursor); +Headers = GetRequestHeaders(Token, Parameters); + +Response = OPI_Tools.PostBinary(URL, GetBinaryDataFromString(""), Headers); + +Return Response; + EndFunction Function GetAccount(Val Token, Val Account) - - URL = "https://api.dropboxapi.com/2/users/get_account"; - - Parameters = New Structure; - OPI_Tools.AddField("account_id", Account, "String", Parameters); - - Headers = GetRequestHeaders(Token); - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - +URL = "https://api.dropboxapi.com/2/users/get_account"; + +Parameters = New Structure; +OPI_Tools.AddField("account_id", Account, "String", Parameters); + +Headers = GetRequestHeaders(Token); + +Response = OPI_Tools.Post(URL, Parameters, Headers); + +Return Response; + EndFunction Function GetOwnAccount(Val Token) - - URL = "https://api.dropboxapi.com/2/users/get_current_account"; - Headers = GetRequestHeaders(Token); - - Response = OPI_Tools.PostBinary(URL - , GetBinaryDataFromString("null") - , Headers - , - , "text/plain; charset=dropbox-cors-hack"); - - Return Response; - + +URL = "https://api.dropboxapi.com/2/users/get_current_account"; +Headers = GetRequestHeaders(Token); + +Response = OPI_Tools.PostBinary(URL +, GetBinaryDataFromString("null") +, Headers +, +, "text/plain; charset=dropbox-cors-hack"); + +Return Response; + EndFunction #EndRegion diff --git a/src/en/OPI/src/CommonModules/OPI_Dropbox/OPI_Dropbox.mdo b/src/en/OPI/src/CommonModules/OPI_Dropbox/OPI_Dropbox.mdo index 7902731e7c..6f0576f573 100644 --- a/src/en/OPI/src/CommonModules/OPI_Dropbox/OPI_Dropbox.mdo +++ b/src/en/OPI/src/CommonModules/OPI_Dropbox/OPI_Dropbox.mdo @@ -1,15 +1,15 @@ - + - OPI_Dropbox - - - OPI dropbox - - - ru - Drop box - - true - true - true +OPI_Dropbox + + +OPI dropbox + + +ru +Drop box + +true +true +true diff --git a/src/en/OPI/src/CommonModules/OPI_GetTestData/Module.bsl b/src/en/OPI/src/CommonModules/OPI_GetTestData/Module.bsl index 5c28012acf..774b2bca0a 100644 --- a/src/en/OPI/src/CommonModules/OPI_GetTestData/Module.bsl +++ b/src/en/OPI/src/CommonModules/OPI_GetTestData/Module.bsl @@ -42,429 +42,429 @@ #Region ServiceProgramInterface Function GetTestingSectionMapping() Export - - StandardDependencies = "[Decode, Build]"; - GoogleDependencies = "Testing-GoogleWorkspace"; - - Sections = New Structure; - Sections.Insert("Telegram" , StandardDependencies); - Sections.Insert("VK" , StandardDependencies); - Sections.Insert("Viber" , StandardDependencies); - Sections.Insert("Twitter" , StandardDependencies); - Sections.Insert("YandexDisk" , StandardDependencies); - Sections.Insert("GoogleWorkspace", StandardDependencies); - Sections.Insert("GoogleCalendar" , GoogleDependencies); - Sections.Insert("GoogleDrive" , GoogleDependencies); - Sections.Insert("GoogleSheets" , GoogleDependencies); - Sections.Insert("Notion" , StandardDependencies); - Sections.Insert("Slack" , StandardDependencies); - Sections.Insert("Airtable" , StandardDependencies); - Sections.Insert("Dropbox" , StandardDependencies); - - Return Sections; - + +StandardDependencies = "[Decode, Build]"; +GoogleDependencies = "Testing-GoogleWorkspace"; + +Sections = New Structure; +Sections.Insert("Telegram" , StandardDependencies); +Sections.Insert("VK" , StandardDependencies); +Sections.Insert("Viber" , StandardDependencies); +Sections.Insert("Twitter" , StandardDependencies); +Sections.Insert("YandexDisk" , StandardDependencies); +Sections.Insert("GoogleWorkspace", StandardDependencies); +Sections.Insert("GoogleCalendar" , GoogleDependencies); +Sections.Insert("GoogleDrive" , GoogleDependencies); +Sections.Insert("GoogleSheets" , GoogleDependencies); +Sections.Insert("Notion" , StandardDependencies); +Sections.Insert("Slack" , StandardDependencies); +Sections.Insert("Airtable" , StandardDependencies); +Sections.Insert("Dropbox" , StandardDependencies); + +Return Sections; + EndFunction Function GetTestTable() Export - - Telegram = "Telegram"; - VK = "VK"; - YDisk = "YandexDisk"; - Calendar = "GoogleCalendar"; - Twitter = "Twitter"; - Viber = "Viber"; - Drive = "GoogleDrive"; - VSpace = "GoogleWorkspace"; - Notion = "Notion"; - Slack = "Slack"; - Tables = "GoogleSheets"; - AirT = "Airtable"; - Dropbox = "Dropbox"; - - TestTable = New ValueTable; - TestTable.Columns.Add("Method"); - TestTable.Columns.Add("Synonym"); - TestTable.Columns.Add("Section"); - - NewTest(TestTable, "Telegram_GetBotInfo" , "Get bot information" , Telegram); - NewTest(TestTable, "Telegram_GetUpdates" , "Get updates" , Telegram); - NewTest(TestTable, "Telegram_SetWebhook" , "Set Webhook" , Telegram); - NewTest(TestTable, "Telegram_SendTextMessage" , "Send text message" , Telegram); - NewTest(TestTable, "Telegram_SendImage" , "Send image" , Telegram); - NewTest(TestTable, "Telegram_SendVideo" , "Send video" , Telegram); - NewTest(TestTable, "Telegram_SendAudio" , "Send audio" , Telegram); - NewTest(TestTable, "Telegram_SendDocument" , "Send document" , Telegram); - NewTest(TestTable, "Telegram_SendGIF" , "Send GIF" , Telegram); - NewTest(TestTable, "Telegram_SendMediaGroup" , "Send media group" , Telegram); - NewTest(TestTable, "Telegram_SendLocation" , "Send location" , Telegram); - NewTest(TestTable, "Telegram_SendContact" , "Send contact" , Telegram); - NewTest(TestTable, "Telegram_SendPoll" , "Send poll" , Telegram); - NewTest(TestTable, "Telegram_ForwardMessage" , "Forward message" , Telegram); - NewTest(TestTable, "Telegram_BanUnban" , "Ban/Unban" , Telegram); - NewTest(TestTable, "Telegram_CreateInvitationLink" , "Create invitation link" , Telegram); - NewTest(TestTable, "Telegram_PinUnpinMessage" , "Pin/Unpin message" , Telegram); - NewTest(TestTable, "Telegram_GetMemberCount" , "Get participant count" , Telegram); - NewTest(TestTable, "Telegram_GetForumAvatarsList", "Get forum avatars list", Telegram); - NewTest(TestTable, "Telegram_CreateDeleteForumTopic" , "Create/Delete forum topic" , Telegram); - NewTest(TestTable, "Telegram_ChangeMainTopicName" , "Change main topic name" , Telegram); - NewTest(TestTable, "Telegram_HideShowMainTopic" , "Hide/Show main topic" , Telegram); - - NewTest(TestTable, "VK_CreateTokenLink" , "Create token retrieval link", VK); - NewTest(TestTable, "VK_CreateDeletePost" , "Create/Delete post" , VK); - NewTest(TestTable, "VK_CreateCompositePost" , "Create/Delete composite post" , VK); - NewTest(TestTable, "VK_CreatePoll" , "Create poll" , VK); - NewTest(TestTable, "VK_SaveDeleteImage" , "Add/Delete image" , VK); - NewTest(TestTable, "VK_CreateStory" , "Create story" , VK); - NewTest(TestTable, "VK_DiscussionMethods" , "Actions with discussions" , VK); - NewTest(TestTable, "VK_LikeRepostComment" , "Like/Repost/Comment" , VK); - NewTest(TestTable, "VK_GetStatistics" , "Get statistics" , VK); - NewTest(TestTable, "VK_GetPostStatistics" , "Get post statistics" , VK); - NewTest(TestTable, "VK_CreateAdCampaign" , "Create advertising campaign" , VK); - NewTest(TestTable, "VK_SendMessage" , "Send message" , VK); - NewTest(TestTable, "VK_GetProductCategories" , "Get product categories" , VK); - NewTest(TestTable, "VK_CreateProductSelection" , "Create product and selection" , VK); - NewTest(TestTable, "VK_CreateProductWithProperties" , "Create product with properties" , VK); - NewTest(TestTable, "VK_GetProductList" , "Get product list" , VK); - NewTest(TestTable, "VK_GetSelectionList" , "Get selection list" , VK); - NewTest(TestTable, "VK_GetPropertyList" , "Get property list" , VK); - NewTest(TestTable, "VK_GetOrderList" , "Get order list" , VK); - NewTest(TestTable, "VK_UploadVideo" , "Upload video" , VK); - - NewTest(TestTable, "YDisk_GetDiskInfo" , "Get disk information" , YDisk); - NewTest(TestTable, "YDisk_CreateFolder" , "Create folder" , YDisk); - NewTest(TestTable, "YDisk_UploadByUrlAndGetObject", "Upload by URL and get" , YDisk); - NewTest(TestTable, "YDisk_UploadDeleteFile" , "Upload/Delete file" , YDisk); - NewTest(TestTable, "YDisk_CreateObjectCopy" , "Create object copy" , YDisk); - NewTest(TestTable, "YDisk_GetDownloadLink" , "Get download link" , YDisk); - NewTest(TestTable, "YDisk_GetFileList" , "Get list of files" , YDisk); - NewTest(TestTable, "YDisk_MoveObject" , "Move object" , YDisk); - NewTest(TestTable, "YDisk_PublicObjectActions" , "Actions with public objects", YDisk); - NewTest(TestTable, "YDisk_GetPublishedList" , "Get published list" , YDisk); - - NewTest(TestTable, "GV_GetAuthorizationLink" , "Get authorization link" , VSpace); - NewTest(TestTable, "GV_GetToken" , "Get token" , VSpace); - NewTest(TestTable, "GV_UpdateToken" , "Refresh token" , VSpace); - - NewTest(TestTable, "GC_GetCalendarList" , "Get list of calendars" , Calendar); - NewTest(TestTable, "GC_CreateDeleteCalendar" , "Create/Delete calendar" , Calendar); - NewTest(TestTable, "GC_CreateDeleteEvent" , "Create/Delete event" , Calendar); - NewTest(TestTable, "GC_GetEventList" , "Get list of events" , Calendar); - - NewTest(TestTable, "GD_GetCatalogList" , "Get list of directories" , Drive); - NewTest(TestTable, "GD_UploadDeleteFile" , "Upload/Delete file" , Drive); - NewTest(TestTable, "GD_CreateDeleteComment" , "Create/Delete Comment" , Drive); - NewTest(TestTable, "GD_CreateCatalog" , "Create/Delete catalog" , Drive); - - NewTest(TestTable, "GT_CreateTable" , "Create table" , Tables); - NewTest(TestTable, "GT_GetTable" , "Get table" , Tables); - NewTest(TestTable, "GT_FillClearCells" , "Fill/Clear cells" , Tables); - - NewTest(TestTable, "Twitter_GetAuthorizationLink" , "Get authorization link" , Twitter); - NewTest(TestTable, "Twitter_UpdateToken" , "Refresh token" , Twitter); - NewTest(TestTable, "Twitter_CreateTextTweet" , "Text tweet" , Twitter); - NewTest(TestTable, "Twitter_CreateTweetWithImage" , "Tweet with image" , Twitter); - NewTest(TestTable, "Twitter_CreateTweetWithVideo" , "Tweet with video" , Twitter); - NewTest(TestTable, "Twitter_CreateTweetWithGif" , "Tweet with gif" , Twitter); - NewTest(TestTable, "Twitter_CreateTweetWithPoll" , "Tweet with poll" , Twitter); - - NewTest(TestTable, "Viber_GetChannelInfo" , "Get channel info" , Viber); - NewTest(TestTable, "Viber_GetUserData" , "Get user data" , Viber); - NewTest(TestTable, "Viber_GetOnlineUsers" , "Get online users" , Viber); - NewTest(TestTable, "Viber_SendTextMessage" , "Send text message" , Viber); - NewTest(TestTable, "Viber_SendImage" , "Send image" , Viber); - NewTest(TestTable, "Viber_SendFile" , "SendFile" , Viber); - NewTest(TestTable, "Viber_SendContact" , "Send contact" , Viber); - NewTest(TestTable, "Viber_SendLocation" , "SendLocation" , Viber); - NewTest(TestTable, "Viber_SendLink" , "SendLink" , Viber); - - NewTest(TestTable, "Notion_CreatePage" , "Create page" , Notion); - NewTest(TestTable, "Notion_CreateEditDatabase" , "Create/Edit database" , Notion); - NewTest(TestTable, "Notion_GetPageInfo" , "Get page info" , Notion); - NewTest(TestTable, "Notion_GetDatabaseInfo" , "Get database info" , Notion); - NewTest(TestTable, "Notion_CreatePageInDatabase" , "Create page in database" , Notion); - NewTest(TestTable, "Notion_EditPageProperties" , "Edit page properties" , Notion); - NewTest(TestTable, "Notion_CreateDeleteBlock" , "Create/Delete block" , Notion); - NewTest(TestTable, "Notion_GetUsers" , "Get users" , Notion); - NewTest(TestTable, "Notion_GetUserData" , "Get user data" , Notion); - - NewTest(TestTable, "Slack_GetBotInfo" , "Get bot information" , Slack); - NewTest(TestTable, "Slack_GetUserList" , "Get user list" , Slack); - NewTest(TestTable, "Slack_GetRegionList" , "Get region list" , Slack); - NewTest(TestTable, "Slack_SendDeleteMessage" , "Send/Delete message" , Slack); - NewTest(TestTable, "Slack_SendDeleteEphemeral" , "Send/Delete ephemeral" , Slack); - NewTest(TestTable, "Slack_GetScheduledMessages" , "Get scheduled messages" , Slack); - NewTest(TestTable, "Slack_CreateArchiveChannel" , "Create/Archive channel" , Slack); - NewTest(TestTable, "Slack_GetChannelList" , "Get channel list" , Slack); - NewTest(TestTable, "Slack_OpenCloseDialog" , "Open/Close dialog" , Slack); - NewTest(TestTable, "Slack_GetFileList" , "Get list of files" , Slack); - NewTest(TestTable, "Slack_UploadDeleteFile" , "Upload/Delete file" , Slack); - NewTest(TestTable, "Slack_GetExternalFileList" , "Get external file list" , Slack); - NewTest(TestTable, "Slack_UploadDeleteExternalFile" , "Upload/Delete external file" , Slack); - - NewTest(TestTable, "AT_CreateDatabase" , "Create/Edit database" , AirT); - NewTest(TestTable, "AT_CreateTable" , "Create/Edit table" , AirT); - NewTest(TestTable, "AT_CreateField" , "Create/Edit field" , AirT); - NewTest(TestTable, "AT_CreateDeleteRecords" , "Create/Delete records" , AirT); - - NewTest(TestTable, "Dropbox_GetUpdateToken" , "Get/Update token" , Dropbox); - NewTest(TestTable, "Dropbox_UploadFile" , "Upload file" , Dropbox); - NewTest(TestTable, "Dropbox_UploadFileByURL" , "Upload file by URL" , Dropbox); - NewTest(TestTable, "Dropbox_CreateFolder" , "Create folder" , Dropbox); - NewTest(TestTable, "Dropbox_CreateDeleteTag" , "Create/Delete tag" , Dropbox); - NewTest(TestTable, "Dropbox_GetAccount" , "Get account data" , Dropbox); - NewTest(TestTable, "Dropbox_AccessManagement" , "Access management" , Dropbox); - - Return TestTable; - -EndFunction + +Telegram = "Telegram"; +VK = "VK"; +YDisk = "YandexDisk"; +Calendar = "GoogleCalendar"; +Twitter = "Twitter"; +Viber = "Viber"; +Drive = "GoogleDrive"; +VSpace = "GoogleWorkspace"; +Notion = "Notion"; +Slack = "Slack"; +Tables = "GoogleSheets"; +AirT = "Airtable"; +Dropbox = "Dropbox"; + +TestTable = New ValueTable; +TestTable.Columns.Add("Method"); +TestTable.Columns.Add("Synonym"); +TestTable.Columns.Add("Section"); + +NewTest(TestTable, "Telegram_GetBotInfo" , "Get bot information" , Telegram); +NewTest(TestTable, "Telegram_GetUpdates" , "Get updates" , Telegram); +NewTest(TestTable, "Telegram_SetWebhook" , "Set Webhook" , Telegram); +NewTest(TestTable, "Telegram_SendTextMessage" , "Send text message" , Telegram); +NewTest(TestTable, "Telegram_SendImage" , "Send image" , Telegram); +NewTest(TestTable, "Telegram_SendVideo" , "Send video" , Telegram); +NewTest(TestTable, "Telegram_SendAudio" , "Send audio" , Telegram); +NewTest(TestTable, "Telegram_SendDocument" , "Send document" , Telegram); +NewTest(TestTable, "Telegram_SendGIF" , "Send GIF" , Telegram); +NewTest(TestTable, "Telegram_SendMediaGroup" , "Send media group" , Telegram); +NewTest(TestTable, "Telegram_SendLocation" , "Send location" , Telegram); +NewTest(TestTable, "Telegram_SendContact" , "Send contact" , Telegram); +NewTest(TestTable, "Telegram_SendPoll" , "Send poll" , Telegram); +NewTest(TestTable, "Telegram_ForwardMessage" , "Forward message" , Telegram); +NewTest(TestTable, "Telegram_BanUnban" , "Ban/Unban" , Telegram); +NewTest(TestTable, "Telegram_CreateInvitationLink" , "Create invitation link" , Telegram); +NewTest(TestTable, "Telegram_PinUnpinMessage" , "Pin/Unpin message" , Telegram); +NewTest(TestTable, "Telegram_GetMemberCount" , "Get participant count" , Telegram); +NewTest(TestTable, "Telegram_GetForumAvatarsList", "Get forum avatars list", Telegram); +NewTest(TestTable, "Telegram_CreateDeleteForumTopic" , "Create/Delete forum topic" , Telegram); +NewTest(TestTable, "Telegram_ChangeMainTopicName" , "Change main topic name" , Telegram); +NewTest(TestTable, "Telegram_HideShowMainTopic" , "Hide/Show main topic" , Telegram); + +NewTest(TestTable, "VK_CreateTokenLink" , "Create token retrieval link", VK); +NewTest(TestTable, "VK_CreateDeletePost" , "Create/Delete post" , VK); +NewTest(TestTable, "VK_CreateCompositePost" , "Create/Delete composite post" , VK); +NewTest(TestTable, "VK_CreatePoll" , "Create poll" , VK); +NewTest(TestTable, "VK_SaveDeleteImage" , "Add/Delete image" , VK); +NewTest(TestTable, "VK_CreateStory" , "Create story" , VK); +NewTest(TestTable, "VK_DiscussionMethods" , "Actions with discussions" , VK); +NewTest(TestTable, "VK_LikeRepostComment" , "Like/Repost/Comment" , VK); +NewTest(TestTable, "VK_GetStatistics" , "Get statistics" , VK); +NewTest(TestTable, "VK_GetPostStatistics" , "Get post statistics" , VK); +NewTest(TestTable, "VK_CreateAdCampaign" , "Create advertising campaign" , VK); +NewTest(TestTable, "VK_SendMessage" , "Send message" , VK); +NewTest(TestTable, "VK_GetProductCategories" , "Get product categories" , VK); +NewTest(TestTable, "VK_CreateProductSelection" , "Create product and selection" , VK); +NewTest(TestTable, "VK_CreateProductWithProperties" , "Create product with properties" , VK); +NewTest(TestTable, "VK_GetProductList" , "Get product list" , VK); +NewTest(TestTable, "VK_GetSelectionList" , "Get selection list" , VK); +NewTest(TestTable, "VK_GetPropertyList" , "Get property list" , VK); +NewTest(TestTable, "VK_GetOrderList" , "Get order list" , VK); +NewTest(TestTable, "VK_UploadVideo" , "Upload video" , VK); + +NewTest(TestTable, "YDisk_GetDiskInfo" , "Get disk information" , YDisk); +NewTest(TestTable, "YDisk_CreateFolder" , "Create folder" , YDisk); +NewTest(TestTable, "YDisk_UploadByUrlAndGetObject", "Upload by URL and get" , YDisk); +NewTest(TestTable, "YDisk_UploadDeleteFile" , "Upload/Delete file" , YDisk); +NewTest(TestTable, "YDisk_CreateObjectCopy" , "Create object copy" , YDisk); +NewTest(TestTable, "YDisk_GetDownloadLink" , "Get download link" , YDisk); +NewTest(TestTable, "YDisk_GetFileList" , "Get list of files" , YDisk); +NewTest(TestTable, "YDisk_MoveObject" , "Move object" , YDisk); +NewTest(TestTable, "YDisk_PublicObjectActions" , "Actions with public objects", YDisk); +NewTest(TestTable, "YDisk_GetPublishedList" , "Get published list" , YDisk); + +NewTest(TestTable, "GV_GetAuthorizationLink" , "Get authorization link" , VSpace); +NewTest(TestTable, "GV_GetToken" , "Get token" , VSpace); +NewTest(TestTable, "GV_UpdateToken" , "Refresh token" , VSpace); + +NewTest(TestTable, "GC_GetCalendarList" , "Get list of calendars" , Calendar); +NewTest(TestTable, "GC_CreateDeleteCalendar" , "Create/Delete calendar" , Calendar); +NewTest(TestTable, "GC_CreateDeleteEvent" , "Create/Delete event" , Calendar); +NewTest(TestTable, "GC_GetEventList" , "Get list of events" , Calendar); + +NewTest(TestTable, "GD_GetCatalogList" , "Get list of directories" , Drive); +NewTest(TestTable, "GD_UploadDeleteFile" , "Upload/Delete file" , Drive); +NewTest(TestTable, "GD_CreateDeleteComment" , "Create/Delete Comment" , Drive); +NewTest(TestTable, "GD_CreateCatalog" , "Create/Delete catalog" , Drive); + +NewTest(TestTable, "GT_CreateTable" , "Create table" , Tables); +NewTest(TestTable, "GT_GetTable" , "Get table" , Tables); +NewTest(TestTable, "GT_FillClearCells" , "Fill/Clear cells" , Tables); + +NewTest(TestTable, "Twitter_GetAuthorizationLink" , "Get authorization link" , Twitter); +NewTest(TestTable, "Twitter_UpdateToken" , "Refresh token" , Twitter); +NewTest(TestTable, "Twitter_CreateTextTweet" , "Text tweet" , Twitter); +NewTest(TestTable, "Twitter_CreateTweetWithImage" , "Tweet with image" , Twitter); +NewTest(TestTable, "Twitter_CreateTweetWithVideo" , "Tweet with video" , Twitter); +NewTest(TestTable, "Twitter_CreateTweetWithGif" , "Tweet with gif" , Twitter); +NewTest(TestTable, "Twitter_CreateTweetWithPoll" , "Tweet with poll" , Twitter); + +NewTest(TestTable, "Viber_GetChannelInfo" , "Get channel info" , Viber); +NewTest(TestTable, "Viber_GetUserData" , "Get user data" , Viber); +NewTest(TestTable, "Viber_GetOnlineUsers" , "Get online users" , Viber); +NewTest(TestTable, "Viber_SendTextMessage" , "Send text message" , Viber); +NewTest(TestTable, "Viber_SendImage" , "Send image" , Viber); +NewTest(TestTable, "Viber_SendFile" , "SendFile" , Viber); +NewTest(TestTable, "Viber_SendContact" , "Send contact" , Viber); +NewTest(TestTable, "Viber_SendLocation" , "SendLocation" , Viber); +NewTest(TestTable, "Viber_SendLink" , "SendLink" , Viber); + +NewTest(TestTable, "Notion_CreatePage" , "Create page" , Notion); +NewTest(TestTable, "Notion_CreateEditDatabase" , "Create/Edit database" , Notion); +NewTest(TestTable, "Notion_GetPageInfo" , "Get page info" , Notion); +NewTest(TestTable, "Notion_GetDatabaseInfo" , "Get database info" , Notion); +NewTest(TestTable, "Notion_CreatePageInDatabase" , "Create page in database" , Notion); +NewTest(TestTable, "Notion_EditPageProperties" , "Edit page properties" , Notion); +NewTest(TestTable, "Notion_CreateDeleteBlock" , "Create/Delete block" , Notion); +NewTest(TestTable, "Notion_GetUsers" , "Get users" , Notion); +NewTest(TestTable, "Notion_GetUserData" , "Get user data" , Notion); + +NewTest(TestTable, "Slack_GetBotInfo" , "Get bot information" , Slack); +NewTest(TestTable, "Slack_GetUserList" , "Get user list" , Slack); +NewTest(TestTable, "Slack_GetRegionList" , "Get region list" , Slack); +NewTest(TestTable, "Slack_SendDeleteMessage" , "Send/Delete message" , Slack); +NewTest(TestTable, "Slack_SendDeleteEphemeral" , "Send/Delete ephemeral" , Slack); +NewTest(TestTable, "Slack_GetScheduledMessages" , "Get scheduled messages" , Slack); +NewTest(TestTable, "Slack_CreateArchiveChannel" , "Create/Archive channel" , Slack); +NewTest(TestTable, "Slack_GetChannelList" , "Get channel list" , Slack); +NewTest(TestTable, "Slack_OpenCloseDialog" , "Open/Close dialog" , Slack); +NewTest(TestTable, "Slack_GetFileList" , "Get list of files" , Slack); +NewTest(TestTable, "Slack_UploadDeleteFile" , "Upload/Delete file" , Slack); +NewTest(TestTable, "Slack_GetExternalFileList" , "Get external file list" , Slack); +NewTest(TestTable, "Slack_UploadDeleteExternalFile" , "Upload/Delete external file" , Slack); + +NewTest(TestTable, "AT_CreateDatabase" , "Create/Edit database" , AirT); +NewTest(TestTable, "AT_CreateTable" , "Create/Edit table" , AirT); +NewTest(TestTable, "AT_CreateField" , "Create/Edit field" , AirT); +NewTest(TestTable, "AT_CreateDeleteRecords" , "Create/Delete records" , AirT); + +NewTest(TestTable, "Dropbox_GetUpdateToken" , "Get/Update token" , Dropbox); +NewTest(TestTable, "Dropbox_UploadFile" , "Upload file" , Dropbox); +NewTest(TestTable, "Dropbox_UploadFileByURL" , "Upload file by URL" , Dropbox); +NewTest(TestTable, "Dropbox_CreateFolder" , "Create folder" , Dropbox); +NewTest(TestTable, "Dropbox_CreateDeleteTag" , "Create/Delete tag" , Dropbox); +NewTest(TestTable, "Dropbox_GetAccount" , "Get account data" , Dropbox); +NewTest(TestTable, "Dropbox_AccessManagement" , "Access management" , Dropbox); + +Return TestTable; + +EndFunction Function ExpectsThat(Value) Export - - Attempt - - Module = GetCommonModule("UTest"); - Awaiting = TypeValue(Module) = Type("CommonModule"); - Return Module.ExpectsThat(Value); - - Exception - Return Awaiting.What(Value); - EndOfAttempt; - + +Try + +Module = GetCommonModule("UTest"); +Awaiting = TypeValue(Module) = Type("CommonModule"); +Return Module.ExpectsThat(Value); + +Except +Return Awaiting.What(Value); +EndTry; + EndFunction Function FormYAXTests() Export - - Module = GetCommonModule("UTTests"); - Sections = GetTestingSectionMapping(); - TestTable = GetTestTable(); - - For Each Section Of Sections Loop - - CurrentSection = Section.Key; - Filter = New Structure("Section", CurrentSection); - SectionTests = TestTable.FindLines(Filter); - - Set = Module.AddTestSet(CurrentSection); - - For Each Test Of SectionTests Loop - Set.AddServerTest(Test.Method, Test.Synonym); - EndOfLoop; - - EndOfLoop; - - Return ""; - + +Module = GetCommonModule("UTTests"); +Sections = GetTestingSectionMapping(); +TestTable = GetTestTable(); + +For Each Section In Sections Do + +CurrentSection = Section.Key; +Filter = New Structure("Section", CurrentSection); +SectionTests = TestTable.FindLines(Filter); + +Set = Module.AddTestSet(CurrentSection); + +For Each Test In SectionTests Do +Set.AddServerTest(Test.Method, Test.Synonym); +EndDo; + +EndDo; + +Return ""; + EndFunction Function FormAssertsTests() Export - - TestTable = GetTestTable(); - ArrayOfTests = New Array; - - For Each Test Of TestTable Loop - ArrayOfTests.Add(Test.Method); - EndOfLoop; - - Return ArrayOfTests; - + +TestTable = GetTestTable(); +ArrayOfTests = New Array; + +For Each Test In TestTable Do +ArrayOfTests.Add(Test.Method); +EndDo; + +Return ArrayOfTests; + EndFunction -Function GetParameter(Parameter) Export +Function GetParameter(Parameter) Export - Path = DataFilePath(); - Return GetValueFromFile(Parameter, Path); +Path = DataFilePath(); +Return GetValueFromFile(Parameter, Path); EndFunction Function GetBinary(Parameter) Export - - Path = DataFilePath(); - LocalParameter = Parameter + "Local"; - MainValue = GetValueFromFile(Parameter , Path); - LocalValue = GetValueFromFile(LocalParameter, Path); - - LocalFile = New File(LocalValue); - - If LocalFile.Exists() Then - Value = New BinaryData(LocalValue); - Otherwise - Value = MainValue; - EndIf; - - If TypeValue(Value) = Type("String") Then - Value = GetFilePath(Value, LocalParameter); - EndIf; - - Return Value; - + +Path = DataFilePath(); +LocalParameter = Parameter + "Local"; +MainValue = GetValueFromFile(Parameter , Path); +LocalValue = GetValueFromFile(LocalParameter, Path); + +LocalFile = New File(LocalValue); + +If LocalFile.Exists() Then +Value = New BinaryData(LocalValue); +Else +Value = MainValue; +EndIf; + +If TypeValue(Value) = Type("String") Then +Value = GetFilePath(Value, LocalParameter); +EndIf; + +Return Value; + EndFunction Function GetFilePath(Val Path, LocalParameter, Val SaveLocally = True) Export - - If StrFind(Path, "http") > 0 - Or StrFind(Path, "www") > 0 Then - - AndVF = GetTempFileName(); - CopyFile(Path, AndVF); - Path = AndVF; - Binary = New BinaryData(Path); - - If SaveLocally Then - WriteParameter(LocalParameter, AndVF); - Otherwise - DeleteFiles(AndVF); - EndIf; - - Otherwise - - Binary = New BinaryData(Path); - - EndIf; - - Return Binary; - + +If StrFind(Path, "http") > 0 +Or StrFind(Path, "www") > 0 Then + +AndVF = GetTempFileName(); +CopyFile(Path, AndVF); +Path = AndVF; +Binary = New BinaryData(Path); + +If SaveLocally Then +WriteParameter(LocalParameter, AndVF); +Else +DeleteFiles(AndVF); +EndIf; + +Else + +Binary = New BinaryData(Path); + +EndIf; + +Return Binary; + EndFunction Procedure ParameterToCollection(Parameter, Collection) Export - Value = GetParameter(Parameter); - Collection.Insert(Parameter, Value); - +Value = GetParameter(Parameter); +Collection.Insert(Parameter, Value); + EndProcedure Procedure BinaryToCollection(Parameter, Collection) Export - Value = GetBinary(Parameter); - Collection.Insert(Parameter, Value); - +Value = GetBinary(Parameter); +Collection.Insert(Parameter, Value); + EndProcedure Procedure WriteParameter(Parameter, Value) Export - - Path = DataFilePath(); - WriteParameterToFile(Parameter, Value, Path); - + +Path = DataFilePath(); +WriteParameterToFile(Parameter, Value, Path); + EndProcedure Procedure WriteLog(Val Result, Val Method, Val Library = "") Export - - Header = String(OPI_Tools.GetCurrentDate()) + " | " + Method; - - Attempt - Data = OPI_Tools.JSONString(Result); - Exception - Data = "Not JSON: " + String(Result); - EndOfAttempt; - - Data = " " + Data; - - Notify(Header); - Notify(Symbols.PS); - Notify(Data); - Notify(Symbols.PS); - Notify("---------------------------------"); - Notify(Symbols.PS); - - If ValueFilled(Library) Then - WriteLogFile(Data, Method, Library); - EndIf; - + +Header = String(OPI_Tools.GetCurrentDate()) + " | " + Method; + +Try +Data = OPI_Tools.JSONString(Result); +Except +Data = "Not JSON: " + String(Result); +EndTry; + +Data = " " + Data; + +Notify(Header); +Notify(Symbols.PS); +Notify(Data); +Notify(Symbols.PS); +Notify("---------------------------------"); +Notify(Symbols.PS); + +If ValueIsFilled(Library) Then +WriteLogFile(Data, Method, Library); +EndIf; + EndProcedure #EndRegion #Region ServiceProceduresAndFunctions -Function GetValueFromFile(Parameter, Path) - - Values = OPI_Tools.ReadJSONFile(Path); - Return ?(Values.Property(Parameter), Values[Parameter], ""); - +Function GetValueFromFile(Parameter, Path) + +Values = OPI_Tools.ReadJSONFile(Path); +Return ?(Values.Property(Parameter), Values[Parameter], ""); + EndFunction Function DataFilePath() - - Path = ""; - PossiblePaths = New Array; - PossiblePaths.Add("./data.json"); - PossiblePaths.Add("C:\GDrive\My Drive\data.json"); - PossiblePaths.Add("D:\GD\My Drive\data.json"); - - For Each PossiblePath Of PossiblePaths Loop - - RepositoryFile = New File(PossiblePath); - - If RepositoryFile.Exists() Then - Path = PossiblePath; - EndIf; - - EndOfLoop; - - Return Path; - + +Path = ""; +PossiblePaths = New Array; +PossiblePaths.Add("./data.json"); +PossiblePaths.Add("C:\GDrive\My Drive\data.json"); +PossiblePaths.Add("D:\GD\My Drive\data.json"); + +For Each PossiblePath In PossiblePaths Do + +RepositoryFile = New File(PossiblePath); + +If RepositoryFile.Exists() Then +Path = PossiblePath; +EndIf; + +EndDo; + +Return Path; + EndFunction Function GetCommonModule(Val Name) - УwithтаноinитьБезопаwithныйMode(True); - Module = Calculate(Name); - УwithтаноinитьБезопаwithныйMode(False); - Return Module; +SetSafeMode(True); +Module = Calculate(Name); +SetSafeMode(False); +Return Module; EndFunction Procedure NewTest(ValueTable, Val Method, Val Synonym, Val Section) - - NewTest = ValueTable.Add(); - NewTest.Method = Method; - NewTest.Synonym = Synonym; - NewTest.Section = Section; - + +NewTest = ValueTable.Add(); +NewTest.Method = Method; +NewTest.Synonym = Synonym; +NewTest.Section = Section; + EndProcedure Procedure WriteParameterToFile(Val Parameter, Val Value, Val Path) - - Values = OPI_Tools.ReadJSONFile(Path); - Values.Insert(Parameter, Value); - Record = New WritingJSON; - JSONWriteParameters = New JSONWriteParameters(JSONLineBreak.Auto, Symbols.Tab); - Record.OpenFile(Path, , , JSONWriteParameters); - WriteJSON(Record, Values); - Record.Close(); +Values = OPI_Tools.ReadJSONFile(Path); +Values.Insert(Parameter, Value); + +Record = New WritingJSON; +JSONWriteParameters = New JSONWriteParameters(JSONLineBreak.Auto, Symbols.Tab); +Record.OpenFile(Path, , , JSONWriteParameters); +WriteJSON(Record, Values); +Record.Close(); EndProcedure Procedure WriteLogFile(Val Data, Val Method, Val Library) - - Attempt - - LogPath = "./docs/results"; - LibraryLogPath = LogPath + "/" + Library; - - LogDirectory = New File(LogPath); - - If Not LogDirectory.Exists() Then - CreateDirectory(LogPath); - EndIf; - - LibraryLogCatalog = New File(LibraryLogPath); - - If Not LibraryLogCatalog.Exists() Then - CreateDirectory(LibraryLogPath); - EndIf; - - FilePath = LibraryLogPath + "/" + Method + ".log"; - LogFile = New File(FilePath); - - If Not LogFile.Exists() Then - LogDocument = New TextDocument; - LogDocument.SetText(Data); - LogDocument.Write(FilePath); - EndIf; - - Exception - Notify("Failed to write log file!: " + ErrorDescription()); - EndOfAttempt; - + +Try + +LogPath = "./docs/results"; +LibraryLogPath = LogPath + "/" + Library; + +LogDirectory = New File(LogPath); + +If Not LogDirectory.Exists() Then +CreateDirectory(LogPath); +EndIf; + +LibraryLogCatalog = New File(LibraryLogPath); + +If Not LibraryLogCatalog.Exists() Then +CreateDirectory(LibraryLogPath); +EndIf; + +FilePath = LibraryLogPath + "/" + Method + ".log"; +LogFile = New File(FilePath); + +If Not LogFile.Exists() Then +LogDocument = New TextDocument; +LogDocument.SetText(Data); +LogDocument.Write(FilePath); +EndIf; + +Except +Notify("Failed to write log file!: " + ErrorDescription()); +EndTry; + EndProcedure #EndRegion diff --git a/src/en/OPI/src/CommonModules/OPI_GetTestData/OPI_GetTestData.mdo b/src/en/OPI/src/CommonModules/OPI_GetTestData/OPI_GetTestData.mdo index cbe314eccc..5ed1a42c7a 100644 --- a/src/en/OPI/src/CommonModules/OPI_GetTestData/OPI_GetTestData.mdo +++ b/src/en/OPI/src/CommonModules/OPI_GetTestData/OPI_GetTestData.mdo @@ -1,11 +1,11 @@ - + - OPI_ПолучениеДанныхТестов - - - OPI получение данных тестов - - true - true - true +OPI_GetTestData + + +OPI test data retrieval + +true +true +true diff --git a/src/en/OPI/src/CommonModules/OPI_GoogleCalendar/Module.bsl b/src/en/OPI/src/CommonModules/OPI_GoogleCalendar/Module.bsl index 24f9fe6714..e7f34d6321 100644 --- a/src/en/OPI/src/CommonModules/OPI_GoogleCalendar/Module.bsl +++ b/src/en/OPI/src/CommonModules/OPI_GoogleCalendar/Module.bsl @@ -38,132 +38,132 @@ // Create calendar // Creates an empty calendar -// +// // Parameters: -// Token - String - Token - token -// Name - String - Name of the created calendar - title -// +// Token - String - Token - token +// Name - String - Name of the created calendar - title +// // Return value: -// Key-Value Pair - serialized JSON response from Google +// Key-Value Pair - serialized JSON response from Google Function CreateCalendar(Val Token, Val Name) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Name); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://www.googleapis.com/calendar/v3/calendars"; - - Parameters = New Structure; - Parameters.Insert("summary" , Name); - Parameters.Insert("timeZone", "Europe/Moscow"); - - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(Name); + +Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); +URL = "https://www.googleapis.com/calendar/v3/calendars"; + +Parameters = New Structure; +Parameters.Insert("summary" , Name); +Parameters.Insert("timeZone", "Europe/Moscow"); + +Response = OPI_Tools.Post(URL, Parameters, Headers); + +Return Response; + EndFunction // Get calendar // Gets calendar information by ID -// +// // Parameters: -// Token - String - Token - token -// Calendar - String - Calendar ID - calendar -// +// Token - String - Token - token +// Calendar - String - Calendar ID - calendar +// // Return value: -// Key-Value Pair - serialized JSON response from Google +// Key-Value Pair - serialized JSON response from Google Function GetCalendarMetadata(Val Token, Val Calendar) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Calendar); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://www.googleapis.com/calendar/v3/calendars/" + Calendar; - Response = OPI_Tools.Get(URL, , Headers); - - Return Response; + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(Calendar); + +Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); +URL = "https://www.googleapis.com/calendar/v3/calendars/" + Calendar; +Response = OPI_Tools.Get(URL, , Headers); + +Return Response; EndFunction // Edit calendar // Edits properties of an existing calendar -// +// // Parameters: -// Token - String - Token - token -// Calendar - String - Calendar ID - calendar -// Name - String - New name - title -// Description - String - New calendar description - description -// +// Token - String - Token - token +// Calendar - String - Calendar ID - calendar +// Name - String - New name - title +// Description - String - New calendar description - description +// // Return value: -// Key-Value Pair - serialized JSON response from Google +// Key-Value Pair - serialized JSON response from Google Function EditCalendarMetadata(Val Token - , Val Calendar - , Val Name = "" - , Val Description = "") Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Calendar); - OPI_TypeConversion.GetLine(Name); - OPI_TypeConversion.GetLine(Description); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://www.googleapis.com/calendar/v3/calendars/" + Calendar; - - Parameters = New Structure; - - If ValueFilled(Name) Then - Parameters.Insert("summary", Name); - EndIf; - - If ValueFilled(Description) Then - Parameters.Insert("description", Description); - EndIf; - - Response = OPI_Tools.Patch(URL, Parameters, Headers, True); - - Return Response; +, Val Calendar +, Val Name = "" +, Val Description = "") Export + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(Calendar); +OPI_TypeConversion.GetLine(Name); +OPI_TypeConversion.GetLine(Description); + +Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); +URL = "https://www.googleapis.com/calendar/v3/calendars/" + Calendar; + +Parameters = New Structure; + +If ValueIsFilled(Name) Then +Parameters.Insert("summary", Name); +EndIf; + +If ValueIsFilled(Description) Then +Parameters.Insert("description", Description); +EndIf; + +Response = OPI_Tools.Patch(URL, Parameters, Headers, True); + +Return Response; EndFunction // Clear primary calendar // Clears the event list of the primary calendar -// +// // Parameters: -// Token - String - Token - token -// +// Token - String - Token - token +// // Return value: -// Key-Value Pair - serialized JSON response from Google +// Key-Value Pair - serialized JSON response from Google Function ClearMainCalendar(Val Token) Export - - OPI_TypeConversion.GetLine(Token); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://www.googleapis.com/calendar/v3/calendars/primary/clear"; - Response = OPI_Tools.Post(URL, , Headers, False); - - Return Response; + +OPI_TypeConversion.GetLine(Token); + +Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); +URL = "https://www.googleapis.com/calendar/v3/calendars/primary/clear"; +Response = OPI_Tools.Post(URL, , Headers, False); + +Return Response; EndFunction // Delete calendar // Deletes a calendar by ID -// +// // Parameters: -// Token - String - Token - token -// Calendar - String - Calendar ID - calendar -// +// Token - String - Token - token +// Calendar - String - Calendar ID - calendar +// // Return value: -// Key-Value Pair - serialized JSON response from Google +// Key-Value Pair - serialized JSON response from Google Function DeleteCalendar(Val Token, Val Calendar) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Calendar); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://www.googleapis.com/calendar/v3/calendars/" + Calendar; - Response = OPI_Tools.Delete(URL, , Headers); - - Return Response; + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(Calendar); + +Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); +URL = "https://www.googleapis.com/calendar/v3/calendars/" + Calendar; +Response = OPI_Tools.Delete(URL, , Headers); + +Return Response; EndFunction @@ -173,130 +173,130 @@ EndFunction // Get list of calendars // Gets an array of account calendars -// +// // Parameters: -// Token - String - Token - token -// +// Token - String - Token - token +// // Return value: -// Key-Value Pair - Array of calendar data mappings +// Key-Value Pair - Array of calendar data mappings Function GetCalendarList(Val Token) Export - - OPI_TypeConversion.GetLine(Token); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - ArrayOfCalendars = New Array; - - GetCalendarsListRecursively(Headers, ArrayOfCalendars); - - Return ArrayOfCalendars; - + +OPI_TypeConversion.GetLine(Token); + +Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); +ArrayOfCalendars = New Array; + +GetCalendarsListRecursively(Headers, ArrayOfCalendars); + +Return ArrayOfCalendars; + EndFunction // Add calendar to list // Adds an existing calendar to the user's list -// +// // Parameters: -// Token - String - Token - token -// Calendar - String - Calendar ID - calendar -// +// Token - String - Token - token +// Calendar - String - Calendar ID - calendar +// // Return value: -// Key-Value Pair - serialized JSON response from Google +// Key-Value Pair - serialized JSON response from Google Function AddCalendarToList(Val Token, Val Calendar) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Calendar); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://www.googleapis.com/calendar/v3/users/me/calendarList"; - - Parameters = New Structure; - Parameters.Insert("id", Calendar); - - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(Calendar); + +Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); +URL = "https://www.googleapis.com/calendar/v3/users/me/calendarList"; + +Parameters = New Structure; +Parameters.Insert("id", Calendar); + +Response = OPI_Tools.Post(URL, Parameters, Headers); + +Return Response; + EndFunction // Get list calendar // Gets a calendar from the user's list by ID -// +// // Parameters: -// Token - String - Token - token -// Calendar - String - Calendar ID - calendar -// +// Token - String - Token - token +// Calendar - String - Calendar ID - calendar +// // Return value: -// Key-Value Pair - serialized JSON response from Google +// Key-Value Pair - serialized JSON response from Google Function GetListCalendar(Val Token, Val Calendar) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Calendar); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://www.googleapis.com/calendar/v3/users/me/calendarList/" + Calendar; - Response = OPI_Tools.Get(URL, , Headers); - - Return Response; + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(Calendar); + +Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); +URL = "https://www.googleapis.com/calendar/v3/users/me/calendarList/" + Calendar; +Response = OPI_Tools.Get(URL, , Headers); + +Return Response; EndFunction // Remove calendar from list // Removes a calendar from the user's list -// +// // Parameters: -// Token - String - Token - token -// Calendar - String - Calendar ID - calendar -// +// Token - String - Token - token +// Calendar - String - Calendar ID - calendar +// // Return value: -// Key-Value Pair - serialized JSON response from Google +// Key-Value Pair - serialized JSON response from Google Function DeleteCalendarFromList(Val Token, Val Calendar) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Calendar); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://www.googleapis.com/calendar/v3/users/me/calendarList/" + Calendar; - Response = OPI_Tools.Delete(URL, , Headers); - - Return Response; + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(Calendar); + +Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); +URL = "https://www.googleapis.com/calendar/v3/users/me/calendarList/" + Calendar; +Response = OPI_Tools.Delete(URL, , Headers); + +Return Response; EndFunction // Edit list calendar // Edits the properties of a calendar from the user's list -// +// // Parameters: -// Token - String - Token - token -// Calendar - String - Calendar ID - calendar -// PrimaryColor - String - HEX mainоinного цinета (#ffffff) - primary -// SecondaryColor - String - HEX addолнительного цinета (#ffffff) - secondary -// Hidden - Boolean - Hidden calendar - hidden -// +// Token - String - Token - token +// Calendar - String - Calendar ID - calendar +// PrimaryColor - String - HEX mainоinного цinета (#ffffff) - primary +// SecondaryColor - String - HEX addолнительного цinета (#ffffff) - secondary +// Hidden - Boolean - Hidden calendar - hidden +// // Return value: -// Key-Value Pair - serialized JSON response from Google +// Key-Value Pair - serialized JSON response from Google Function EditListCalendar(Val Token - , Val Calendar - , Val PrimaryColor - , Val SecondaryColor - , Val Hidden = False) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Calendar); - OPI_TypeConversion.GetLine(PrimaryColor); - OPI_TypeConversion.GetLine(SecondaryColor); - OPI_TypeConversion.GetBoolean(Hidden); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://www.googleapis.com/calendar/v3/users/me/calendarList/" + Calendar + "?colorRgbFormat=true"; - - Parameters = New Match; - Parameters.Insert("hidden" , Hidden); - Parameters.Insert("foregroundColor", PrimaryColor); - Parameters.Insert("backgroundColor", SecondaryColor); - - Response = OPI_Tools.Put(URL, Parameters, Headers); - - Return Response; +, Val Calendar +, Val PrimaryColor +, Val SecondaryColor +, Val Hidden = False) Export + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(Calendar); +OPI_TypeConversion.GetLine(PrimaryColor); +OPI_TypeConversion.GetLine(SecondaryColor); +OPI_TypeConversion.GetBoolean(Hidden); + +Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); +URL = "https://www.googleapis.com/calendar/v3/users/me/calendarList/" + Calendar + "?colorRgbFormat=true"; + +Parameters = New Match; +Parameters.Insert("hidden" , Hidden); +Parameters.Insert("foregroundColor", PrimaryColor); +Parameters.Insert("backgroundColor", SecondaryColor); + +Response = OPI_Tools.Put(URL, Parameters, Headers); + +Return Response; EndFunction @@ -305,164 +305,164 @@ EndFunction #Region EventManagement // Get event description !NOCLI -// +// // Return value: // Key-Value Pair - Empty event template Function GetEventDescription() Export - - CurrentDate = OPI_Tools.GetCurrentDate(); - Hour = 3600; - Event = New Match; - - Event.Insert("Description" , ""); // Event description - Event.Insert("Title" , "New event"); // Title events - Event.Insert("Venue" , ""); // String description of the venue of the event - Event.Insert("StartDate" , CurrentDate); // Date of start events - Event.Insert("EndDate" , CurrentDate + Hour); // Date of end events - Event.Insert("ArrayOfAttachmentURLs", New Match); // Key - name, Value - URL to file - Event.Insert("SendNotifications" , True); // Indication of sending notifications to participants - Return Event; - +CurrentDate = OPI_Tools.GetCurrentDate(); +Hour = 3600; +Event = New Match; + +Event.Insert("Description" , ""); // Event description +Event.Insert("Title" , "New event"); // Title events +Event.Insert("Venue" , ""); // String description of the venue of the event +Event.Insert("StartDate" , CurrentDate); // Date of start events +Event.Insert("EndDate" , CurrentDate + Hour); // Date of end events +Event.Insert("ArrayOfAttachmentURLs", New Match); // Key - name, Value - URL to file +Event.Insert("SendNotifications" , True); // Indication of sending notifications to participants + +Return Event; + EndFunction // Get list of events // Gets the list of all calendar events -// +// // Parameters: -// Token - String - Token - token -// Calendar - String - Calendar ID - calendar -// +// Token - String - Token - token +// Calendar - String - Calendar ID - calendar +// // Return value: -// Key-Value Pair - Array of event mappings +// Key-Value Pair - Array of event mappings Function GetEventList(Val Token, Val Calendar) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Calendar); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - ArrayOfEvents = New Array; - - GetEventsListRecursively(Headers, Calendar, ArrayOfEvents); - - Return ArrayOfEvents; - + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(Calendar); + +Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); +ArrayOfEvents = New Array; + +GetEventsListRecursively(Headers, Calendar, ArrayOfEvents); + +Return ArrayOfEvents; + EndFunction // Get event // Gets an event by ID -// +// // Parameters: -// Token - String - Token - token -// Calendar - String - Calendar ID - calendar -// Event - String - Event ID - event -// +// Token - String - Token - token +// Calendar - String - Calendar ID - calendar +// Event - String - Event ID - event +// // Return value: -// Key-Value Pair - serialized JSON response from Google +// Key-Value Pair - serialized JSON response from Google Function GetEvent(Val Token, Val Calendar, Val Event) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Calendar); - OPI_TypeConversion.GetLine(Event); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://www.googleapis.com/calendar/v3/calendars/" - + Calendar - + "/events/" - + Event; - - Response = OPI_Tools.Get(URL, , Headers); - - Return Response; + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(Calendar); +OPI_TypeConversion.GetLine(Event); + +Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); +URL = "https://www.googleapis.com/calendar/v3/calendars/" ++ Calendar ++ "/events/" ++ Event; + +Response = OPI_Tools.Get(URL, , Headers); + +Return Response; EndFunction // Create event // Creates a new event -// +// // Parameters: -// Token - String - Token - token -// Calendar - String - Calendar ID - calendar -// EventDescription - Key-Value Pair - Event description - props -// +// Token - String - Token - token +// Calendar - String - Calendar ID - calendar +// EventDescription - Key-Value Pair - Event description - props +// // Return value: -// String, Arbitrary, HTTPResponse, BinaryData, Undefined - Google server response -Function CreateEvent(Val Token, Val Calendar, Val EventDescription) Export - Return EventManagement(Token, Calendar, EventDescription); +// String, Arbitrary, HTTPResponse, BinaryData, Undefined - Google server response +Function CreateEvent(Val Token, Val Calendar, Val EventDescription) Export +Return EventManagement(Token, Calendar, EventDescription); EndFunction // Move event // Moves an event to another calendar -// +// // Parameters: -// Token - String - Token - token -// SourceCalendar - String - ID of the source calendar - from -// TargetCalendar - String - ID of the target calendar - to -// Event - String - ID of the source calendar event - event -// +// Token - String - Token - token +// SourceCalendar - String - ID of the source calendar - from +// TargetCalendar - String - ID of the target calendar - to +// Event - String - ID of the source calendar event - event +// // Return value: -// Key-Value Pair - serialized JSON response from Google +// Key-Value Pair - serialized JSON response from Google Function MoveEvent(Val Token, Val SourceCalendar, Val TargetCalendar, Val Event) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(SourceCalendar); - OPI_TypeConversion.GetLine(TargetCalendar); - OPI_TypeConversion.GetLine(Event); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://www.googleapis.com/calendar/v3/calendars/" - + SourceCalendar - + "/events/" - + Event - + "/move?destination=" - + TargetCalendar; - - Response = OPI_Tools.Post(URL, , Headers); - - Return Response; + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(SourceCalendar); +OPI_TypeConversion.GetLine(TargetCalendar); +OPI_TypeConversion.GetLine(Event); + +Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); +URL = "https://www.googleapis.com/calendar/v3/calendars/" ++ SourceCalendar ++ "/events/" ++ Event ++ "/move?destination=" ++ TargetCalendar; + +Response = OPI_Tools.Post(URL, , Headers); + +Return Response; EndFunction // Edit event // Edits an existing event -// +// // Parameters: -// Token - String - Token - token -// Calendar - String - Calendar ID - calendar -// EventDescription - String - New event description - props -// Event - String - Event ID - event -// +// Token - String - Token - token +// Calendar - String - Calendar ID - calendar +// EventDescription - String - New event description - props +// Event - String - Event ID - event +// // Return value: -// Key-Value Pair - serialized JSON response from Google +// Key-Value Pair - serialized JSON response from Google Function EditEvent(Val Token, Val Calendar, Val EventDescription, Val Event) Export - Return EventManagement(Token, Calendar, EventDescription, Event); +Return EventManagement(Token, Calendar, EventDescription, Event); EndFunction // Delete event // Deletes an event by ID -// +// // Parameters: -// Token - String - Token - token -// Calendar - String - Calendar ID - calendar -// Event - String - Event ID - event -// +// Token - String - Token - token +// Calendar - String - Calendar ID - calendar +// Event - String - Event ID - event +// // Return value: -// Key-Value Pair - serialized JSON response from Google +// Key-Value Pair - serialized JSON response from Google Function DeleteEvent(Val Token, Val Calendar, Val Event) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Calendar); - OPI_TypeConversion.GetLine(Event); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://www.googleapis.com/calendar/v3/calendars/" - + Calendar - + "/events/" - + Event; - - Response = OPI_Tools.Delete(URL, , Headers); - - Return Response; + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(Calendar); +OPI_TypeConversion.GetLine(Event); + +Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); +URL = "https://www.googleapis.com/calendar/v3/calendars/" ++ Calendar ++ "/events/" ++ Event; + +Response = OPI_Tools.Delete(URL, , Headers); + +Return Response; EndFunction @@ -473,159 +473,159 @@ EndFunction #Region ServiceProceduresAndFunctions Function ConvertDate(Val Date) - - OPI_TypeConversion.GetDate(Date); - - DateStructure = New Structure; - - If Not TypeValue(Date) = Type("Date") Then - Return Undefined; - EndIf; - - If Date = StartOfDay(Date) Then - DateFormat = "DF=yyyy-MM-dd"; - Field = "date"; - Otherwise - DateFormat = "DF=yyyy-MM-ddTHH:mm:ssZ"; - Field = "dateTime"; - EndIf; - - Date = Format(Date, DateFormat); - DateStructure.Insert(Field , Date); - DateStructure.Insert("timeZone", "Europe/Moscow"); - - Return DateStructure; - + +OPI_TypeConversion.GetDate(Date); + +DateStructure = New Structure; + +If Not TypeValue(Date) = Type("Date") Then +Return Undefined; +EndIf; + +If Date = StartOfDay(Date) Then +DateFormat = "DF=yyyy-MM-dd"; +Field = "date"; +Else +DateFormat = "DF=yyyy-MM-ddTHH:mm:ssZ"; +Field = "dateTime"; +EndIf; + +Date = Format(Date, DateFormat); +DateStructure.Insert(Field , Date); +DateStructure.Insert("timeZone", "Europe/Moscow"); + +Return DateStructure; + EndFunction Function ConvertAttachments(Val Attachments) - - OPI_TypeConversion.GetCollection(Attachments); - - AttachmentsArray = New Array; - - If TypeValue(Attachments) = Type("Match") Or TypeValue(Attachments) = Type("Structure") Then - - For Each Attachment Of Attachments Loop - - CurrentAttachment = New Structure; - CurrentAttachment.Insert("title" , Attachment.Key); - CurrentAttachment.Insert("fileUrl", Attachment.Value); - - AttachmentsArray.Add(CurrentAttachment); - - EndOfLoop; - - EndIf; - - If AttachmentsArray.Quantity() > 0 Then - Return AttachmentsArray; - Otherwise - Return Undefined; - EndIf; + +OPI_TypeConversion.GetCollection(Attachments); + +AttachmentsArray = New Array; + +If TypeValue(Attachments) = Type("Match") Or TypeValue(Attachments) = Type("Structure") Then + +For Each Attachment In Attachments Do + +CurrentAttachment = New Structure; +CurrentAttachment.Insert("title" , Attachment.Key); +CurrentAttachment.Insert("fileUrl", Attachment.Value); + +AttachmentsArray.Add(CurrentAttachment); + +EndDo; + +EndIf; + +If AttachmentsArray.Quantity() > 0 Then +Return AttachmentsArray; +Else +Return Undefined; +EndIf; EndFunction Function EventManagement(Val Token, Val Calendar, Val EventDescription, Val Event = "") - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Calendar); - OPI_TypeConversion.GetLine(Event); - OPI_TypeConversion.GetCollection(EventDescription); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - Existing = ValueFilled(Event); - URL = "https://www.googleapis.com/calendar/v3/calendars/" - + Calendar - + "/events" - + ?(Existing, "/" + Event, ""); - - Date0 = EventDescription["StartDate"]; - Date1 = EventDescription["EndDate"]; - Attachments = EventDescription["ArrayOfAttachmentURLs"]; - Attachments = ConvertAttachments(Attachments); - Notifications = ?(EventDescription["SendNotifications"] = Undefined - , False - , EventDescription["SendNotifications"]); - - Parameters = New Structure; - Parameters.Insert("summary" , EventDescription["Title"]); - Parameters.Insert("description", EventDescription["Description"]); - Parameters.Insert("location" , EventDescription["Venue"]); - Parameters.Insert("start" , ConvertDate(Date0)); - Parameters.Insert("end" , ConvertDate(Date1)); - Parameters.Insert("attachments", Attachments); - - URLParameters = New Structure; - URLParameters.Insert("sendUpdates" , ?(Notifications, "all", "none")); - URLParameters.Insert("supportsAttachments" , ?(ValueFilled(Attachments), "true", "false")); - - URL = URL + OPI_Tools.RequestParametersToString(URLParameters); - - OPI_Tools.RemoveEmptyCollectionFields(Parameters); - - If Existing Then - Response = OPI_Tools.Patch(URL, Parameters, Headers, True); - Otherwise - Response = OPI_Tools.Post(URL, Parameters, Headers, True); - EndIf; - - Return Response; + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(Calendar); +OPI_TypeConversion.GetLine(Event); +OPI_TypeConversion.GetCollection(EventDescription); + +Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); +Existing = ValueIsFilled(Event); +URL = "https://www.googleapis.com/calendar/v3/calendars/" ++ Calendar ++ "/events" ++ ?(Existing, "/" + Event, ""); + +Date0 = EventDescription["StartDate"]; +Date1 = EventDescription["EndDate"]; +Attachments = EventDescription["ArrayOfAttachmentURLs"]; +Attachments = ConvertAttachments(Attachments); +Notifications = ?(EventDescription["SendNotifications"] = Undefined +, False +, EventDescription["SendNotifications"]); + +Parameters = New Structure; +Parameters.Insert("summary" , EventDescription["Title"]); +Parameters.Insert("description", EventDescription["Description"]); +Parameters.Insert("location" , EventDescription["Venue"]); +Parameters.Insert("start" , ConvertDate(Date0)); +Parameters.Insert("end" , ConvertDate(Date1)); +Parameters.Insert("attachments", Attachments); + +URLParameters = New Structure; +URLParameters.Insert("sendUpdates" , ?(Notifications, "all", "none")); +URLParameters.Insert("supportsAttachments" , ?(ValueIsFilled(Attachments), "true", "false")); + +URL = URL + OPI_Tools.RequestParametersToString(URLParameters); + +OPI_Tools.RemoveEmptyCollectionFields(Parameters); + +If Existing Then +Response = OPI_Tools.Patch(URL, Parameters, Headers, True); +Else +Response = OPI_Tools.Post(URL, Parameters, Headers, True); +EndIf; + +Return Response; EndFunction -Procedure GetCalendarsListRecursively(Val Headers, ArrayOfCalendars, Page = "") - - Items = "items"; - NPT = "nextPageToken"; - Parameters = New Structure; - - If ValueFilled(Page) Then - Parameters.Insert("pageToken", Page); - EndIf; - - Result = OPI_Tools.Get("https://www.googleapis.com/calendar/v3/users/me/calendarList" - , Parameters - , Headers); - - Calendars = Result[Items]; - Page = Result[NPT]; - - For Each Calendar Of Calendars Loop - ArrayOfCalendars.Add(Calendar); - EndOfLoop; - - If Calendars.Quantity() > 0 And ValueFilled(Page) Then - GetCalendarsListRecursively(Headers, ArrayOfCalendars, Page); - EndIf; - +Procedure GetCalendarsListRecursively(Val Headers, ArrayOfCalendars, Page = "") + +Items = "items"; +NPT = "nextPageToken"; +Parameters = New Structure; + +If ValueIsFilled(Page) Then +Parameters.Insert("pageToken", Page); +EndIf; + +Result = OPI_Tools.Get("https://www.googleapis.com/calendar/v3/users/me/calendarList" +, Parameters +, Headers); + +Calendars = Result[Items]; +Page = Result[NPT]; + +For Each Calendar In Calendars Do +ArrayOfCalendars.Add(Calendar); +EndDo; + +If Calendars.Quantity() > 0 And ValueIsFilled(Page) Then +GetCalendarsListRecursively(Headers, ArrayOfCalendars, Page); +EndIf; + EndProcedure -Procedure GetEventsListRecursively(Val Headers, Val Calendar, ArrayOfEvents, Page = "") - - Items = "items"; - NPT = "nextPageToken"; - Parameters = New Structure; - - If ValueFilled(Page) Then - Parameters.Insert("pageToken", Page); - EndIf; - - Result = OPI_Tools.Get("https://www.googleapis.com/calendar/v3/calendars/" + Calendar + "/events" - , Parameters - , Headers); - - Events = Result[Items]; - Page = Result[NPT]; - - For Each Event Of Events Loop - ArrayOfEvents.Add(Event); - EndOfLoop; - - If Events.Quantity() > 0 And ValueFilled(Page) Then - GetEventsListRecursively(Headers, ArrayOfEvents, Page); - EndIf; - +Procedure GetEventsListRecursively(Val Headers, Val Calendar, ArrayOfEvents, Page = "") + +Items = "items"; +NPT = "nextPageToken"; +Parameters = New Structure; + +If ValueIsFilled(Page) Then +Parameters.Insert("pageToken", Page); +EndIf; + +Result = OPI_Tools.Get("https://www.googleapis.com/calendar/v3/calendars/" + Calendar + "/events" +, Parameters +, Headers); + +Events = Result[Items]; +Page = Result[NPT]; + +For Each Event In Events Do +ArrayOfEvents.Add(Event); +EndDo; + +If Events.Quantity() > 0 And ValueIsFilled(Page) Then +GetEventsListRecursively(Headers, ArrayOfEvents, Page); +EndIf; + EndProcedure #EndRegion diff --git a/src/en/OPI/src/CommonModules/OPI_GoogleCalendar/OPI_GoogleCalendar.mdo b/src/en/OPI/src/CommonModules/OPI_GoogleCalendar/OPI_GoogleCalendar.mdo index 3d38018f54..a6581846e5 100644 --- a/src/en/OPI/src/CommonModules/OPI_GoogleCalendar/OPI_GoogleCalendar.mdo +++ b/src/en/OPI/src/CommonModules/OPI_GoogleCalendar/OPI_GoogleCalendar.mdo @@ -1,11 +1,11 @@ - + - OPI_GoogleCalendar - - - OPI google calendar - - true - true - true +OPI_GoogleCalendar + + +OPI google calendar + +true +true +true diff --git a/src/en/OPI/src/CommonModules/OPI_GoogleDrive/Module.bsl b/src/en/OPI/src/CommonModules/OPI_GoogleDrive/Module.bsl index 94f062c227..d5b845f13d 100644 --- a/src/en/OPI/src/CommonModules/OPI_GoogleDrive/Module.bsl +++ b/src/en/OPI/src/CommonModules/OPI_GoogleDrive/Module.bsl @@ -38,275 +38,275 @@ // Get object information // Gets information about a folder or file by ID -// +// // Parameters: -// Token - String - Token - token -// Identifier - String - Identifier of the file or folder - object -// +// Token - String - Token - token +// Identifier - String - Identifier of the file or folder - object +// // Return value: -// Key-Value Pair - serialized JSON response from Google +// Key-Value Pair - serialized JSON response from Google Function GetObjectInformation(Val Token, Val Identifier) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Identifier); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://www.googleapis.com/drive/v3/files/" + Identifier; - - Parameters = New Structure; - Parameters.Insert("fields", "*"); - - Response = OPI_Tools.Get(URL, Parameters, Headers); - - Return Response; + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(Identifier); + +Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); +URL = "https://www.googleapis.com/drive/v3/files/" + Identifier; + +Parameters = New Structure; +Parameters.Insert("fields", "*"); + +Response = OPI_Tools.Get(URL, Parameters, Headers); + +Return Response; EndFunction // Get list of directories // Gets the list of drive directories -// +// // Parameters: -// Token - String - Token - token -// NameContains - String - Filter by name - querry -// Detailed - Boolean - Adds a list of files to the directory fields - depth -// +// Token - String - Token - token +// NameContains - String - Filter by name - querry +// Detailed - Boolean - Adds a list of files to the directory fields - depth +// // Return value: -// Key-Value Pair - Array of directory mappings +// Key-Value Pair - Array of directory mappings Function GetDirectoriesList(Val Token, Val NameContains = "", Val Detailed = False) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(NameContains); - OPI_TypeConversion.GetBoolean(Detailed); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - ArrayOfObjects = New Array; - Filter = New Array; - - Filter.Add("mimeType = 'application/vnd.google-apps.folder'"); - - If ValueFilled(NameContains) Then - Filter.Add("name contains '" + NameContains + "'"); - EndIf; - - GetObjectsListRecursively(Headers, ArrayOfObjects, Detailed, Filter); - - If Detailed Then - BreakDownObjectsInDetail(Token, ArrayOfObjects); - EndIf; - - Return ArrayOfObjects; - + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(NameContains); +OPI_TypeConversion.GetBoolean(Detailed); + +Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); +ArrayOfObjects = New Array; +Filter = New Array; + +Filter.Add("mimeType = 'application/vnd.google-apps.folder'"); + +If ValueIsFilled(NameContains) Then +Filter.Add("name contains '" + NameContains + "'"); +EndIf; + +GetObjectsListRecursively(Headers, ArrayOfObjects, Detailed, Filter); + +If Detailed Then +BreakDownObjectsInDetail(Token, ArrayOfObjects); +EndIf; + +Return ArrayOfObjects; + EndFunction // Get list of files // Gets the list of files -// +// // Parameters: -// Token - String - Token - token -// NameContains - String - Filter by name - querry -// Directory - String - Filter by parent directory ID - catalog -// +// Token - String - Token - token +// NameContains - String - Filter by name - querry +// Directory - String - Filter by parent directory ID - catalog +// // Return value: -// Key-Value Pair - Array of file mappings +// Key-Value Pair - Array of file mappings Function GetFilesList(Val Token, Val NameContains = "", Val Directory = "") Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(NameContains); - OPI_TypeConversion.GetLine(Directory); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - ArrayOfObjects = New Array; - Filter = New Array; - - Filter.Add("mimeType != 'application/vnd.google-apps.folder'"); - - If ValueFilled(NameContains) Then - Filter.Add("name contains '" + NameContains + "'"); - EndIf; - - If ValueFilled(Directory) Then - Filter.Add("'" + Directory + "' in parents"); - EndIf; - - GetObjectsListRecursively(Headers, ArrayOfObjects, , Filter); - - Return ArrayOfObjects; + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(NameContains); +OPI_TypeConversion.GetLine(Directory); + +Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); +ArrayOfObjects = New Array; +Filter = New Array; + +Filter.Add("mimeType != 'application/vnd.google-apps.folder'"); + +If ValueIsFilled(NameContains) Then +Filter.Add("name contains '" + NameContains + "'"); +EndIf; + +If ValueIsFilled(Directory) Then +Filter.Add("'" + Directory + "' in parents"); +EndIf; + +GetObjectsListRecursively(Headers, ArrayOfObjects, , Filter); + +Return ArrayOfObjects; EndFunction // Upload file // Uploads a file to the drive -// +// // Parameters: -// Token - String - Token - token -// File - BinaryData,String - File to be uploaded - file -// Description - Key-Value Pair - See GetFileDescription - props - JSON description or path to .json -// +// Token - String - Token - token +// File - BinaryData,String - File to be uploaded - file +// Description - Key-Value Pair - See GetFileDescription - props - JSON description or path to .json +// // Return value: -// Key-Value Pair - serialized JSON response from Google +// Key-Value Pair - serialized JSON response from Google Function UploadFile(Val Token, Val File, Val Description) Export - Return FileManagement(Token, File, Description); +Return FileManagement(Token, File, Description); EndFunction // Create folder // Creates an empty directory on the drive -// +// // Parameters: -// Token - String - Token - token -// Name - String - Folder name - title -// Parent - String - Parent - catalog -// +// Token - String - Token - token +// Name - String - Folder name - title +// Parent - String - Parent - catalog +// // Return value: -// Key-Value Pair - serialized JSON response from Google +// Key-Value Pair - serialized JSON response from Google Function CreateFolder(Val Token, Val Name, Val Parent = "") Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Name); - OPI_TypeConversion.GetLine(Parent); - - Description = New Match; - Description.Insert("MIME" , "application/vnd.google-apps.folder"); - Description.Insert("Name" , Name); - Description.Insert("Description", ""); - Description.Insert("Parent", ?(ValueFilled(Parent), Parent, "root")); - - Return FileManagement(Token, , Description); - + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(Name); +OPI_TypeConversion.GetLine(Parent); + +Description = New Match; +Description.Insert("MIME" , "application/vnd.google-apps.folder"); +Description.Insert("Name" , Name); +Description.Insert("Description", ""); +Description.Insert("Parent", ?(ValueIsFilled(Parent), Parent, "root")); + +Return FileManagement(Token, , Description); + EndFunction // Download file // Gets file by ID -// +// // Parameters: -// Token - String - Token - token -// Identifier - String - File identifier - object -// SavePath - String - File save path - out -// +// Token - String - Token - token +// Identifier - String - File identifier - object +// SavePath - String - File save path - out +// // Return value: -// BinaryData,String - Binary data or file path when SavePath parameter is specified +// BinaryData,String - Binary data or file path when SavePath parameter is specified Function DownloadFile(Val Token, Val Identifier, Val SavePath = "") Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Identifier); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://www.googleapis.com/drive/v3/files/" + Identifier; - - Parameters = New Match; - Parameters.Insert("alt", "media"); - - Response = OPI_Tools.Get(URL, Parameters , Headers, SavePath); - - Return Response; + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(Identifier); + +Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); +URL = "https://www.googleapis.com/drive/v3/files/" + Identifier; + +Parameters = New Match; +Parameters.Insert("alt", "media"); + +Response = OPI_Tools.Get(URL, Parameters , Headers, SavePath); + +Return Response; EndFunction // Copy object // Copies file or directory -// +// // Parameters: -// Token - String - Token - token -// Identifier - String - Object identifier - object -// NewName - String - New object name - title -// NewParent - String - New parent directory - catalog -// +// Token - String - Token - token +// Identifier - String - Object identifier - object +// NewName - String - New object name - title +// NewParent - String - New parent directory - catalog +// // Return value: -// Key-Value Pair - serialized JSON response from Google +// Key-Value Pair - serialized JSON response from Google Function CopyObject(Val Token, Val Identifier, Val NewName = "", Val NewParent = "") Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(NewName); - OPI_TypeConversion.GetLine(Identifier); - OPI_TypeConversion.GetLine(NewParent); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://www.googleapis.com/drive/v3/files/" + Identifier + "/copy"; - - Parameters = New Structure; - - If ValueFilled(NewName) Then - Parameters.Insert("name", NewName); - EndIf; - - If ValueFilled(NewParent) Then - - ArrayOfParents = New Array; - ArrayOfParents.Add(NewParent); - Parameters.Insert("parents", ArrayOfParents); - - EndIf; - - Response = OPI_Tools.Post(URL, Parameters , Headers, True); - - Return Response; + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(NewName); +OPI_TypeConversion.GetLine(Identifier); +OPI_TypeConversion.GetLine(NewParent); + +Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); +URL = "https://www.googleapis.com/drive/v3/files/" + Identifier + "/copy"; + +Parameters = New Structure; + +If ValueIsFilled(NewName) Then +Parameters.Insert("name", NewName); +EndIf; + +If ValueIsFilled(NewParent) Then + +ArrayOfParents = New Array; +ArrayOfParents.Add(NewParent); +Parameters.Insert("parents", ArrayOfParents); + +EndIf; + +Response = OPI_Tools.Post(URL, Parameters , Headers, True); + +Return Response; EndFunction // Update file // Updates file binary data -// +// // Parameters: -// Token - String - Token - token -// Identifier - String - Identifier of the object to update - object -// File - BinaryData,String - File source for update - file -// NewName - String - Nоinое имя file (еwithли необхоdимо) - title -// +// Token - String - Token - token +// Identifier - String - Identifier of the object to update - object +// File - BinaryData,String - File source for update - file +// NewName - String - Nоinое имя file (еwithли необхоdимо) - title +// // Return value: -// Key-Value Pair - serialized JSON response from Google +// Key-Value Pair - serialized JSON response from Google Function UpdateFile(Val Token, Val Identifier, Val File, Val NewName = "") Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Identifier); - OPI_TypeConversion.GetLine(NewName); - OPI_TypeConversion.GetBinaryData(File); - - If ValueFilled(NewName) Then - Description = New Match; - Description.Insert("Name", NewName); - Otherwise - Description = ""; - EndIf; - - Return FileManagement(Token, File, Description, Identifier); - + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(Identifier); +OPI_TypeConversion.GetLine(NewName); +OPI_TypeConversion.GetBinaryData(File); + +If ValueIsFilled(NewName) Then +Description = New Match; +Description.Insert("Name", NewName); +Else +Description = ""; +EndIf; + +Return FileManagement(Token, File, Description, Identifier); + EndFunction // Delete object // Deletes file or directory by ID -// +// // Parameters: -// Token - String - Token - token -// Identifier - String - Identifier of the object to delete - object -// +// Token - String - Token - token +// Identifier - String - Identifier of the object to delete - object +// // Return value: -// Key-Value Pair - serialized JSON response from Google +// Key-Value Pair - serialized JSON response from Google Function DeleteObject(Val Token, Val Identifier) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Identifier); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://www.googleapis.com/drive/v3/files/" + Identifier; - Response = OPI_Tools.Delete(URL, , Headers); - - Return Response; + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(Identifier); + +Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); +URL = "https://www.googleapis.com/drive/v3/files/" + Identifier; +Response = OPI_Tools.Delete(URL, , Headers); + +Return Response; EndFunction // Get file description !NOCLI -// +// // Return value: -// Key-Value Pair - File description +// Key-Value Pair - File description Function GetFileDescription() Export - - Description = New Match; - Description.Insert("MIME" , "image/jpeg"); // MIME-type uploading file - Description.Insert("Name" , "New file.jpg"); // File name with extension - Description.Insert("Description" , "This is a new file"); // File description - Description.Insert("Parent" , "root"); // ID directory upload or "root" for upload in root - - Return Description; - + +Description = New Match; +Description.Insert("MIME" , "image/jpeg"); // MIME-type uploading file +Description.Insert("Name" , "New file.jpg"); // File name with extension +Description.Insert("Description" , "This is a new file"); // File description +Description.Insert("Parent" , "root"); // ID directory upload or "root" for upload in root + +Return Description; + EndFunction #EndRegion @@ -315,108 +315,108 @@ EndFunction // Create comment // Creates a comment for a file or directory -// +// // Parameters: -// Token - String - Token - token -// Identifier - String - Identifier of the object that needs a comment - object -// Comment - String - Comment text - text -// +// Token - String - Token - token +// Identifier - String - Identifier of the object that needs a comment - object +// Comment - String - Comment text - text +// // Return value: -// Key-Value Pair - serialized JSON response from Google +// Key-Value Pair - serialized JSON response from Google Function CreateComment(Val Token, Val Identifier, Val Comment) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Identifier); - OPI_TypeConversion.GetLine(Comment); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://www.googleapis.com/drive/v3/files/" + Identifier + "/comments?fields=*"; - - Parameters = New Structure; - Parameters.Insert("content", Comment); - - Response = OPI_Tools.POST(URL, Parameters, Headers); - - Return Response; + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(Identifier); +OPI_TypeConversion.GetLine(Comment); + +Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); +URL = "https://www.googleapis.com/drive/v3/files/" + Identifier + "/comments?fields=*"; + +Parameters = New Structure; +Parameters.Insert("content", Comment); + +Response = OPI_Tools.POST(URL, Parameters, Headers); + +Return Response; EndFunction // Get comment // Gets comment by ID -// +// // Parameters: -// Token - String - Token - token -// ObjectID - String - Identifier of the file or directory where the comment is located - object -// CommentID - String - Comment identifier - comment -// +// Token - String - Token - token +// ObjectID - String - Identifier of the file or directory where the comment is located - object +// CommentID - String - Comment identifier - comment +// // Return value: -// Key-Value Pair - serialized JSON response from Google +// Key-Value Pair - serialized JSON response from Google Function GetComment(Val Token, Val ObjectID, Val CommentID) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(ObjectID); - OPI_TypeConversion.GetLine(CommentID); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://www.googleapis.com/drive/v3/files/" + ObjectID + "/comments/" + CommentID; - - Parameters = New Structure; - Parameters.Insert("fields", "*"); - - Response = OPI_Tools.Get(URL, Parameters, Headers); - - Return Response; + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(ObjectID); +OPI_TypeConversion.GetLine(CommentID); + +Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); +URL = "https://www.googleapis.com/drive/v3/files/" + ObjectID + "/comments/" + CommentID; + +Parameters = New Structure; +Parameters.Insert("fields", "*"); + +Response = OPI_Tools.Get(URL, Parameters, Headers); + +Return Response; EndFunction // Get list of comments // Gets the list of all comments of the object -// +// // Parameters: -// Token - String - Token - token -// ObjectID - String - Object identifier - object -// +// Token - String - Token - token +// ObjectID - String - Object identifier - object +// // Return value: -// Key-Value Pair - serialized JSON response from Google +// Key-Value Pair - serialized JSON response from Google Function GetCommentList(Val Token, Val ObjectID) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(ObjectID); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://www.googleapis.com/drive/v3/files/" + ObjectID + "/comments"; - - Parameters = New Structure; - Parameters.Insert("fields", "*"); - - Response = OPI_Tools.Get(URL, Parameters, Headers); - - Return Response; + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(ObjectID); + +Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); +URL = "https://www.googleapis.com/drive/v3/files/" + ObjectID + "/comments"; + +Parameters = New Structure; +Parameters.Insert("fields", "*"); + +Response = OPI_Tools.Get(URL, Parameters, Headers); + +Return Response; EndFunction // Delete comment // Deletes comment by ID -// +// // Parameters: -// Token - String - Token - token -// ObjectID - String - Identifier of the file or directory where the comment is located - object -// CommentID - String - Comment identifier - comment -// +// Token - String - Token - token +// ObjectID - String - Identifier of the file or directory where the comment is located - object +// CommentID - String - Comment identifier - comment +// // Return value: -// Key-Value Pair - serialized JSON response from Google +// Key-Value Pair - serialized JSON response from Google Function DeleteComment(Val Token, Val ObjectID, Val CommentID) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(ObjectID); - OPI_TypeConversion.GetLine(CommentID); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://www.googleapis.com/drive/v3/files/" + ObjectID + "/comments/" + CommentID; - - Response = OPI_Tools.Delete(URL, , Headers); - - Return Response; + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(ObjectID); +OPI_TypeConversion.GetLine(CommentID); + +Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); +URL = "https://www.googleapis.com/drive/v3/files/" + ObjectID + "/comments/" + CommentID; + +Response = OPI_Tools.Delete(URL, , Headers); + +Return Response; EndFunction @@ -426,294 +426,294 @@ EndFunction #Region ServiceProceduresAndFunctions -Procedure GetObjectsListRecursively(Val Headers, ArrayOfObjects, Detailed = False, Filter = "", Page = "") - - URL = "https://www.googleapis.com/drive/v3/files"; - Files = "files"; - NPT = "nextPageToken"; - Parameters = New Structure; - Parameters.Insert("fields", "*"); - - If ValueFilled(Page) Then - Parameters.Insert("pageToken", Page); - EndIf; - - If ValueFilled(Filter) And TypeValue(Filter) = Type("Array") Then - FilterString = StrJoin(Filter, " and "); - Parameters.Insert("q", FilterString); - EndIf; - - Result = OPI_Tools.Get(URL, Parameters, Headers); - - Objects = Result[Files]; - Page = Result[NPT]; - - For Each CurrentObject Of Objects Loop - ArrayOfObjects.Add(CurrentObject); - EndOfLoop; - - If Objects.Quantity() > 0 And ValueFilled(Page) Then - GetObjectsListRecursively(Headers, ArrayOfObjects, Detailed, Filter, Page); - EndIf; - +Procedure GetObjectsListRecursively(Val Headers, ArrayOfObjects, Detailed = False, Filter = "", Page = "") + +URL = "https://www.googleapis.com/drive/v3/files"; +Files = "files"; +NPT = "nextPageToken"; +Parameters = New Structure; +Parameters.Insert("fields", "*"); + +If ValueIsFilled(Page) Then +Parameters.Insert("pageToken", Page); +EndIf; + +If ValueIsFilled(Filter) And TypeValue(Filter) = Type("Array") Then +FilterString = StrJoin(Filter, " and "); +Parameters.Insert("q", FilterString); +EndIf; + +Result = OPI_Tools.Get(URL, Parameters, Headers); + +Objects = Result[Files]; +Page = Result[NPT]; + +For Each CurrentObject In Objects Do +ArrayOfObjects.Add(CurrentObject); +EndDo; + +If Objects.Quantity() > 0 And ValueIsFilled(Page) Then +GetObjectsListRecursively(Headers, ArrayOfObjects, Detailed, Filter, Page); +EndIf; + EndProcedure -Procedure BreakDownObjectsInDetail(Val Token, ArrayOfObjects) - - For Each CurrentObject Of ArrayOfObjects Loop - - ArrayOfFiles = New Array; - CurrentID = CurrentObject["id"]; - - Result = GetFilesList(Token, , CurrentID); - - For Each File Of Result Loop - ArrayOfFiles.Add(File); - EndOfLoop; - - CurrentObject.Insert("files", ArrayOfFiles); - - EndOfLoop; - +Procedure BreakDownObjectsInDetail(Val Token, ArrayOfObjects) + +For Each CurrentObject In ArrayOfObjects Do + +ArrayOfFiles = New Array; +CurrentID = CurrentObject["id"]; + +Result = GetFilesList(Token, , CurrentID); + +For Each File In Result Do +ArrayOfFiles.Add(File); +EndDo; + +CurrentObject.Insert("files", ArrayOfFiles); + +EndDo; + EndProcedure Procedure FormFileUploadParameters(Description) - - FormedDescription = New Match; - OPI_Tools.RemoveEmptyCollectionFields(Description); - FieldMapping = New Match; - FieldMapping.Insert("MIME" , "mimeType"); - FieldMapping.Insert("Name" , "name"); - FieldMapping.Insert("Description" , "description"); - FieldMapping.Insert("Parent" , "parents"); - FieldMapping.Insert("Extension", "fileExtension"); - - For Each Element Of Description Loop - - If Element.Key = "Parent" Then - - CurrentValue = New Array; - CurrentValue.Add(Element.Value); - - Otherwise - - CurrentValue = Element.Value; - - EndIf; - - FieldName = FieldMapping.Get(Element.Key); - FormedDescription.Insert(FieldName, CurrentValue); - - EndOfLoop; - - Description = FormedDescription; - +FormedDescription = New Match; +OPI_Tools.RemoveEmptyCollectionFields(Description); + +FieldMapping = New Match; +FieldMapping.Insert("MIME" , "mimeType"); +FieldMapping.Insert("Name" , "name"); +FieldMapping.Insert("Description" , "description"); +FieldMapping.Insert("Parent" , "parents"); +FieldMapping.Insert("Extension", "fileExtension"); + +For Each Element In Description Do + +If Element.Key = "Parent" Then + +CurrentValue = New Array; +CurrentValue.Add(Element.Value); + +Else + +CurrentValue = Element.Value; + +EndIf; + +FieldName = FieldMapping.Get(Element.Key); +FormedDescription.Insert(FieldName, CurrentValue); + +EndDo; + +Description = FormedDescription; + EndProcedure -Function FileManagement(Val Token, Val File = "", Val Description = "", Val Identifier = "") - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Identifier); - - If ValueFilled(Description) Then - OPI_TypeConversion.GetCollection(Description); - EndIf; - - MimeType = "mimeType"; - - If ValueFilled(Identifier) Then - MIME = GetObjectInformation(Token, Identifier)[MimeType]; - Otherwise - MIME = Description["MIME"]; - EndIf; - - If Not ValueFilled(Description) Then - Description = New Match; - EndIf; - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - FormFileUploadParameters(Description); - JSONDescription = OPI_Tools.JSONString(Description); - - FileMapping = New Match; - - If ValueFilled(File) Then - - ChunkSize = 268435457; - Size = OPI_Tools.ConvertDataWithSizeRetrieval(File, ChunkSize); - - FileMapping.Insert(File, MIME); - - If Size < ChunkSize And TypeValue(File) = Type("BinaryData") Then - Response = UploadSmallFile(JSONDescription, FileMapping, Headers, Identifier); - Otherwise - Response = UploadLargeFile(Description, FileMapping, Headers, Identifier); - EndIf; - - Otherwise - Response = UploadSmallFile(JSONDescription, FileMapping, Headers, Identifier); - EndIf; - - Return Response; - +Function FileManagement(Val Token, Val File = "", Val Description = "", Val Identifier = "") + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(Identifier); + +If ValueIsFilled(Description) Then +OPI_TypeConversion.GetCollection(Description); +EndIf; + +MimeType = "mimeType"; + +If ValueIsFilled(Identifier) Then +MIME = GetObjectInformation(Token, Identifier)[MimeType]; +Else +MIME = Description["MIME"]; +EndIf; + +If Not ValueIsFilled(Description) Then +Description = New Match; +EndIf; + +Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); +FormFileUploadParameters(Description); +JSONDescription = OPI_Tools.JSONString(Description); + +FileMapping = New Match; + +If ValueIsFilled(File) Then + +ChunkSize = 268435457; +Size = OPI_Tools.ConvertDataWithSizeRetrieval(File, ChunkSize); + +FileMapping.Insert(File, MIME); + +If Size < ChunkSize And TypeValue(File) = Type("BinaryData") Then +Response = UploadSmallFile(JSONDescription, FileMapping, Headers, Identifier); +Else +Response = UploadLargeFile(Description, FileMapping, Headers, Identifier); +EndIf; + +Else +Response = UploadSmallFile(JSONDescription, FileMapping, Headers, Identifier); +EndIf; + +Return Response; + EndFunction Function UploadSmallFile(Val Description, Val FileMapping, Val Headers, Val Identifier = "") - - URL = "https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart"; - - If ValueFilled(Identifier) Then - URL = StringReplace(URL, "/files", "/files/" + Identifier); - Response = OPI_Tools.PatchMultipartRelated(URL, Description, FileMapping, Headers); - Otherwise - Response = OPI_Tools.PostMultipartRelated(URL, Description, FileMapping, Headers); - EndIf; - Return Response; - +URL = "https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart"; + +If ValueIsFilled(Identifier) Then +URL = StringReplace(URL, "/files", "/files/" + Identifier); +Response = OPI_Tools.PatchMultipartRelated(URL, Description, FileMapping, Headers); +Else +Response = OPI_Tools.PostMultipartRelated(URL, Description, FileMapping, Headers); +EndIf; + +Return Response; + EndFunction Function UploadLargeFile(Val Description, Val FileMapping, Val Headers, Val Identifier = "") - - For Each File Of FileMapping Loop - Binary = File.Key; - Interrupt; - EndOfLoop; - - URL = "https://www.googleapis.com/upload/drive/v3/files?uploadType=resumable"; - - If ValueFilled(Identifier) Then - URL = StringReplace(URL, "/files", "/files/" + Identifier); - Response = OPI_Tools.Patch(URL, Description, Headers, True, True); - Otherwise - Response = OPI_Tools.Post(URL, Description, Headers, True, True); - EndIf; - - UploadURL = Response.Headers["Location"]; - - If Not ValueFilled(UploadURL) Then - OPI_Tools.ProcessResponse(Response); - Return Response; - EndIf; - - UploadResponse = UploadFileInParts(Binary, UploadURL); - Response = ?(ValueFilled(UploadResponse), UploadResponse, Response); - - OPI_Tools.ProcessResponse(Response); - Return Response; - + +For Each File In FileMapping Do +Binary = File.Key; +Break; +EndDo; + +URL = "https://www.googleapis.com/upload/drive/v3/files?uploadType=resumable"; + +If ValueIsFilled(Identifier) Then +URL = StringReplace(URL, "/files", "/files/" + Identifier); +Response = OPI_Tools.Patch(URL, Description, Headers, True, True); +Else +Response = OPI_Tools.Post(URL, Description, Headers, True, True); +EndIf; + +UploadURL = Response.Headers["Location"]; + +If Not ValueIsFilled(UploadURL) Then +OPI_Tools.ProcessResponse(Response); +Return Response; +EndIf; + +UploadResponse = UploadFileInParts(Binary, UploadURL); +Response = ?(ValueIsFilled(UploadResponse), UploadResponse, Response); + +OPI_Tools.ProcessResponse(Response); +Return Response; + EndFunction Function UploadFileInParts(Val Binary, Val UploadURL) - - Response = ""; - ChunkSize = 268435456; - BytesRead = 0; - CurrentPosition = 0; - TotalSize = Binary.Size(); - StrTotalSize = OPI_Tools.NumberToString(TotalSize); - ReadingData = New ReadingData(Binary); - SourceStream = ReadingData.SourceStream(); - - While BytesRead < TotalSize Loop - - BytesRead = SourceStream.CurrentPosition(); - Result = ReadingData.Read(ChunkSize); - Current data = Result.GetBinaryData(); - CurrentSize = Current data.Size(); - NextPosition = CurrentPosition + CurrentSize - 1; - - If Not ValueFilled(Current data) Then - Interrupt; - EndIf; - - StreamHeader = "bytes " - + OPI_Tools.NumberToString(CurrentPosition) - + "-" - + OPI_Tools.NumberToString(NextPosition) - + "/" - + StrTotalSize; - - AdditionalHeaders = New Match; - AdditionalHeaders.Insert("Content-Length", OPI_Tools.NumberToString(CurrentSize)); - AdditionalHeaders.Insert("Content-Range" , StreamHeader); - AdditionalHeaders.Insert("Content-Type" , "application/octet-stream"); - - Response = OPI_Tools.Put(UploadURL, Current data, AdditionalHeaders, False, True); - - CheckResult = CheckPartUpload(Response, StrTotalSize, AdditionalHeaders, UploadURL, CurrentPosition); - - If ValueFilled(CheckResult) Then - Return CheckResult; - EndIf; - - // !OInt KBytes = 1024; - // !OInt MByte = KBytes * KBytes; - // !OInt Notify(OPI_Tools.ProgressInformation(CurrentPosition, TotalSize, "MB", MByte)); - - // !OInt PerformGarbageCollection(); - // !OInt ReleaseObject(Current data); - - EndOfLoop; - - Return Response; - + +Response = ""; +ChunkSize = 268435456; +BytesRead = 0; +CurrentPosition = 0; +TotalSize = Binary.Size(); +StrTotalSize = OPI_Tools.NumberToString(TotalSize); +ReadingData = New ReadingData(Binary); +SourceStream = ReadingData.SourceStream(); + +WHile BytesRead < TotalSize Do + +BytesRead = SourceStream.CurrentPosition(); +Result = ReadingData.Read(ChunkSize); +Current data = Result.GetBinaryData(); +CurrentSize = Current data.Size(); +NextPosition = CurrentPosition + CurrentSize - 1; + +If Not ValueIsFilled(Current data) Then +Break; +EndIf; + +StreamHeader = "bytes " ++ OPI_Tools.NumberToString(CurrentPosition) ++ "-" ++ OPI_Tools.NumberToString(NextPosition) ++ "/" ++ StrTotalSize; + +AdditionalHeaders = New Match; +AdditionalHeaders.Insert("Content-Length", OPI_Tools.NumberToString(CurrentSize)); +AdditionalHeaders.Insert("Content-Range" , StreamHeader); +AdditionalHeaders.Insert("Content-Type" , "application/octet-stream"); + +Response = OPI_Tools.Put(UploadURL, Current data, AdditionalHeaders, False, True); + +CheckResult = CheckPartUpload(Response, StrTotalSize, AdditionalHeaders, UploadURL, CurrentPosition); + +If ValueIsFilled(CheckResult) Then +Return CheckResult; +EndIf; + +// !OInt KBytes = 1024; +// !OInt MByte = KBytes * KBytes; +// !OInt Notify(OPI_Tools.ProgressInformation(CurrentPosition, TotalSize, "MB", MByte)); + +// !OInt PerformGarbageCollection(); +// !OInt ReleaseObject(Current data); + +EndDo; + +Return Response; + EndFunction Function CheckPartUpload(Response, StrTotalSize, AdditionalHeaders, UploadURL, CurrentPosition) - - StartOfErrorCodes = 400; - EndOfFailureCodes = 600; - StartOfSuccessCodes = 200; - EndOfSuccessCodes = 300; - Redirection = 308; - - If Response.StatusCode >= StartOfErrorCodes And Response.StatusCode < EndOfFailureCodes Then - - StreamHeader = "bytes */" + StrTotalSize; - AdditionalHeaders.Insert("Content-Range" , StreamHeader); - - CheckResponse = OPI_Tools.Put(UploadURL, "", AdditionalHeaders, False, True); - - If CheckResponse.StatusCode >= StartOfSuccessCodes And CheckResponse.StatusCode < EndOfSuccessCodes Then - - OPI_Tools.ProcessResponse(CheckResponse); - Return CheckResponse; - - ElseIf CheckResponse.StatusCode = Redirection Then - - UploadedData = Response.Headers["Range"]; - - Otherwise - - OPI_Tools.ProcessResponse(Response); - Return Response; - - EndIf; - - Otherwise - UploadedData = Response.Headers["Range"]; - EndIf; - - If Not ValueFilled(UploadedData) Then - OPI_Tools.ProcessResponse(Response); - Return Response; - EndIf; - - UploadedData = StringReplace(UploadedData, "bytes=", ""); - ArrayOfInformation = StrSplit(UploadedData, "-", False); - PartsRequired = 2; - - If Not ArrayOfInformation.Quantity() = PartsRequired Then - OPI_Tools.ProcessResponse(Response); - Return Response; - EndIf; - - CurrentPosition = Number(ArrayOfInformation[1]) + 1; - - Return ""; - + +StartOfErrorCodes = 400; +EndOfFailureCodes = 600; +StartOfSuccessCodes = 200; +EndOfSuccessCodes = 300; +Redirection = 308; + +If Response.StatusCode >= StartOfErrorCodes And Response.StatusCode < EndOfFailureCodes Then + +StreamHeader = "bytes */" + StrTotalSize; +AdditionalHeaders.Insert("Content-Range" , StreamHeader); + +CheckResponse = OPI_Tools.Put(UploadURL, "", AdditionalHeaders, False, True); + +If CheckResponse.StatusCode >= StartOfSuccessCodes And CheckResponse.StatusCode < EndOfSuccessCodes Then + +OPI_Tools.ProcessResponse(CheckResponse); +Return CheckResponse; + +ElsIf CheckResponse.StatusCode = Redirection Then + +UploadedData = Response.Headers["Range"]; + +Else + +OPI_Tools.ProcessResponse(Response); +Return Response; + +EndIf; + +Else +UploadedData = Response.Headers["Range"]; +EndIf; + +If Not ValueIsFilled(UploadedData) Then +OPI_Tools.ProcessResponse(Response); +Return Response; +EndIf; + +UploadedData = StringReplace(UploadedData, "bytes=", ""); +ArrayOfInformation = StrSplit(UploadedData, "-", False); +PartsRequired = 2; + +If Not ArrayOfInformation.Quantity() = PartsRequired Then +OPI_Tools.ProcessResponse(Response); +Return Response; +EndIf; + +CurrentPosition = Number(ArrayOfInformation[1]) + 1; + +Return ""; + EndFunction #EndRegion diff --git a/src/en/OPI/src/CommonModules/OPI_GoogleDrive/OPI_GoogleDrive.mdo b/src/en/OPI/src/CommonModules/OPI_GoogleDrive/OPI_GoogleDrive.mdo index 696a3a5326..854d38a3a1 100644 --- a/src/en/OPI/src/CommonModules/OPI_GoogleDrive/OPI_GoogleDrive.mdo +++ b/src/en/OPI/src/CommonModules/OPI_GoogleDrive/OPI_GoogleDrive.mdo @@ -1,11 +1,11 @@ - + - OPI_GoogleDrive - - - OPI google drive - - true - true - true +OPI_GoogleDrive + + +OPI google drive + +true +true +true diff --git a/src/en/OPI/src/CommonModules/OPI_GoogleSheets/Module.bsl b/src/en/OPI/src/CommonModules/OPI_GoogleSheets/Module.bsl index 9c2748af34..950e159927 100644 --- a/src/en/OPI/src/CommonModules/OPI_GoogleSheets/Module.bsl +++ b/src/en/OPI/src/CommonModules/OPI_GoogleSheets/Module.bsl @@ -38,90 +38,90 @@ // CreateBook // Creates a new book -// +// // Parameters: -// Token - String - Token - token -// Name - String - Name - title -// ArrayOfSheetNames - Array of Strings - Array of names to add new sheets to the book - sheets -// +// Token - String - Token - token +// Name - String - Name - title +// ArrayOfSheetNames - Array of Strings - Array of names to add new sheets to the book - sheets +// // Return value: -// Key-Value Pair - serialized JSON response from Google +// Key-Value Pair - serialized JSON response from Google Function CreateBook(Val Token, Val Name, Val ArrayOfSheetNames) Export - - OPI_TypeConversion.GetLine(Name); - OPI_TypeConversion.GetCollection(ArrayOfSheetNames); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://sheets.googleapis.com/v4/spreadsheets"; - - Properties = New Structure("title" , Name); - Sheets = New Array; - - FillSheetArray(ArrayOfSheetNames, Sheets); - - Parameters = New Structure; - OPI_Tools.AddField("properties", Properties, "Collection", Parameters); - OPI_Tools.AddField("sheets" , Sheets , "Collection", Parameters); - - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; + +OPI_TypeConversion.GetLine(Name); +OPI_TypeConversion.GetCollection(ArrayOfSheetNames); + +Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); +URL = "https://sheets.googleapis.com/v4/spreadsheets"; + +Properties = New Structure("title" , Name); +Sheets = New Array; + +FillSheetArray(ArrayOfSheetNames, Sheets); + +Parameters = New Structure; +OPI_Tools.AddField("properties", Properties, "Collection", Parameters); +OPI_Tools.AddField("sheets" , Sheets , "Collection", Parameters); + +Response = OPI_Tools.Post(URL, Parameters, Headers); + +Return Response; EndFunction // GetBook // Gets information about the book by ID -// +// // Parameters: -// Token - String - Token - token -// Identifier - String - BookIdentifier - spreadsheet -// +// Token - String - Token - token +// Identifier - String - BookIdentifier - spreadsheet +// // Return value: -// Key-Value Pair - serialized JSON response from Google +// Key-Value Pair - serialized JSON response from Google Function GetBook(Val Token, Val Identifier) Export - OPI_TypeConversion.GetLine(Identifier); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://sheets.googleapis.com/v4/spreadsheets/" + Identifier; - - Response = OPI_Tools.Get(URL, , Headers); - - Return Response; +OPI_TypeConversion.GetLine(Identifier); + +Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); +URL = "https://sheets.googleapis.com/v4/spreadsheets/" + Identifier; + +Response = OPI_Tools.Get(URL, , Headers); + +Return Response; EndFunction // ChangeBookName // Changes the name of the existing book -// +// // Parameters: -// Token - String - Token - token -// Book - String - BookID - spreadsheet -// Name - String - New name - title -// +// Token - String - Token - token +// Book - String - BookID - spreadsheet +// Name - String - New name - title +// // Return value: -// Key-Value Pair - serialized JSON response from Google +// Key-Value Pair - serialized JSON response from Google Function EditBookTitle(Val Token, Val Book, Val Name) Export - - OPI_TypeConversion.GetLine(Book); - OPI_TypeConversion.GetLine(Name); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://sheets.googleapis.com/v4/spreadsheets/" + Book + ":batchUpdate"; - - Change = New Structure("title", Name); - ChangeRequest = New Structure("properties,fields", Change, "title"); - Request = New Structure("updateSpreadsheetProperties", ChangeRequest); - - ArrayOfRequests = New Array; - ArrayOfRequests.Add(Request); - - Parameters = New Structure("requests", ArrayOfRequests); - - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - + +OPI_TypeConversion.GetLine(Book); +OPI_TypeConversion.GetLine(Name); + +Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); +URL = "https://sheets.googleapis.com/v4/spreadsheets/" + Book + ":batchUpdate"; + +Change = New Structure("title", Name); +ChangeRequest = New Structure("properties,fields", Change, "title"); +Request = New Structure("updateSpreadsheetProperties", ChangeRequest); + +ArrayOfRequests = New Array; +ArrayOfRequests.Add(Request); + +Parameters = New Structure("requests", ArrayOfRequests); + +Response = OPI_Tools.Post(URL, Parameters, Headers); + +Return Response; + EndFunction #EndRegion @@ -130,95 +130,95 @@ EndFunction // AddSheet // Adds a new sheet to the book -// -// +// +// // Parameters: -// Token - String - Token - token -// Book - String - BookIdentifier - spreadsheet -// Name - String - NewSheetName - title -// +// Token - String - Token - token +// Book - String - BookIdentifier - spreadsheet +// Name - String - NewSheetName - title +// // Return value: -// Key-Value Pair - serialized JSON response from Google +// Key-Value Pair - serialized JSON response from Google Function AddSheet(Val Token, Val Book, Val Name) Export - - OPI_TypeConversion.GetLine(Book); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://sheets.googleapis.com/v4/spreadsheets/" + Book + ":batchUpdate"; - Sheet = CreateSheet(Name); - - Requests = New Array; - Change = New Structure("addSheet", Sheet); - Requests.Add(Change); - - Parameters = New Structure("requests", Requests); - - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; + +OPI_TypeConversion.GetLine(Book); + +Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); +URL = "https://sheets.googleapis.com/v4/spreadsheets/" + Book + ":batchUpdate"; +Sheet = CreateSheet(Name); + +Requests = New Array; +Change = New Structure("addSheet", Sheet); +Requests.Add(Change); + +Parameters = New Structure("requests", Requests); + +Response = OPI_Tools.Post(URL, Parameters, Headers); + +Return Response; EndFunction // DeleteSheet // Deletes a sheet from the book -// +// // Parameters: -// Token - String - Token - token -// Book - String - BookIdentifier - spreadsheet -// Sheet - String - IdentifierOfSheetToDelete - sheet -// +// Token - String - Token - token +// Book - String - BookIdentifier - spreadsheet +// Sheet - String - IdentifierOfSheetToDelete - sheet +// // Return value: -// Key-Value Pair - serialized JSON response from Google +// Key-Value Pair - serialized JSON response from Google Function DeleteSheet(Val Token, Val Book, Val Sheet) Export - - OPI_TypeConversion.GetLine(Book); - OPI_TypeConversion.GetLine(Sheet); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://sheets.googleapis.com/v4/spreadsheets/" + Book + ":batchUpdate"; - - Requests = New Array; - Sheet = New Structure("sheetId" , Sheet); - Change = New Structure("deleteSheet", Sheet); - Requests.Add(Change); - - Parameters = New Structure("requests", Requests); - - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; + +OPI_TypeConversion.GetLine(Book); +OPI_TypeConversion.GetLine(Sheet); + +Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); +URL = "https://sheets.googleapis.com/v4/spreadsheets/" + Book + ":batchUpdate"; + +Requests = New Array; +Sheet = New Structure("sheetId" , Sheet); +Change = New Structure("deleteSheet", Sheet); +Requests.Add(Change); + +Parameters = New Structure("requests", Requests); + +Response = OPI_Tools.Post(URL, Parameters, Headers); + +Return Response; EndFunction // CopySheet // Copies a sheet from one book to another -// +// // Parameters: -// Token - String - Token - token -// From - String - SourceBookID - from -// To - String - DestinationBookID - to -// Sheet - String - CopiedSheetID - sheet -// +// Token - String - Token - token +// From - String - SourceBookID - from +// To - String - DestinationBookID - to +// Sheet - String - CopiedSheetID - sheet +// // Return value: -// Key-Value Pair - serialized JSON response from Google +// Key-Value Pair - serialized JSON response from Google Function CopySheet(Val Token, Val From, Val To, Val Sheet) Export - - OPI_TypeConversion.GetLine(From); - OPI_TypeConversion.GetLine(To); - OPI_TypeConversion.GetLine(Sheet); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://sheets.googleapis.com/v4/spreadsheets/" - + From - + "/sheets/" - + Sheet - + ":copyTo"; - - Parameters = New Structure("destinationSpreadsheetId", To); - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - + +OPI_TypeConversion.GetLine(From); +OPI_TypeConversion.GetLine(To); +OPI_TypeConversion.GetLine(Sheet); + +Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); +URL = "https://sheets.googleapis.com/v4/spreadsheets/" ++ From ++ "/sheets/" ++ Sheet ++ ":copyTo"; + +Parameters = New Structure("destinationSpreadsheetId", To); +Response = OPI_Tools.Post(URL, Parameters, Headers); + +Return Response; + EndFunction #EndRegion @@ -227,105 +227,105 @@ EndFunction // SetCellValues // Sets sheet cell values -// +// // Parameters: -// Token - String - Token - token -// Book - String - BookID - spreadsheet -// ValueMapping - Key-Value Pair - Fill data where the key is the cell name like A1 - data -// Sheet - String - Name лиwithта (перinый лиwithт по умолчанию) - sheetname -// MajorDimension - String - Main dimension when filling the array range - dim -// +// Token - String - Token - token +// Book - String - BookID - spreadsheet +// ValueMapping - Key-Value Pair - Fill data where the key is the cell name like A1 - data +// Sheet - String - Name лиwithта (перinый лиwithт по умолчанию) - sheetname +// MajorDimension - String - Main dimension when filling the array range - dim +// // Return value: -// Key-Value Pair - serialized JSON response from Google +// Key-Value Pair - serialized JSON response from Google Function SetCellValues(Val Token - , Val Book - , Val ValueMapping - , Val Sheet = "" - , Val MajorDimension = "COLUMNS") Export - - OPI_TypeConversion.GetLine(Book); - OPI_TypeConversion.GetCollection(ValueMapping); - - If Not TypeValue(ValueMapping) = Type("Structure") - And Not TypeValue(ValueMapping) = Type("Match") Then - Return "Failed to convert the structure of values to a collection"; - EndIf; - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://sheets.googleapis.com/v4/spreadsheets/" + Book + "/values:batchUpdate"; - Data array = FormCellDataArray(ValueMapping, MajorDimension, Sheet); +, Val Book +, Val ValueMapping +, Val Sheet = "" +, Val MajorDimension = "COLUMNS") Export + +OPI_TypeConversion.GetLine(Book); +OPI_TypeConversion.GetCollection(ValueMapping); + +If Not TypeValue(ValueMapping) = Type("Structure") +And Not TypeValue(ValueMapping) = Type("Match") Then +Return "Failed to convert the structure of values to a collection"; +EndIf; + +Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); +URL = "https://sheets.googleapis.com/v4/spreadsheets/" + Book + "/values:batchUpdate"; +Data array = FormCellDataArray(ValueMapping, MajorDimension, Sheet); + +Parameters = New Structure("data,valueInputOption", Data array, "USER_ENTERED"); +Response = OPI_Tools.Post(URL, Parameters, Headers); + +Return Response; - Parameters = New Structure("data,valueInputOption", Data array, "USER_ENTERED"); - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - EndFunction // Clear cells // Clears the value in cells -// +// // Parameters: -// Token - String - Token - token -// Book - String - BookID - spreadsheet -// Cell array - Array of Strings - Array of cells like A1 to be cleared - cells -// Sheet - String - Name лиwithта (перinый лиwithт по умолчанию) - sheetname -// +// Token - String - Token - token +// Book - String - BookID - spreadsheet +// Cell array - Array of Strings - Array of cells like A1 to be cleared - cells +// Sheet - String - Name лиwithта (перinый лиwithт по умолчанию) - sheetname +// // Return value: -// Key-Value Pair - serialized JSON response from Google +// Key-Value Pair - serialized JSON response from Google Function ClearCells(Val Token, Val Book, Val Cell array, Val Sheet = "") Export - - OPI_TypeConversion.GetLine(Book); - OPI_TypeConversion.GetCollection(Cell array); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://sheets.googleapis.com/v4/spreadsheets/" + Book + "/values:batchClear"; - - FormCellNameArray(Cell array, Sheet); - - Parameters = New Structure("ranges", Cell array); - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - + +OPI_TypeConversion.GetLine(Book); +OPI_TypeConversion.GetCollection(Cell array); + +Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); +URL = "https://sheets.googleapis.com/v4/spreadsheets/" + Book + "/values:batchClear"; + +FormCellNameArray(Cell array, Sheet); + +Parameters = New Structure("ranges", Cell array); +Response = OPI_Tools.Post(URL, Parameters, Headers); + +Return Response; + EndFunction // Get cell values // Gets cell values of the table -// +// // Parameters: -// Token - String - Token - token -// Book - String - BookID - spreadsheet -// Cell array - Array of Strings - Array ячееto inиdа А1 for получения (inеwithь лиwithт, еwithли не заполнено) - cells -// Sheet - String - Name лиwithта (перinый лиwithт по умолчанию) - sheetname -// +// Token - String - Token - token +// Book - String - BookID - spreadsheet +// Cell array - Array of Strings - Array ячееto inиdа А1 for получения (inеwithь лиwithт, еwithли не заполнено) - cells +// Sheet - String - Name лиwithта (перinый лиwithт по умолчанию) - sheetname +// // Return value: -// Key-Value Pair - serialized JSON response from Google +// Key-Value Pair - serialized JSON response from Google Function GetCellValues(Val Token, Val Book, Val Cell array = "", Val Sheet = "") Export - - OPI_TypeConversion.GetLine(Book); - - Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); - URL = "https://sheets.googleapis.com/v4/spreadsheets/" + Book + "/values:batchGet"; - - If ValueFilled(Cell array) Then - OPI_TypeConversion.GetCollection(Cell array); - FormCellNameArray(Cell array, Sheet); - - First = True; - For Each Cell Of Cell array Loop - Delimiter = ?(First, "?", "&"); - URL = URL + Delimiter + "ranges=" + Cell; - First = False; - EndOfLoop; - Otherwise - URL = URL + "?ranges='" + Sheet + "'"; - EndIf; - - Response = OPI_Tools.Get(URL, , Headers); - - Return Response; - + +OPI_TypeConversion.GetLine(Book); + +Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token); +URL = "https://sheets.googleapis.com/v4/spreadsheets/" + Book + "/values:batchGet"; + +If ValueIsFilled(Cell array) Then +OPI_TypeConversion.GetCollection(Cell array); +FormCellNameArray(Cell array, Sheet); + +First = True; +For Each Cell In Cell array Do +Delimiter = ?(First, "?", "&"); +URL = URL + Delimiter + "ranges=" + Cell; +First = False; +EndDo; +Else +URL = URL + "?ranges='" + Sheet + "'"; +EndIf; + +Response = OPI_Tools.Get(URL, , Headers); + +Return Response; + EndFunction #EndRegion @@ -335,75 +335,75 @@ EndFunction #Region ServiceProceduresAndFunctions Procedure FillSheetArray(Val ArrayOfNames, SheetArray) - - For Each SheetName Of ArrayOfNames Loop - - Sheet = CreateSheet(SheetName); - SheetArray.Add(Sheet); - - EndOfLoop; + +For Each SheetName In ArrayOfNames Do + +Sheet = CreateSheet(SheetName); +SheetArray.Add(Sheet); + +EndDo; EndProcedure Procedure AddSheetName(Cell, Val Sheet) - - If ValueFilled(Sheet) Then - Cell = "'" + Sheet + "'!" + Cell; - EndIf; - + +If ValueIsFilled(Sheet) Then +Cell = "'" + Sheet + "'!" + Cell; +EndIf; + EndProcedure Function CreateSheet(Val Name) - - OPI_TypeConversion.GetLine(Name); - - Sheet properties = New Structure("title" , Name); - Sheet = New Structure("properties", Sheet properties); - Return Sheet; - +OPI_TypeConversion.GetLine(Name); + +Sheet properties = New Structure("title" , Name); +Sheet = New Structure("properties", Sheet properties); + +Return Sheet; + EndFunction Function FormCellDataArray(Val ValueStructure, Val MajorDimension, Val Sheet) - - OPI_TypeConversion.GetLine(Sheet); - - Data array = New Array; - - For Each CellData Of ValueStructure Loop - - CurrentValue = CellData.Value; - Current key = CellData.Key; - - AddSheetName(Current key, Sheet); - - OPI_TypeConversion.GetArray(CurrentValue); - - Current data = New Match; - Current array = New Array; - - Current array.Add(CurrentValue); - - OPI_Tools.AddField("range" , Current key , "String", Current data); - OPI_Tools.AddField("values" , Current array , "Array", Current data); - OPI_Tools.AddField("majorDimension", MajorDimension, "String", Current data); - - Data array.Add(Current data); - - EndOfLoop; - - Return Data array; - + +OPI_TypeConversion.GetLine(Sheet); + +Data array = New Array; + +For Each CellData In ValueStructure Do + +CurrentValue = CellData.Value; +Current key = CellData.Key; + +AddSheetName(Current key, Sheet); + +OPI_TypeConversion.GetArray(CurrentValue); + +Current data = New Match; +Current array = New Array; + +Current array.Add(CurrentValue); + +OPI_Tools.AddField("range" , Current key , "String", Current data); +OPI_Tools.AddField("values" , Current array , "Array", Current data); +OPI_Tools.AddField("majorDimension", MajorDimension, "String", Current data); + +Data array.Add(Current data); + +EndDo; + +Return Data array; + EndFunction Procedure FormCellNameArray(Val ArrayOfNames, Val Sheet) - OPI_TypeConversion.GetLine(Sheet); - - For N = 0 by ArrayOfNames.WithinBoundary() Loop - AddSheetName(ArrayOfNames[N], Sheet); - EndOfLoop; - +OPI_TypeConversion.GetLine(Sheet); + +For N = 0 For ArrayOfNames.WithinBoundary() Do +AddSheetName(ArrayOfNames[N], Sheet); +EndDo; + EndProcedure #EndRegion diff --git a/src/en/OPI/src/CommonModules/OPI_GoogleSheets/OPI_GoogleSheets.mdo b/src/en/OPI/src/CommonModules/OPI_GoogleSheets/OPI_GoogleSheets.mdo index c26710fdc3..e6f8ac0c0d 100644 --- a/src/en/OPI/src/CommonModules/OPI_GoogleSheets/OPI_GoogleSheets.mdo +++ b/src/en/OPI/src/CommonModules/OPI_GoogleSheets/OPI_GoogleSheets.mdo @@ -1,11 +1,11 @@ - + - OPI_GoogleSheets - - - OPI google sheets - - true - true - true +OPI_GoogleSheets + + +OPI google sheets + +true +true +true diff --git a/src/en/OPI/src/CommonModules/OPI_GoogleWorkspace/Module.bsl b/src/en/OPI/src/CommonModules/OPI_GoogleWorkspace/Module.bsl index 7161529741..22b9b2213b 100644 --- a/src/en/OPI/src/CommonModules/OPI_GoogleWorkspace/Module.bsl +++ b/src/en/OPI/src/CommonModules/OPI_GoogleWorkspace/Module.bsl @@ -36,98 +36,98 @@ // Generate code retrieval link // Returns URL for browser authorization -// +// // Parameters: -// ClientID - String - Client ID - id -// Calendar - Boolean - Calendar methods permission - calendar -// Drive - Boolean - Drive methods permission - drive -// Sheets - Boolean - Sheets methods permission - sheets -// +// ClientID - String - Client ID - id +// Calendar - Boolean - Calendar methods permission - calendar +// Drive - Boolean - Drive methods permission - drive +// Sheets - Boolean - Sheets methods permission - sheets +// // Return value: -// String - Code retrieval link +// String - Code retrieval link Function FormCodeRetrievalLink(Val ClientID - , Val Calendar = True - , Val Drive = True - , Val Sheets = True) Export - - OPI_TypeConversion.GetLine(ClientID); - OPI_TypeConversion.GetBoolean(Calendar); - OPI_TypeConversion.GetBoolean(Sheets); - OPI_TypeConversion.GetBoolean(Drive); - - URL = "https://accounts.google.com/o/oauth2/auth"; - - URLParameters = New Structure; - URLParameters.Insert("response_type", "code"); - URLParameters.Insert("client_id" , ClientID); - URLParameters.Insert("redirect_uri" , "http://localhost"); - URLParameters.Insert("access_type" , "offline"); - URLParameters.Insert("scope" , GetPermissionsList(Calendar, Drive, Sheets)); - - URL = URL + OPI_Tools.RequestParametersToString(URLParameters); - - Return URL; - +, Val Calendar = True +, Val Drive = True +, Val Sheets = True) Export + +OPI_TypeConversion.GetLine(ClientID); +OPI_TypeConversion.GetBoolean(Calendar); +OPI_TypeConversion.GetBoolean(Sheets); +OPI_TypeConversion.GetBoolean(Drive); + +URL = "https://accounts.google.com/o/oauth2/auth"; + +URLParameters = New Structure; +URLParameters.Insert("response_type", "code"); +URLParameters.Insert("client_id" , ClientID); +URLParameters.Insert("redirect_uri" , "http://localhost"); +URLParameters.Insert("access_type" , "offline"); +URLParameters.Insert("scope" , GetPermissionsList(Calendar, Drive, Sheets)); + +URL = URL + OPI_Tools.RequestParametersToString(URLParameters); + +Return URL; + EndFunction // Get token by code // Gets token by code from browser authorization -// +// // Parameters: -// ClientID - String - Client ID - id -// ClientSecret - String - Client secret - secret -// Code - String - Code from browser - code -// +// ClientID - String - Client ID - id +// ClientSecret - String - Client secret - secret +// Code - String - Code from browser - code +// // Return value: -// Key-Value Pair - serialized JSON response from Google +// Key-Value Pair - serialized JSON response from Google Function GetTokenByCode(Val ClientID, Val ClientSecret, Val Code) Export - - OPI_TypeConversion.GetLine(ClientID); - OPI_TypeConversion.GetLine(ClientSecret); - OPI_TypeConversion.GetLine(Code); - - URL = "https://accounts.google.com/o/oauth2/token"; - - URLParameters = New Structure; - URLParameters.Insert("grant_type" , "authorization_code"); - URLParameters.Insert("client_id" , ClientID); - URLParameters.Insert("client_secret", ClientSecret); - URLParameters.Insert("redirect_uri" , "http://localhost"); - URLParameters.Insert("code" , Code); - - Response = OPI_Tools.Post(URL, URLParameters, , False); - - Return Response; + +OPI_TypeConversion.GetLine(ClientID); +OPI_TypeConversion.GetLine(ClientSecret); +OPI_TypeConversion.GetLine(Code); + +URL = "https://accounts.google.com/o/oauth2/token"; + +URLParameters = New Structure; +URLParameters.Insert("grant_type" , "authorization_code"); +URLParameters.Insert("client_id" , ClientID); +URLParameters.Insert("client_secret", ClientSecret); +URLParameters.Insert("redirect_uri" , "http://localhost"); +URLParameters.Insert("code" , Code); + +Response = OPI_Tools.Post(URL, URLParameters, , False); + +Return Response; EndFunction // Refresh token // Updates token by Refresh token -// +// // Parameters: -// ClientID - String - Client ID - id -// ClientSecret - String - Client secret - secret -// RefreshToken - String - Refresh token - refresh -// +// ClientID - String - Client ID - id +// ClientSecret - String - Client secret - secret +// RefreshToken - String - Refresh token - refresh +// // Return value: -// Key-Value Pair - serialized JSON response from Google +// Key-Value Pair - serialized JSON response from Google Function RefreshToken(Val ClientID, Val ClientSecret, Val RefreshToken) Export - - OPI_TypeConversion.GetLine(ClientID); - OPI_TypeConversion.GetLine(ClientSecret); - OPI_TypeConversion.GetLine(RefreshToken); - - URL = "https://accounts.google.com/o/oauth2/token"; - - URLParameters = New Structure; - URLParameters.Insert("grant_type" , "refresh_token"); - URLParameters.Insert("client_id" , ClientID); - URLParameters.Insert("client_secret", ClientSecret); - URLParameters.Insert("refresh_token", RefreshToken); - - Response = OPI_Tools.Post(URL, URLParameters, , False); - - Return Response; + +OPI_TypeConversion.GetLine(ClientID); +OPI_TypeConversion.GetLine(ClientSecret); +OPI_TypeConversion.GetLine(RefreshToken); + +URL = "https://accounts.google.com/o/oauth2/token"; + +URLParameters = New Structure; +URLParameters.Insert("grant_type" , "refresh_token"); +URLParameters.Insert("client_id" , ClientID); +URLParameters.Insert("client_secret", ClientSecret); +URLParameters.Insert("refresh_token", RefreshToken); + +Response = OPI_Tools.Post(URL, URLParameters, , False); + +Return Response; EndFunction @@ -136,14 +136,14 @@ EndFunction #Region ServiceProgramInterface Function GetAuthorizationHeader(Val Token) Export - - OPI_TypeConversion.GetLine(Token); - - Headers = New Match; - Headers.Insert("Authorization", "Bearer " + Token); - - Return Headers; - + +OPI_TypeConversion.GetLine(Token); + +Headers = New Match; +Headers.Insert("Authorization", "Bearer " + Token); + +Return Headers; + EndFunction #EndRegion @@ -151,23 +151,23 @@ EndFunction #Region ServiceProceduresAndFunctions Function GetPermissionsList(Calendar, Drive, Sheets) - - Permissions array = New Array; - - If Calendar Then - Permissions array.Add("https://www.googleapis.com/auth/calendar"); - EndIf; - - If Drive Then - Permissions array.Add("https://www.googleapis.com/auth/drive"); - EndIf; - - If Sheets Then - Permissions array.Add("https://www.googleapis.com/auth/spreadsheets"); - EndIf; - - Return StrJoin(Permissions array, " "); - + +Permissions array = New Array; + +If Calendar Then +Permissions array.Add("https://www.googleapis.com/auth/calendar"); +EndIf; + +If Drive Then +Permissions array.Add("https://www.googleapis.com/auth/drive"); +EndIf; + +If Sheets Then +Permissions array.Add("https://www.googleapis.com/auth/spreadsheets"); +EndIf; + +Return StrJoin(Permissions array, " "); + EndFunction #EndRegion diff --git a/src/en/OPI/src/CommonModules/OPI_GoogleWorkspace/OPI_GoogleWorkspace.mdo b/src/en/OPI/src/CommonModules/OPI_GoogleWorkspace/OPI_GoogleWorkspace.mdo index 45fb1957ce..a67c47fbb6 100644 --- a/src/en/OPI/src/CommonModules/OPI_GoogleWorkspace/OPI_GoogleWorkspace.mdo +++ b/src/en/OPI/src/CommonModules/OPI_GoogleWorkspace/OPI_GoogleWorkspace.mdo @@ -1,11 +1,11 @@ - + - OPI_GoogleWorkspace - - - OPI google workspace - - true - true - true +OPI_GoogleWorkspace + + +OPI google workspace + +true +true +true diff --git a/src/en/OPI/src/CommonModules/OPI_Notion/Module.bsl b/src/en/OPI/src/CommonModules/OPI_Notion/Module.bsl index f62fa39b40..a29adca305 100644 --- a/src/en/OPI/src/CommonModules/OPI_Notion/Module.bsl +++ b/src/en/OPI/src/CommonModules/OPI_Notion/Module.bsl @@ -42,156 +42,156 @@ // Create page // Creates a child page above another parent page -// +// // Parameters: -// Token - String - Token - token -// Parent - String - Parent ID - page -// Title - String - Page title - title -// +// Token - String - Token - token +// Parent - String - Parent ID - page +// Title - String - Page title - title +// // Return value: -// Key-Value Pair - Serialized JSON response from Notion +// Key-Value Pair - Serialized JSON response from Notion Function CreatePage(Val Token, Val Parent, Val Title) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Parent); - OPI_TypeConversion.GetLine(Title); - - Headers = CreateRequestHeaders(Token); - Properties = New Structure; - Parameters = New Structure; - - AddPageHeader(Title, Properties); - AddPageParent(Parent, False, Parameters); - - Parameters.Insert("properties", Properties); - - Response = OPI_Tools.Post("https://api.notion.com/v1/pages", Parameters, Headers); - - Return Response; - + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(Parent); +OPI_TypeConversion.GetLine(Title); + +Headers = CreateRequestHeaders(Token); +Properties = New Structure; +Parameters = New Structure; + +AddPageHeader(Title, Properties); +AddPageParent(Parent, False, Parameters); + +Parameters.Insert("properties", Properties); + +Response = OPI_Tools.Post("https://api.notion.com/v1/pages", Parameters, Headers); + +Return Response; + EndFunction // Create page in database // Creates a page in the parent database -// +// // Parameters: -// Token - String - Token - token -// Parent - String - Parent database ID - base -// Data - Key-Value Pair - Properties match - data -// +// Token - String - Token - token +// Parent - String - Parent database ID - base +// Data - Key-Value Pair - Properties match - data +// // Return value: -// Key-Value Pair - Serialized JSON response from Notion +// Key-Value Pair - Serialized JSON response from Notion Function CreatePageInDatabase(Val Token, Val Parent, Val Data) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Parent); - OPI_TypeConversion.GetCollection(Data); - - Headers = CreateRequestHeaders(Token); - Parameters = New Structure; - - AddPageParent(Parent, True, Parameters); - Properties = FillDataBySchema(Parent, Data, Token); - Parameters.Insert("properties", Properties); - - Response = OPI_Tools.Post("https://api.notion.com/v1/pages", Parameters, Headers); - - Return Response; - +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(Parent); +OPI_TypeConversion.GetCollection(Data); + +Headers = CreateRequestHeaders(Token); +Parameters = New Structure; + +AddPageParent(Parent, True, Parameters); + +Properties = FillDataBySchema(Parent, Data, Token); +Parameters.Insert("properties", Properties); + +Response = OPI_Tools.Post("https://api.notion.com/v1/pages", Parameters, Headers); + +Return Response; + EndFunction // Get page // Gets information about the page by ID -// +// // Parameters: -// Token - String - Token - token -// Page - String - Page ID - page -// +// Token - String - Token - token +// Page - String - Page ID - page +// // Return value: -// Key-Value Pair - Serialized JSON response from Notion +// Key-Value Pair - Serialized JSON response from Notion Function GetPage(Val Token, Val Page) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Page); - - Headers = CreateRequestHeaders(Token); - ConvertID(Page); - - Response = OPI_Tools.Get("https://api.notion.com/v1/pages/" + Page, , Headers); - - Return Response; - + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(Page); + +Headers = CreateRequestHeaders(Token); +ConvertID(Page); + +Response = OPI_Tools.Get("https://api.notion.com/v1/pages/" + Page, , Headers); + +Return Response; + EndFunction // Edit page properties. -// +// // Parameters: -// Token - String - Token - token -// Page - String - ID of the page being modified - page -// Data - Key-Value Pair - Matching of editable parameters - data -// Icon - String - URL of the page icon image - icon -// Cover - String - URL of the page cover image - cover -// Archived - Boolean - Archive page or нет (boolean) - archive -// +// Token - String - Token - token +// Page - String - ID of the page being modified - page +// Data - Key-Value Pair - Matching of editable parameters - data +// Icon - String - URL of the page icon image - icon +// Cover - String - URL of the page cover image - cover +// Archived - Boolean - Archive page or нет (boolean) - archive +// // Return value: -// Key-Value Pair - Serialized JSON response from Notion +// Key-Value Pair - Serialized JSON response from Notion Function EditPageProperties(Val Token - , Val Page - , Val Data = "" - , Val Icon = "" - , Val Cover = "" - , Val Archived = False) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Page); - OPI_TypeConversion.GetLine(Icon); - OPI_TypeConversion.GetLine(Cover); - OPI_TypeConversion.GetBoolean(Archived); - OPI_TypeConversion.GetCollection(Data); - - Headers = CreateRequestHeaders(Token); - Parameters = New Structure; - Files = "files"; - - If ValueFilled(Data) - And (TypeValue(Data) = Type("Match") Or TypeValue(Data) = Type("Structure")) Then - Properties = FillDataBySchema(Page, Data, Token, False); - Otherwise - Properties = New Match; - EndIf; - - If ValueFilled(Icon) Then - Icon match = New Match; - Icon match.Insert("Icon", Icon); - - Icon object = ConvertValueByType(Files, Icon match); - Icon object = Icon object[Files][0]; - Icon object.Delete("name"); - - Parameters.Insert("icon", Icon object); - EndIf; - - If ValueFilled(Cover) Then - Cover match = New Match; - Cover match.Insert("Cover", Cover); +, Val Page +, Val Data = "" +, Val Icon = "" +, Val Cover = "" +, Val Archived = False) Export - Cover object = ConvertValueByType(Files, Cover match); - Cover object = Cover object[Files][0]; - Cover object.Delete("name"); +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(Page); +OPI_TypeConversion.GetLine(Icon); +OPI_TypeConversion.GetLine(Cover); +OPI_TypeConversion.GetBoolean(Archived); +OPI_TypeConversion.GetCollection(Data); - Parameters.Insert("cover", Cover object); - EndIf; +Headers = CreateRequestHeaders(Token); +Parameters = New Structure; +Files = "files"; - Parameters.Insert("properties", Properties); - Parameters.Insert("archived" , Archived); - - ConvertID(Page); +If ValueIsFilled(Data) +And (TypeValue(Data) = Type("Match") Or TypeValue(Data) = Type("Structure")) Then +Properties = FillDataBySchema(Page, Data, Token, False); +Else +Properties = New Match; +EndIf; + +If ValueIsFilled(Icon) Then +Icon match = New Match; +Icon match.Insert("Icon", Icon); + +Icon object = ConvertValueByType(Files, Icon match); +Icon object = Icon object[Files][0]; +Icon object.Delete("name"); + +Parameters.Insert("icon", Icon object); +EndIf; + +If ValueIsFilled(Cover) Then +Cover match = New Match; +Cover match.Insert("Cover", Cover); + +Cover object = ConvertValueByType(Files, Cover match); +Cover object = Cover object[Files][0]; +Cover object.Delete("name"); + +Parameters.Insert("cover", Cover object); +EndIf; + +Parameters.Insert("properties", Properties); +Parameters.Insert("archived" , Archived); + +ConvertID(Page); + +Response = OPI_Tools.Patch("https://api.notion.com/v1/pages/" + Page, Parameters, Headers); + +Return Response; - Response = OPI_Tools.Patch("https://api.notion.com/v1/pages/" + Page, Parameters, Headers); - - Return Response; - EndFunction #EndRegion @@ -200,287 +200,287 @@ EndFunction // Create database // Creates a database -// +// // Parameters: -// Token - String - Token - token -// Parent - String - Parent page ID - page -// Title - String - Database title - title -// Properties - Structure Of String - Database properties - props -// +// Token - String - Token - token +// Parent - String - Parent page ID - page +// Title - String - Database title - title +// Properties - Structure Of String - Database properties - props +// // Return value: -// Key-Value Pair - Serialized JSON response from Notion +// Key-Value Pair - Serialized JSON response from Notion Function CreateDatabase(Val Token, Val Parent, Val Title, Val Properties = "") Export - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Parent); - OPI_TypeConversion.GetLine(Title); - OPI_TypeConversion.GetCollection(Properties); - - // Example structure/property map - - // Name : title - // Description : rich_text - // In progress : checkbox - // Quantity : number - // Date : date - // Status : Map - // Active : green - // Inactive : red - // Archive : yellow - - // All pages created as children must have parent base properties +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(Parent); +OPI_TypeConversion.GetLine(Title); +OPI_TypeConversion.GetCollection(Properties); - If Not TypeValue(Properties) = Type("Structure") And Not TypeValue(Properties) = Type("Match") Then - Properties = New Structure("Name", "title"); - EndIf; +// Example structure/property map - Headers = CreateRequestHeaders(Token); - Parameters = New Structure; - - AddDatabaseParent(Parent, False, Parameters); - AddDatabaseHeader(Title, Parameters); - AddDatabaseProperties(Properties, Parameters); +// Name : title +// Description : rich_text +// InProgress : checkbox +// Quantity : number +// Date : date +// Status : Match +// Аtoтиinный : green +// Inactive : red +// Архиin : yellow + +// All pages created as children must have parent base properties + +If Not TypeValue(Properties) = Type("Structure") And Not TypeValue(Properties) = Type("Match") Then +Properties = New Structure("Name", "title"); +EndIf; + +Headers = CreateRequestHeaders(Token); +Parameters = New Structure; + +AddDatabaseParent(Parent, False, Parameters); +AddDatabaseHeader(Title, Parameters); +AddDatabaseProperties(Properties, Parameters); + +Response = OPI_Tools.Post("https://api.notion.com/v1/databases", Parameters, Headers); + +Return Response; - Response = OPI_Tools.Post("https://api.notion.com/v1/databases", Parameters, Headers); - - Return Response; - EndFunction // Get database // Get database information -// +// // Parameters: -// Token - String - Token - token -// Base - String - Database ID - base -// +// Token - String - Token - token +// Base - String - Database ID - base +// // Return value: -// Key-Value Pair - Serialized JSON response from Notion +// Key-Value Pair - Serialized JSON response from Notion Function GetDatabase(Val Token, Val Base) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Base); - - Headers = CreateRequestHeaders(Token); - ConvertID(Base); - - Response = OPI_Tools.Get("https://api.notion.com/v1/databases/" + Base, , Headers); - - Return Response; - + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(Base); + +Headers = CreateRequestHeaders(Token); +ConvertID(Base); + +Response = OPI_Tools.Get("https://api.notion.com/v1/databases/" + Base, , Headers); + +Return Response; + EndFunction // Edit database properties // Edits properties of an existing database -// +// // Parameters: -// Token - String - Token - token -// Base - String - Target database ID - base -// Properties - Map from KeyAndValue - New or modified database properties - props -// Title - String - New database title - title -// Description - String - New database description - description -// +// Token - String - Token - token +// Base - String - Target database ID - base +// Properties - Map from KeyAndValue - New or modified database properties - props +// Title - String - New database title - title +// Description - String - New database description - description +// // Return value: -// Key-Value Pair - Serialized JSON response from Notion +// Key-Value Pair - Serialized JSON response from Notion Function EditDatabaseProperties(Val Token, Val Base, Val Properties = "", Val Title = "", Val Description = "") Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Base); - OPI_TypeConversion.GetLine(Title); - OPI_TypeConversion.GetLine(Description); - OPI_TypeConversion.GetCollection(Properties); - - Parameters = New Structure; - Headers = CreateRequestHeaders(Token); - ConvertID(Base); - - If ValueFilled(Title) Then - AddDatabaseHeader(Title, Parameters); - EndIf; - - If ValueFilled(Description) Then - AddDatabaseDescription(Description, Parameters); - EndIf; - - If TypeValue(Properties) = Type("Structure") Or TypeValue(Properties) = Type("Match") Then - AddDatabaseProperties(Properties, Parameters); - EndIf; - - Response = OPI_Tools.Patch("https://api.notion.com/v1/databases/" + Base, Parameters, Headers); - - Return Response; - + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(Base); +OPI_TypeConversion.GetLine(Title); +OPI_TypeConversion.GetLine(Description); +OPI_TypeConversion.GetCollection(Properties); + +Parameters = New Structure; +Headers = CreateRequestHeaders(Token); +ConvertID(Base); + +If ValueIsFilled(Title) Then +AddDatabaseHeader(Title, Parameters); +EndIf; + +If ValueIsFilled(Description) Then +AddDatabaseDescription(Description, Parameters); +EndIf; + +If TypeValue(Properties) = Type("Structure") Or TypeValue(Properties) = Type("Match") Then +AddDatabaseProperties(Properties, Parameters); +EndIf; + +Response = OPI_Tools.Patch("https://api.notion.com/v1/databases/" + Base, Parameters, Headers); + +Return Response; + EndFunction -#EndRegion +#EndRegion #Region BlockWork // Create block // Creates a new block based on an existing block -// +// // Parameters: -// Token - String - Token - token -// Parent - String - Parent block or page ID - page -// Block - String, Map From KeyAndValue - Block ID or block sample itself - block -// InsertAfter - String - Block ID after which to insert the new one - prev -// +// Token - String - Token - token +// Parent - String - Parent block or page ID - page +// Block - String, Map From KeyAndValue - Block ID or block sample itself - block +// InsertAfter - String - Block ID after which to insert the new one - prev +// // Return value: -// Key-Value Pair - Serialized JSON response from Notion +// Key-Value Pair - Serialized JSON response from Notion Function CreateBlock(Val Token, Val Parent, Val Block, Val InsertAfter = "") Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Parent); - OPI_TypeConversion.GetLine(InsertAfter); - OPI_TypeConversion.GetCollection(Block); - - If TypeValue(Block) = Type("Array") Then - Block = Block[0]; - EndIf; - - Headers = CreateRequestHeaders(Token); - ConvertID(Parent); - - If TypeValue(Block) = Type("String") Then - ConvertID(Block); - Block = ReturnBlock(Token, Block); - EndIf; - - BlockArray = New Array; - BlockArray.Add(Block); - - Parameters = New Match; - Parameters.Insert("children", BlockArray); - - If ValueFilled(InsertAfter) Then - Parameters.Insert("after", InsertAfter); - EndIf; - - URL = "https://api.notion.com/v1/blocks/" + Parent + "/children"; - Response = OPI_Tools.Patch(URL, Parameters, Headers); - - Return Response; - + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(Parent); +OPI_TypeConversion.GetLine(InsertAfter); +OPI_TypeConversion.GetCollection(Block); + +If TypeValue(Block) = Type("Array") Then +Block = Block[0]; +EndIf; + +Headers = CreateRequestHeaders(Token); +ConvertID(Parent); + +If TypeValue(Block) = Type("String") Then +ConvertID(Block); +Block = ReturnBlock(Token, Block); +EndIf; + +BlockArray = New Array; +BlockArray.Add(Block); + +Parameters = New Match; +Parameters.Insert("children", BlockArray); + +If ValueIsFilled(InsertAfter) Then +Parameters.Insert("after", InsertAfter); +EndIf; + +URL = "https://api.notion.com/v1/blocks/" + Parent + "/children"; +Response = OPI_Tools.Patch(URL, Parameters, Headers); + +Return Response; + EndFunction // Inернуть блоto. -// +// // Parameters: -// Token - String - Token - token -// BlockID - String - Block ID - block -// OnlyBase - Boolean - True > service fields are deleted, only the block itself remains - core -// +// Token - String - Token - token +// BlockID - String - Block ID - block +// OnlyBase - Boolean - True > service fields are deleted, only the block itself remains - core +// // Return value: -// Key-Value Pair - Serialized JSON response from Notion +// Key-Value Pair - Serialized JSON response from Notion Function ReturnBlock(Val Token, Val BlockID, Val OnlyBase = True) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(BlockID); - OPI_TypeConversion.GetBoolean(OnlyBase); - - ConvertID(BlockID); - - Headers = CreateRequestHeaders(Token); - Response = OPI_Tools.Get("https://api.notion.com/v1/blocks/" + BlockID, , Headers); - - If OnlyBase Then - RemoveExtraBlockFields(Response); - EndIf; - - Return Response; - + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(BlockID); +OPI_TypeConversion.GetBoolean(OnlyBase); + +ConvertID(BlockID); + +Headers = CreateRequestHeaders(Token); +Response = OPI_Tools.Get("https://api.notion.com/v1/blocks/" + BlockID, , Headers); + +If OnlyBase Then +RemoveExtraBlockFields(Response); +EndIf; + +Return Response; + EndFunction // Return child blocks // Returns list of child blocks of parent block -// +// // Parameters: -// Token - String - Token - token -// BlockID - String - Parent block ID - block -// +// Token - String - Token - token +// BlockID - String - Parent block ID - block +// // Return value: -// Key-Value Pair - Serialized JSON response from Notion +// Key-Value Pair - Serialized JSON response from Notion Function ReturnChildBlocks(Val Token, Val BlockID) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(BlockID); - - ConvertID(BlockID); - - Headers = CreateRequestHeaders(Token); - Response = OPI_Tools.Get("https://api.notion.com/v1/blocks/" + BlockID + "/children", , Headers); - - Return Response; - + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(BlockID); + +ConvertID(BlockID); + +Headers = CreateRequestHeaders(Token); +Response = OPI_Tools.Get("https://api.notion.com/v1/blocks/" + BlockID + "/children", , Headers); + +Return Response; + EndFunction // Delete block // Deletes block by ID -// +// // Parameters: -// Token - String - Token - token -// BlockID - String - Block ID - block -// +// Token - String - Token - token +// BlockID - String - Block ID - block +// // Return value: -// Key-Value Pair - Serialized JSON response from Notion +// Key-Value Pair - Serialized JSON response from Notion Function DeleteBlock(Val Token, Val BlockID) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(BlockID); - - ConvertID(BlockID); - - Headers = CreateRequestHeaders(Token); - Response = OPI_Tools.Delete("https://api.notion.com/v1/blocks/" + BlockID, , Headers); - - Return Response; - + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(BlockID); + +ConvertID(BlockID); + +Headers = CreateRequestHeaders(Token); +Response = OPI_Tools.Delete("https://api.notion.com/v1/blocks/" + BlockID, , Headers); + +Return Response; + EndFunction - + #EndRegion #Region Users // User list // Returns a list of workspace users -// +// // Parameters: -// Token - String - Token - token -// +// Token - String - Token - token +// // Return value: -// Key-Value Pair - Serialized JSON response from Notion +// Key-Value Pair - Serialized JSON response from Notion Function UserList(Val Token) Export - OPI_TypeConversion.GetLine(Token); - - Headers = CreateRequestHeaders(Token); - Response = OPI_Tools.Get("https://api.notion.com/v1/users", , Headers); - - Return Response; - +OPI_TypeConversion.GetLine(Token); + +Headers = CreateRequestHeaders(Token); +Response = OPI_Tools.Get("https://api.notion.com/v1/users", , Headers); + +Return Response; + EndFunction // Get user data // Gets user data by ID -// +// // Parameters: -// Token - String - Token - token -// UserID - String - Target user ID - user -// +// Token - String - Token - token +// UserID - String - Target user ID - user +// // Return value: -// Key-Value Pair - Serialized JSON response from Notion +// Key-Value Pair - Serialized JSON response from Notion Function GetUserData(Val Token, Val UserID) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(UserID); - - ConvertID(UserID); - - Headers = CreateRequestHeaders(Token); - Response = OPI_Tools.Get("https://api.notion.com/v1/users/" + UserID, , Headers); - - Return Response; - + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(UserID); + +ConvertID(UserID); + +Headers = CreateRequestHeaders(Token); +Response = OPI_Tools.Get("https://api.notion.com/v1/users/" + UserID, , Headers); + +Return Response; + EndFunction #EndRegion @@ -490,398 +490,398 @@ EndFunction #Region ServiceProceduresAndFunctions Function CreateRequestHeaders(Val Token) - - OPI_TypeConversion.GetLine(Token); - - Headers = New Match; - Headers.Insert("Authorization" , "Bearer " + Token); - Headers.Insert("Notion-Version", "2022-06-28"); - - Return Headers; - + +OPI_TypeConversion.GetLine(Token); + +Headers = New Match; +Headers.Insert("Authorization" , "Bearer " + Token); +Headers.Insert("Notion-Version", "2022-06-28"); + +Return Headers; + EndFunction Procedure ConvertID(Identifier) - - OPI_TypeConversion.GetLine(Identifier); - - Identifier = StringReplace(Identifier, "-", ""); - + +OPI_TypeConversion.GetLine(Identifier); + +Identifier = StringReplace(Identifier, "-", ""); + EndProcedure Procedure AddPageParent(Val Parent, Val ParentBase, MainStructure) - - OPI_TypeConversion.GetLine(ParentBase); - - ConvertID(Parent); - - IdentifierField = ?(ParentBase, "database_id", "page_id"); - ParentStructure = New Structure(IdentifierField, Parent); - MainStructure.Insert("parent", ParentStructure); - +OPI_TypeConversion.GetLine(ParentBase); + +ConvertID(Parent); + +IdentifierField = ?(ParentBase, "database_id", "page_id"); +ParentStructure = New Structure(IdentifierField, Parent); + +MainStructure.Insert("parent", ParentStructure); + EndProcedure Procedure AddDatabaseParent(Val Parent, Val ParentBase, MainStructure) - - OPI_TypeConversion.GetLine(ParentBase); - - ConvertID(Parent); - - IdentifierField = ?(ParentBase, "database_id", "page_id"); - - ParentStructure = New Structure(); - ParentStructure.Insert("type" , IdentifierField); - ParentStructure.Insert(IdentifierField, Parent); - MainStructure.Insert("parent", ParentStructure); - +OPI_TypeConversion.GetLine(ParentBase); + +ConvertID(Parent); + +IdentifierField = ?(ParentBase, "database_id", "page_id"); + +ParentStructure = New Structure(); +ParentStructure.Insert("type" , IdentifierField); +ParentStructure.Insert(IdentifierField, Parent); + +MainStructure.Insert("parent", ParentStructure); + EndProcedure -Procedure AddPageHeader(Val Title, MainStructure) - - OPI_TypeConversion.GetLine(Title); - - SubordinateStructure = New Structure; - DataStructure = New Structure; - TextStructure = New Structure; - Data array = New Array; - Title = "title"; - - TextStructure.Insert("content", Title); - TextStructure.Insert("link" , Undefined); - - DataStructure.Insert("text", TextStructure); - DataStructure.Insert("type", "text"); - - Data array.Add(DataStructure); - - SubordinateStructure.Insert("id" , Title); - SubordinateStructure.Insert("type" , Title); - SubordinateStructure.Insert(Title , Data array); - - MainStructure.Insert(Title, SubordinateStructure); - +Procedure AddPageHeader(Val Title, MainStructure) + +OPI_TypeConversion.GetLine(Title); + +SubordinateStructure = New Structure; +DataStructure = New Structure; +TextStructure = New Structure; +Data array = New Array; +Title = "title"; + +TextStructure.Insert("content", Title); +TextStructure.Insert("link" , Undefined); + +DataStructure.Insert("text", TextStructure); +DataStructure.Insert("type", "text"); + +Data array.Add(DataStructure); + +SubordinateStructure.Insert("id" , Title); +SubordinateStructure.Insert("type" , Title); +SubordinateStructure.Insert(Title , Data array); + +MainStructure.Insert(Title, SubordinateStructure); + EndProcedure Procedure AddDatabaseHeader(Val Title, MainStructure) - - OPI_TypeConversion.GetLine(Title); - - Title = ConvertHeader(Title); - MainStructure.Insert("title", Title["title"]); - + +OPI_TypeConversion.GetLine(Title); + +Title = ConvertHeader(Title); +MainStructure.Insert("title", Title["title"]); + EndProcedure Procedure AddDatabaseDescription(Val Description, MainStructure) - - OPI_TypeConversion.GetLine(Description); - - Title = ConvertHeader(Description); - MainStructure.Insert("description", Title["title"]); - + +OPI_TypeConversion.GetLine(Description); + +Title = ConvertHeader(Description); +MainStructure.Insert("description", Title["title"]); + EndProcedure Procedure AddDatabaseProperties(Val Properties, MainStructure) - - If Properties.Quantity() = 0 Then - MainStructure.Insert("properties", New Structure); - Return; - EndIf; - - ParameterMap = New Match; - - For Each Property Of Properties Loop - - If TypeValue(Property.Value) = Type("String") Then - - ParameterMap.Insert(Property.Key, New Structure(Property.Value, New Structure)); - - ElseIf TypeValue(Property.Value) = Type("Structure") - Or TypeValue(Property.Value) = Type("Match") Then - - ValueSelection = FormSelectionValues(Property.Value); - ParameterMap.Insert(Property.Key, New Structure("select", ValueSelection)); - - Otherwise - - ParameterMap.Insert(Property.Key, Property.Value); - - EndIf; - - EndOfLoop; - - MainStructure.Insert("properties", ParameterMap); - + +If Properties.Quantity() = 0 Then +MainStructure.Insert("properties", New Structure); +Return; +EndIf; + +ParameterMap = New Match; + +For Each Property In Properties Do + +If TypeValue(Property.Value) = Type("String") Then + +ParameterMap.Insert(Property.Key, New Structure(Property.Value, New Structure)); + +ElsIf TypeValue(Property.Value) = Type("Structure") +Or TypeValue(Property.Value) = Type("Match") Then + +ValueSelection = FormSelectionValues(Property.Value); +ParameterMap.Insert(Property.Key, New Structure("select", ValueSelection)); + +Else + +ParameterMap.Insert(Property.Key, Property.Value); + +EndIf; + +EndDo; + +MainStructure.Insert("properties", ParameterMap); + EndProcedure Function FormSelectionValues(Val VariantStructure) - - OptionArray = New Array; - - For Each Option Of VariantStructure Loop - - OptionMap = New Match; - OptionMap.Insert("name" , Option.Key); - OptionMap.Insert("color", Option.Value); - - OptionArray.Add(OptionMap); - - EndOfLoop; - - Return New Structure("options", OptionArray); - + +OptionArray = New Array; + +For Each Option In VariantStructure Do + +OptionMap = New Match; +OptionMap.Insert("name" , Option.Key); +OptionMap.Insert("color", Option.Value); + +OptionArray.Add(OptionMap); + +EndDo; + +Return New Structure("options", OptionArray); + EndFunction Function FillDataBySchema(Val Scheme, Val Data, Val Token, Val ThisIsBase = True) - - If ThisIsBase Then - SchemaData = GetDatabase(Token, Scheme); - Otherwise - SchemaData = GetPage(Token, Scheme); - EndIf; - - BaseFields = SchemaData["properties"]; - Properties = New Match; - - If ValueFilled(BaseFields) Then - - For Each Field Of BaseFields Loop - - FieldData = Field.Value; - FieldType = FieldData["type"]; - - FillableData = Data.Get(Field.Key); - - If FillableData = Undefined Then - Continue; - EndIf; - - ConvertedData = ConvertValueByType(FieldType, FillableData); - - If ConvertedData = Undefined Then - Continue; - EndIf; - - Properties.Insert(FieldData["id"], ConvertedData); - - EndOfLoop; - - EndIf; - Return Properties; +If ThisIsBase Then +SchemaData = GetDatabase(Token, Scheme); +Else +SchemaData = GetPage(Token, Scheme); +EndIf; + +BaseFields = SchemaData["properties"]; +Properties = New Match; + +If ValueIsFilled(BaseFields) Then + +For Each Field In BaseFields Do + +FieldData = Field.Value; +FieldType = FieldData["type"]; + +FillableData = Data.Get(Field.Key); + +If FillableData = Undefined Then +Continue; +EndIf; + +ConvertedData = ConvertValueByType(FieldType, FillableData); + +If ConvertedData = Undefined Then +Continue; +EndIf; + +Properties.Insert(FieldData["id"], ConvertedData); + +EndDo; + +EndIf; + +Return Properties; EndFunction Procedure RemoveExtraBlockFields(Val Block) - - ExtraArray = New Array; - ExtraArray.Add("request_id"); - ExtraArray.Add("archived"); - ExtraArray.Add("created_by"); - ExtraArray.Add("last_edited_time"); - ExtraArray.Add("created_time"); - ExtraArray.Add("has_children"); - ExtraArray.Add("parrent"); - ExtraArray.Add("last_edited_by"); - ExtraArray.Add("id"); - - For Each Field Of ExtraArray Loop - - If Not Block.Get(Field) = Undefined Then - Block.Delete(Field); - EndIf; - - EndOfLoop; - + +ExtraArray = New Array; +ExtraArray.Add("request_id"); +ExtraArray.Add("archived"); +ExtraArray.Add("created_by"); +ExtraArray.Add("last_edited_time"); +ExtraArray.Add("created_time"); +ExtraArray.Add("has_children"); +ExtraArray.Add("parrent"); +ExtraArray.Add("last_edited_by"); +ExtraArray.Add("id"); + +For Each Field In ExtraArray Do + +If Not Block.Get(Field) = Undefined Then +Block.Delete(Field); +EndIf; + +EndDo; + EndProcedure #Region TypeConversion Function ConvertValueByType(Val Type, Val Value) - - If Type = "title" Then - Return ConvertHeader(Value); - ElseIf Type = "rich_text" Then - Return ConvertText(Value); - ElseIf Type = "number" Then - Return ConvertNumber(Value); - ElseIf Type = "select" Then - Return ConvertSelectionOption(Value); - ElseIf Type = "multi_select" Then - Return ConvertMultipleChoice(Value); - ElseIf Type = "status" Then - Return ConvertStatus(Value); - ElseIf Type = "date" Then - Return ConvertDate(Value); - ElseIf Type = "relation" Then - Return ConvertLink(Value); - ElseIf Type = "people" Then - Return ConvertUsers(Value); - ElseIf Type = "files" Then - Return ConvertFiles(Value); - ElseIf Type = "checkbox" Then - Return ConvertBoolean(Value); - ElseIf Type = "url" Then - Return ConvertLink(Value); - ElseIf Type = "email" Then - Return ConvertEmail(Value); - ElseIf Type = "phone_number" Then - Return ConvertPhone(Value); - Otherwise - Return Undefined; - EndIf; - + +If Type = "title" Then +Return ConvertHeader(Value); +ElsIf Type = "rich_text" Then +Return ConvertText(Value); +ElsIf Type = "number" Then +Return ConvertNumber(Value); +ElsIf Type = "select" Then +Return ConvertSelectionOption(Value); +ElsIf Type = "multi_select" Then +Return ConvertMultipleChoice(Value); +ElsIf Type = "status" Then +Return ConvertStatus(Value); +ElsIf Type = "date" Then +Return ConvertDate(Value); +ElsIf Type = "relation" Then +Return ConvertLink(Value); +ElsIf Type = "people" Then +Return ConvertUsers(Value); +ElsIf Type = "files" Then +Return ConvertFiles(Value); +ElsIf Type = "checkbox" Then +Return ConvertBoolean(Value); +ElsIf Type = "url" Then +Return ConvertLink(Value); +ElsIf Type = "email" Then +Return ConvertEmail(Value); +ElsIf Type = "phone_number" Then +Return ConvertPhone(Value); +Else +Return Undefined; +EndIf; + EndFunction -Function ConvertHeader(Val Title) - - DataStructure = New Structure; - TextStructure = New Structure; - Data array = New Array; - - TextStructure.Insert("content", Title); - TextStructure.Insert("link" , Undefined); - - DataStructure.Insert("type", "text"); - DataStructure.Insert("text", TextStructure); - - Data array.Add(DataStructure); +Function ConvertHeader(Val Title) + +DataStructure = New Structure; +TextStructure = New Structure; +Data array = New Array; + +TextStructure.Insert("content", Title); +TextStructure.Insert("link" , Undefined); + +DataStructure.Insert("type", "text"); +DataStructure.Insert("text", TextStructure); + +Data array.Add(DataStructure); + +Return New Structure("title", Data array); - Return New Structure("title", Data array); - EndFunction Function ConvertText(Val Text) - - TextArray = New Array; - TextStructure = New Structure; - - TextStructure.Insert("type", "text"); - TextStructure.Insert("text", New Structure("content", Text)); - - TextArray.Add(TextStructure); - - Return New Structure("rich_text", TextArray); - + +TextArray = New Array; +TextStructure = New Structure; + +TextStructure.Insert("type", "text"); +TextStructure.Insert("text", New Structure("content", Text)); + +TextArray.Add(TextStructure); + +Return New Structure("rich_text", TextArray); + EndFunction Function ConvertNumber(Val Number) - Return New Structure("number", Number); +Return New Structure("number", Number); EndFunction Function ConvertSelectionOption(Val Option) - - ChoiceStructure = New Structure; - ChoiceStructure.Insert("select", New Structure("name", Option)); - - Return ChoiceStructure; - + +ChoiceStructure = New Structure; +ChoiceStructure.Insert("select", New Structure("name", Option)); + +Return ChoiceStructure; + EndFunction Function ConvertStatus(Val Status) - - StatusStructure = New Structure; - StatusStructure.Insert("status", New Structure("name", Status)); - - Return StatusStructure; - + +StatusStructure = New Structure; +StatusStructure.Insert("status", New Structure("name", Status)); + +Return StatusStructure; + EndFunction Function ConvertMultipleChoice(Val OptionArray) - - ChoiceOptionArray = New Array; - - For Each Option Of OptionArray Loop - ChoiceOptionArray.Add(New Structure("name", Option)); - EndOfLoop; - - Return New Structure("multi_select", ChoiceOptionArray); - + +ChoiceOptionArray = New Array; + +For Each Option In OptionArray Do +ChoiceOptionArray.Add(New Structure("name", Option)); +EndDo; + +Return New Structure("multi_select", ChoiceOptionArray); + EndFunction Function ConvertDate(Val Date) - - DateStructure = New Structure; - - If Date = StartOfDay(Date) Then - DateFormat = "DF=yyyy-MM-dd"; - Otherwise - DateFormat = "ISO8601Datetime"; - EndIf; - - Date = Format(Date, DateFormat); - DateStructure.Insert("start", Date); - - Return New Structure("date", DateStructure); - + +DateStructure = New Structure; + +If Date = StartOfDay(Date) Then +DateFormat = "DF=yyyy-MM-dd"; +Else +DateFormat = "ISO8601Datetime"; +EndIf; + +Date = Format(Date, DateFormat); +DateStructure.Insert("start", Date); + +Return New Structure("date", DateStructure); + EndFunction -Function ConvertLink(Val Identifier) - - LinkArray = New Array; - LinkArray.Add(New Structure("id", Identifier)); - - Return New Structure("relation", LinkArray); - +Function ConvertLink(Val Identifier) + +LinkArray = New Array; +LinkArray.Add(New Structure("id", Identifier)); + +Return New Structure("relation", LinkArray); + EndFunction Function ConvertUsers(Val IDArray) - - If Not TypeValue(IDArray) = Type("Array") Then - ArrayID_ = New Array; - ArrayID_.Add(IDArray); - IDArray = ArrayID_; - EndIf; - - ArrayOfUsers = New Array; - - For Each Identifier Of IDArray Loop - - UserStructure = New Structure; - UserStructure.Insert("object", "user"); - UserStructure.Insert("id" , Identifier); - ArrayOfUsers.Add(UserStructure); - - EndOfLoop; - - Return New Structure("people", ArrayOfUsers); - + +If Not TypeValue(IDArray) = Type("Array") Then +ArrayID_ = New Array; +ArrayID_.Add(IDArray); +IDArray = ArrayID_; +EndIf; + +ArrayOfUsers = New Array; + +For Each Identifier In IDArray Do + +UserStructure = New Structure; +UserStructure.Insert("object", "user"); +UserStructure.Insert("id" , Identifier); +ArrayOfUsers.Add(UserStructure); + +EndDo; + +Return New Structure("people", ArrayOfUsers); + EndFunction Function ConvertFiles(Val FileMapping) - - ArrayOfFiles = New Array; - - For Each File Of FileMapping Loop - - FileStructure = New Structure; - FileStructure.Insert("type" , "external"); - FileStructure.Insert("name" , File.Key); - FileStructure.Insert("external", New Structure("url", File.Value)); - - ArrayOfFiles.Add(FileStructure); - - EndOfLoop; - Return New Structure("files", ArrayOfFiles); - +ArrayOfFiles = New Array; + +For Each File In FileMapping Do + +FileStructure = New Structure; +FileStructure.Insert("type" , "external"); +FileStructure.Insert("name" , File.Key); +FileStructure.Insert("external", New Structure("url", File.Value)); + +ArrayOfFiles.Add(FileStructure); + +EndDo; + +Return New Structure("files", ArrayOfFiles); + EndFunction Function ConvertBoolean(Val Boolean) - Return New Structure("checkbox", Boolean); +Return New Structure("checkbox", Boolean); EndFunction Function ConvertLink(Val URL) - Return New Structure("url", URL); +Return New Structure("url", URL); EndFunction Function ConvertEmail(Val Email) - Return New Structure("email", Email); +Return New Structure("email", Email); EndFunction Function ConvertPhone(Val Phone) - Return New Structure("phone_number", Phone); +Return New Structure("phone_number", Phone); EndFunction #EndRegion diff --git a/src/en/OPI/src/CommonModules/OPI_Notion/OPI_Notion.mdo b/src/en/OPI/src/CommonModules/OPI_Notion/OPI_Notion.mdo index 2af4fd559d..c77bf35ab6 100644 --- a/src/en/OPI/src/CommonModules/OPI_Notion/OPI_Notion.mdo +++ b/src/en/OPI/src/CommonModules/OPI_Notion/OPI_Notion.mdo @@ -1,11 +1,11 @@ - + - OPI_Notion - - ru - Методы работы с Notion (ОПИ) - - true - true - true +OPI_Notion + +ru +Methodы work with Notion (OPI) + +true +true +true diff --git a/src/en/OPI/src/CommonModules/OPI_Slack/Module.bsl b/src/en/OPI/src/CommonModules/OPI_Slack/Module.bsl index f270794958..da61e10c33 100644 --- a/src/en/OPI/src/CommonModules/OPI_Slack/Module.bsl +++ b/src/en/OPI/src/CommonModules/OPI_Slack/Module.bsl @@ -38,57 +38,57 @@ // Get bot information // Gets basic information about the bot -// +// // Parameters: -// Token - String - Bot token - token -// +// Token - String - Bot token - token +// // Return value: -// Key-Value Pair - Serialized JSON response from Slack +// Key-Value Pair - Serialized JSON response from Slack Function GetBotInformation(Val Token) Export - - URL = "https://slack.com/api/auth.test"; - Headers = GetAuthorizationHeader(Token); - - Response = OPI_Tools.Get(URL, , Headers); - - Return Response; + +URL = "https://slack.com/api/auth.test"; +Headers = GetAuthorizationHeader(Token); + +Response = OPI_Tools.Get(URL, , Headers); + +Return Response; EndFunction // Get workspace list // Gets a list of workspaces where the bot is connected -// +// // Parameters: -// Token - String - Bot token - token -// Cursor - String - Pointer from the previous request, if the result rows > 100 - cursor -// +// Token - String - Bot token - token +// Cursor - String - Pointer from the previous request, if the result rows > 100 - cursor +// // Return value: -// Key-Value Pair - Serialized JSON response from Slack +// Key-Value Pair - Serialized JSON response from Slack Function GetWorkspaceList(Val Token, Val Cursor = "") Export - - URL = "https://slack.com/api/auth.teams.list"; - Response = GeneralDataRetrieval(Token, URL, Cursor); - - Return Response; + +URL = "https://slack.com/api/auth.teams.list"; +Response = GeneralDataRetrieval(Token, URL, Cursor); + +Return Response; EndFunction // Get user list // Gets a list of users in the workspace -// +// // Parameters: -// Token - String - Bot token - token -// Cursor - String - Pointer from the previous request, if the result rows > 100 - cursor -// +// Token - String - Bot token - token +// Cursor - String - Pointer from the previous request, if the result rows > 100 - cursor +// // Return value: -// Key-Value Pair - Serialized JSON response from Slack +// Key-Value Pair - Serialized JSON response from Slack Function GetUserList(Val Token, Val Cursor = "") Export - - URL = "https://slack.com/api/users.list"; - Response = GeneralDataRetrieval(Token, URL, Cursor); - - Return Response; - + +URL = "https://slack.com/api/users.list"; +Response = GeneralDataRetrieval(Token, URL, Cursor); + +Return Response; + EndFunction #EndRegion @@ -97,238 +97,238 @@ EndFunction // Send message // Sends a message at a selected hour -// +// // Parameters: -// Token - String - Bot token - token -// Channel - String - Channel ID - channel -// Text - String - Message text - text -// Sending date - Date - Sending date for delayed message - date -// Blocks - Array of Structures - Array of block descriptions - blocks - JSON array of block descriptions -// +// Token - String - Bot token - token +// Channel - String - Channel ID - channel +// Text - String - Message text - text +// Sending date - Date - Sending date for delayed message - date +// Blocks - Array of Structures - Array of block descriptions - blocks - JSON array of block descriptions +// // Return value: -// Key-Value Pair - Serialized JSON response from Slack +// Key-Value Pair - Serialized JSON response from Slack Function SendMessage(Val Token, Val Channel, Val Text = "", Val Sending date = "", Val Blocks = "") Export - - String_ = "String"; - HasDate = ValueFilled(Sending date); - Headers = GetAuthorizationHeader(Token); - - If ValueFilled(Blocks) And TypeValue(Blocks) = Type(String_) Then - OPI_TypeConversion.GetCollection(Blocks); - - If TypeValue(Blocks) = Type("Array") Then - - For N = 0 by Blocks.WithinBoundary() Loop - OPI_TypeConversion.GetCollection(Blocks[N]); - EndOfLoop; - - EndIf; - EndIf; - - Parameters = New Structure; - OPI_Tools.AddField("channel", Channel, String_ , Parameters); - OPI_Tools.AddField("text" , Text, String_ , Parameters); - OPI_Tools.AddField("blocks" , Blocks, "Array" , Parameters); +String_ = "String"; +HasDate = ValueIsFilled(Sending date); +Headers = GetAuthorizationHeader(Token); + +If ValueIsFilled(Blocks) And TypeValue(Blocks) = Type(String_) Then +OPI_TypeConversion.GetCollection(Blocks); + +If TypeValue(Blocks) = Type("Array") Then + +For N = 0 For Blocks.WithinBoundary() Do +OPI_TypeConversion.GetCollection(Blocks[N]); +EndDo; + +EndIf; + +EndIf; + +Parameters = New Structure; +OPI_Tools.AddField("channel", Channel, String_ , Parameters); +OPI_Tools.AddField("text" , Text, String_ , Parameters); +OPI_Tools.AddField("blocks" , Blocks, "Array" , Parameters); + +If HasDate Then + +URL = "https://slack.com/api/chat.scheduleMessage"; +OPI_Tools.AddField("post_at", Sending date, "Date", Parameters); + +Else + +URL = "https://slack.com/api/chat.postMessage"; + +EndIf; + +Response = OPI_Tools.Post(URL, Parameters, Headers); + +Return Response; - If HasDate Then - - URL = "https://slack.com/api/chat.scheduleMessage"; - OPI_Tools.AddField("post_at", Sending date, "Date", Parameters); - - Otherwise - - URL = "https://slack.com/api/chat.postMessage"; - - EndIf; - - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - EndFunction // Send ephemeral message -// Sends a message that arrives in the channel but is visible +// Sends a message that arrives in the channel but is visible // only to a specific user -// +// // Parameters: -// Token - String - Bot token - token -// Channel - String - Channel ID - channel -// Text - String - Message text - text -// User - String - User ID - user -// Blocks - Array of Structures - Array of block descriptions - blocks - JSON array of block descriptions -// +// Token - String - Bot token - token +// Channel - String - Channel ID - channel +// Text - String - Message text - text +// User - String - User ID - user +// Blocks - Array of Structures - Array of block descriptions - blocks - JSON array of block descriptions +// // Return value: -// Key-Value Pair - Serialized JSON response from Slack +// Key-Value Pair - Serialized JSON response from Slack Function SendEphemeralMessage(Val Token - , Val Channel - , Val Text = "" - , Val User = "" - , Val Blocks = "") Export - - String_ = "String"; - - If ValueFilled(Blocks) And Not TypeValue(Blocks) = Type(String_) Then - OPI_TypeConversion.GetArray(Blocks); - EndIf; - - Headers = GetAuthorizationHeader(Token); - - Parameters = New Structure; - OPI_Tools.AddField("channel", Channel , String_ , Parameters); - OPI_Tools.AddField("text" , Text , String_ , Parameters); - OPI_Tools.AddField("user" , User, String_ , Parameters); - OPI_Tools.AddField("blocks" , Blocks , "Collection", Parameters); - - URL = "https://slack.com/api/chat.postEphemeral"; - - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - +, Val Channel +, Val Text = "" +, Val User = "" +, Val Blocks = "") Export + +String_ = "String"; + +If ValueIsFilled(Blocks) And Not TypeValue(Blocks) = Type(String_) Then +OPI_TypeConversion.GetArray(Blocks); +EndIf; + +Headers = GetAuthorizationHeader(Token); + +Parameters = New Structure; +OPI_Tools.AddField("channel", Channel , String_ , Parameters); +OPI_Tools.AddField("text" , Text , String_ , Parameters); +OPI_Tools.AddField("user" , User, String_ , Parameters); +OPI_Tools.AddField("blocks" , Blocks , "Collection", Parameters); + +URL = "https://slack.com/api/chat.postEphemeral"; + +Response = OPI_Tools.Post(URL, Parameters, Headers); + +Return Response; + EndFunction // Edit message // Edits the content of an existing message -// +// // Parameters: -// Token - String - Bot token - token -// Channel - String - Channel ID - channel -// Timestamp - String - Message timestamp - stamp -// Text - String - New message text - text -// BlockArray - Array of Structures - Array of block descriptions - blocks - JSON array of block descriptions -// +// Token - String - Bot token - token +// Channel - String - Channel ID - channel +// Timestamp - String - Message timestamp - stamp +// Text - String - New message text - text +// BlockArray - Array of Structures - Array of block descriptions - blocks - JSON array of block descriptions +// // Return value: -// Key-Value Pair - Serialized JSON response from Slack +// Key-Value Pair - Serialized JSON response from Slack Function EditMessage(Val Token, Val Channel, Val Timestamp, Val Text = "", Val BlockArray = "") Export - - String_ = "String"; - URL = "https://slack.com/api/chat.update"; - Headers = GetAuthorizationHeader(Token); - - Parameters = New Structure; - OPI_Tools.AddField("channel", Channel , String_ , Parameters); - OPI_Tools.AddField("text" , Text , String_ , Parameters); - OPI_Tools.AddField("ts" , Timestamp , String_ , Parameters); - OPI_Tools.AddField("blocks" , BlockArray, "Collection", Parameters); - - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - + +String_ = "String"; +URL = "https://slack.com/api/chat.update"; +Headers = GetAuthorizationHeader(Token); + +Parameters = New Structure; +OPI_Tools.AddField("channel", Channel , String_ , Parameters); +OPI_Tools.AddField("text" , Text , String_ , Parameters); +OPI_Tools.AddField("ts" , Timestamp , String_ , Parameters); +OPI_Tools.AddField("blocks" , BlockArray, "Collection", Parameters); + +Response = OPI_Tools.Post(URL, Parameters, Headers); + +Return Response; + EndFunction // Delete message // Deletes a channel message by timestamp -// +// // Parameters: -// Token - String - Bot token - token -// Channel - String - Channel ID - channel -// Timestamp - String - Timestamp or message ID - stamp -// IsDelayed - Boolean - Indicator of deleting a delayed message - issheduled -// +// Token - String - Bot token - token +// Channel - String - Channel ID - channel +// Timestamp - String - Timestamp or message ID - stamp +// IsDelayed - Boolean - Indicator of deleting a delayed message - issheduled +// // Return value: -// Key-Value Pair - Serialized JSON response from Slack +// Key-Value Pair - Serialized JSON response from Slack Function DeleteMessage(Val Token, Val Channel, Val Timestamp, Val IsDelayed = False) Export - - OPI_TypeConversion.GetBoolean(IsDelayed); - - Headers = GetAuthorizationHeader(Token); - - If IsDelayed Then - URL = "https://slack.com/api/chat.deleteScheduledMessage"; - TimestampField = "scheduled_message_id"; - Otherwise - URL = "https://slack.com/api/chat.delete"; - TimestampField = "ts"; - EndIf; - - Parameters = New Structure; - OPI_Tools.AddField("channel" , Channel , "String", Parameters); - OPI_Tools.AddField(TimestampField, Timestamp, "String", Parameters); - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; +OPI_TypeConversion.GetBoolean(IsDelayed); + +Headers = GetAuthorizationHeader(Token); + +If IsDelayed Then +URL = "https://slack.com/api/chat.deleteScheduledMessage"; +TimestampField = "scheduled_message_id"; +Else +URL = "https://slack.com/api/chat.delete"; +TimestampField = "ts"; +EndIf; + +Parameters = New Structure; +OPI_Tools.AddField("channel" , Channel , "String", Parameters); +OPI_Tools.AddField(TimestampField, Timestamp, "String", Parameters); + +Response = OPI_Tools.Post(URL, Parameters, Headers); + +Return Response; EndFunction // Get list of delayed messages // Gets a list of delayed channel messages -// +// // Parameters: -// Token - String - Bot token - token -// Channel - String - Channel ID - channel -// Cursor - String - Pointer from the previous request, if the result rows > 100 - cursor -// +// Token - String - Bot token - token +// Channel - String - Channel ID - channel +// Cursor - String - Pointer from the previous request, if the result rows > 100 - cursor +// // Return value: -// Key-Value Pair - Serialized JSON response from Slack +// Key-Value Pair - Serialized JSON response from Slack Function GetDelayedMessageList(Val Token, Val Channel, Val Cursor = "") Export - - URL = "https://slack.com/api/chat.scheduledMessages.list"; - Headers = GetAuthorizationHeader(Token); - - Parameters = New Structure; - OPI_Tools.AddField("channel", Channel , "String", Parameters); - OPI_Tools.AddField("cursor" , Cursor, "String", Parameters); - - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; + +URL = "https://slack.com/api/chat.scheduledMessages.list"; +Headers = GetAuthorizationHeader(Token); + +Parameters = New Structure; +OPI_Tools.AddField("channel", Channel , "String", Parameters); +OPI_Tools.AddField("cursor" , Cursor, "String", Parameters); + +Response = OPI_Tools.Post(URL, Parameters, Headers); + +Return Response; EndFunction // Get message link // Gets a permanent URL to the channel message -// +// // Parameters: -// Token - String - Bot token - token -// Channel - String - Channel ID - channel -// Timestamp - String - Timestamp or message ID - stamp -// +// Token - String - Bot token - token +// Channel - String - Channel ID - channel +// Timestamp - String - Timestamp or message ID - stamp +// // Return value: -// Key-Value Pair - Serialized JSON response from Slack +// Key-Value Pair - Serialized JSON response from Slack Function GetMessageLink(Val Token, Val Channel, Val Timestamp) Export - - URL = "https://slack.com/api/chat.getPermalink"; - Headers = GetAuthorizationHeader(Token); - - Parameters = New Structure; - OPI_Tools.AddField("channel" , Channel , "String", Parameters); - OPI_Tools.AddField("message_ts", Timestamp, "String", Parameters); - Response = OPI_Tools.Get(URL, Parameters, Headers); - - Return Response; +URL = "https://slack.com/api/chat.getPermalink"; +Headers = GetAuthorizationHeader(Token); + +Parameters = New Structure; +OPI_Tools.AddField("channel" , Channel , "String", Parameters); +OPI_Tools.AddField("message_ts", Timestamp, "String", Parameters); + +Response = OPI_Tools.Get(URL, Parameters, Headers); + +Return Response; EndFunction // Get list of message replies // Gets an array of messages that are replies to the specified -// +// // Parameters: -// Token - String - Bot token - token -// Channel - String - Channel ID - channel -// Timestamp - String - Timestamp or message ID - stamp -// Cursor - String - Pointer from the previous request, if the result rows > 100 - cursor -// +// Token - String - Bot token - token +// Channel - String - Channel ID - channel +// Timestamp - String - Timestamp or message ID - stamp +// Cursor - String - Pointer from the previous request, if the result rows > 100 - cursor +// // Return value: -// Key-Value Pair - Serialized JSON response from Slack +// Key-Value Pair - Serialized JSON response from Slack Function GetMessageReplyList(Val Token, Val Channel, Val Timestamp, Val Cursor = "") Export - - String_ = "String"; - URL = "https://slack.com/api/conversations.replies"; - Headers = GetAuthorizationHeader(Token); - - Parameters = New Structure; - OPI_Tools.AddField("channel", Channel , String_, Parameters); - OPI_Tools.AddField("cursor" , Cursor , String_, Parameters); - OPI_Tools.AddField("ts" , Timestamp, String_, Parameters); - - Response = OPI_Tools.Get(URL, Parameters, Headers); - - Return Response; + +String_ = "String"; +URL = "https://slack.com/api/conversations.replies"; +Headers = GetAuthorizationHeader(Token); + +Parameters = New Structure; +OPI_Tools.AddField("channel", Channel , String_, Parameters); +OPI_Tools.AddField("cursor" , Cursor , String_, Parameters); +OPI_Tools.AddField("ts" , Timestamp, String_, Parameters); + +Response = OPI_Tools.Get(URL, Parameters, Headers); + +Return Response; EndFunction @@ -338,289 +338,289 @@ EndFunction // Get channel list // Gets a list of available channels -// +// // Parameters: -// Token - String - Bot token - token -// ExcludeArchived - Boolean - Indicator of excluding archived channels - notarchived -// Cursor - String - Pointer from the previous request, if the result rows > 100 - cursor -// +// Token - String - Bot token - token +// ExcludeArchived - Boolean - Indicator of excluding archived channels - notarchived +// Cursor - String - Pointer from the previous request, if the result rows > 100 - cursor +// // Return value: -// Key-Value Pair - Serialized JSON response from Slack +// Key-Value Pair - Serialized JSON response from Slack Function GetChannelList(Val Token, Val ExcludeArchived = False, Val Cursor = "") Export - - URL = "https://slack.com/api/conversations.list"; - Headers = GetAuthorizationHeader(Token); - - Parameters = New Structure; - OPI_Tools.AddField("exclude_archived", ExcludeArchived, "Boolean", Parameters); - OPI_Tools.AddField("cursor" , Cursor , "String", Parameters); - Response = OPI_Tools.Get(URL, Parameters, Headers); - - Return Response; - +URL = "https://slack.com/api/conversations.list"; +Headers = GetAuthorizationHeader(Token); + +Parameters = New Structure; +OPI_Tools.AddField("exclude_archived", ExcludeArchived, "Boolean", Parameters); +OPI_Tools.AddField("cursor" , Cursor , "String", Parameters); + +Response = OPI_Tools.Get(URL, Parameters, Headers); + +Return Response; + EndFunction // Get channel user list // Gets a list of users in the specified channel -// +// // Parameters: -// Token - String - Bot token - token -// Channel - String - Channel ID - channel -// Cursor - String - Pointer from the previous request, if the result rows > 100 - cursor -// +// Token - String - Bot token - token +// Channel - String - Channel ID - channel +// Cursor - String - Pointer from the previous request, if the result rows > 100 - cursor +// // Return value: -// Key-Value Pair - Serialized JSON response from Slack +// Key-Value Pair - Serialized JSON response from Slack Function GetChannelUserList(Val Token, Val Channel, Val Cursor = "") Export - - URL = "https://slack.com/api/conversations.members"; - Headers = GetAuthorizationHeader(Token); - - Parameters = New Structure; - OPI_Tools.AddField("channel", Channel , "String", Parameters); - OPI_Tools.AddField("cursor" , Cursor, "String", Parameters); - Response = OPI_Tools.Get(URL, Parameters, Headers); - - Return Response; +URL = "https://slack.com/api/conversations.members"; +Headers = GetAuthorizationHeader(Token); + +Parameters = New Structure; +OPI_Tools.AddField("channel", Channel , "String", Parameters); +OPI_Tools.AddField("cursor" , Cursor, "String", Parameters); + +Response = OPI_Tools.Get(URL, Parameters, Headers); + +Return Response; EndFunction // Create channel // Creates a new channel -// +// // Parameters: -// Token - String - Bot token - token -// Name - String - Channel name - title -// Private - Boolean - Create channel as private - private -// +// Token - String - Bot token - token +// Name - String - Channel name - title +// Private - Boolean - Create channel as private - private +// // Return value: -// Key-Value Pair - Serialized JSON response from Slack +// Key-Value Pair - Serialized JSON response from Slack Function CreateChannel(Val Token, Val Name, Val Private = False) Export - - URL = "https://slack.com/api/conversations.create"; - Headers = GetAuthorizationHeader(Token); - - Parameters = New Structure; - OPI_Tools.AddField("name" , Name , "String", Parameters); - OPI_Tools.AddField("is_private", Private, "Boolean", Parameters); - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - +URL = "https://slack.com/api/conversations.create"; +Headers = GetAuthorizationHeader(Token); + +Parameters = New Structure; +OPI_Tools.AddField("name" , Name , "String", Parameters); +OPI_Tools.AddField("is_private", Private, "Boolean", Parameters); + +Response = OPI_Tools.Post(URL, Parameters, Headers); + +Return Response; + EndFunction // Archive channel // Archives an active channel -// +// // Parameters: -// Token - String - Bot token - token -// Channel - String - Channel ID - channel -// +// Token - String - Bot token - token +// Channel - String - Channel ID - channel +// // Return value: -// Key-Value Pair - Serialized JSON response from Slack +// Key-Value Pair - Serialized JSON response from Slack Function ArchiveChannel(Val Token, Val Channel) Export - - URL = "https://slack.com/api/conversations.archive"; - Response = DialogManagement(Token, Channel, URL); - Return Response; - + +URL = "https://slack.com/api/conversations.archive"; +Response = DialogManagement(Token, Channel, URL); +Return Response; + EndFunction // Get channel // Gets information about the channel -// +// // Parameters: -// Token - String - Bot token - token -// Channel - String - Channel ID - channel -// +// Token - String - Bot token - token +// Channel - String - Channel ID - channel +// // Return value: -// Key-Value Pair - Serialized JSON response from Slack +// Key-Value Pair - Serialized JSON response from Slack Function GetChannel(Val Token, Val Channel) Export - - URL = "https://slack.com/api/conversations.info"; - Response = DialogManagement(Token, Channel, URL, "GET"); - Return Response; + +URL = "https://slack.com/api/conversations.info"; +Response = DialogManagement(Token, Channel, URL, "GET"); +Return Response; EndFunction // Get channel history // Gets information about channel events -// +// // Parameters: -// Token - String - Bot token - token -// Channel - String - Channel ID - channel -// +// Token - String - Bot token - token +// Channel - String - Channel ID - channel +// // Return value: -// Key-Value Pair - Serialized JSON response from Slack +// Key-Value Pair - Serialized JSON response from Slack Function GetChannelHistory(Val Token, Val Channel) Export - - URL = "https://slack.com/api/conversations.history"; - Response = DialogManagement(Token, Channel, URL, "GET"); - Return Response; + +URL = "https://slack.com/api/conversations.history"; +Response = DialogManagement(Token, Channel, URL, "GET"); +Return Response; EndFunction // Invite users to channel // Adds specified users to the channel -// +// // Parameters: -// Token - String - Bot token - token -// Channel - String - Channel ID - channel -// ArrayOfUsers - Array Of String - User ID Array - users -// +// Token - String - Bot token - token +// Channel - String - Channel ID - channel +// ArrayOfUsers - Array Of String - User ID Array - users +// // Return value: -// Key-Value Pair - Serialized JSON response from Slack +// Key-Value Pair - Serialized JSON response from Slack Function InviteUsersToChannel(Val Token, Val Channel, Val ArrayOfUsers) Export - - URL = "https://slack.com/api/conversations.invite"; - Headers = GetAuthorizationHeader(Token); - - OPI_TypeConversion.GetCollection(ArrayOfUsers); - ArrayOfUsers = StrJoin(ArrayOfUsers, ","); - - Parameters = New Structure; - OPI_Tools.AddField("channel", Channel , "String", Parameters); - OPI_Tools.AddField("users" , ArrayOfUsers, "String", Parameters); - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; +URL = "https://slack.com/api/conversations.invite"; +Headers = GetAuthorizationHeader(Token); + +OPI_TypeConversion.GetCollection(ArrayOfUsers); +ArrayOfUsers = StrJoin(ArrayOfUsers, ","); + +Parameters = New Structure; +OPI_Tools.AddField("channel", Channel , "String", Parameters); +OPI_Tools.AddField("users" , ArrayOfUsers, "String", Parameters); + +Response = OPI_Tools.Post(URL, Parameters, Headers); + +Return Response; EndFunction // Kick user from channel // Removes specified user from channel -// +// // Parameters: -// Token - String - Bot token - token -// Channel - String - Channel ID - channel -// User - String - User ID - user -// +// Token - String - Bot token - token +// Channel - String - Channel ID - channel +// User - String - User ID - user +// // Return value: -// Key-Value Pair - Serialized JSON response from Slack +// Key-Value Pair - Serialized JSON response from Slack Function KickUserFromChannel(Val Token, Val Channel, Val User) Export - - URL = "https://slack.com/api/conversations.kick"; - Headers = GetAuthorizationHeader(Token); - - Parameters = New Structure; - OPI_Tools.AddField("channel", Channel , "String", Parameters); - OPI_Tools.AddField("user" , User, "String", Parameters); - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; +URL = "https://slack.com/api/conversations.kick"; +Headers = GetAuthorizationHeader(Token); + +Parameters = New Structure; +OPI_Tools.AddField("channel", Channel , "String", Parameters); +OPI_Tools.AddField("user" , User, "String", Parameters); + +Response = OPI_Tools.Post(URL, Parameters, Headers); + +Return Response; EndFunction // Join channel // Adds the current bot to the channel -// +// // Parameters: -// Token - String - Bot token - token -// Channel - String - Channel ID - channel -// +// Token - String - Bot token - token +// Channel - String - Channel ID - channel +// // Return value: -// Key-Value Pair - Serialized JSON response from Slack +// Key-Value Pair - Serialized JSON response from Slack Function JoinChannel(Val Token, Val Channel) Export - - URL = "https://slack.com/api/conversations.join"; - Response = DialogManagement(Token, Channel, URL); - Return Response; + +URL = "https://slack.com/api/conversations.join"; +Response = DialogManagement(Token, Channel, URL); +Return Response; EndFunction // Leave channel // Removes the current bot from the channel -// +// // Parameters: -// Token - String - Bot token - token -// Channel - String - Channel ID - channel -// +// Token - String - Bot token - token +// Channel - String - Channel ID - channel +// // Return value: -// Key-Value Pair - Serialized JSON response from Slack +// Key-Value Pair - Serialized JSON response from Slack Function LeaveChannel(Val Token, Val Channel) Export - - URL = "https://slack.com/api/conversations.leave"; - Response = DialogManagement(Token, Channel, URL); - Return Response; + +URL = "https://slack.com/api/conversations.leave"; +Response = DialogManagement(Token, Channel, URL); +Return Response; EndFunction // Set channel topic // Sets the channel topic -// +// // Parameters: -// Token - String - Bot token - token -// Channel - String - Channel ID - channel -// Topic - String - Channel topic - theme -// +// Token - String - Bot token - token +// Channel - String - Channel ID - channel +// Topic - String - Channel topic - theme +// // Return value: -// Key-Value Pair - Serialized JSON response from Slack +// Key-Value Pair - Serialized JSON response from Slack Function SetChannelTopic(Val Token, Val Channel, Val Topic) Export - - URL = "https://slack.com/api/conversations.setTopic"; - Headers = GetAuthorizationHeader(Token); - - Parameters = New Structure; - OPI_Tools.AddField("channel", Channel , "String", Parameters); - OPI_Tools.AddField("topic" , Topic , "String", Parameters); - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; +URL = "https://slack.com/api/conversations.setTopic"; +Headers = GetAuthorizationHeader(Token); + +Parameters = New Structure; +OPI_Tools.AddField("channel", Channel , "String", Parameters); +OPI_Tools.AddField("topic" , Topic , "String", Parameters); + +Response = OPI_Tools.Post(URL, Parameters, Headers); + +Return Response; EndFunction // Set channel purpose // Sets the channel purpose (description) -// +// // Parameters: -// Token - String - Bot token - token -// Channel - String - Channel ID - channel -// Purpose - String - Channel purpose - purpose -// +// Token - String - Bot token - token +// Channel - String - Channel ID - channel +// Purpose - String - Channel purpose - purpose +// // Return value: -// Key-Value Pair - Serialized JSON response from Slack +// Key-Value Pair - Serialized JSON response from Slack Function SetChannelGoal(Val Token, Val Channel, Val Purpose) Export - - URL = "https://slack.com/api/conversations.setPurpose"; - Headers = GetAuthorizationHeader(Token); - - Parameters = New Structure; - OPI_Tools.AddField("channel", Channel , "String", Parameters); - OPI_Tools.AddField("purpose", Purpose , "String", Parameters); - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; +URL = "https://slack.com/api/conversations.setPurpose"; +Headers = GetAuthorizationHeader(Token); + +Parameters = New Structure; +OPI_Tools.AddField("channel", Channel , "String", Parameters); +OPI_Tools.AddField("purpose", Purpose , "String", Parameters); + +Response = OPI_Tools.Post(URL, Parameters, Headers); + +Return Response; EndFunction // Rename channel // Changes the name of the channel -// +// // Parameters: -// Token - String - Bot token - token -// Channel - String - Channel ID - channel -// Name - String - New channel name - title -// +// Token - String - Bot token - token +// Channel - String - Channel ID - channel +// Name - String - New channel name - title +// // Return value: -// Key-Value Pair - Serialized JSON response from Slack +// Key-Value Pair - Serialized JSON response from Slack Function RenameChannel(Val Token, Val Channel, Val Name) Export - - URL = "https://slack.com/api/conversations.rename"; - Headers = GetAuthorizationHeader(Token); - - Parameters = New Structure; - OPI_Tools.AddField("channel", Channel , "String", Parameters); - OPI_Tools.AddField("name" , Name, "String", Parameters); - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; +URL = "https://slack.com/api/conversations.rename"; +Headers = GetAuthorizationHeader(Token); + +Parameters = New Structure; +OPI_Tools.AddField("channel", Channel , "String", Parameters); +OPI_Tools.AddField("name" , Name, "String", Parameters); + +Response = OPI_Tools.Post(URL, Parameters, Headers); + +Return Response; EndFunction @@ -630,45 +630,45 @@ EndFunction // Open dialog // Opens a new dialog with one or more users -// +// // Parameters: -// Token - String - Bot token - token -// ArrayOfUsers - Array of Strings - User ID Array - users -// +// Token - String - Bot token - token +// ArrayOfUsers - Array of Strings - User ID Array - users +// // Return value: -// Key-Value Pair - Serialized JSON response from Slack +// Key-Value Pair - Serialized JSON response from Slack Function OpenDialog(Val Token, Val ArrayOfUsers) Export - - URL = "https://slack.com/api/conversations.open"; - Headers = GetAuthorizationHeader(Token); - - OPI_TypeConversion.GetCollection(ArrayOfUsers); - ArrayOfUsers = StrJoin(ArrayOfUsers, ","); - - Parameters = New Structure; - OPI_Tools.AddField("users", ArrayOfUsers, "String", Parameters); - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; +URL = "https://slack.com/api/conversations.open"; +Headers = GetAuthorizationHeader(Token); + +OPI_TypeConversion.GetCollection(ArrayOfUsers); +ArrayOfUsers = StrJoin(ArrayOfUsers, ","); + +Parameters = New Structure; +OPI_Tools.AddField("users", ArrayOfUsers, "String", Parameters); + +Response = OPI_Tools.Post(URL, Parameters, Headers); + +Return Response; EndFunction // Close dialog // Closes an existing dialog -// +// // Parameters: -// Token - String - Bot token - token -// Dialog - String - Dialog ID - conv -// +// Token - String - Bot token - token +// Dialog - String - Dialog ID - conv +// // Return value: -// Key-Value Pair - Serialized JSON response from Slack +// Key-Value Pair - Serialized JSON response from Slack Function CloseDialog(Val Token, Val Dialog) Export - - URL = "https://slack.com/api/conversations.close"; - Response = DialogManagement(Token, Dialog, URL); - Return Response; - + +URL = "https://slack.com/api/conversations.close"; +Response = DialogManagement(Token, Dialog, URL); +Return Response; + EndFunction #EndRegion @@ -677,154 +677,154 @@ EndFunction // Get list of files // Gets a list of files of the bot or channel -// +// // Parameters: -// Token - String - Bot token - token -// Channel - String - Channel for selection - channel -// PageNumber - Number, String - Page number - page -// +// Token - String - Bot token - token +// Channel - String - Channel for selection - channel +// PageNumber - Number, String - Page number - page +// // Return value: -// Key-Value Pair - Serialized JSON response from Slack +// Key-Value Pair - Serialized JSON response from Slack Function GetFilesList(Val Token, Val Channel = "", Val PageNumber = 1) Export - - URL = "https://slack.com/api/files.list"; - Headers = GetAuthorizationHeader(Token); - - Parameters = New Structure; - OPI_Tools.AddField("channel", Channel , "String", Parameters); - OPI_Tools.AddField("page" , PageNumber, "String", Parameters); - Response = OPI_Tools.Get(URL, Parameters, Headers); - - Return Response; - +URL = "https://slack.com/api/files.list"; +Headers = GetAuthorizationHeader(Token); + +Parameters = New Structure; +OPI_Tools.AddField("channel", Channel , "String", Parameters); +OPI_Tools.AddField("page" , PageNumber, "String", Parameters); + +Response = OPI_Tools.Get(URL, Parameters, Headers); + +Return Response; + EndFunction // Upload file // Uploads a file to Slack servers -// +// // Parameters: -// Token - String - Bot token - token -// File - String, BinaryData - File for upload - file -// FileName - String - File name with extension - filename -// Title - String - File name in Slack - title -// Channel - String - Channel ID - channel -// +// Token - String - Bot token - token +// File - String, BinaryData - File for upload - file +// FileName - String - File name with extension - filename +// Title - String - File name in Slack - title +// Channel - String - Channel ID - channel +// // Return value: -// Key-Value Pair - Serialized JSON response from Slack +// Key-Value Pair - Serialized JSON response from Slack Function UploadFile(Val Token, Val File, Val FileName, Val Title, Val Channel = "") Export - - OPI_TypeConversion.GetBinaryData(File); - OPI_TypeConversion.GetLine(FileName); - OPI_TypeConversion.GetLine(Title); - - String_ = "String"; - Upload_url = "upload_url"; - File_id = "file_id"; - URL = "https://slack.com/api/files.getUploadURLExternal"; - Headers = GetAuthorizationHeader(Token); - Size = File.Size(); - - Parameters = New Structure; - OPI_Tools.AddField("filename", FileName, String_, Parameters); - OPI_Tools.AddField("length" , Size , String_, Parameters); - Response = OPI_Tools.Get(URL, Parameters, Headers); - URL = Response[Upload_url]; - Identifier = Response[File_id]; - - If Not ValueFilled(URL) Or Not ValueFilled(Identifier) Then - Return Response; - EndIf; - - Files = New Match; - Files.Insert(FileName, File); - - Response = OPI_Tools.PostMultipart(URL, , Files, , Headers); - URL = "https://slack.com/api/files.completeUploadExternal"; - SlackFile = New Structure("id, title", Identifier, Title); - - Parameters = New Structure; - OPI_Tools.AddField("filename" , FileName, String_, Parameters); - OPI_Tools.AddField("channel_id", Channel , String_, Parameters); - OPI_Tools.AddField("files" , SlackFile, "Array", Parameters); +OPI_TypeConversion.GetBinaryData(File); +OPI_TypeConversion.GetLine(FileName); +OPI_TypeConversion.GetLine(Title); + +String_ = "String"; +Upload_url = "upload_url"; +File_id = "file_id"; +URL = "https://slack.com/api/files.getUploadURLExternal"; +Headers = GetAuthorizationHeader(Token); +Size = File.Size(); + +Parameters = New Structure; +OPI_Tools.AddField("filename", FileName, String_, Parameters); +OPI_Tools.AddField("length" , Size , String_, Parameters); + +Response = OPI_Tools.Get(URL, Parameters, Headers); +URL = Response[Upload_url]; +Identifier = Response[File_id]; + +If Not ValueIsFilled(URL) Or Not ValueIsFilled(Identifier) Then +Return Response; +EndIf; + +Files = New Match; +Files.Insert(FileName, File); + +Response = OPI_Tools.PostMultipart(URL, , Files, , Headers); +URL = "https://slack.com/api/files.completeUploadExternal"; +SlackFile = New Structure("id, title", Identifier, Title); + +Parameters = New Structure; +OPI_Tools.AddField("filename" , FileName, String_, Parameters); +OPI_Tools.AddField("channel_id", Channel , String_, Parameters); +OPI_Tools.AddField("files" , SlackFile, "Array", Parameters); + +Response = OPI_Tools.Post(URL, Parameters, Headers); + +Return Response; - Response = OPI_Tools.Post(URL, Parameters, Headers); - - Return Response; - EndFunction // Get file data // Gets information about the file -// +// // Parameters: -// Token - String - Bot token - token -// FileID - String - File identifier - fileid -// +// Token - String - Bot token - token +// FileID - String - File identifier - fileid +// // Return value: -// Key-Value Pair - Serialized JSON response from Slack +// Key-Value Pair - Serialized JSON response from Slack Function GetFileData(Val Token, Val FileID) Export - - URL = "https://slack.com/api/files.info"; - Response = FileManagement(Token, FileID, URL, "GET"); - - Return Response; - + +URL = "https://slack.com/api/files.info"; +Response = FileManagement(Token, FileID, URL, "GET"); + +Return Response; + EndFunction // Delete file // Deletes a file on Slack -// +// // Parameters: -// Token - String - Bot token - token -// FileID - String - File identifier - fileid -// +// Token - String - Bot token - token +// FileID - String - File identifier - fileid +// // Return value: -// Key-Value Pair - Serialized JSON response from Slack +// Key-Value Pair - Serialized JSON response from Slack Function DeleteFile(Val Token, Val FileID) Export - - URL = "https://slack.com/api/files.delete"; - Response = FileManagement(Token, FileID, URL); - - Return Response; - + +URL = "https://slack.com/api/files.delete"; +Response = FileManagement(Token, FileID, URL); + +Return Response; + EndFunction // Make file public // Creates a public URL for the file. Requires user token -// +// // Parameters: -// Token - String - User token - token -// FileID - String - File identifier - fileid -// +// Token - String - User token - token +// FileID - String - File identifier - fileid +// // Return value: -// Key-Value Pair - Serialized JSON response from Slack +// Key-Value Pair - Serialized JSON response from Slack Function MakeFilePublic(Val Token, Val FileID) Export - - URL = "https://slack.com/api/files.sharedPublicURL"; - Response = FileManagement(Token, FileID, URL); - - Return Response; - + +URL = "https://slack.com/api/files.sharedPublicURL"; +Response = FileManagement(Token, FileID, URL); + +Return Response; + EndFunction // Make file private // Removes the public URL from the file. Requires user token -// +// // Parameters: -// Token - String - User token - token -// FileID - String - File identifier - fileid -// +// Token - String - User token - token +// FileID - String - File identifier - fileid +// // Return value: -// Key-Value Pair - Serialized JSON response from Slack +// Key-Value Pair - Serialized JSON response from Slack Function MakeFilePrivate(Val Token, Val FileID) Export - - URL = "https://slack.com/api/files.revokePublicURL"; - Response = FileManagement(Token, FileID, URL); - - Return Response; - + +URL = "https://slack.com/api/files.revokePublicURL"; +Response = FileManagement(Token, FileID, URL); + +Return Response; + EndFunction #EndRegion @@ -833,119 +833,119 @@ EndFunction // Get list of external files // Gets a list of external files of a user or channel -// +// // Parameters: -// Token - String - Bot token - token -// Channel - String - Channel for selection - channel -// Cursor - String - Pointer from the previous request, if the result rows > 100 - cursor -// +// Token - String - Bot token - token +// Channel - String - Channel for selection - channel +// Cursor - String - Pointer from the previous request, if the result rows > 100 - cursor +// // Return value: -// Key-Value Pair - Serialized JSON response from Slack +// Key-Value Pair - Serialized JSON response from Slack Function GetExternalFileList(Val Token, Val Channel = "", Val Cursor = "") Export - - URL = "https://slack.com/api/files.remote.list"; - Headers = GetAuthorizationHeader(Token); - - Parameters = New Structure; - OPI_Tools.AddField("channel", Channel , "String", Parameters); - OPI_Tools.AddField("cursor" , Cursor, "String", Parameters); - Response = OPI_Tools.Get(URL, Parameters, Headers); - - Return Response; - +URL = "https://slack.com/api/files.remote.list"; +Headers = GetAuthorizationHeader(Token); + +Parameters = New Structure; +OPI_Tools.AddField("channel", Channel , "String", Parameters); +OPI_Tools.AddField("cursor" , Cursor, "String", Parameters); + +Response = OPI_Tools.Get(URL, Parameters, Headers); + +Return Response; + EndFunction // Get external file // Gets information about the external file -// +// // Parameters: -// Token - String - Bot token - token -// FileID - String - File identifier - fileid -// +// Token - String - Bot token - token +// FileID - String - File identifier - fileid +// // Return value: -// Key-Value Pair - Serialized JSON response from Slack +// Key-Value Pair - Serialized JSON response from Slack Function GetExternalFile(Val Token, Val FileID) Export - - URL = "https://slack.com/api/files.remote.info"; - Response = ExternalFileManagement(Token, FileID, URL); - - Return Response; - + +URL = "https://slack.com/api/files.remote.info"; +Response = ExternalFileManagement(Token, FileID, URL); + +Return Response; + EndFunction // Add external file // Adds a new external file -// +// // Parameters: -// Token - String - Bot token - token -// URL - String - URL to external file - url -// Title - String - File title for Slack - title -// +// Token - String - Bot token - token +// URL - String - URL to external file - url +// Title - String - File title for Slack - title +// // Return value: -// Key-Value Pair - Serialized JSON response from Slack +// Key-Value Pair - Serialized JSON response from Slack Function AddExternalFile(Val Token, Val URL, Val Title) Export - - String_ = "String"; - URL = "https://slack.com/api/files.remote.add"; - Headers = GetAuthorizationHeader(Token); - UID = String(New UniqueIdentifier()); - - Parameters = New Structure; - OPI_Tools.AddField("external_url", URL , String_, Parameters); - OPI_Tools.AddField("external_id" , UID , String_, Parameters); - OPI_Tools.AddField("title" , Title , String_, Parameters); - Response = OPI_Tools.Get(URL, Parameters, Headers); - - Return Response; - +String_ = "String"; +URL = "https://slack.com/api/files.remote.add"; +Headers = GetAuthorizationHeader(Token); +UID = String(New UniqueIdentifier()); + +Parameters = New Structure; +OPI_Tools.AddField("external_url", URL , String_, Parameters); +OPI_Tools.AddField("external_id" , UID , String_, Parameters); +OPI_Tools.AddField("title" , Title , String_, Parameters); + +Response = OPI_Tools.Get(URL, Parameters, Headers); + +Return Response; + EndFunction // Send external file // Sends an external file to a list of channels -// +// // Parameters: -// Token - String - Bot token - token -// FileID - String - File identifier - fileid -// ChannelArray - Array Of String - Array of channels for sending - channels -// +// Token - String - Bot token - token +// FileID - String - File identifier - fileid +// ChannelArray - Array Of String - Array of channels for sending - channels +// // Return value: -// Key-Value Pair - Serialized JSON response from Slack +// Key-Value Pair - Serialized JSON response from Slack Function SendExternalFile(Val Token, Val FileID, Val ChannelArray) Export - - URL = "https://slack.com/api/files.remote.share"; - Headers = GetAuthorizationHeader(Token); - - OPI_TypeConversion.GetCollection(ChannelArray); - ChannelArray = StrJoin(ChannelArray, ","); - - Parameters = New Structure; - OPI_Tools.AddField("file" , FileID , "String", Parameters); - OPI_Tools.AddField("channels", ChannelArray , "String", Parameters); - Response = OPI_Tools.Get(URL, Parameters, Headers); - - Return Response; - +URL = "https://slack.com/api/files.remote.share"; +Headers = GetAuthorizationHeader(Token); + +OPI_TypeConversion.GetCollection(ChannelArray); +ChannelArray = StrJoin(ChannelArray, ","); + +Parameters = New Structure; +OPI_Tools.AddField("file" , FileID , "String", Parameters); +OPI_Tools.AddField("channels", ChannelArray , "String", Parameters); + +Response = OPI_Tools.Get(URL, Parameters, Headers); + +Return Response; + EndFunction // Delete external file // Deletes an external file from Slack -// +// // Parameters: -// Token - String - Bot token - token -// FileID - String - File identifier - fileid -// +// Token - String - Bot token - token +// FileID - String - File identifier - fileid +// // Return value: -// Key-Value Pair - Serialized JSON response from Slack +// Key-Value Pair - Serialized JSON response from Slack Function DeleteExternalFile(Val Token, Val FileID) Export - - URL = "https://slack.com/api/files.remote.remove"; - Response = ExternalFileManagement(Token, FileID, URL); - - Return Response; - + +URL = "https://slack.com/api/files.remote.remove"; +Response = ExternalFileManagement(Token, FileID, URL); + +Return Response; + EndFunction #EndRegion @@ -954,24 +954,24 @@ EndFunction // Generate image block // Generates a block with an image to add to the message block array -// +// // Parameters: -// URL - String - Image URL - picture -// AlternateText - String - Alternate text of the image - alt -// +// URL - String - Image URL - picture +// AlternateText - String - Alternate text of the image - alt +// // Return value: -// Key-Value Pair - Image block +// Key-Value Pair - Image block Function GenerateImageBlock(Val URL, Val AlternateText = "") Export - - String_ = "String"; - - Block = New Match; - OPI_Tools.AddField("type" , "image" , String_, Block); - OPI_Tools.AddField("image_url", URL , String_, Block); - OPI_Tools.AddField("alt_text" , AlternateText , String_, Block); - - Return Block; - + +String_ = "String"; + +Block = New Match; +OPI_Tools.AddField("type" , "image" , String_, Block); +OPI_Tools.AddField("image_url", URL , String_, Block); +OPI_Tools.AddField("alt_text" , AlternateText , String_, Block); + +Return Block; + EndFunction #EndRegion @@ -982,74 +982,74 @@ EndFunction Function GetAuthorizationHeader(Val Token) - OPI_TypeConversion.GetLine(Token); - - Headers = New Match; - Headers.Insert("Authorization", "Bearer " + Token); - Return Headers; - +OPI_TypeConversion.GetLine(Token); + +Headers = New Match; +Headers.Insert("Authorization", "Bearer " + Token); +Return Headers; + EndFunction Function DialogManagement(Val Token, Val Channel, Val URL, Val RequestType = "POST") - - Headers = GetAuthorizationHeader(Token); - RequestType = inReg(RequestType); - - Parameters = New Structure; - OPI_Tools.AddField("channel", Channel, "String", Parameters); - If RequestType = "POST" Then - Response = OPI_Tools.Post(URL, Parameters, Headers); - Otherwise - Response = OPI_Tools.Get(URL, Parameters, Headers); - EndIf; - - Return Response; - +Headers = GetAuthorizationHeader(Token); +RequestType = inReg(RequestType); + +Parameters = New Structure; +OPI_Tools.AddField("channel", Channel, "String", Parameters); + +If RequestType = "POST" Then +Response = OPI_Tools.Post(URL, Parameters, Headers); +Else +Response = OPI_Tools.Get(URL, Parameters, Headers); +EndIf; + +Return Response; + EndFunction Function FileManagement(Val Token, Val FileID, Val URL, Val RequestType = "POST") - - Headers = GetAuthorizationHeader(Token); - RequestType = inReg(RequestType); - - Parameters = New Structure; - OPI_Tools.AddField("file", FileID , "String", Parameters); - If RequestType = "POST" Then - Response = OPI_Tools.Post(URL, Parameters, Headers); - Otherwise - Response = OPI_Tools.Get(URL, Parameters, Headers); - EndIf; +Headers = GetAuthorizationHeader(Token); +RequestType = inReg(RequestType); - Return Response; +Parameters = New Structure; +OPI_Tools.AddField("file", FileID , "String", Parameters); + +If RequestType = "POST" Then +Response = OPI_Tools.Post(URL, Parameters, Headers); +Else +Response = OPI_Tools.Get(URL, Parameters, Headers); +EndIf; + +Return Response; EndFunction Function GeneralDataRetrieval(Val Token, Val URL, Val Cursor) - - Headers = GetAuthorizationHeader(Token); - - Parameters = New Structure; - OPI_Tools.AddField("cursor", Cursor, "String", Parameters); - - Response = OPI_Tools.Get(URL, Parameters, Headers); - - Return Response; - + +Headers = GetAuthorizationHeader(Token); + +Parameters = New Structure; +OPI_Tools.AddField("cursor", Cursor, "String", Parameters); + +Response = OPI_Tools.Get(URL, Parameters, Headers); + +Return Response; + EndFunction Function ExternalFileManagement(Val Token, Val FileID, Val URL) - - Headers = GetAuthorizationHeader(Token); - - Parameters = New Structure; - OPI_Tools.AddField("file", FileID , "String", Parameters); - Response = OPI_Tools.Get(URL, Parameters, Headers); - - Return Response; - +Headers = GetAuthorizationHeader(Token); + +Parameters = New Structure; +OPI_Tools.AddField("file", FileID , "String", Parameters); + +Response = OPI_Tools.Get(URL, Parameters, Headers); + +Return Response; + EndFunction #EndRegion diff --git a/src/en/OPI/src/CommonModules/OPI_Slack/OPI_Slack.mdo b/src/en/OPI/src/CommonModules/OPI_Slack/OPI_Slack.mdo index 10c2bd2efb..fcf5becb55 100644 --- a/src/en/OPI/src/CommonModules/OPI_Slack/OPI_Slack.mdo +++ b/src/en/OPI/src/CommonModules/OPI_Slack/OPI_Slack.mdo @@ -1,11 +1,11 @@ - + - OPI_Slack - - ru - Slack - - true - true - true +OPI_Slack + +ru +Slack + +true +true +true diff --git a/src/en/OPI/src/CommonModules/OPI_Telegram/Module.bsl b/src/en/OPI/src/CommonModules/OPI_Telegram/Module.bsl index f4147099f5..25327323c4 100644 --- a/src/en/OPI/src/CommonModules/OPI_Telegram/Module.bsl +++ b/src/en/OPI/src/CommonModules/OPI_Telegram/Module.bsl @@ -41,20 +41,20 @@ // Get bot information // Inыполняет запроwith /getMe, inозinращающий базоinую информацию о боте: имя, id, inозможноwithть dобаinлять бота in группы и т.d. -// +// // Parameters: -// Token - String - Bot token - token -// +// Token - String - Bot token - token +// // Return value: -// Key-Value Pair - Serialized JSON response from Telegram +// Key-Value Pair - Serialized JSON response from Telegram Function GetBotInformation(Val Token) Export - OPI_TypeConversion.GetLine(Token); - - URL = "api.telegram.org/bot" + Token + "/getMe"; - Response = OPI_Tools.Get(URL); - - Return Response; +OPI_TypeConversion.GetLine(Token); + +URL = "api.telegram.org/bot" + Token + "/getMe"; +Response = OPI_Tools.Get(URL); + +Return Response; EndFunction @@ -62,167 +62,167 @@ EndFunction // Executes a request /getUpdates, returning information about bot events. Used in polling mode // // Parameters: -// Token - String - Bot token - token -// Timeout - String, Number - Waiting time for new events - timeout -// Offset - String, Number - Offset in the list of received messages - offset -// +// Token - String - Bot token - token +// Timeout - String, Number - Waiting time for new events - timeout +// Offset - String, Number - Offset in the list of received messages - offset +// // Return value: -// Key-Value Pair - Serialized JSON response from Telegram +// Key-Value Pair - Serialized JSON response from Telegram Function GetUpdates(Val Token, Val Timeout = 0, Val Offset = "") Export - OPI_TypeConversion.GetLine(Token); - - URL = "api.telegram.org/bot" + Token + "/getUpdates"; - - Parameters = New Structure; - OPI_Tools.AddField("timeout", Timeout , "String", Parameters); - OPI_Tools.AddField("offset" , Offset, "String", Parameters); - - Response = OPI_Tools.Get(URL, Parameters); - Return Response; +OPI_TypeConversion.GetLine(Token); + +URL = "api.telegram.org/bot" + Token + "/getUpdates"; + +Parameters = New Structure; +OPI_Tools.AddField("timeout", Timeout , "String", Parameters); +OPI_Tools.AddField("offset" , Offset, "String", Parameters); + +Response = OPI_Tools.Get(URL, Parameters); +Return Response; EndFunction // Set Webhook -// Set webhook URL for bot event handling in webhook mode -// +// Set webhook URL for bot event handling in webhook mode +// // Parameters: -// Token - String - Bot token - token -// URL - String - Address processing запроwithоin от Telegram (with https:) - url -// +// Token - String - Bot token - token +// URL - String - Address processing запроwithоin от Telegram (with https:) - url +// // Return value: -// Key-Value Pair - Serialized JSON response from Telegram +// Key-Value Pair - Serialized JSON response from Telegram Function SetWebhook(Val Token, Val URL) Export - OPI_TypeConversion.GetLine(Token); - - Parameters = New Structure; - OPI_Tools.AddField("url", URL, "String", Parameters); +OPI_TypeConversion.GetLine(Token); - URL = "api.telegram.org/bot" + Token + "/setWebHook"; - Response = OPI_Tools.Get(URL, Parameters); - - Return Response; +Parameters = New Structure; +OPI_Tools.AddField("url", URL, "String", Parameters); + +URL = "api.telegram.org/bot" + Token + "/setWebHook"; +Response = OPI_Tools.Get(URL, Parameters); + +Return Response; EndFunction // Delete webhook // Deletes the bot event handler URL for webhook operation -// +// // Parameters: -// Token - String - Bot token - token -// +// Token - String - Bot token - token +// // Return value: -// Key-Value Pair - Serialized JSON response from Telegram +// Key-Value Pair - Serialized JSON response from Telegram Function DeleteWebhook(Val Token) Export - OPI_TypeConversion.GetLine(Token); - - URL = "api.telegram.org/bot" + Token + "/deleteWebHook"; - Response = OPI_Tools.Get(URL); - - Return Response; +OPI_TypeConversion.GetLine(Token); + +URL = "api.telegram.org/bot" + Token + "/deleteWebHook"; +Response = OPI_Tools.Get(URL); + +Return Response; EndFunction // Download file // Download file from Telegram servers -// +// // Parameters: -// Token - String - Token - token -// FileID - String - File ID for downloading - fileid -// +// Token - String - Token - token +// FileID - String - File ID for downloading - fileid +// // Return value: -// Key-Value Pair - Serialized JSON response from Telegram +// Key-Value Pair - Serialized JSON response from Telegram Function DownloadFile(Val Token, Val FileID) Export - Result = "result"; - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(FileID); - - Parameters = New Structure("file_id", FileID); +Result = "result"; + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(FileID); + +Parameters = New Structure("file_id", FileID); + +URL = "api.telegram.org/bot" + Token + "/getFile"; +Response = OPI_Tools.Get(URL, Parameters); + +Path = Response[Result]["file_path"]; + +If Not ValueIsFilled(Path) Then +Return Response; +EndIf; + +URL = "api.telegram.org/file/bot" + Token + "/" + Path; +Response = OPI_Tools.Get(URL, Parameters); + +Return Response; - URL = "api.telegram.org/bot" + Token + "/getFile"; - Response = OPI_Tools.Get(URL, Parameters); - - Path = Response[Result]["file_path"]; - - If Not ValueFilled(Path) Then - Return Response; - EndIf; - - URL = "api.telegram.org/file/bot" + Token + "/" + Path; - Response = OPI_Tools.Get(URL, Parameters); - - Return Response; - EndFunction // Process Telegram Mini App data // Processes TMA data and determines its validity -// +// // Parameters: -// DataString - String - Query from Telegram.WebApp.initData -// Token - String - Bot token -// +// DataString - String - Query from Telegram.WebApp.initData +// Token - String - Bot token +// // Return value: -// Map from String - Map of data with the result of verification in the passed field +// Map from String - Map of data with the result of verification in the passed field Function ProcessTMAData(Val DataString, Val Token) Export - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(DataString); - - DataString = DecodeString(DataString, StringEncodingMethod.URLencoding); - DataStructure = OPI_Tools.RequestParametersToMatch(DataString); - Key = "WebAppData"; - Hash = ""; - BinaryKey = GetBinaryDataFromString(Key); +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(DataString); - Result = OPI_Cryptography.HMACSHA256(BinaryKey, GetBinaryDataFromString(Token)); +DataString = DecodeString(DataString, StringEncodingMethod.URLencoding); +DataStructure = OPI_Tools.RequestParametersToMatch(DataString); +Key = "WebAppData"; +Hash = ""; +BinaryKey = GetBinaryDataFromString(Key); - TValue = New ValueTable; - TValue.Columns.Add("Key"); - TValue.Columns.Add("Value"); +Result = OPI_Cryptography.HMACSHA256(BinaryKey, GetBinaryDataFromString(Token)); - For Each Data Of DataStructure Loop +TValue = New ValueTable; +TValue.Columns.Add("Key"); +TValue.Columns.Add("Value"); - NewLine = TValue.Add(); - NewLine.Key = Data.Key; - NewLine.Value = Data.Value; +For Each Data In DataStructure Do - EndOfLoop; +NewLine = TValue.Add(); +NewLine.Key = Data.Key; +NewLine.Value = Data.Value; - TValue.Sort("Key"); +EndDo; - ReturnMapping = New Match; - DCS = ""; +TValue.Sort("Key"); - For Each DataString Of TValue Loop +ReturnMapping = New Match; +DCS = ""; - If DataString.Key <> "hash" Then - DCS = DCS + DataString.Key + "=" + DataString.Value + Symbols.PS; - ReturnMapping.Insert(DataString.Key, DataString.Value); - Otherwise - Hash = DataString.Value; - EndIf; +For Each DataString In TValue Do - EndOfLoop; +If DataString.Key <> "hash" Then +DCS = DCS + DataString.Key + "=" + DataString.Value + Symbols.PS; +ReturnMapping.Insert(DataString.Key, DataString.Value); +Else +Hash = DataString.Value; +EndIf; - DCS = Left(DCS, StrLength(DCS) - 1); - Signature = OPI_Cryptography.HMACSHA256(Result, GetBinaryDataFromString(DCS)); +EndDo; - Final = GetHexStringFromBinaryData(Signature); +DCS = Left(DCS, StrLength(DCS) - 1); +Signature = OPI_Cryptography.HMACSHA256(Result, GetBinaryDataFromString(DCS)); - If Final = inReg(Hash) Then - Response = True; - Otherwise - Response = False; - EndIf; +Final = GetHexStringFromBinaryData(Signature); - ReturnMapping.Insert("passed", Response); +If Final = inReg(Hash) Then +Response = True; +Else +Response = False; +EndIf; - Return ReturnMapping; +ReturnMapping.Insert("passed", Response); + +Return ReturnMapping; EndFunction @@ -232,382 +232,382 @@ EndFunction // Send text message // Sends a text message to a chat or channel -// +// // Parameters: -// Token - String - Bot token - token -// ChatID - String, Number - Target chat ID or ChatID*TopicID - chat -// Text - String - Message text - text -// Keyboard - String - See GenerateKeyboardFromArray - keyboard - Keyboard JSON or path to .json -// Markup - String - View processing textа (HTML, Markdown, MarkdownV2) - parsemode -// +// Token - String - Bot token - token +// ChatID - String, Number - Target chat ID or ChatID*TopicID - chat +// Text - String - Message text - text +// Keyboard - String - See GenerateKeyboardFromArray - keyboard - Keyboard JSON or path to .json +// Markup - String - View processing textа (HTML, Markdown, MarkdownV2) - parsemode +// // Return value: -// Key-Value Pair - Serialized JSON response from Telegram +// Key-Value Pair - Serialized JSON response from Telegram Function SendTextMessage(Val Token - , Val ChatID - , Val Text - , Val Keyboard = "" - , Val Markup = "Markdown") Export +, Val ChatID +, Val Text +, Val Keyboard = "" +, Val Markup = "Markdown") Export - OPI_TypeConversion.GetLine(Token); - OPI_Tools.ReplaceSpecialCharacters(Text, Markup); - - Parameters = New Structure; - OPI_Tools.AddField("parse_mode" , Markup , "String" , Parameters); - OPI_Tools.AddField("text" , Text , "String" , Parameters); - OPI_Tools.AddField("reply_markup", Keyboard, "FileString", Parameters); - - AddChatIdentifier(ChatID, Parameters); - - URL = "api.telegram.org/bot" + Token + "/sendMessage"; - Response = OPI_Tools.Get(URL, Parameters); +OPI_TypeConversion.GetLine(Token); +OPI_Tools.ReplaceSpecialCharacters(Text, Markup); - Return Response; +Parameters = New Structure; +OPI_Tools.AddField("parse_mode" , Markup , "String" , Parameters); +OPI_Tools.AddField("text" , Text , "String" , Parameters); +OPI_Tools.AddField("reply_markup", Keyboard, "FileString", Parameters); + +AddChatIdentifier(ChatID, Parameters); + +URL = "api.telegram.org/bot" + Token + "/sendMessage"; +Response = OPI_Tools.Get(URL, Parameters); + +Return Response; EndFunction // Send image // Sends an image to a chat or channel -// +// // Parameters: -// Token - String - Bot token - token -// ChatID - String, Number - Target chat ID or ChatID*TopicID - chat -// Text - String - Message text - text -// Image - BinaryData,String - Image file - picture -// Keyboard - String - See GenerateKeyboardFromArray - keyboard - Keyboard JSON or path to .json -// Markup - String - View processing textа (HTML, Markdown, MarkdownV2) - parsemode -// +// Token - String - Bot token - token +// ChatID - String, Number - Target chat ID or ChatID*TopicID - chat +// Text - String - Message text - text +// Image - BinaryData,String - Image file - picture +// Keyboard - String - See GenerateKeyboardFromArray - keyboard - Keyboard JSON or path to .json +// Markup - String - View processing textа (HTML, Markdown, MarkdownV2) - parsemode +// // Return value: -// Key-Value Pair - Serialized JSON response from Telegram +// Key-Value Pair - Serialized JSON response from Telegram Function SendImage(Val Token - , Val ChatID - , Val Text - , Val Image - , Val Keyboard = "" - , Val Markup = "Markdown") Export +, Val ChatID +, Val Text +, Val Image +, Val Keyboard = "" +, Val Markup = "Markdown") Export - Return SendFile(Token, ChatID, Text, Image, "photo", Keyboard, Markup); +Return SendFile(Token, ChatID, Text, Image, "photo", Keyboard, Markup); EndFunction // Send video // Sends a video to a chat or channel -// +// // Parameters: -// Token - String - Bot token - token -// ChatID - String, Number - Target chat ID or ChatID*TopicID - chat -// Text - String - Message text - text -// Video - BinaryData,String - Video file - video -// Keyboard - String - See GenerateKeyboardFromArray - keyboard - Keyboard JSON or path to .json -// Markup - String - View processing textа (HTML, Markdown, MarkdownV2) - parsemode -// +// Token - String - Bot token - token +// ChatID - String, Number - Target chat ID or ChatID*TopicID - chat +// Text - String - Message text - text +// Video - BinaryData,String - Video file - video +// Keyboard - String - See GenerateKeyboardFromArray - keyboard - Keyboard JSON or path to .json +// Markup - String - View processing textа (HTML, Markdown, MarkdownV2) - parsemode +// // Return value: -// Key-Value Pair - Serialized JSON response from Telegram +// Key-Value Pair - Serialized JSON response from Telegram Function SendVideo(Val Token - , Val ChatID - , Val Text - , Val Video - , Val Keyboard = "" - , Val Markup = "Markdown") Export +, Val ChatID +, Val Text +, Val Video +, Val Keyboard = "" +, Val Markup = "Markdown") Export - Return SendFile(Token, ChatID, Text, Video, "video", Keyboard, Markup); +Return SendFile(Token, ChatID, Text, Video, "video", Keyboard, Markup); EndFunction // Send audio // Sends an audio file to a chat or channel -// +// // Parameters: -// Token - String - Bot token - token -// ChatID - String, Number - Target chat ID or ChatID*TopicID - chat -// Text - String - Message text - text -// Audio - BinaryData,String - Audio file - audio -// Keyboard - String - See GenerateKeyboardFromArray - keyboard - Keyboard JSON or path to .json -// Markup - String - View processing textа (HTML, Markdown, MarkdownV2) - parsemode -// +// Token - String - Bot token - token +// ChatID - String, Number - Target chat ID or ChatID*TopicID - chat +// Text - String - Message text - text +// Audio - BinaryData,String - Audio file - audio +// Keyboard - String - See GenerateKeyboardFromArray - keyboard - Keyboard JSON or path to .json +// Markup - String - View processing textа (HTML, Markdown, MarkdownV2) - parsemode +// // Return value: -// Key-Value Pair - Serialized JSON response from Telegram +// Key-Value Pair - Serialized JSON response from Telegram Function SendAudio(Val Token - , Val ChatID - , Val Text - , Val Audio - , Val Keyboard = "" - , Val Markup = "Markdown") Export +, Val ChatID +, Val Text +, Val Audio +, Val Keyboard = "" +, Val Markup = "Markdown") Export - Return SendFile(Token, ChatID, Text, Audio, "audio", Keyboard, Markup); +Return SendFile(Token, ChatID, Text, Audio, "audio", Keyboard, Markup); EndFunction // Send document // Sends a document to a chat or channel -// +// // Parameters: -// Token - String - Bot token - token -// ChatID - String, Number - Target chat ID or ChatID*TopicID - chat -// Text - String - Message text - text -// Document - BinaryData,String - Document file - doc -// Keyboard - String - See GenerateKeyboardFromArray - keyboard - Keyboard JSON or path to .json -// Markup - String - View processing textа (HTML, Markdown, MarkdownV2) - parsemode -// +// Token - String - Bot token - token +// ChatID - String, Number - Target chat ID or ChatID*TopicID - chat +// Text - String - Message text - text +// Document - BinaryData,String - Document file - doc +// Keyboard - String - See GenerateKeyboardFromArray - keyboard - Keyboard JSON or path to .json +// Markup - String - View processing textа (HTML, Markdown, MarkdownV2) - parsemode +// // Return value: -// Key-Value Pair - Serialized JSON response from Telegram +// Key-Value Pair - Serialized JSON response from Telegram Function SendDocument(Val Token - , Val ChatID - , Val Text - , Val Document - , Val Keyboard = "" - , Val Markup = "Markdown") Export +, Val ChatID +, Val Text +, Val Document +, Val Keyboard = "" +, Val Markup = "Markdown") Export - Return SendFile(Token, ChatID, Text, Document, "document", Keyboard, Markup); +Return SendFile(Token, ChatID, Text, Document, "document", Keyboard, Markup); EndFunction // Send GIF // Sends a GIF to a chat or channel -// +// // Parameters: -// Token - String - Bot token - token -// ChatID - String, Number - Target chat ID or ChatID*TopicID - chat -// Text - String - Message text - text -// GIF - BinaryData,String - GIF file - gif -// Keyboard - String - See GenerateKeyboardFromArray - keyboard - Keyboard JSON or path to .json -// Markup - String - View processing textа (HTML, Markdown, MarkdownV2) - parsemode -// +// Token - String - Bot token - token +// ChatID - String, Number - Target chat ID or ChatID*TopicID - chat +// Text - String - Message text - text +// GIF - BinaryData,String - GIF file - gif +// Keyboard - String - See GenerateKeyboardFromArray - keyboard - Keyboard JSON or path to .json +// Markup - String - View processing textа (HTML, Markdown, MarkdownV2) - parsemode +// // Return value: -// Key-Value Pair - Serialized JSON response from Telegram +// Key-Value Pair - Serialized JSON response from Telegram Function SendGif(Val Token - , Val ChatID - , Val Text - , Val GIF - , Val Keyboard = "" - , Val Markup = "Markdown") Export +, Val ChatID +, Val Text +, Val GIF +, Val Keyboard = "" +, Val Markup = "Markdown") Export - Return SendFile(Token, ChatID, Text, GIF, "animation", Keyboard, Markup); +Return SendFile(Token, ChatID, Text, GIF, "animation", Keyboard, Markup); EndFunction // Send media group // Sends a set of files to a chat or channel. Media types: audio, document, photo, video -// +// // Parameters: -// Token - String - Bot token - token -// ChatID - String, Number - Target chat ID or ChatID*TopicID - chat -// Text - String - Message text - text -// FileMapping - Map from String - File collection - media - File JSON or path to .json -// Keyboard - String - See GenerateKeyboardFromArray - keyboard - Keyboard JSON or path to .json -// Markup - String - View processing textа (HTML, Markdown, MarkdownV2) - parsemode -// +// Token - String - Bot token - token +// ChatID - String, Number - Target chat ID or ChatID*TopicID - chat +// Text - String - Message text - text +// FileMapping - Map from String - File collection - media - File JSON or path to .json +// Keyboard - String - See GenerateKeyboardFromArray - keyboard - Keyboard JSON or path to .json +// Markup - String - View processing textа (HTML, Markdown, MarkdownV2) - parsemode +// // Return value: -// Key-Value Pair - Serialized JSON response from Telegram +// Key-Value Pair - Serialized JSON response from Telegram Function SendMediaGroup(Val Token - , Val ChatID - , Val Text - , Val FileMapping - , Val Keyboard = "" - , Val Markup = "Markdown") Export - - // FileMapping - // Key - File, Value - Type - // Types: audio, document, photo, video - // Different types cannot be mixed! +, Val ChatID +, Val Text +, Val FileMapping +, Val Keyboard = "" +, Val Markup = "Markdown") Export - String_ = "String"; - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(ChatID); - OPI_TypeConversion.GetCollection(FileMapping); - - OPI_Tools.ReplaceSpecialCharacters(Text, Markup); +// FileMapping +// Key - File, Value - Type +// Types: audio, document, photo, video +// Different types cannot be mixed! - URL = "api.telegram.org/bot" + Token + "/sendMediaGroup"; - FileStructure = New Structure; - Media = New Array; - Parameters = New Structure; - - AddChatIdentifier(ChatID, Parameters); - FormMediaArray(FileMapping, Text, FileStructure, Media); - - OPI_Tools.AddField("parse_mode" , Markup , String_ , Parameters); - OPI_Tools.AddField("caption" , Text , String_ , Parameters); - OPI_Tools.AddField("media" , Media , String_ , Parameters); - OPI_Tools.AddField("reply_markup", Keyboard, "FileString", Parameters); +String_ = "String"; - Response = OPI_Tools.PostMultipart(URL, Parameters, FileStructure, "mixed"); +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(ChatID); +OPI_TypeConversion.GetCollection(FileMapping); - Return Response; +OPI_Tools.ReplaceSpecialCharacters(Text, Markup); + +URL = "api.telegram.org/bot" + Token + "/sendMediaGroup"; +FileStructure = New Structure; +Media = New Array; +Parameters = New Structure; + +AddChatIdentifier(ChatID, Parameters); +FormMediaArray(FileMapping, Text, FileStructure, Media); + +OPI_Tools.AddField("parse_mode" , Markup , String_ , Parameters); +OPI_Tools.AddField("caption" , Text , String_ , Parameters); +OPI_Tools.AddField("media" , Media , String_ , Parameters); +OPI_Tools.AddField("reply_markup", Keyboard, "FileString", Parameters); + +Response = OPI_Tools.PostMultipart(URL, Parameters, FileStructure, "mixed"); + +Return Response; EndFunction // Send location // Sends location by geographic latitude and longitude to a chat or channel -// +// // Parameters: -// Token - String - Bot token - token -// ChatID - String, Number - Target chat ID or ChatID*TopicID - chat -// Latitude - String, Number - Geographic latitude - lat -// Longitude - String, Number - Geographic longitude - long -// Keyboard - String - See GenerateKeyboardFromArray - keyboard - Keyboard JSON or path to .json -// +// Token - String - Bot token - token +// ChatID - String, Number - Target chat ID or ChatID*TopicID - chat +// Latitude - String, Number - Geographic latitude - lat +// Longitude - String, Number - Geographic longitude - long +// Keyboard - String - See GenerateKeyboardFromArray - keyboard - Keyboard JSON or path to .json +// // Return value: -// Key-Value Pair - Serialized JSON response from Telegram +// Key-Value Pair - Serialized JSON response from Telegram Function SendLocation(Val Token, Val ChatID, Val Latitude, Val Longitude, Val Keyboard = "") Export - String_ = "String"; - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(ChatID); - - URL = "api.telegram.org/bot" + Token + "/sendLocation"; - - Parameters = New Structure; - OPI_Tools.AddField("parse_mode" , "Markdown" , String_ , Parameters); - OPI_Tools.AddField("latitude" , Latitude , String_ , Parameters); - OPI_Tools.AddField("longitude" , Longitude , String_ , Parameters); - OPI_Tools.AddField("reply_markup", Keyboard , "FileString", Parameters); - - AddChatIdentifier(ChatID, Parameters); +String_ = "String"; +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(ChatID); - Response = OPI_Tools.Get(URL, Parameters); +URL = "api.telegram.org/bot" + Token + "/sendLocation"; - Return Response; +Parameters = New Structure; +OPI_Tools.AddField("parse_mode" , "Markdown" , String_ , Parameters); +OPI_Tools.AddField("latitude" , Latitude , String_ , Parameters); +OPI_Tools.AddField("longitude" , Longitude , String_ , Parameters); +OPI_Tools.AddField("reply_markup", Keyboard , "FileString", Parameters); + +AddChatIdentifier(ChatID, Parameters); + +Response = OPI_Tools.Get(URL, Parameters); + +Return Response; EndFunction // Send contact // Sends a contact with name and phone number -// +// // Parameters: -// Token - String - Bot token - token -// ChatID - String, Number - Target chat ID or ChatID*TopicID - chat -// Name - String - Contact name - name -// Last name - String - Contact last name - surname -// Phone - String - Contact phone number - phone -// Keyboard - String - See GenerateKeyboardFromArray - keyboard - Keyboard JSON or path to .json -// +// Token - String - Bot token - token +// ChatID - String, Number - Target chat ID or ChatID*TopicID - chat +// Name - String - Contact name - name +// Last name - String - Contact last name - surname +// Phone - String - Contact phone number - phone +// Keyboard - String - See GenerateKeyboardFromArray - keyboard - Keyboard JSON or path to .json +// // Return value: -// Key-Value Pair - Serialized JSON response from Telegram +// Key-Value Pair - Serialized JSON response from Telegram Function SendContact(Val Token, Val ChatID, Val Name, Val Last name, Val Phone, Val Keyboard = "") Export - String_ = "String"; - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(ChatID); - - URL = "api.telegram.org/bot" + Token + "/sendContact"; +String_ = "String"; +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(ChatID); - Parameters = New Structure; - OPI_Tools.AddField("parse_mode" , "Markdown", String_ , Parameters); - OPI_Tools.AddField("first_name" , Name , String_ , Parameters); - OPI_Tools.AddField("last_name" , Last name , String_ , Parameters); - OPI_Tools.AddField("phone_number", Phone , String_ , Parameters); - OPI_Tools.AddField("reply_markup", Keyboard, "FileString", Parameters); - - AddChatIdentifier(ChatID, Parameters); +URL = "api.telegram.org/bot" + Token + "/sendContact"; - Response = OPI_Tools.Get(URL, Parameters); +Parameters = New Structure; +OPI_Tools.AddField("parse_mode" , "Markdown", String_ , Parameters); +OPI_Tools.AddField("first_name" , Name , String_ , Parameters); +OPI_Tools.AddField("last_name" , Last name , String_ , Parameters); +OPI_Tools.AddField("phone_number", Phone , String_ , Parameters); +OPI_Tools.AddField("reply_markup", Keyboard, "FileString", Parameters); - Return Response; +AddChatIdentifier(ChatID, Parameters); + +Response = OPI_Tools.Get(URL, Parameters); + +Return Response; EndFunction // Send poll // Sends a poll with answer options -// +// // Parameters: -// Token - String - Bot token - token -// ChatID - String, Number - Target chat ID or ChatID*TopicID - chat -// Question - String - Poll question - question -// AnswersArray - Array of Strings - Array of answer options - options -// Anonymous - Boolean - Poll anonymity - anonymous -// +// Token - String - Bot token - token +// ChatID - String, Number - Target chat ID or ChatID*TopicID - chat +// Question - String - Poll question - question +// AnswersArray - Array of Strings - Array of answer options - options +// Anonymous - Boolean - Poll anonymity - anonymous +// // Return value: -// Key-Value Pair - Serialized JSON response from Telegram +// Key-Value Pair - Serialized JSON response from Telegram Function SendPoll(Val Token, Val ChatID, Val Question, Val AnswersArray, Val Anonymous = True) Export - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(ChatID); - OPI_TypeConversion.GetCollection(AnswersArray); +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(ChatID); +OPI_TypeConversion.GetCollection(AnswersArray); - OPI_TypeConversion.GetBoolean(Anonymous); - - URL = "api.telegram.org/bot" + Token + "/sendPoll"; +OPI_TypeConversion.GetBoolean(Anonymous); - Parameters = New Structure; - OPI_Tools.AddField("parse_mode", "Markdown" , "String" , Parameters); - OPI_Tools.AddField("question" , Question , "String" , Parameters); - OPI_Tools.AddField("options" , AnswersArray, "FileString", Parameters); - - Parameters.Insert("is_anonymous", ?(Anonymous, 1, 0)); - AddChatIdentifier(ChatID, Parameters); +URL = "api.telegram.org/bot" + Token + "/sendPoll"; - Response = OPI_Tools.Get(URL, Parameters); +Parameters = New Structure; +OPI_Tools.AddField("parse_mode", "Markdown" , "String" , Parameters); +OPI_Tools.AddField("question" , Question , "String" , Parameters); +OPI_Tools.AddField("options" , AnswersArray, "FileString", Parameters); - Return Response; +Parameters.Insert("is_anonymous", ?(Anonymous, 1, 0)); +AddChatIdentifier(ChatID, Parameters); + +Response = OPI_Tools.Get(URL, Parameters); + +Return Response; EndFunction // Forward message // Forwards a message between chats or within a chat -// +// // Parameters: -// Token - String - Bot token - token -// OriginalID - String, Number - Original message ID - message -// FromID - String, Number - Chat ID of the original message - from -// ToID - String, Number - Target chat ID or ChatID*TopicID - to -// +// Token - String - Bot token - token +// OriginalID - String, Number - Original message ID - message +// FromID - String, Number - Chat ID of the original message - from +// ToID - String, Number - Target chat ID or ChatID*TopicID - to +// // Return value: -// Key-Value Pair - Serialized JSON response from Telegram +// Key-Value Pair - Serialized JSON response from Telegram Function ForwardMessage(Val Token, Val OriginalID, Val FromID, Val ToID) Export - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(OriginalID); - OPI_TypeConversion.GetLine(FromID); - OPI_TypeConversion.GetLine(ToID); - - URL = "api.telegram.org/bot" + Token + "/forwardMessage"; - - Parameters = New Structure; - OPI_Tools.AddField("from_chat_id", FromID , "String", Parameters); - OPI_Tools.AddField("message_id" , OriginalID, "String", Parameters); +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(OriginalID); +OPI_TypeConversion.GetLine(FromID); +OPI_TypeConversion.GetLine(ToID); - AddChatIdentifier(ToID, Parameters); - - Response = OPI_Tools.Get(URL, Parameters); +URL = "api.telegram.org/bot" + Token + "/forwardMessage"; - Return Response; +Parameters = New Structure; +OPI_Tools.AddField("from_chat_id", FromID , "String", Parameters); +OPI_Tools.AddField("message_id" , OriginalID, "String", Parameters); + +AddChatIdentifier(ToID, Parameters); + +Response = OPI_Tools.Get(URL, Parameters); + +Return Response; EndFunction // Generate keyboard from array of buttons // Generates a simple JSON keyboard from an array of buttons for a message or bottom panel -// +// // Parameters: -// ButtonArray - Array of Strings - Array of buttons - buttons -// UnderMessage - Boolean - Keyboard under the message or on the bottom panel - under -// OneByOne - Boolean - True > buttons are displayed in a column, False > in a row - column -// +// ButtonArray - Array of Strings - Array of buttons - buttons +// UnderMessage - Boolean - Keyboard under the message or on the bottom panel - under +// OneByOne - Boolean - True > buttons are displayed in a column, False > in a row - column +// // Return value: -// String - Keyboard JSON +// String - Keyboard JSON Function FormKeyboardFromButtonArray(Val ButtonArray - , Val UnderMessage = False - , Val OneByOne = True) Export +, Val UnderMessage = False +, Val OneByOne = True) Export - OPI_TypeConversion.GetBoolean(UnderMessage); - OPI_TypeConversion.GetBoolean(OneByOne); - OPI_TypeConversion.GetCollection(ButtonArray); - - If OneByOne Then - Strings = CreateTallKeyboard(ButtonArray); - Otherwise - Strings = CreateLongKeyboard(ButtonArray); - EndIf; +OPI_TypeConversion.GetBoolean(UnderMessage); +OPI_TypeConversion.GetBoolean(OneByOne); +OPI_TypeConversion.GetCollection(ButtonArray); - If UnderMessage Then - ParameterStructure = New Structure("inline_keyboard,rows", Strings, 1); - Otherwise - ParameterStructure = New Structure("keyboard,resize_keyboard", Strings, True); - EndIf; +If OneByOne Then +Strings = CreateTallKeyboard(ButtonArray); +Else +Strings = CreateLongKeyboard(ButtonArray); +EndIf; - Keyboard = OPI_Tools.JSONString(ParameterStructure); +If UnderMessage Then +ParameterStructure = New Structure("inline_keyboard,rows", Strings, 1); +Else +ParameterStructure = New Structure("keyboard,resize_keyboard", Strings, True); +EndIf; - Return Keyboard; +Keyboard = OPI_Tools.JSONString(ParameterStructure); + +Return Keyboard; EndFunction @@ -617,176 +617,176 @@ EndFunction // Ban // Bans a user in the selected chat -// +// // Parameters: -// Token - String - Bot token - token -// ChatID - String, Number - Target chat ID or ChatID*TopicID - chat -// UserID - String, Number - Target user ID - user -// +// Token - String - Bot token - token +// ChatID - String, Number - Target chat ID or ChatID*TopicID - chat +// UserID - String, Number - Target user ID - user +// // Return value: -// Key-Value Pair - Serialized JSON response from Telegram +// Key-Value Pair - Serialized JSON response from Telegram Function Ban(Val Token, Val ChatID, Val UserID) Export - String_ = "String"; - OPI_TypeConversion.GetLine(Token); - - URL = "api.telegram.org/bot" + Token + "/banChatMember"; +String_ = "String"; +OPI_TypeConversion.GetLine(Token); - Parameters = New Structure; - OPI_Tools.AddField("parse_mode", "Markdown" , String_, Parameters); - OPI_Tools.AddField("chat_id" , ChatID , String_, Parameters); - OPI_Tools.AddField("user_id" , UserID, String_, Parameters); +URL = "api.telegram.org/bot" + Token + "/banChatMember"; - Response = OPI_Tools.Get(URL, Parameters); +Parameters = New Structure; +OPI_Tools.AddField("parse_mode", "Markdown" , String_, Parameters); +OPI_Tools.AddField("chat_id" , ChatID , String_, Parameters); +OPI_Tools.AddField("user_id" , UserID, String_, Parameters); - Return Response; +Response = OPI_Tools.Get(URL, Parameters); + +Return Response; EndFunction // Unban // Unbans a previously banned user -// +// // Parameters: -// Token - String - Bot token - token -// ChatID - String, Number - Target chat ID or ChatID*TopicID - chat -// UserID - String, Number - Target user ID - user -// +// Token - String - Bot token - token +// ChatID - String, Number - Target chat ID or ChatID*TopicID - chat +// UserID - String, Number - Target user ID - user +// // Return value: -// Key-Value Pair - Serialized JSON response from Telegram +// Key-Value Pair - Serialized JSON response from Telegram Function Unban(Val Token, Val ChatID, Val UserID) Export - String_ = "String"; - OPI_TypeConversion.GetLine(Token); - - URL = "api.telegram.org/bot" + Token + "/unbanChatMember"; +String_ = "String"; +OPI_TypeConversion.GetLine(Token); - Parameters = New Structure; - OPI_Tools.AddField("parse_mode" , "Markdown" , String_ , Parameters); - OPI_Tools.AddField("chat_id" , ChatID , String_ , Parameters); - OPI_Tools.AddField("user_id" , UserID, String_ , Parameters); - OPI_Tools.AddField("only_if_banned", False , "Boolean", Parameters); +URL = "api.telegram.org/bot" + Token + "/unbanChatMember"; - Response = OPI_Tools.Get(URL, Parameters); +Parameters = New Structure; +OPI_Tools.AddField("parse_mode" , "Markdown" , String_ , Parameters); +OPI_Tools.AddField("chat_id" , ChatID , String_ , Parameters); +OPI_Tools.AddField("user_id" , UserID, String_ , Parameters); +OPI_Tools.AddField("only_if_banned", False , "Boolean", Parameters); - Return Response; +Response = OPI_Tools.Get(URL, Parameters); + +Return Response; EndFunction // Create invitation link // Creates a link for joining a closed chat -// +// // Parameters: -// Token - String - Bot token - token -// ChatID - String, Number - Target chat ID or ChatID*TopicID - chat -// Title - String - Invitation title - title -// ExpirationDate - Date - Date of end жfromни withwithылtoи (withoutwithрочно, еwithли не уtoазано) - expire -// UserLimit - Number - Limit пользоinателей (беwithtoонечно, еwithли не уtoазано) - limit -// +// Token - String - Bot token - token +// ChatID - String, Number - Target chat ID or ChatID*TopicID - chat +// Title - String - Invitation title - title +// ExpirationDate - Date - Date of end жfromни withwithылtoи (withoutwithрочно, еwithли не уtoазано) - expire +// UserLimit - Number - Limit пользоinателей (беwithtoонечно, еwithли не уtoазано) - limit +// // Return value: -// Key-Value Pair - Serialized JSON response from Telegram +// Key-Value Pair - Serialized JSON response from Telegram Function CreateInvitationLink(Val Token - , Val ChatID - , Val Title = "" - , Val ExpirationDate = "" - , Val UserLimit = 0) Export +, Val ChatID +, Val Title = "" +, Val ExpirationDate = "" +, Val UserLimit = 0) Export - String_ = "String"; - OPI_TypeConversion.GetLine(Token); - - URL = "api.telegram.org/bot" + Token + "/createChatInviteLink"; - - Parameters = New Structure; - OPI_Tools.AddField("parse_mode" , "Markdown" , String_ , Parameters); - OPI_Tools.AddField("chat_id" , ChatID , String_ , Parameters); - OPI_Tools.AddField("name" , Title , String_ , Parameters); - OPI_Tools.AddField("member_limit" , UserLimit, String_ , Parameters); - OPI_Tools.AddField("expire_date" , ExpirationDate , "Date" , Parameters); - - Response = OPI_Tools.Get(URL, Parameters); +String_ = "String"; +OPI_TypeConversion.GetLine(Token); - Return Response; +URL = "api.telegram.org/bot" + Token + "/createChatInviteLink"; + +Parameters = New Structure; +OPI_Tools.AddField("parse_mode" , "Markdown" , String_ , Parameters); +OPI_Tools.AddField("chat_id" , ChatID , String_ , Parameters); +OPI_Tools.AddField("name" , Title , String_ , Parameters); +OPI_Tools.AddField("member_limit" , UserLimit, String_ , Parameters); +OPI_Tools.AddField("expire_date" , ExpirationDate , "Date" , Parameters); + +Response = OPI_Tools.Get(URL, Parameters); + +Return Response; EndFunction // Pin message // Pins a message in the chat header -// +// // Parameters: -// Token - String - Token - token -// ChatID - String, Number - Target chat ID - chat -// MessageID - String, Number - Target message ID - message -// +// Token - String - Token - token +// ChatID - String, Number - Target chat ID - chat +// MessageID - String, Number - Target message ID - message +// // Return value: -// Key-Value Pair - Serialized JSON response from Telegram +// Key-Value Pair - Serialized JSON response from Telegram Function PinMessage(Val Token, Val ChatID, Val MessageID) Export - - String_ = "String"; - OPI_TypeConversion.GetLine(Token); - - URL = "api.telegram.org/bot" + Token + "/pinChatMessage"; - - Parameters = New Structure; - OPI_Tools.AddField("parse_mode" , "Markdown" , String_ , Parameters); - OPI_Tools.AddField("chat_id" , ChatID , String_ , Parameters); - OPI_Tools.AddField("message_id" , MessageID, String_ , Parameters); - OPI_Tools.AddField("disable_notification", False , "Boolean", Parameters); - Response = OPI_Tools.Get(URL, Parameters); +String_ = "String"; +OPI_TypeConversion.GetLine(Token); - Return Response; +URL = "api.telegram.org/bot" + Token + "/pinChatMessage"; + +Parameters = New Structure; +OPI_Tools.AddField("parse_mode" , "Markdown" , String_ , Parameters); +OPI_Tools.AddField("chat_id" , ChatID , String_ , Parameters); +OPI_Tools.AddField("message_id" , MessageID, String_ , Parameters); +OPI_Tools.AddField("disable_notification", False , "Boolean", Parameters); + +Response = OPI_Tools.Get(URL, Parameters); + +Return Response; EndFunction // Unpin message // Unpins a message in the chat header -// +// // Parameters: -// Token - String - Bot token - token -// ChatID - String, Number - Target chat ID - chat -// MessageID - String, Number - Target message ID - message -// +// Token - String - Bot token - token +// ChatID - String, Number - Target chat ID - chat +// MessageID - String, Number - Target message ID - message +// // Return value: -// Key-Value Pair - Serialized JSON response from Telegram +// Key-Value Pair - Serialized JSON response from Telegram Function UnpinMessage(Val Token, Val ChatID, Val MessageID) Export - - String_ = "String"; - OPI_TypeConversion.GetLine(Token); - - URL = "api.telegram.org/bot" + Token + "/unpinChatMessage"; - - Parameters = New Structure; - OPI_Tools.AddField("parse_mode", "Markdown" , String_, Parameters); - OPI_Tools.AddField("chat_id" , ChatID , String_, Parameters); - OPI_Tools.AddField("message_id", MessageID, String_, Parameters); - Response = OPI_Tools.Get(URL, Parameters); +String_ = "String"; +OPI_TypeConversion.GetLine(Token); - Return Response; +URL = "api.telegram.org/bot" + Token + "/unpinChatMessage"; + +Parameters = New Structure; +OPI_Tools.AddField("parse_mode", "Markdown" , String_, Parameters); +OPI_Tools.AddField("chat_id" , ChatID , String_, Parameters); +OPI_Tools.AddField("message_id", MessageID, String_, Parameters); + +Response = OPI_Tools.Get(URL, Parameters); + +Return Response; EndFunction // Get participant count // Gets the total number of chat participants -// +// // Parameters: -// Token - String - Bot token - token -// ChatID - String, Number - Target chat ID - chat -// +// Token - String - Bot token - token +// ChatID - String, Number - Target chat ID - chat +// // Return value: -// Key-Value Pair - Serialized JSON response from Telegram +// Key-Value Pair - Serialized JSON response from Telegram Function GetParticipantCount(Val Token, Val ChatID) Export - OPI_TypeConversion.GetLine(Token); - - URL = "api.telegram.org/bot" + Token + "/getChatMemberCount"; - - Parameters = New Structure; - OPI_Tools.AddField("parse_mode", "Markdown" , "String", Parameters); - OPI_Tools.AddField("chat_id" , ChatID , "String", Parameters); +OPI_TypeConversion.GetLine(Token); - Response = OPI_Tools.Get(URL, Parameters); +URL = "api.telegram.org/bot" + Token + "/getChatMemberCount"; - Return Response; +Parameters = New Structure; +OPI_Tools.AddField("parse_mode", "Markdown" , "String", Parameters); +OPI_Tools.AddField("chat_id" , ChatID , "String", Parameters); + +Response = OPI_Tools.Get(URL, Parameters); + +Return Response; EndFunction @@ -796,195 +796,195 @@ EndFunction // Get avatar icon list // Gets the mapping of Emoji IDs for setting as forum theme icons -// +// // Parameters: -// Token - String - Token - token -// +// Token - String - Token - token +// // Return value: -// Key-Value Pair - Key > ID, Value > Emoji +// Key-Value Pair - Key > ID, Value > Emoji Function GetAvatarIconList(Val Token) Export - - OPI_TypeConversion.GetLine(Token); - - Result = "result"; - URL = "api.telegram.org/bot" + Token + "/getForumTopicIconStickers"; - Response = OPI_Tools.Get(URL); - Icons = Response[Result]; - - If Not ValueFilled(Icons) Then - Return Response; - EndIf; - - Collection = New Match; - - For Each Icon Of Icons Loop - Collection.Insert(Icon["custom_emoji_id"], Icon["emoji"]); - EndOfLoop; - - Return Collection; + +OPI_TypeConversion.GetLine(Token); + +Result = "result"; +URL = "api.telegram.org/bot" + Token + "/getForumTopicIconStickers"; +Response = OPI_Tools.Get(URL); +Icons = Response[Result]; + +If Not ValueIsFilled(Icons) Then +Return Response; +EndIf; + +Collection = New Match; + +For Each Icon In Icons Do +Collection.Insert(Icon["custom_emoji_id"], Icon["emoji"]); +EndDo; + +Return Collection; EndFunction // Create forum thread // Creates a new thread in the group with theme functionality enabled -// +// // Parameters: -// Token - String - Token - token -// ChatID - String, Number - Thread creation chat ID - forum -// Title - String - Thread title - title -// IconID - String - See GetAvatarIconList - icon -// +// Token - String - Token - token +// ChatID - String, Number - Thread creation chat ID - forum +// Title - String - Thread title - title +// IconID - String - See GetAvatarIconList - icon +// // Return value: -// Key-Value Pair - Serialized JSON response from Telegram +// Key-Value Pair - Serialized JSON response from Telegram Function CreateForumThread(Val Token, Val ChatID, Val Title, Val IconID = "") Export - Return ForumTopicManagement(Token, ChatID, Title, IconID); +Return ForumTopicManagement(Token, ChatID, Title, IconID); EndFunction // Edit forum thread // Creates a new thread in the group with theme functionality enabled -// +// // Parameters: -// Token - String - Token - token -// ChatID - String, Number - Thread creation chat ID - forum -// ThreadID - String, Number - Thread ID - topic -// Title - String - New title - title -// IconID - String - See GetAvatarIconList - icon -// +// Token - String - Token - token +// ChatID - String, Number - Thread creation chat ID - forum +// ThreadID - String, Number - Thread ID - topic +// Title - String - New title - title +// IconID - String - See GetAvatarIconList - icon +// // Return value: -// Key-Value Pair - Serialized JSON response from Telegram +// Key-Value Pair - Serialized JSON response from Telegram Function EditForumTopic(Val Token - , Val ChatID - , Val ThreadID - , Val Title = Undefined - , Val IconID = Undefined) Export - - Return ForumTopicManagement(Token, ChatID, Title, IconID, ThreadID); +, Val ChatID +, Val ThreadID +, Val Title = Undefined +, Val IconID = Undefined) Export + +Return ForumTopicManagement(Token, ChatID, Title, IconID, ThreadID); EndFunction // Close forum thread // Closes the thread for new messages -// +// // Parameters: -// Token - String - Token - token -// ChatID - String, Number - Thread chat ID - forum -// ThreadID - String, Number - Thread ID - topic -// +// Token - String - Token - token +// ChatID - String, Number - Thread chat ID - forum +// ThreadID - String, Number - Thread ID - topic +// // Return value: -// Key-Value Pair - Serialized JSON response from Telegram +// Key-Value Pair - Serialized JSON response from Telegram Function CloseForumThread(Val Token, Val ChatID, Val ThreadID = "") Export - Return ManageForumThreadState(Token, ChatID, 2, ThreadID); +Return ManageForumThreadState(Token, ChatID, 2, ThreadID); EndFunction // Open forum thread // Reopens a previously closed forum thread -// +// // Parameters: -// Token - String - Token - token -// ChatID - String, Number - Thread chat ID - forum -// ThreadID - String, Number - Thread ID - topic -// +// Token - String - Token - token +// ChatID - String, Number - Thread chat ID - forum +// ThreadID - String, Number - Thread ID - topic +// // Return value: -// Key-Value Pair - Serialized JSON response from Telegram +// Key-Value Pair - Serialized JSON response from Telegram Function OpenForumThread(Val Token, Val ChatID, Val ThreadID = "") Export - Return ManageForumThreadState(Token, ChatID, 1, ThreadID); +Return ManageForumThreadState(Token, ChatID, 1, ThreadID); EndFunction // Delete forum thread // Deletes a forum thread -// +// // Parameters: -// Token - String - Token - token -// ChatID - String, Number - Thread chat ID - forum -// ThreadID - String, Number - Thread ID - topic -// +// Token - String - Token - token +// ChatID - String, Number - Thread chat ID - forum +// ThreadID - String, Number - Thread ID - topic +// // Return value: -// Key-Value Pair - Serialized JSON response from Telegram +// Key-Value Pair - Serialized JSON response from Telegram Function DeleteForumTopic(Val Token, Val ChatID, Val ThreadID) Export - Return ManageForumThreadState(Token, ChatID, 3, ThreadID); +Return ManageForumThreadState(Token, ChatID, 3, ThreadID); EndFunction // Hide main forum thread // Hides the main forum thread -// +// // Parameters: -// Token - String - Token - token -// ChatID - String, Number - Thread chat ID - forum -// +// Token - String - Token - token +// ChatID - String, Number - Thread chat ID - forum +// // Return value: -// Key-Value Pair - Serialized JSON response from Telegram +// Key-Value Pair - Serialized JSON response from Telegram Function HideMainForumTopic(Val Token, Val ChatID) Export - Return ManageMainTopicVisibility(Token, ChatID, True); +Return ManageMainTopicVisibility(Token, ChatID, True); EndFunction // Show main forum thread // Shows a previously hidden main forum thread -// +// // Parameters: -// Token - String - Token - token -// ChatID - String, Number - Thread chat ID - forum -// +// Token - String - Token - token +// ChatID - String, Number - Thread chat ID - forum +// // Return value: -// Key-Value Pair - Serialized JSON response from Telegram +// Key-Value Pair - Serialized JSON response from Telegram Function ShowMainForumTopic(Val Token, Val ChatID) Export - Return ManageMainTopicVisibility(Token, ChatID, False); +Return ManageMainTopicVisibility(Token, ChatID, False); EndFunction // Edit main forum thread name // Edits the name of the main forum thread -// +// // Parameters: -// Token - String - Token - token -// ChatID - String, Number - Thread chat ID - forum -// Title - String - New main thread name - title -// +// Token - String - Token - token +// ChatID - String, Number - Thread chat ID - forum +// Title - String - New main thread name - title +// // Return value: -// Key-Value Pair - Serialized JSON response from Telegram +// Key-Value Pair - Serialized JSON response from Telegram Function EditMainForumTopicName(Val Token, Val ChatID, Val Title) Export - - OPI_TypeConversion.GetLine(Token); - - URL = "api.telegram.org/bot" + Token + "/editGeneralForumTopic"; - - Parameters = New Structure; - OPI_Tools.AddField("chat_id", ChatID , "String", Parameters); - OPI_Tools.AddField("name" , Title, "String", Parameters); - - Response = OPI_Tools.Get(URL, Parameters); - - Return Response; + +OPI_TypeConversion.GetLine(Token); + +URL = "api.telegram.org/bot" + Token + "/editGeneralForumTopic"; + +Parameters = New Structure; +OPI_Tools.AddField("chat_id", ChatID , "String", Parameters); +OPI_Tools.AddField("name" , Title, "String", Parameters); + +Response = OPI_Tools.Get(URL, Parameters); + +Return Response; EndFunction // Clear thread's pinned messages list // Clears the list of pinned messages in the forum thread -// +// // Parameters: -// Token - String - Token - token -// ChatID - String, Number - Thread chat ID - forum -// ThreadID - String, Number - Thread ID. Main if not filled - topic -// +// Token - String - Token - token +// ChatID - String, Number - Thread chat ID - forum +// ThreadID - String, Number - Thread ID. Main if not filled - topic +// // Return value: -// Key-Value Pair - Serialized JSON response from Telegram +// Key-Value Pair - Serialized JSON response from Telegram Function ClearThreadPinnedMessagesList(Val Token, Val ChatID, Val ThreadID = "") Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(ChatID); - OPI_TypeConversion.GetLine(ThreadID); - - Parameters = New Structure; - OPI_Tools.AddField("chat_id" , ChatID, "String", Parameters); - OPI_Tools.AddField("message_thread_id", ThreadID, "String", Parameters); - - If ValueFilled(ThreadID) Then - Method = "/unpinAllForumTopicMessages"; - Otherwise - Method = "/unpinAllGeneralForumTopicMessages"; - EndIf; - - URL = "api.telegram.org/bot" + Token + Method; - Response = OPI_Tools.Get(URL, Parameters); - - Return Response; + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(ChatID); +OPI_TypeConversion.GetLine(ThreadID); + +Parameters = New Structure; +OPI_Tools.AddField("chat_id" , ChatID, "String", Parameters); +OPI_Tools.AddField("message_thread_id", ThreadID, "String", Parameters); + +If ValueIsFilled(ThreadID) Then +Method = "/unpinAllForumTopicMessages"; +Else +Method = "/unpinAllGeneralForumTopicMessages"; +EndIf; + +URL = "api.telegram.org/bot" + Token + Method; +Response = OPI_Tools.Get(URL, Parameters); + +Return Response; EndFunction @@ -996,258 +996,258 @@ EndFunction Function SendFile(Val Token, Val ChatID, Val Text, Val File, Val View, Val Keyboard, Val Markup) - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(ChatID); - OPI_TypeConversion.GetLine(View); +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(ChatID); +OPI_TypeConversion.GetLine(View); - Extension = ""; - Method = ""; - - DetermineSendMethod(View, Method, Extension); - ConvertFileData(File, Extension, View); - OPI_Tools.ReplaceSpecialCharacters(Text, Markup); - - Parameters = New Structure; - OPI_Tools.AddField("parse_mode" , Markup , "String" , Parameters); - OPI_Tools.AddField("caption" , Text , "String" , Parameters); - OPI_Tools.AddField("reply_markup", Keyboard, "FileString", Parameters); - - AddChatIdentifier(ChatID, Parameters); +Extension = ""; +Method = ""; - FileStructure = New Structure; - FileStructure.Insert(View + Extension, File); +DetermineSendMethod(View, Method, Extension); +ConvertFileData(File, Extension, View); +OPI_Tools.ReplaceSpecialCharacters(Text, Markup); - URL = "api.telegram.org/bot" + Token + Method; - Response = OPI_Tools.PostMultipart(URL, Parameters, FileStructure, "mixed"); +Parameters = New Structure; +OPI_Tools.AddField("parse_mode" , Markup , "String" , Parameters); +OPI_Tools.AddField("caption" , Text , "String" , Parameters); +OPI_Tools.AddField("reply_markup", Keyboard, "FileString", Parameters); - Return Response; +AddChatIdentifier(ChatID, Parameters); + +FileStructure = New Structure; +FileStructure.Insert(View + Extension, File); + +URL = "api.telegram.org/bot" + Token + Method; +Response = OPI_Tools.PostMultipart(URL, Parameters, FileStructure, "mixed"); + +Return Response; EndFunction Function ForumTopicManagement(Val Token - , Val ChatID - , Val Title = Undefined - , Val IconID = Undefined - , Val ThreadID = "") - - String_ = "String"; - OPI_TypeConversion.GetLine(Token); - - Parameters = New Structure; - OPI_Tools.AddField("name" , Title, String_, Parameters); - OPI_Tools.AddField("chat_id" , ChatID , String_, Parameters); - OPI_Tools.AddField("icon_custom_emoji_id", IconID , String_, Parameters); - OPI_Tools.AddField("message_thread_id" , ThreadID , String_, Parameters); - - If ValueFilled(ThreadID) Then - Method = "/editForumTopic"; - Otherwise - Method = "/createForumTopic"; - EndIf; - - OPI_Tools.RemoveEmptyCollectionFields(Parameters); - Response = OPI_Tools.Get("api.telegram.org/bot" + Token + Method, Parameters); - - Return Response; +, Val ChatID +, Val Title = Undefined +, Val IconID = Undefined +, Val ThreadID = "") + +String_ = "String"; +OPI_TypeConversion.GetLine(Token); + +Parameters = New Structure; +OPI_Tools.AddField("name" , Title, String_, Parameters); +OPI_Tools.AddField("chat_id" , ChatID , String_, Parameters); +OPI_Tools.AddField("icon_custom_emoji_id", IconID , String_, Parameters); +OPI_Tools.AddField("message_thread_id" , ThreadID , String_, Parameters); + +If ValueIsFilled(ThreadID) Then +Method = "/editForumTopic"; +Else +Method = "/createForumTopic"; +EndIf; + +OPI_Tools.RemoveEmptyCollectionFields(Parameters); +Response = OPI_Tools.Get("api.telegram.org/bot" + Token + Method, Parameters); + +Return Response; EndFunction -Function ManageForumThreadState(Val Token, Val ChatID, Val Status, Val ThreadID = "") - - OPI_TypeConversion.GetLine(Token); - - If ValueFilled(ThreadID) Then - Forum = "Forum"; - Otherwise - Forum = "GeneralForum"; - EndIf; - - Method = DetermineForumManagementMethod(Status, Forum); - - Parameters = New Structure; - OPI_Tools.AddField("chat_id" , ChatID, "String", Parameters); - OPI_Tools.AddField("message_thread_id", ThreadID, "String", Parameters); - - URL = "api.telegram.org/bot" + Token + Method; - Response = OPI_Tools.Get(URL, Parameters); +Function ManageForumThreadState(Val Token, Val ChatID, Val Status, Val ThreadID = "") + +OPI_TypeConversion.GetLine(Token); + +If ValueIsFilled(ThreadID) Then +Forum = "Forum"; +Else +Forum = "GeneralForum"; +EndIf; + +Method = DetermineForumManagementMethod(Status, Forum); + +Parameters = New Structure; +OPI_Tools.AddField("chat_id" , ChatID, "String", Parameters); +OPI_Tools.AddField("message_thread_id", ThreadID, "String", Parameters); + +URL = "api.telegram.org/bot" + Token + Method; +Response = OPI_Tools.Get(URL, Parameters); + +Return Response; - Return Response; - EndFunction Function ManageMainTopicVisibility(Val Token, Val ChatID, Val Hide) - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetBoolean(Hide); - If Hide Then - Method = "/hideGeneralForumTopic"; - Otherwise - Method = "/unhideGeneralForumTopic"; - EndIf; - - Parameters = New Structure; - OPI_Tools.AddField("chat_id", ChatID, "String", Parameters); - - URL = "api.telegram.org/bot" + Token + Method; - Response = OPI_Tools.Get(URL, Parameters); - - Return Response; +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetBoolean(Hide); -EndFunction +If Hide Then +Method = "/hideGeneralForumTopic"; +Else +Method = "/unhideGeneralForumTopic"; +EndIf; -Function DetermineForumManagementMethod(Val Status, Val Forum) - - Open = 1; - Close = 2; - Delete = 3; - - If Status = Open Then - Method = "/reopen" + Forum + "Topic"; - ElseIf Status = Close Then - Method = "/close" + Forum + "Topic"; - ElseIf Status = Delete Then - Method = "/deleteForumTopic"; - Otherwise - RaiseException "Incorrect forum management status"; - EndIf; - - Return Method; +Parameters = New Structure; +OPI_Tools.AddField("chat_id", ChatID, "String", Parameters); + +URL = "api.telegram.org/bot" + Token + Method; +Response = OPI_Tools.Get(URL, Parameters); + +Return Response; + +EndFunction + +Function DetermineForumManagementMethod(Val Status, Val Forum) + +Open = 1; +Close = 2; +Delete = 3; + +If Status = Open Then +Method = "/reopen" + Forum + "Topic"; +ElsIf Status = Close Then +Method = "/close" + Forum + "Topic"; +ElsIf Status = Delete Then +Method = "/deleteForumTopic"; +Else +Raise "Incorrect forum management status"; +EndIf; + +Return Method; EndFunction Function CreateTallKeyboard(Val ButtonArray) - - Strings = New Array; - - For Each Button Of ButtonArray Loop - Buttons = New Array; - Button = OPI_Tools.NumberToString(Button); - Buttons.Add(New Structure("text,callback_data", Button, Button)); - Strings.Add(Buttons); - EndOfLoop; - Return Strings; - +Strings = New Array; + +For Each Button In ButtonArray Do +Buttons = New Array; +Button = OPI_Tools.NumberToString(Button); +Buttons.Add(New Structure("text,callback_data", Button, Button)); +Strings.Add(Buttons); +EndDo; + +Return Strings; + EndFunction Function CreateLongKeyboard(Val ButtonArray) - - Strings = New Array; - Buttons = New Array; - - For Each Button Of ButtonArray Loop - Button = OPI_Tools.NumberToString(Button); - Buttons.Add(New Structure("text,callback_data", Button, Button)); - EndOfLoop; - - Strings.Add(Buttons); - - Return Strings; + +Strings = New Array; +Buttons = New Array; + +For Each Button In ButtonArray Do +Button = OPI_Tools.NumberToString(Button); +Buttons.Add(New Structure("text,callback_data", Button, Button)); +EndDo; + +Strings.Add(Buttons); + +Return Strings; EndFunction Procedure FormMediaArray(Val FileMapping, Val Text, FileStructure, Media) - - Counter = 0; - - OPI_TypeConversion.GetCollection(FileMapping); - OPI_TypeConversion.GetLine(Text); - - If TypeValue(FileMapping) <> Type("Match") Then - // !OInt RaiseException("Failed to Retrieve Information from JSON media!"); - Return; - EndIf; - - For Each CurrentFile Of FileMapping Loop - - If Not TypeValue(CurrentFile.Key) = Type("BinaryData") Then - - Binary = CurrentFile.Key; - OPI_TypeConversion.GetBinaryData(Binary); - - ThisFile = New File(CurrentFile.Key); - MediaName = CurrentFile.Value - + String(Counter) - + ?(CurrentFile.Value = "document", ThisFile.Extension, ""); - - FullMediaName = StringReplace(MediaName, ".", "___"); - - Otherwise - Binary = CurrentFile.Key; - MediaName = CurrentFile.Value + String(Counter); - FullMediaName = MediaName; - EndIf; - - FileStructure.Insert(FullMediaName, Binary); - - MediaStructure = New Structure; - MediaStructure.Insert("type" , CurrentFile.Value); - MediaStructure.Insert("media", "attach://" + MediaName); - - If Counter = 0 Then - MediaStructure.Insert("caption", Text); - EndIf; - - Media.Add(MediaStructure); - - Counter = Counter + 1; - - EndOfLoop; - Media = OPI_Tools.JSONString(Media); - +Counter = 0; + +OPI_TypeConversion.GetCollection(FileMapping); +OPI_TypeConversion.GetLine(Text); + +If TypeValue(FileMapping) <> Type("Match") Then +// !OInt Raise("Failed to Retrieve Information from JSON media!"); +Return; +EndIf; + +For Each CurrentFile In FileMapping Do + +If Not TypeValue(CurrentFile.Key) = Type("BinaryData") Then + +Binary = CurrentFile.Key; +OPI_TypeConversion.GetBinaryData(Binary); + +ThisFile = New File(CurrentFile.Key); +MediaName = CurrentFile.Value ++ String(Counter) ++ ?(CurrentFile.Value = "document", ThisFile.Extension, ""); + +FullMediaName = StringReplace(MediaName, ".", "___"); + +Else +Binary = CurrentFile.Key; +MediaName = CurrentFile.Value + String(Counter); +FullMediaName = MediaName; +EndIf; + +FileStructure.Insert(FullMediaName, Binary); + +MediaStructure = New Structure; +MediaStructure.Insert("type" , CurrentFile.Value); +MediaStructure.Insert("media", "attach://" + MediaName); + +If Counter = 0 Then +MediaStructure.Insert("caption", Text); +EndIf; + +Media.Add(MediaStructure); + +Counter = Counter + 1; + +EndDo; + +Media = OPI_Tools.JSONString(Media); + EndProcedure Procedure AddChatIdentifier(Val ChatID, Parameters) - - ChatID = OPI_Tools.NumberToString(ChatID); - ChatArray = StrSplit(ChatID, "*", False); - - If ChatArray.Quantity() > 1 Then - - ChatID = ChatArray[0]; - ThreadID = ChatArray[1]; - - Parameters.Insert("message_thread_id", ThreadID); - - EndIf; - - Parameters.Insert("chat_id", ChatID); + +ChatID = OPI_Tools.NumberToString(ChatID); +ChatArray = StrSplit(ChatID, "*", False); + +If ChatArray.Quantity() > 1 Then + +ChatID = ChatArray[0]; +ThreadID = ChatArray[1]; + +Parameters.Insert("message_thread_id", ThreadID); + +EndIf; + +Parameters.Insert("chat_id", ChatID); EndProcedure Procedure DetermineSendMethod(Val View, Method, Extension) - - If View = "photo" Then - Method = "/sendPhoto"; - ElseIf View = "video" Then - Method = "/sendVideo"; - ElseIf View = "audio" Then - Method = "/sendAudio"; - ElseIf View = "document" Then - Method = "/sendDocument"; - ElseIf View = "animation" Then - Method = "/sendAnimation"; - Extension = ".gif"; - Otherwise - RaiseException "Incorrect sending view"; - EndIf; + +If View = "photo" Then +Method = "/sendPhoto"; +ElsIf View = "video" Then +Method = "/sendVideo"; +ElsIf View = "audio" Then +Method = "/sendAudio"; +ElsIf View = "document" Then +Method = "/sendDocument"; +ElsIf View = "animation" Then +Method = "/sendAnimation"; +Extension = ".gif"; +Else +Raise "Incorrect sending view"; +EndIf; EndProcedure Procedure ConvertFileData(File, Extension, View) - - If Not TypeValue(File) = Type("BinaryData") Then - - CurrentFile = New File(File); - Extension = ?(View = "document", CurrentFile.Extension, Extension); - OPI_TypeConversion.GetBinaryData(File); - - EndIf; - Extension = StringReplace(Extension, ".", "___"); - +If Not TypeValue(File) = Type("BinaryData") Then + +CurrentFile = New File(File); +Extension = ?(View = "document", CurrentFile.Extension, Extension); +OPI_TypeConversion.GetBinaryData(File); + +EndIf; + +Extension = StringReplace(Extension, ".", "___"); + EndProcedure #EndRegion diff --git a/src/en/OPI/src/CommonModules/OPI_Telegram/OPI_Telegram.mdo b/src/en/OPI/src/CommonModules/OPI_Telegram/OPI_Telegram.mdo index cc233a0791..46dccc11b8 100644 --- a/src/en/OPI/src/CommonModules/OPI_Telegram/OPI_Telegram.mdo +++ b/src/en/OPI/src/CommonModules/OPI_Telegram/OPI_Telegram.mdo @@ -1,11 +1,11 @@ - + - OPI_Telegram - - ru - Методы интеграции с Telegram (ОПИ) - - true - true - true +OPI_Telegram + +ru +Methodы интеграции with Telegram (OPI) + +true +true +true diff --git a/src/en/OPI/src/CommonModules/OPI_Tests/Module.bsl b/src/en/OPI/src/CommonModules/OPI_Tests/Module.bsl new file mode 100644 index 0000000000..ff1efd2cb9 --- /dev/null +++ b/src/en/OPI/src/CommonModules/OPI_Tests/Module.bsl @@ -0,0 +1,5307 @@ +// Location OS: ./OInt/tests/Modules/internal/OPI_Tests.os + +// MIT License + +// Copyright (c) 2023 Anton Tsitavets + +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: + +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. + +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +// https://github.com/Bayselonarrend/OpenIntegrations + +// Test suite for YAxUnit + +// BSLLS:Typo-off +// BSLLS:LatinAndCyrillicSymbolInWord-off +// BSLLS:IncorrectLineBreak-off +// BSLLS:UsingServiceTag-off +// BSLLS:UnusedParameters-off +// BSLLS:DuplicateStringLiteral-off + +// @skip-check undefined-variable +// @skip-check wrong-string-literal-content + +// Uncomment if OneScript is executed +// #Use oint +// #Use asserts + +#Region ServiceProgramInterface + +// For YAxUnit + +Procedure ExecutableScripts() Export + +OPI_GetTestData.FormYAXTests(); + +EndProcedure + +// For Asserts + +Function GetTestList(UnitTesting) Export + +Return OPI_GetTestData.FormAssertsTests(); + +EndFunction + +#Region RunnableTests + +#Region Telegram + +Procedure Telegram_GetBotInfo() Export + +TestParameters = New Structure; +OPI_GetTestData.ParameterToCollection("Telegram_Token", TestParameters); + +Telegram_GetBotInformation(TestParameters); + +EndProcedure + +Procedure Telegram_GetUpdates() Export + +TestParameters = New Structure; +OPI_GetTestData.ParameterToCollection("Telegram_Token", TestParameters); + +Telegram_DeleteWebhook(TestParameters); +Telegram_GetUpdates(TestParameters); + +EndProcedure + +Procedure Telegram_SetWebhook() Export + +TestParameters = New Structure; +OPI_GetTestData.ParameterToCollection("Telegram_Token", TestParameters); +OPI_GetTestData.ParameterToCollection("Telegram_URL" , TestParameters); + +Telegram_SetWebhook(TestParameters); +Telegram_DeleteWebhook(TestParameters); + +EndProcedure + +Procedure Telegram_SendTextMessage() Export + +TestParameters = New Structure; +OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); +OPI_GetTestData.ParameterToCollection("Telegram_ChatID" , TestParameters); +OPI_GetTestData.ParameterToCollection("Telegram_ChannelID", TestParameters); +OPI_GetTestData.ParameterToCollection("String" , TestParameters); + +Telegram_SendTextMessage(TestParameters); + +EndProcedure + +Procedure Telegram_SendImage() Export + +TestParameters = New Structure; +OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); +OPI_GetTestData.ParameterToCollection("Telegram_ChatID" , TestParameters); +OPI_GetTestData.ParameterToCollection("Telegram_ChannelID", TestParameters); +OPI_GetTestData.ParameterToCollection("String" , TestParameters); +OPI_GetTestData.ParameterToCollection("Picture" , TestParameters); + +Telegram_SendPicture(TestParameters); +Telegram_DownloadFile(TestParameters); + +EndProcedure + +Procedure Telegram_SendVideo() Export + +TestParameters = New Structure; +OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); +OPI_GetTestData.ParameterToCollection("Telegram_ChatID" , TestParameters); +OPI_GetTestData.ParameterToCollection("Telegram_ChannelID", TestParameters); +OPI_GetTestData.ParameterToCollection("String" , TestParameters); +OPI_GetTestData.ParameterToCollection("Video" , TestParameters); + +Telegram_SendVideo(TestParameters); +Telegram_DownloadFile(TestParameters); + +EndProcedure + +Procedure Telegram_SendAudio() Export + +TestParameters = New Structure; +OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); +OPI_GetTestData.ParameterToCollection("Telegram_ChatID" , TestParameters); +OPI_GetTestData.ParameterToCollection("Telegram_ChannelID", TestParameters); +OPI_GetTestData.ParameterToCollection("String" , TestParameters); +OPI_GetTestData.ParameterToCollection("Audio" , TestParameters); + +Telegram_SendAudio(TestParameters); +Telegram_DownloadFile(TestParameters); + +EndProcedure + +Procedure Telegram_SendDocument() Export + +TestParameters = New Structure; +OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); +OPI_GetTestData.ParameterToCollection("Telegram_ChatID" , TestParameters); +OPI_GetTestData.ParameterToCollection("Telegram_ChannelID", TestParameters); +OPI_GetTestData.ParameterToCollection("String" , TestParameters); +OPI_GetTestData.ParameterToCollection("Document" , TestParameters); + +Telegram_SendDocument(TestParameters); + +EndProcedure + +Procedure Telegram_SendGIF() Export + +TestParameters = New Structure; +OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); +OPI_GetTestData.ParameterToCollection("Telegram_ChatID" , TestParameters); +OPI_GetTestData.ParameterToCollection("Telegram_ChannelID", TestParameters); +OPI_GetTestData.ParameterToCollection("String" , TestParameters); +OPI_GetTestData.ParameterToCollection("GIF" , TestParameters); + +Telegram_SendGif(TestParameters); + +EndProcedure + +Procedure Telegram_SendMediaGroup() Export + +TestParameters = New Structure; +OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); +OPI_GetTestData.ParameterToCollection("Telegram_ChatID" , TestParameters); +OPI_GetTestData.ParameterToCollection("Telegram_ChannelID", TestParameters); +OPI_GetTestData.ParameterToCollection("String" , TestParameters); +OPI_GetTestData.ParameterToCollection("Picture" , TestParameters); +OPI_GetTestData.ParameterToCollection("Video" , TestParameters); + +Telegram_SendMediaGroup(TestParameters); + +EndProcedure + +Procedure Telegram_SendLocation() Export + +TestParameters = New Structure; +OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); +OPI_GetTestData.ParameterToCollection("Telegram_ChatID" , TestParameters); +OPI_GetTestData.ParameterToCollection("Telegram_ChannelID", TestParameters); +OPI_GetTestData.ParameterToCollection("Long" , TestParameters); +OPI_GetTestData.ParameterToCollection("Lat" , TestParameters); + +Telegram_SendLocation(TestParameters); + +EndProcedure + +Procedure Telegram_SendContact() Export + +TestParameters = New Structure; +OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); +OPI_GetTestData.ParameterToCollection("Telegram_ChatID" , TestParameters); +OPI_GetTestData.ParameterToCollection("Telegram_ChannelID", TestParameters); +OPI_GetTestData.ParameterToCollection("Name" , TestParameters); +OPI_GetTestData.ParameterToCollection("Surname" , TestParameters); +OPI_GetTestData.ParameterToCollection("Phone" , TestParameters); + +Telegram_SendContact(TestParameters); + +EndProcedure + +Procedure Telegram_SendPoll() Export + +TestParameters = New Structure; +OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); +OPI_GetTestData.ParameterToCollection("Telegram_ChatID" , TestParameters); +OPI_GetTestData.ParameterToCollection("Telegram_ChannelID", TestParameters); + +Telegram_SendPoll(TestParameters); + +EndProcedure + +Procedure Telegram_ForwardMessage() Export + +TestParameters = New Structure; +OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); +OPI_GetTestData.ParameterToCollection("Telegram_ChatID" , TestParameters); +OPI_GetTestData.ParameterToCollection("Telegram_ChannelID" , TestParameters); +OPI_GetTestData.ParameterToCollection("Telegram_ChannelMessageID", TestParameters); + +Telegram_ForwardMessage(TestParameters); + +EndProcedure + +Procedure Telegram_BanUnban() Export + +TestParameters = New Structure; +OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); +OPI_GetTestData.ParameterToCollection("Telegram_ChatID" , TestParameters); +OPI_GetTestData.ParameterToCollection("Telegram_ChannelID" , TestParameters); + +Telegram_Ban(TestParameters); +Telegram_Unban(TestParameters); + +EndProcedure + +Procedure Telegram_CreateInvitationLink() Export + +TestParameters = New Structure; +OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); +OPI_GetTestData.ParameterToCollection("Telegram_ChannelID", TestParameters); + +Telegram_CreateInviteLink(TestParameters); + +EndProcedure + +Procedure Telegram_PinUnpinMessage() Export + +TestParameters = New Structure; +OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); +OPI_GetTestData.ParameterToCollection("Telegram_ChannelID" , TestParameters); +OPI_GetTestData.ParameterToCollection("Telegram_ChannelMessageID", TestParameters); + +Telegram_PinMessage(TestParameters); +Telegram_UnpinMessage(TestParameters); + +EndProcedure + +Procedure Telegram_GetMemberCount() Export + +TestParameters = New Structure; +OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); +OPI_GetTestData.ParameterToCollection("Telegram_ChannelID", TestParameters); + +Telegram_GetParticipantCount(TestParameters); + +EndProcedure + +Procedure Telegram_GetForumAvatarsList() Export + +TestParameters = New Structure; +OPI_GetTestData.ParameterToCollection("Telegram_Token", TestParameters); + +Telegram_GetForumAvatarList(TestParameters); + +EndProcedure + +Procedure Telegram_CreateDeleteForumTopic() Export + +TestParameters = New Structure; +OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); +OPI_GetTestData.ParameterToCollection("Telegram_ForumID", TestParameters); +OPI_GetTestData.ParameterToCollection("Picture" , TestParameters); +OPI_GetTestData.ParameterToCollection("String" , TestParameters); + +Telegram_CreateForumTopic(TestParameters); +Telegram_EditForumTopic(TestParameters); +Telegram_CloseForumTopic(TestParameters); +Telegram_OpenForumTopic(TestParameters); +Telegram_ClearPinnedMessagesList(TestParameters); +Telegram_DeleteForumTopic(TestParameters); + +EndProcedure + +Procedure Telegram_HideShowMainTopic() Export + +TestParameters = New Structure; +OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); +OPI_GetTestData.ParameterToCollection("Telegram_ForumID", TestParameters); + +Telegram_HideMainForumTopic(TestParameters); +Telegram_ShowMainForumTopic(TestParameters); + +EndProcedure + +Procedure Telegram_ChangeMainTopicName() Export + +TestParameters = New Structure; +OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); +OPI_GetTestData.ParameterToCollection("Telegram_ForumID", TestParameters); + +Telegram_ChangeMainTopicName(TestParameters); + +EndProcedure + +#EndRegion + +#Region VK + +Procedure VK_CreateTokenLink() Export + +TestParameters = New Structure; +OPI_GetTestData.ParameterToCollection("VK_AppID", TestParameters); + +VK_CreateTokenRetrievalLink(TestParameters); + +EndProcedure + +Procedure VK_CreateDeletePost() Export + +TestParameters = New Structure; +OPI_GetTestData.ParameterToCollection("Picture" , TestParameters); +OPI_GetTestData.ParameterToCollection("Picture2", TestParameters); + +VK_CreatePost(TestParameters); +VK_DeletePost(TestParameters); + +EndProcedure + +Procedure VK_CreateCompositePost() Export + +TestParameters = New Structure; +OPI_GetTestData.ParameterToCollection("Picture" , TestParameters); +OPI_GetTestData.ParameterToCollection("Video" , TestParameters); + +VK_CreateCompositePost(TestParameters); + +EndProcedure + +Procedure VK_CreatePoll() Export + +VK_CreatePoll(); + +EndProcedure + +Procedure VK_SaveDeleteImage() Export + +TestParameters = New Structure; +OPI_GetTestData.ParameterToCollection("Picture" , TestParameters); + +VK_CreateAlbum(TestParameters); +VK_SavePictureToAlbum(TestParameters); +VK_DeleteImage(TestParameters); +VK_DeleteAlbum(TestParameters); + +EndProcedure + +Procedure VK_CreateStory() Export + +TestParameters = New Match; +OPI_GetTestData.ParameterToCollection("Picture" , TestParameters); + +VK_CreateStory(TestParameters); + +EndProcedure + +Procedure VK_DiscussionMethods() Export + +TestParameters = New Structure; +Parameters = GetVKParameters(); + +VK_CreateDiscussion(TestParameters); +VK_CloseDiscussion(TestParameters); +VK_OpenDiscussion(TestParameters); +VK_PostToDiscussion(TestParameters); + +OPI_VK.CloseDiscussion(TestParameters["VK_ConvID"], True, Parameters); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure VK_LikeRepostComment() Export + +Parameters = GetVKParameters(); +Text = "Post from autotest"; +Message = "Message from autotest"; +TypeMatch = Type("Match"); +TypeNumber = Type("Number"); +Response = "response"; + +Result = OPI_VK.CreatePost(Text, New Array, , , Parameters); + +PostID = Result[Response]["post_id"]; +Result = OPI_VK.LikePost(PostID, , Parameters); + +// !OInt OPI_GetTestData.WriteLog(Result, "LikePost"); + +OPI_Tools.Pause(5); + +OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch).Filled(); +OPI_GetTestData.ExpectsThat(Result[Response]["likes"]).HasType(TypeNumber).Filled(); + +ExternalPost = 2571; +ExternalWall = -218704372; + +Result = OPI_VK.MakeRepost(ExternalPost, ExternalWall, , , Parameters); + +// !OInt OPI_GetTestData.WriteLog(Result, "MakeRepost"); + +OPI_Tools.Pause(5); + +OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch).Filled(); +OPI_GetTestData.ExpectsThat(Result[Response]["success"]).HasType(TypeNumber).Equal(1); +OPI_GetTestData.ExpectsThat(Result[Response]["wall_repost_count"]).HasType(TypeNumber).Equal(1); + +Result = OPI_VK.WriteComment(PostID, Parameters["owner_id"], Message, Parameters); + +// !OInt OPI_GetTestData.WriteLog(Result, "WriteComment"); + +OPI_Tools.Pause(5); + +OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch).Filled(); +OPI_GetTestData.ExpectsThat(Result[Response]["comment_id"]).HasType(TypeNumber).Filled(); + +OPI_VK.DeletePost(PostID, Parameters); +OPI_VK.DeletePost(Result[Response]["post_id"], Parameters); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure VK_GetStatistics() Export + +CurrentDate = OPI_Tools.GetCurrentDate(); +Parameters = GetVKParameters(); +Date0 = StartOfDay(CurrentDate); +Date1 = EndOfDay(Date0); +TypeMatch = Type("Match"); + +Result = OPI_VK.GetStatistics(Date0, Date1, Parameters); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetStatistics"); + +OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch).Filled(); +OPI_GetTestData.ExpectsThat(Result["response"][0]["visitors"]).HasType(TypeMatch).Filled(); +OPI_GetTestData.ExpectsThat(Result["response"][0]["reach"]).HasType(TypeMatch).Filled(); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure VK_GetPostStatistics() Export + +Parameters = GetVKParameters(); + +ArrayOfPosts = New Array; +ArrayOfPosts.Add(214); +ArrayOfPosts.Add(215); + +Result = OPI_VK.GetPostStatistics(ArrayOfPosts, Parameters); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetPostStatistics"); + +OPI_GetTestData.ExpectsThat(Result).HasType("Array").HasLength(2); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure VK_CreateAdCampaign() Export + +Parameters = GetVKParameters(); +CabinetID = OPI_GetTestData.GetParameter("VK_AdsCabinetID"); +Name = "TestCampaign"; +TypeMatch = Type("Match"); +TypeNumber = Type("Number"); +Response = "response"; +UID = "id"; + +Result = OPI_VK.CreateAdvertisingCampaign(CabinetID, Name, Parameters); + +// !OInt OPI_GetTestData.WriteLog(Result, "CreateAdvertisingCampaign"); + +Result = Result[Response][0]; + +OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); +OPI_GetTestData.ExpectsThat(Result["error_code"]).HasType(TypeNumber).Equal(602); +OPI_GetTestData.ExpectsThat(Result[UID]).HasType(TypeNumber).Filled(); + +CampaignID = Result[UID]; +CategoryID = 126; +Limit = 150; + +Result = OPI_VK.CreatePost(Name, New Array, , , Parameters); +PostID = Result[Response]["post_id"]; + +Result = OPI_VK.CreateAd(CampaignID +, Limit +, CategoryID +, PostID +, CabinetID +, Parameters); + +// !OInt OPI_GetTestData.WriteLog(Result, "CreateAd"); + +Result = Result[Response][0]; + +OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); +OPI_GetTestData.ExpectsThat(Result["error_code"]).HasType(TypeNumber).Equal(602); +OPI_GetTestData.ExpectsThat(Result[UID]).HasType(TypeNumber).Filled(); + +AnnouncementID = Result[UID]; +Result = OPI_VK.PauseAdvertisingAd(CabinetID, AnnouncementID, Parameters); + +// !OInt OPI_GetTestData.WriteLog(Result, "PauseAdvertisingAd"); + +Result = Result[Response][0]; + +OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); +OPI_GetTestData.ExpectsThat(Result[UID]).HasType(TypeNumber).Filled(); + +OPI_VK.DeletePost(PostID, Parameters); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure VK_SendMessage() Export + +Parameters = GetVKParameters(); +User = OPI_GetTestData.GetParameter("VK_UserID"); +Token = OPI_GetTestData.GetParameter("VK_CommunityToken"); +Text = "Message from autotest"; + +ButtonArray = New Array; +ButtonArray.Add("Button 1"); +ButtonArray.Add("Button 2"); + +Keyboard = OPI_VK.FormKeyboard(ButtonArray); +Result = OPI_VK.WriteMessage(Text, User, Token, Keyboard, Parameters); + +// !OInt OPI_GetTestData.WriteLog(Result, "WriteMessage"); + +OPI_GetTestData.ExpectsThat(Result).HasType("Match"); +OPI_GetTestData.ExpectsThat(Result["response"]).HasType("Number").Filled(); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure VK_GetProductCategories() Export + +Parameters = GetVKParameters(); +Result = OPI_VK.GetProductCategoryList(Parameters); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetProductCategoryList"); + +OPI_GetTestData.ExpectsThat(Result) +.HasType("Match") +.Filled(); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure VK_CreateProductSelection() Export + +Parameters = GetVKParameters(); +TypeMatch = Type("Match"); +TypeNumber = Type("Number"); +Response = "response"; +Image = OPI_GetTestData.GetBinary("Picture"); +AndVF = GetTempFileName("png"); +Image.Write(AndVF); + +Result = OPI_VK.CreateProductCollection("TestCollection" +, Image +, True +, False +, Parameters); + +// !OInt OPI_GetTestData.WriteLog(Result, "CreateProductCollection"); + +OPI_Tools.Pause(5); + +OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); +OPI_GetTestData.ExpectsThat(Result[Response]["albums_count"]).HasType(TypeNumber).Filled(); +OPI_GetTestData.ExpectsThat(Result[Response]["market_album_id"]).HasType(TypeNumber).Filled(); + +SelectionID = Result[Response]["market_album_id"]; + +Result = OPI_VK.EditProductCollection("EditedCollection", SelectionID, , , , Parameters); + +// !OInt OPI_GetTestData.WriteLog(Result, "EditProductCollection"); + +OPI_Tools.Pause(5); + +OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); +OPI_GetTestData.ExpectsThat(Result[Response]).HasType(TypeNumber).Equal(1); + +ImageArray = New Array; +ImageArray.Add(OPI_GetTestData.GetBinary("Picture")); +ImageArray.Add(OPI_GetTestData.GetBinary("Picture2")); + +Product = New Match(); +Product.Insert("Name" , "TestProduct"); +Product.Insert("Description" , "Product description"); +Product.Insert("Category" , "20173"); +Product.Insert("Price" , 1); +Product.Insert("OldPrice" , 15); +Product.Insert("MainPhoto" , Image); +Product.Insert("URL" , "https://github.com/Bayselonarrend/OpenIntegrations"); +Product.Insert("AdditionalPhotos" , ImageArray); +Product.Insert("MainInGroup" , True); +Product.Insert("Width" , 20); +Product.Insert("Height" , 30); +Product.Insert("Depth" , 40); +Product.Insert("Weight" , 100); +Product.Insert("SKU" , "12345"); +Product.Insert("AvailableBalance" , "10"); + +Result = OPI_VK.AddProduct(Product, SelectionID, Parameters); // Adding product + +// !OInt OPI_GetTestData.WriteLog(Result, "AddProduct"); + +OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); +OPI_GetTestData.ExpectsThat(Result[Response]["market_item_id"]).HasType(TypeNumber).Filled(); + +ProductID = Result[Response]["market_item_id"]; + +Product = New Match; +Product.Insert("Name", "EditedTestProduct"); + +Result = OPI_VK.EditProduct(ProductID, Product, , Parameters); // Change product + +// !OInt OPI_GetTestData.WriteLog(Result, "EditProduct"); + +Check_VKTrue(Result); + +Result = OPI_VK.AddProductToSelection(ProductID, SelectionID, Parameters); // Adding in selection + +// !OInt OPI_GetTestData.WriteLog(Result, "AddProductToSelection"); + +OPI_Tools.Pause(5); + +OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); +OPI_GetTestData.ExpectsThat(Result[Response]).HasType(TypeNumber).Filled(); + +Result = OPI_VK.RemoveProductFromSelection(ProductID, SelectionID, Parameters); // Deletes from selections + +// !OInt OPI_GetTestData.WriteLog(Result, "RemoveProductFromSelection"); + +OPI_Tools.Pause(5); +Check_VKTrue(Result); + +Result = OPI_VK.DeleteProduct(ProductID, Parameters); // Deletion product + +// !OInt OPI_GetTestData.WriteLog(Result, "DeleteProduct"); + +OPI_Tools.Pause(5); +Check_VKTrue(Result); + +Result = OPI_VK.DeleteSelection(SelectionID, Parameters); // Removal selections + +// !OInt OPI_GetTestData.WriteLog(Result, "DeleteSelection"); + +OPI_Tools.Pause(5); +Check_VKTrue(Result); + +DeleteFiles(AndVF); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure VK_CreateProductWithProperties() Export + +Parameters = GetVKParameters(); +TypeMatch = Type("Match"); +TypeNumber = Type("Number"); +MII = "market_item_id"; +Response = "response"; +Yellow = "Yellow"; +Red = "Red"; +Image = OPI_GetTestData.GetBinary("Picture"); +AndVF = GetTempFileName("png"); +Image.Write(AndVF); + +OptionArray = New Array; +OptionArray.Add(Yellow); +OptionArray.Add("Blue"); +OptionArray.Add(Red); + +Result = OPI_VK.CreateProductProperty("Color", Parameters); + +// !OInt OPI_GetTestData.WriteLog(Result, "CreateProductProperty"); + +OPI_Tools.Pause(5); + +Property = Result[Response]["property_id"]; +Property = OPI_Tools.NumberToString(Property); + +PropertyMatch = New Match; + +OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); +OPI_GetTestData.ExpectsThat(Result[Response]["property_id"]).HasType(TypeNumber).Filled(); + +Result = OPI_VK.EditProductProperty("Color (fromм.)", Property, Parameters); + +// !OInt OPI_GetTestData.WriteLog(Result, "EditProductProperty"); + +OPI_Tools.Pause(5); + +Check_VKTrue(Result); + +For Each Option In OptionArray Do + +Result = OPI_VK.AddProductPropertyVariant(Option, Property, Parameters); + +// !OInt OPI_GetTestData.WriteLog(Result, "AddProductPropertyVariant"); + +OPI_Tools.Pause(5); + +OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); +OPI_GetTestData.ExpectsThat(Result[Response]["variant_id"]).HasType(TypeNumber).Filled(); + +VariantID = Result[Response]["variant_id"]; +PropertyMatch.Insert(Option, VariantID); + +Result = OPI_VK.EditProductPropertyVariant(Option + String(New UniqueIdentifier()) +, Property +, VariantID +, Parameters); + +// !OInt OPI_GetTestData.WriteLog(Result, "EditProductPropertyVariant"); + +Check_VKTrue(Result); + +EndDo; + +ImageArray = New Array; +ImageArray.Add(AndVF); +ImageArray.Add(Image); + +Product = New Match(); +Product.Insert("Name" , "TestProduct (" + Yellow + ")"); +Product.Insert("Description" , "Product description"); +Product.Insert("Category" , "20173"); +Product.Insert("Price" , 1); +Product.Insert("OldPrice" , 15); +Product.Insert("MainPhoto" , Image); +Product.Insert("URL" , "https://github.com/Bayselonarrend/OpenIntegrations"); +Product.Insert("AdditionalPhotos" , ImageArray); +Product.Insert("MainInGroup" , True); +Product.Insert("GroupNumber" , Undefined); +Product.Insert("Width" , 20); +Product.Insert("Height" , 30); +Product.Insert("Depth" , 40); +Product.Insert("Weight" , 100); +Product.Insert("SKU" , 12345); +Product.Insert("AvailableBalance" , "10"); +Product.Insert("PropertyValues" , PropertyMatch[Yellow]); + +Result = OPI_VK.AddProduct(Product, , Parameters); // Adding product + +// !OInt OPI_GetTestData.WriteLog(Result, "AddProduct"); + +OPI_Tools.Pause(5); + +YellowID = Result[Response]["market_item_id"]; + +OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); +OPI_GetTestData.ExpectsThat(Result[Response][MII]).HasType(TypeNumber).Filled(); + +Product.Insert("Name" , "TestProduct (" + Red + ")"); +Product.Insert("PropertyValues", PropertyMatch[Red]); + +Result = OPI_VK.AddProduct(Product, , Parameters); // Adding product + +// !OInt OPI_GetTestData.WriteLog(Result, "AddProduct"); + +OPI_Tools.Pause(5); + +RedID = Result[Response][MII]; + +OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); +OPI_GetTestData.ExpectsThat(Result[Response][MII]).HasType(TypeNumber).Filled(); + +Array of products = New Array; +Array of products.Add(YellowID); +Array of products.Add(RedID); + +Result = OPI_VK.GetProductsByID(Array of products, Parameters); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetProductsByID"); + +OPI_Tools.Pause(5); + +OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); +OPI_GetTestData.ExpectsThat(Result[Response]["items"]).HasType("Array").HasLength(2); + +Result = OPI_VK.GroupProducts(Array of products, , Parameters); + +// !OInt OPI_GetTestData.WriteLog(Result, "GroupProducts"); + +OPI_Tools.Pause(5); + +OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); +OPI_GetTestData.ExpectsThat(Result[Response]["item_group_id"]).HasType(TypeNumber).Filled(); + +OPI_VK.DeleteProduct(YellowID , Parameters); +OPI_VK.DeleteProduct(RedID, Parameters); + +For Each Option In PropertyMatch Do + +Deletion = OPI_VK.DeleteProductPropertyVariant(Option.Value, Parameters); + +// !OInt OPI_GetTestData.WriteLog(Result, "DeleteProductPropertyVariant"); + +OPI_Tools.Pause(5); +Check_VKTrue(Deletion); + +EndDo; + +Deletion = OPI_VK.DeleteProductProperty(Property, Parameters); + +// !OInt OPI_GetTestData.WriteLog(Result, "DeleteProductProperty"); + +OPI_Tools.Pause(5); + +Check_VKTrue(Deletion); + +DeleteFiles(AndVF); + +EndProcedure + +Procedure VK_GetProductList() Export + +Parameters = GetVKParameters(); +Image = OPI_GetTestData.GetBinary("Picture"); + +ImageArray = New Array; +ImageArray.Add(Image); + +Product = New Match(); +Product.Insert("Name" , "TestProduct2"); +Product.Insert("Description" , "Product description"); +Product.Insert("Category" , "20173"); +Product.Insert("Price" , 1); +Product.Insert("OldPrice" , 15); +Product.Insert("MainPhoto" , Image); +Product.Insert("URL" , "https://github.com/Bayselonarrend/OpenIntegrations"); +Product.Insert("AdditionalPhotos" , ImageArray); +Product.Insert("MainInGroup" , True); +Product.Insert("GroupNumber" , Undefined); +Product.Insert("Width" , 20); +Product.Insert("Height" , 30); +Product.Insert("Depth" , 40); +Product.Insert("Weight" , 100); +Product.Insert("SKU" , 12345); +Product.Insert("AvailableBalance" , "10"); + +Result = OPI_VK.AddProduct(Product, , Parameters); +ProductID = Result["response"]["market_item_id"]; +OPI_Tools.Pause(5); + +Result = OPI_VK.GetProductList(, Parameters); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetProductList"); + +OPI_Tools.Pause(5); + +OPI_GetTestData.ExpectsThat(Result) +.HasType("Array").Filled(); + +OPI_VK.DeleteProduct(ProductID, Parameters); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure VK_GetSelectionList() Export + +Parameters = GetVKParameters(); +Image = OPI_GetTestData.GetBinary("Picture"); +Result = OPI_VK.CreateProductCollection("TestCollection" +, Image +, True +, False +, Parameters); + +// !OInt OPI_GetTestData.WriteLog(Result, "CreateProductCollection"); + +SelectionID = Result["response"]["market_album_id"]; +Result = OPI_VK.GetSelectionList(Parameters); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetSelectionList"); + +OPI_Tools.Pause(5); + +OPI_GetTestData.ExpectsThat(Result) +.HasType("Array").Filled(); + +OPI_VK.DeleteSelection(SelectionID, Parameters); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure VK_GetPropertyList() Export + +Parameters = GetVKParameters(); +Result = OPI_VK.GetPropertyList(Parameters); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetPropertyList"); + +OPI_Tools.Pause(5); + +OPI_GetTestData.ExpectsThat(Result) +.HasType("Array").Filled(); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure VK_GetOrderList() Export + +Parameters = GetVKParameters(); +Result = OPI_VK.GetOrderList(Parameters); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetOrderList"); + +OPI_Tools.Pause(5); + +OPI_GetTestData.ExpectsThat(Result) +.HasType("Array").Filled(); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure VK_UploadVideo() Export + +Parameters = GetVKParameters(); +Video = OPI_GetTestData.GetParameter("Video"); +Name = "NewVideo"; +Description = "Video description"; + +Result = OPI_VK.UploadVideoToServer(Video, Name, Description, , Parameters); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetOrderList"); + +OPI_GetTestData.ExpectsThat(Result["video_id"]).Filled(); +OPI_GetTestData.ExpectsThat(Result["video_hash"]).Filled(); + +OPI_Tools.Pause(5); + +EndProcedure + +#EndRegion + +#Region YandexDisk + +Procedure YDisk_GetDiskInfo() Export + +Token = OPI_GetTestData.GetParameter("YandexDisk_Token"); +Match = "Match"; + +Result = OPI_YandexDisk.GetDiskInformation(Token); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetDiskInformation"); + +OPI_GetTestData.ExpectsThat(Result).HasType(Match).Filled(); +OPI_GetTestData.ExpectsThat(Result["system_folders"]).HasType(Match); +OPI_GetTestData.ExpectsThat(Result["user"]).HasType(Match); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure YDisk_CreateFolder() Export + +Token = OPI_GetTestData.GetParameter("YandexDisk_Token"); +Path = "/" + String(New UniqueIdentifier); + +Result = OPI_YandexDisk.CreateFolder(Token, Path); + +// !OInt OPI_GetTestData.WriteLog(Result, "CreateFolder"); + +OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); +OPI_GetTestData.ExpectsThat(Result["type"]).Equal("dir"); +OPI_GetTestData.ExpectsThat(Result["path"]).Equal("disk:" + Path); + +OPI_YandexDisk.DeleteObject(Token, Path, False); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure YDisk_UploadByUrlAndGetObject() Export + +Token = OPI_GetTestData.GetParameter("YandexDisk_Token"); +Path = "/" + String(New UniqueIdentifier) + ".png"; +URL = "https://raw.githubusercontent.com/Bayselonarrend/OpenIntegrations/main/Media/logo.png"; + +OPI_YandexDisk.UploadFileByURL(Token, Path, URL); +OPI_Tools.Pause(5); + +Result = OPI_YandexDisk.GetObject(Token, Path); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetObject"); + +OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); +OPI_GetTestData.ExpectsThat(Result["type"]).Equal("file"); +OPI_GetTestData.ExpectsThat(Result["path"]).Equal("disk:" + Path); + +OPI_YandexDisk.DeleteObject(Token, Path, False); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure YDisk_UploadDeleteFile() Export + +Token = OPI_GetTestData.GetParameter("YandexDisk_Token"); +Path = "/" + String(New UniqueIdentifier) + ".png"; +Image = OPI_GetTestData.GetBinary("Picture"); +AndVF = GetTempFileName("png"); +Image.Write(AndVF); + +Result = OPI_YandexDisk.UploadFile(Token, Path, Image, True); + +// !OInt OPI_GetTestData.WriteLog(Result, "UploadFile"); + +Check_Empty(Result); +OPI_Tools.Pause(5); + +Result = OPI_YandexDisk.DeleteObject(Token, Path, False); + +// !OInt OPI_GetTestData.WriteLog(Result, "DeleteObject"); + +Check_Empty(Result); + +Result = OPI_YandexDisk.UploadFile(Token, Path, AndVF, True); + +// !OInt OPI_GetTestData.WriteLog(Result, "UploadFile"); + +Check_Empty(Result); +OPI_Tools.Pause(5); + +Result = OPI_YandexDisk.DeleteObject(Token, Path, False); + +// !OInt OPI_GetTestData.WriteLog(Result, "DeleteObject"); + +Check_Empty(Result); + +DeleteFiles(AndVF); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure YDisk_CreateObjectCopy() Export + +Token = OPI_GetTestData.GetParameter("YandexDisk_Token"); +OriginalPath = "/" + String(New UniqueIdentifier) + ".png"; +CopyPath = "/" + String(New UniqueIdentifier) + ".png"; +URL = "https://raw.githubusercontent.com/Bayselonarrend/" ++ "OpenIntegrations/main/Media/logo.png"; + +OPI_YandexDisk.UploadFileByURL(Token, OriginalPath, URL); +OPI_Tools.Pause(5); + +Result = OPI_YandexDisk.CreateObjectCopy(Token, OriginalPath, CopyPath, True); + +// !OInt OPI_GetTestData.WriteLog(Result, "CreateObjectCopy"); + +OPI_Tools.Pause(5); + +OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); +OPI_GetTestData.ExpectsThat(Result["type"]).Equal("file"); +OPI_GetTestData.ExpectsThat(Result["path"]).Equal("disk:" + CopyPath); + +OPI_YandexDisk.DeleteObject(Token, OriginalPath, False); +OPI_YandexDisk.DeleteObject(Token, CopyPath, False); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure YDisk_GetDownloadLink() Export + +Token = OPI_GetTestData.GetParameter("YandexDisk_Token"); +Path = "/" + String(New UniqueIdentifier) + ".png"; +URL = "https://raw.githubusercontent.com/Bayselonarrend/OpenIntegrations/main/Media/logo.png"; + +OPI_YandexDisk.UploadFileByURL(Token, Path, URL); +OPI_Tools.Pause(5); + +Result = OPI_YandexDisk.GetDownloadLink(Token, Path); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetDownloadLink"); + +OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); +OPI_GetTestData.ExpectsThat(Result["method"]).Equal("GET"); +OPI_GetTestData.ExpectsThat(Result["href"]).HasType("String").Filled(); + +URL = Result["href"]; + +Result = OPI_YandexDisk.DownloadFile(Token, Path); + +OPI_GetTestData.ExpectsThat(Result).HasType("BinaryData").Filled(); + +OPI_YandexDisk.DeleteObject(Token, Path, False); + +EndProcedure + +Procedure YDisk_GetFileList() Export + +Token = OPI_GetTestData.GetParameter("YandexDisk_Token"); +Quantity = 2; +Indent = 1; + +Result = OPI_YandexDisk.GetFilesList(Token, Quantity, Indent, "image"); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetFilesList"); + +OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); +OPI_GetTestData.ExpectsThat(Result["limit"]).Equal(Quantity); +OPI_GetTestData.ExpectsThat(Result["offset"]).Equal(Indent); +OPI_GetTestData.ExpectsThat(Result["items"]).HasType("Array"); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure YDisk_MoveObject() Export + +Token = OPI_GetTestData.GetParameter("YandexDisk_Token"); +OriginalPath = "/" + String(New UniqueIdentifier) + ".png"; +CopyPath = "/" + String(New UniqueIdentifier) + ".png"; +URL = "https://raw.githubusercontent.com/Bayselonarrend/" ++ "OpenIntegrations/main/Media/logo.png"; + +OPI_YandexDisk.UploadFileByURL(Token, OriginalPath, URL); +OPI_Tools.Pause(15); + +Result = OPI_YandexDisk.MoveObject(Token, OriginalPath, CopyPath, True); + +// !OInt OPI_GetTestData.WriteLog(Result, "MoveObject"); + +OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); +OPI_GetTestData.ExpectsThat(Result["type"]).Equal("file"); +OPI_GetTestData.ExpectsThat(Result["path"]).Equal("disk:" + CopyPath); + +OPI_YandexDisk.DeleteObject(Token, OriginalPath, False); +OPI_YandexDisk.DeleteObject(Token, CopyPath, False); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure YDisk_PublicObjectActions() Export + +PUrl = "public_url"; +Match = "Match"; +Token = OPI_GetTestData.GetParameter("YandexDisk_Token"); +Path = "/" + String(New UniqueIdentifier) + ".png"; +URL = "https://raw.githubusercontent.com/Bayselonarrend/OpenIntegrations/main/Media/logo.png"; + +OPI_YandexDisk.UploadFileByURL(Token, Path, URL); +OPI_Tools.Pause(5); + +ResultArray = New Array; + +ResultArray.Add(OPI_YandexDisk.PublishObject(Token, Path)); +PublicURL = ResultArray[0][PUrl]; + +Result = OPI_YandexDisk.GetDownloadLinkForPublicObject(Token, PublicURL); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetDownloadLinkForPublicObject"); + +OPI_GetTestData.ExpectsThat(Result).HasType(Match).Filled(); +OPI_GetTestData.ExpectsThat(Result["method"]).Equal("GET"); +OPI_GetTestData.ExpectsThat(Result["href"]).HasType("String").Filled(); + +Result = OPI_YandexDisk.GetPublicObject(Token, PublicURL); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetPublicObject"); + +OPI_GetTestData.ExpectsThat(Result).HasType(Match).Filled(); +OPI_GetTestData.ExpectsThat(Result["type"]).Equal("file"); +OPI_GetTestData.ExpectsThat(Result["path"]).Equal("/"); + +ResultArray.Add(OPI_YandexDisk.SavePublicObjectToDisk(Token, PublicURL)); + +ResultArray.Add(OPI_YandexDisk.CancelObjectPublication(Token, Path)); + +Counter = 0; +For Each Result In ResultArray Do + +// !OInt OPI_GetTestData.WriteLog(Result, "PublicationChange"); + +OPI_GetTestData.ExpectsThat(Result).HasType(Match).Filled(); +OPI_GetTestData.ExpectsThat(Result["type"]).Equal("file"); +OPI_GetTestData.ExpectsThat(Result["path"]).Filled(); + +If Counter = 0 Then +OPI_GetTestData.ExpectsThat(Result[PUrl]).HasType("String").Filled(); +Else +OPI_GetTestData.ExpectsThat(Result[PUrl]).HasType("Undefined"); +EndIf; + +Counter = Counter + 1; + +EndDo; + +OPI_YandexDisk.DeleteObject(Token, Path, False); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure YDisk_GetPublishedList() Export + +Token = OPI_GetTestData.GetParameter("YandexDisk_Token"); +Quantity = 2; +Indent = 1; + +Result = OPI_YandexDisk.GetPublishedObjectsList(Token, Quantity, Indent); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetPublishedObjectsList"); + +OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); +OPI_GetTestData.ExpectsThat(Result["limit"]).Equal(Quantity); +OPI_GetTestData.ExpectsThat(Result["offset"]).Equal(Indent); +OPI_GetTestData.ExpectsThat(Result["items"]).HasType("Array"); + +OPI_Tools.Pause(5); + +EndProcedure + +#EndRegion + +#Region Viber + +Procedure Viber_GetChannelInfo() Export + +Token = OPI_GetTestData.GetParameter("Viber_ChannelToken"); +Result = OPI_Viber.GetChannelInformation(Token); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetChannelInformation"); + +Check_ViberOk(Result); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Viber_GetUserData() Export + +Token = OPI_GetTestData.GetParameter("Viber_ChannelToken"); +User = OPI_GetTestData.GetParameter("Viber_ChannelAdminID"); +Result = OPI_Viber.GetUserData(Token, User); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetUserData"); + +OPI_GetTestData.ExpectsThat(Result["chat_hostname"]).Filled(); +OPI_GetTestData.ExpectsThat(Result["status_message"]).Filled(); +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Viber_GetOnlineUsers() Export + +Token = OPI_GetTestData.GetParameter("Viber_ChannelToken"); +User = OPI_GetTestData.GetParameter("Viber_UserID"); +Result = OPI_Viber.GetOnlineUsers(Token, User); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetOnlineUsers"); + +OPI_GetTestData.ExpectsThat(Result["users"]).HasType("Array"); +Check_ViberOk(Result); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Viber_SendTextMessage() Export + +Text = "TestMessage"; +ChannelToken = OPI_GetTestData.GetParameter("Viber_ChannelToken"); +BotToken = OPI_GetTestData.GetParameter("Viber_Token"); +User = OPI_GetTestData.GetParameter("Viber_UserID"); +Administrator = OPI_GetTestData.GetParameter("Viber_ChannelAdminID"); + +ButtonArray = New Array; +ButtonArray.Add("Button 1"); +ButtonArray.Add("Button 2"); +ButtonArray.Add("Button 3"); + +Keyboard = OPI_Viber.CreateKeyboardFromArrayButton(ButtonArray); + +Result = OPI_Viber.SendTextMessage(BotToken, Text, User, False, Keyboard); + +// !OInt OPI_GetTestData.WriteLog(Result, "SendTextMessage"); + +OPI_GetTestData.ExpectsThat(Result["message_token"]).Filled(); +Check_ViberOk(Result); + +Result = OPI_Viber.SendTextMessage(ChannelToken, Text, Administrator, True, Keyboard); + +// !OInt OPI_GetTestData.WriteLog(Result, "SendTextMessage"); + +OPI_GetTestData.ExpectsThat(Result["message_token"]).Filled(); +Check_ViberOk(Result); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Viber_SendImage() Export + +Text = "TestMessage"; +Image = OPI_GetTestData.GetParameter("Picture"); +ChannelToken = OPI_GetTestData.GetParameter("Viber_ChannelToken"); +BotToken = OPI_GetTestData.GetParameter("Viber_Token"); +User = OPI_GetTestData.GetParameter("Viber_UserID"); +Administrator = OPI_GetTestData.GetParameter("Viber_ChannelAdminID"); + +Result = OPI_Viber.SendImage(BotToken, Image, User, False, Text); + +// !OInt OPI_GetTestData.WriteLog(Result, "SendImage"); + +OPI_GetTestData.ExpectsThat(Result["message_token"]).Filled(); +Check_ViberOk(Result); + +Result = OPI_Viber.SendImage(ChannelToken, Image, Administrator, True, Text); + +// !OInt OPI_GetTestData.WriteLog(Result, "SendImage"); + +OPI_GetTestData.ExpectsThat(Result["message_token"]).Filled(); +Check_ViberOk(Result); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Viber_SendFile() Export + +Document = OPI_GetTestData.GetParameter("Document"); +ChannelToken = OPI_GetTestData.GetParameter("Viber_ChannelToken"); +BotToken = OPI_GetTestData.GetParameter("Viber_Token"); +User = OPI_GetTestData.GetParameter("Viber_UserID"); +Administrator = OPI_GetTestData.GetParameter("Viber_ChannelAdminID"); + +Result = OPI_Viber.SendFile(BotToken, Document, User, False, "docx"); + +// !OInt OPI_GetTestData.WriteLog(Result, "SendFile"); + +OPI_GetTestData.ExpectsThat(Result["message_token"]).Filled(); +Check_ViberOk(Result); + +Result = OPI_Viber.SendFile(ChannelToken, Document, Administrator, True, "docx"); + +// !OInt OPI_GetTestData.WriteLog(Result, "SendFile"); + +OPI_GetTestData.ExpectsThat(Result["message_token"]).Filled(); +Check_ViberOk(Result); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Viber_SendContact() Export + +Name = "Petr Petrov"; +Phone = "+123456789"; +ChannelToken = OPI_GetTestData.GetParameter("Viber_ChannelToken"); +BotToken = OPI_GetTestData.GetParameter("Viber_Token"); +User = OPI_GetTestData.GetParameter("Viber_UserID"); +Administrator = OPI_GetTestData.GetParameter("Viber_ChannelAdminID"); + +Result = OPI_Viber.SendContact(BotToken, Name, Phone, User, False); + +// !OInt OPI_GetTestData.WriteLog(Result, "SendContact"); + +OPI_GetTestData.ExpectsThat(Result["message_token"]).Filled(); +Check_ViberOk(Result); + +Result = OPI_Viber.SendContact(ChannelToken, Name, Phone, Administrator, True); + +// !OInt OPI_GetTestData.WriteLog(Result, "SendContact"); + +OPI_GetTestData.ExpectsThat(Result["message_token"]).Filled(); +Check_ViberOk(Result); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Viber_SendLocation() Export + +Latitude = "48.87373649724122"; +Longitude = "2.2954639195323967"; +ChannelToken = OPI_GetTestData.GetParameter("Viber_ChannelToken"); +BotToken = OPI_GetTestData.GetParameter("Viber_Token"); +User = OPI_GetTestData.GetParameter("Viber_UserID"); +Administrator = OPI_GetTestData.GetParameter("Viber_ChannelAdminID"); + +Result = OPI_Viber.SendLocation(BotToken, Latitude, Longitude, User, False); + +// !OInt OPI_GetTestData.WriteLog(Result, "SendLocation"); + +OPI_GetTestData.ExpectsThat(Result["message_token"]).Filled(); +Check_ViberOk(Result); + +Result = OPI_Viber.SendLocation(ChannelToken, Latitude, Longitude, Administrator, True); + +// !OInt OPI_GetTestData.WriteLog(Result, "SendLocation"); + +OPI_GetTestData.ExpectsThat(Result["message_token"]).Filled(); +Check_ViberOk(Result); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Viber_SendLink() Export + +URL = "https://github.com/Bayselonarrend/OpenIntegrations"; +ChannelToken = OPI_GetTestData.GetParameter("Viber_ChannelToken"); +BotToken = OPI_GetTestData.GetParameter("Viber_Token"); +User = OPI_GetTestData.GetParameter("Viber_UserID"); +Administrator = OPI_GetTestData.GetParameter("Viber_ChannelAdminID"); + +Result = OPI_Viber.SendLink(BotToken, URL, User, False); + +// !OInt OPI_GetTestData.WriteLog(Result, "SendLink"); + +OPI_GetTestData.ExpectsThat(Result["message_token"]).Filled(); +Check_ViberOk(Result); + +Result = OPI_Viber.SendLink(ChannelToken, URL, Administrator, True); + +// !OInt OPI_GetTestData.WriteLog(Result, "SendLink"); + +OPI_GetTestData.ExpectsThat(Result["message_token"]).Filled(); +Check_ViberOk(Result); + +OPI_Tools.Pause(5); + +EndProcedure + +#EndRegion + +#Region GoogleWorkspace + +Procedure GV_GetAuthorizationLink() Export + +ClientID = OPI_GetTestData.GetParameter("Google_ClientID"); +Result = OPI_GoogleWorkspace.FormCodeRetrievalLink(ClientID); + +OPI_GetTestData.ExpectsThat(Result) +.HasType("String") +.Filled(); + +OPI_GetTestData.WriteParameter("Google_Link", Result); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure GV_GetToken() Export + +ClientID = OPI_GetTestData.GetParameter("Google_ClientID"); +ClientSecret = OPI_GetTestData.GetParameter("Google_ClientSecret"); +Code = OPI_GetTestData.GetParameter("Google_Code"); + +Result = OPI_GoogleWorkspace.GetTokenByCode(ClientID, ClientSecret, Code); + +If ValueIsFilled(Result["access_token"]) +And ValueIsFilled(Result["refresh_token"]) Then + +OPI_GetTestData.WriteParameter("Google_Token" , Result["access_token"]); +OPI_GetTestData.WriteParameter("Google_Refresh", Result["refresh_token"]); + +EndIf; + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure GV_UpdateToken() Export + +ClientID = OPI_GetTestData.GetParameter("Google_ClientID"); +ClientSecret = OPI_GetTestData.GetParameter("Google_ClientSecret"); +RefreshToken = OPI_GetTestData.GetParameter("Google_Refresh"); + +Result = OPI_GoogleWorkspace.RefreshToken(ClientID, ClientSecret, RefreshToken); + +OPI_GetTestData.ExpectsThat(Result).HasType("Match"); +OPI_GetTestData.ExpectsThat(Result["access_token"]).Filled(); + +OPI_GetTestData.WriteParameter("Google_Token", Result["access_token"]); + +OPI_Tools.Pause(5); + +EndProcedure + +#EndRegion + +#Region GoogleCalendar + +Procedure GC_GetCalendarList() Export + +Token = OPI_GetTestData.GetParameter("Google_Token"); +Result = OPI_GoogleCalendar.GetCalendarList(Token); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetCalendarList"); + +OPI_GetTestData.ExpectsThat(Result) +.HasType("Array"); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure GC_CreateDeleteCalendar() Export + +Token = OPI_GetTestData.GetParameter("Google_Token"); +Name = "TestCalendar"; +Description = "TestDescription"; +EditedName = Name + " (fromм.)"; +TypeMatch = Type("Match"); +TypeString = Type("String"); +Summary = "summary"; +Black = "#000000"; +Yellow = "#ffd800"; + +Result = OPI_GoogleCalendar.CreateCalendar(Token, Name); + +// !OInt OPI_GetTestData.WriteLog(Result, "CreateCalendar"); + +OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); +OPI_GetTestData.ExpectsThat(Result[Summary]).Equal(Name); +OPI_GetTestData.ExpectsThat(Result["id"]).HasType(TypeString).Filled(); + +Calendar = Result["id"]; + +Result = OPI_GoogleCalendar.EditCalendarMetadata(Token +, Calendar +, EditedName +, Description); + +// !OInt OPI_GetTestData.WriteLog(Result, "EditCalendarMetadata"); + +Check_GKObject(Result, EditedName, Description); + +Result = OPI_GoogleCalendar.GetCalendarMetadata(Token, Calendar); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetCalendarMetadata"); + +Check_GKObject(Result, EditedName, Description); + +Result = OPI_GoogleCalendar.AddCalendarToList(Token, Calendar); + +// !OInt OPI_GetTestData.WriteLog(Result, "AddCalendarToList"); + +Check_GKObject(Result, EditedName, Description); + +Result = OPI_GoogleCalendar.EditListCalendar(Token, Calendar, Black, Yellow, False); + +// !OInt OPI_GetTestData.WriteLog(Result, "EditListCalendar"); + +OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); +OPI_GetTestData.ExpectsThat(Result[Summary]).Equal(EditedName); +OPI_GetTestData.ExpectsThat(Result["foregroundColor"]).Equal(Black); +OPI_GetTestData.ExpectsThat(Result["backgroundColor"]).Equal(Yellow); + +Result = OPI_GoogleCalendar.GetListCalendar(Token, Calendar); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetListCalendar"); + +OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); +OPI_GetTestData.ExpectsThat(Result[Summary]).Equal(EditedName); +OPI_GetTestData.ExpectsThat(Result["foregroundColor"]).Equal(Black); +OPI_GetTestData.ExpectsThat(Result["backgroundColor"]).Equal(Yellow); + +Result = OPI_GoogleCalendar.ClearMainCalendar(Token); + +// !OInt OPI_GetTestData.WriteLog(Result, "ClearMainCalendar"); + +Check_Empty(Result); + +Result = OPI_GoogleCalendar.DeleteCalendarFromList(Token, Calendar); + +// !OInt OPI_GetTestData.WriteLog(Result, "DeleteCalendarFromList"); + +Check_Empty(Result); + +Result = OPI_GoogleCalendar.DeleteCalendar(Token, Calendar); + +// !OInt OPI_GetTestData.WriteLog(Result, "DeleteCalendar"); + +Check_Empty(Result); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure GC_CreateDeleteEvent() Export + +CurrentDate = OPI_Tools.GetCurrentDate(); +Token = OPI_GetTestData.GetParameter("Google_Token"); +Calendar = OPI_GetTestData.GetParameter("Google_CalendarID"); +Name = "New event"; +Description = "TestEventDescription"; +EditedDescription = "TestEventDescription (fromм.)"; +UID = "id"; +Hour = 3600; + +Attachments = New Match; + +Attachments.Insert("Image1" +, "https://opi.neocities.org/assets/images/logo_long-e8fdcca6ff8b32e679ea49a1ccdd3eac.png"); +Attachments.Insert("Image2" +, "https://github.com/Bayselonarrend/OpenIntegrations/raw/main/Media/logo.png?v1"); + +EventMatch = New Match; +EventMatch.Insert("Description" , Description); +EventMatch.Insert("Title" , Name); +EventMatch.Insert("Venue" , "InOffice"); +EventMatch.Insert("StartDate" , CurrentDate); +EventMatch.Insert("EndDate" , EventMatch["StartDate"] + Hour); +EventMatch.Insert("ArrayOfAttachmentURLs" , Attachments); +EventMatch.Insert("SendNotifications" , True); + +Result = OPI_GoogleCalendar.CreateEvent(Token, Calendar, EventMatch); + +// !OInt OPI_GetTestData.WriteLog(Result, "CreateEvent"); + +Event = Result[UID]; + +Check_GKObject(Result, Name, Description); + +EventMatch = New Match; +EventMatch.Insert("Description", EditedDescription); + +Result = OPI_GoogleCalendar.EditEvent(Token, Calendar, EventMatch, Event); + +// !OInt OPI_GetTestData.WriteLog(Result, "EditEvent"); + +Check_GKObject(Result, Name, EditedDescription); + +Result = OPI_GoogleCalendar.GetEvent(Token, Calendar, Event); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetEvent"); + +Check_GKObject(Result, Name, EditedDescription); + +Result = OPI_GoogleCalendar.MoveEvent(Token, Calendar, Calendar, Event); + +// !OInt OPI_GetTestData.WriteLog(Result, "MoveEvent"); + +Check_GKObject(Result, Name, EditedDescription); + +Result = OPI_GoogleCalendar.DeleteEvent(Token, Calendar, Event); + +// !OInt OPI_GetTestData.WriteLog(Result, "DeleteEvent"); + +Check_Empty(Result); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure GC_GetEventList() Export + +Token = OPI_GetTestData.GetParameter("Google_Token"); +Calendar = OPI_GetTestData.GetParameter("Google_CalendarID"); + +Result = OPI_GoogleCalendar.GetEventList(Token, Calendar); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetEventList"); + +OPI_GetTestData.ExpectsThat(Result).HasType("Array"); + +OPI_Tools.Pause(5); + +EndProcedure + +#EndRegion + +#Region GoogleDrive + +Procedure GD_GetCatalogList() Export + +MimeType = "mimeType"; +Name = "name"; +Name = "TestFolder"; +Token = OPI_GetTestData.GetParameter("Google_Token"); +Result = OPI_GoogleDrive.GetDirectoriesList(Token, Name, True); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetDirectoriesList"); + +Result = Result[0]; + +OPI_GetTestData.ExpectsThat(Result["files"]).HasType("Array"); +OPI_GetTestData.ExpectsThat(Result[MimeType]).Equal("application/vnd.google-apps.folder"); +OPI_GetTestData.ExpectsThat(Result[Name]).Filled(); + +OPI_Tools.Pause(5); +Identifier = Result["id"]; + +OPI_GetTestData.WriteParameter("GD_Catalog", Identifier); + +Result = OPI_GoogleDrive.GetObjectInformation(Token, Identifier); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetObjectInformation"); + +OPI_GetTestData.ExpectsThat(Result[MimeType]).Equal("application/vnd.google-apps.folder"); +OPI_GetTestData.ExpectsThat(Result[Name]).Filled(); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure GD_UploadDeleteFile() Export + +ExtraBytes = 2; + +Kind = "kind"; +Content = "content"; +MIME = "MIME"; +MimeType = "mimeType"; +Name = "name"; +Id_ = "id"; + +ArrayOfDeletions = New Array; +Token = OPI_GetTestData.GetParameter("Google_Token"); +Image = OPI_GetTestData.GetBinary("Picture"); +ReplacementImage = OPI_GetTestData.GetBinary("Picture2"); +Directory = OPI_GetTestData.GetParameter("GD_Catalog"); + +Description = OPI_GoogleDrive.GetFileDescription(); +Description.Insert("Parent", Directory); + +Result = OPI_GoogleDrive.UploadFile(Token, Image, Description); + +// !OInt OPI_GetTestData.WriteLog(Result, "UploadFile"); + +OPI_GetTestData.ExpectsThat(Result[MimeType]).Equal(Description[MIME]); +OPI_GetTestData.ExpectsThat(Result[Name]).Equal(Description["Name"]); + +Identifier = Result[Id_]; +ArrayOfDeletions.Add(Identifier); + +NewName = "CopiedFile.jpeg"; +Result = OPI_GoogleDrive.CopyObject(Token, Identifier, NewName, "root"); + +// !OInt OPI_GetTestData.WriteLog(Result, "CopyObject"); + +OPI_Tools.Pause(5); + +OPI_GetTestData.ExpectsThat(Result[MimeType]).Equal(Description[MIME]); +OPI_GetTestData.ExpectsThat(Result[Name]).Equal(NewName); + +ArrayOfDeletions.Add(Result[Id_]); + +Result = OPI_GoogleDrive.DownloadFile(Token, Identifier); + +// !OInt OPI_GetTestData.WriteLog(Result, "DownloadFile"); + +OPI_GetTestData.ExpectsThat(Result.Size()).Equal(Image.Size() + ExtraBytes); +OPI_Tools.Pause(5); + +NewName = "UpdatedFile.jpg"; +Result = OPI_GoogleDrive.UpdateFile(Token, Identifier, ReplacementImage, NewName); + +// !OInt OPI_GetTestData.WriteLog(Result, "UpdateFile"); + +OPI_GetTestData.ExpectsThat(Result[MimeType]).Equal(Description[MIME]); +OPI_GetTestData.ExpectsThat(Result[Name]).Equal(NewName); + +OPI_Tools.Pause(5); + +Comment = "Yo"; +Result = OPI_GoogleDrive.CreateComment(Token, Identifier, Comment); + +// !OInt OPI_GetTestData.WriteLog(Result, "CreateComment"); + +OPI_GetTestData.ExpectsThat(Result[Content]).Equal(Comment); +OPI_GetTestData.ExpectsThat(Result[Kind]).Equal("drive#comment"); + +OPI_Tools.Pause(5); + +For Each Deletable In ArrayOfDeletions Do +Result = OPI_GoogleDrive.DeleteObject(Token, Deletable); + +// !OInt OPI_GetTestData.WriteLog(Result, "DeleteObject"); + +OPI_GetTestData.ExpectsThat(ValueIsFilled(Result)).Equal(False); +OPI_Tools.Pause(2); +EndDo; + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure GD_CreateDeleteComment() Export + +Kind = "kind"; +Content = "content"; +Id_ = "id"; +Comments = "comments"; +Token = OPI_GetTestData.GetParameter("Google_Token"); +Directory = OPI_GetTestData.GetParameter("GD_Catalog"); +Image = OPI_GetTestData.GetBinary("Picture"); + +Description = OPI_GoogleDrive.GetFileDescription(); +Description.Insert("Parent", Directory); + +Result = OPI_GoogleDrive.UploadFile(Token, Image, Description); +Identifier = Result[Id_]; + +Comment = "NewComment"; +ResultArray = New Array; +Result = OPI_GoogleDrive.CreateComment(Token, Identifier, Comment); + +// !OInt OPI_GetTestData.WriteLog(Result, "CreateComment"); + +CommentID = Result[Id_]; + +ResultArray.Add(Result); + +Result = OPI_GoogleDrive.GetComment(Token, Identifier, CommentID); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetComment"); + +ResultArray.Add(Result); + +Result = OPI_GoogleDrive.GetCommentList(Token, Identifier); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetCommentList"); + +Comments = Result[Comments]; +CommentObject = Comments[Comments.WithinBoundary()]; + +ResultArray.Add(CommentObject); + +For Each Result In ResultArray Do +OPI_GetTestData.ExpectsThat(Result[Content]).Equal(Comment); +OPI_GetTestData.ExpectsThat(Result[Kind]).Equal("drive#comment"); +EndDo; + +Result = OPI_GoogleDrive.DeleteComment(Token, Identifier, CommentID); + +// !OInt OPI_GetTestData.WriteLog(Result, "DeleteComment"); + +OPI_GetTestData.ExpectsThat(ValueIsFilled(Result)).Equal(False); + +OPI_GoogleDrive.DeleteObject(Token, Identifier); + +EndProcedure + +Procedure GD_CreateCatalog() Export + +Name = "name"; +Name = "TestFolder"; +Token = OPI_GetTestData.GetParameter("Google_Token"); +Directory = OPI_GetTestData.GetParameter("GD_Catalog"); + +ResultArray = New Array; + +ResultArray.Add(OPI_GoogleDrive.CreateFolder(Token, Name)); +ResultArray.Add(OPI_GoogleDrive.CreateFolder(Token, Name, Directory)); + +For Each Result In ResultArray Do + +// !OInt OPI_GetTestData.WriteLog(Result, "CreateFolder"); + +CatalogID = Result["id"]; + +OPI_GetTestData.ExpectsThat(Result[Name]).Equal(Name); + +OPI_GoogleDrive.DeleteObject(Token, CatalogID); + +EndDo; + +EndProcedure + +#EndRegion + +#Region GoogleSheets + +Procedure GT_CreateTable() Export + +Token = OPI_GetTestData.GetParameter("Google_Token"); +Name = "TestTable"; + +SheetArray = New Array; +SheetArray.Add("Sheet1"); +SheetArray.Add("Sheet2"); + +Result = OPI_GoogleSheets.CreateBook(Token, Name, SheetArray); + +// !OInt OPI_GetTestData.WriteLog(Result, "CreateBook"); + +OPI_GetTestData.ExpectsThat(Result["properties"]["title"]).Equal(Name); + +For N = 0 For SheetArray.WithinBoundary() Do + +SheetName = Result["sheets"][N]["properties"]["title"]; +OPI_GetTestData.ExpectsThat(SheetName).Equal(SheetArray[N]); +Sheet = Result["sheets"][N]["properties"]["sheetId"]; +Sheet = OPI_Tools.NumberToString(Sheet); + +EndDo; + +Book = Result["spreadsheetId"]; + +OPI_GetTestData.WriteParameter("GS_Spreadsheet", Book); +OPI_GetTestData.WriteParameter("GS_Sheet" , Sheet); + +Result = OPI_GoogleSheets.CreateBook(Token, Name, SheetArray); +Book2 = Result["spreadsheetId"]; + +Result = OPI_GoogleSheets.CopySheet(Token, Book, Book2, Sheet); + +// !OInt OPI_GetTestData.WriteLog(Result, "CopySheet"); + +OPI_GetTestData.ExpectsThat(Result["title"]).Equal(SheetName + " (toопия)"); + +Name = "TestSheet"; + +Result = OPI_GoogleSheets.AddSheet(Token, Book, Name); + +// !OInt OPI_GetTestData.WriteLog(Result, "AddSheet"); + +NewSheet = Result["replies"][0]["addSheet"]["properties"]["sheetId"]; +NewSheet = OPI_Tools.NumberToString(NewSheet); + +OPI_GetTestData.ExpectsThat(Result["spreadsheetId"]).Equal(Book); + +Result = OPI_GoogleSheets.DeleteSheet(Token, Book, NewSheet); + +// !OInt OPI_GetTestData.WriteLog(Result, "DeleteSheet"); + +OPI_GetTestData.ExpectsThat(Result["spreadsheetId"]).Equal(Book); + +Name = "TestTable (fromм.)"; + +Result = OPI_GoogleSheets.EditBookTitle(Token, Book, Name); + +// !OInt OPI_GetTestData.WriteLog(Result, "EditBookTitle"); + +OPI_GetTestData.ExpectsThat(Result["spreadsheetId"]).Equal(Book); + +EndProcedure + +Procedure GT_GetTable() Export + +Token = OPI_GetTestData.GetParameter("Google_Token"); +Book = OPI_GetTestData.GetParameter("GS_Spreadsheet"); +Name = "TestTable (fromм.)"; + +Result = OPI_GoogleSheets.GetBook(Token, Book); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetTable"); + +OPI_GetTestData.ExpectsThat(Result["properties"]["title"]).Equal(Name); + +EndProcedure + +Procedure GT_FillClearCells() Export + +Token = OPI_GetTestData.GetParameter("Google_Token"); +Book = OPI_GetTestData.GetParameter("GS_Spreadsheet"); +Sheet = "Sheet2"; + +CellStructure = New Match; +CellStructure.Insert("A1", "ThisIsA1"); +CellStructure.Insert("A2", "ThisIsA2"); +CellStructure.Insert("B2", "ThisIsB2"); +CellStructure.Insert("B3", "ThisIsB3"); +CellStructure.Insert("A3", "ThisIsA3"); +CellStructure.Insert("A4", "ThisIsA4"); +CellStructure.Insert("B1", "ThisIsB1"); +CellStructure.Insert("B4", "ThisIsB4"); + +Cell array = New Array; +Cell array.Add("B2"); +Cell array.Add("A3"); +Cell array.Add("B4"); + +Result = OPI_GoogleSheets.SetCellValues(Token, Book, CellStructure, Sheet); + +// !OInt OPI_GetTestData.WriteLog(Result, "SetCellValues"); + +OPI_GetTestData.ExpectsThat(Result["spreadsheetId"]).Equal(Book); +OPI_GetTestData.ExpectsThat(Result["totalUpdatedCells"]).Equal(CellStructure.Quantity()); + +Result = OPI_GoogleSheets.GetCellValues(Token, Book, Cell array, Sheet); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetCellValues"); + +OPI_GetTestData.ExpectsThat(Result["spreadsheetId"]).Equal(Book); +OPI_GetTestData.ExpectsThat(Result["valueRanges"].Quantity()).Equal(Cell array.Quantity()); + +Result = OPI_GoogleSheets.GetCellValues(Token, Book, , Sheet); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetCellValues"); + +OPI_GetTestData.ExpectsThat(Result["spreadsheetId"]).Equal(Book); + +Cell array = New Array; +Cell array.Add("B2"); +Cell array.Add("A3"); +Cell array.Add("B4"); + +Result = OPI_GoogleSheets.ClearCells(Token, Book, Cell array, Sheet); + +// !OInt OPI_GetTestData.WriteLog(Result, "ClearCells"); + +OPI_GetTestData.ExpectsThat(Result["spreadsheetId"]).Equal(Book); +OPI_GetTestData.ExpectsThat(Result["clearedRanges"].Quantity()).Equal(Cell array.Quantity()); + +EndProcedure + +#EndRegion + +#Region Twitter + +Procedure Twitter_GetAuthorizationLink() Export + +Parameters = GetTwitterParameters(); +Result = OPI_Twitter.GetAuthorizationLink(Parameters); + +OPI_GetTestData.ExpectsThat(Result).HasType("String").Filled(); + +OPI_GetTestData.WriteParameter("Twitter_URL", Result); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Twitter_UpdateToken() Export + +Parameters = GetTwitterParameters(); +Result = OPI_Twitter.RefreshToken(Parameters); + +OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); +OPI_GetTestData.ExpectsThat(Result["access_token"]).Filled(); +OPI_GetTestData.ExpectsThat(Result["refresh_token"]).Filled(); + +Refresh = Result["refresh_token"]; +Token = Result["access_token"]; + +If ValueIsFilled(Refresh) And Not Refresh = "null" Then +OPI_GetTestData.WriteParameter("Twitter_Refresh", Refresh); +EndIf; + +If ValueIsFilled(Token) And Not Token = "null" Then +OPI_GetTestData.WriteParameter("Twitter_Token" , Token); +EndIf; + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Twitter_CreateTextTweet() Export + +Parameters = GetTwitterParameters(); +Text = "TestTweet" + String(New UniqueIdentifier); + +Result = OPI_Twitter.CreateTextTweet(Text, Parameters); + +// !OInt OPI_GetTestData.WriteLog(Result, "CreateTextTweet"); + +Check_TwitterText(Result, Text); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Twitter_CreateTweetWithImage() Export + +Parameters = GetTwitterParameters(); +Text = "TestTweet" + String(New UniqueIdentifier); +Image = OPI_GetTestData.GetBinary("Picture"); +AndVF = GetTempFileName("png"); +Image.Write(AndVF); + +Result = OPI_Twitter.Create image tweet(Text, Image, Parameters); + +// !OInt OPI_GetTestData.WriteLog(Result, "Create image tweet"); + +Check_TwitterText(Result, Text); + +Result = OPI_Twitter.Create image tweet(Text, AndVF, Parameters); + +// !OInt OPI_GetTestData.WriteLog(Result, "Create image tweet"); + +Check_TwitterText(Result, Text); + +DeleteFiles(AndVF); + +OPI_Tools.Pause(20); + +EndProcedure + +Procedure Twitter_CreateTweetWithVideo() Export + +Parameters = GetTwitterParameters(); +Text = "TestTweet" + String(New UniqueIdentifier); +Video = OPI_GetTestData.GetBinary("Video"); +AndVF = GetTempFileName("mp4"); +Video.Write(AndVF); + +Result = OPI_Twitter.CreateVideoTweet(Text, Video, Parameters); + +// !OInt OPI_GetTestData.WriteLog(Result, "CreateVideoTweet"); + +Check_TwitterText(Result, Text); + +Result = OPI_Twitter.CreateVideoTweet(Text, AndVF, Parameters); + +// !OInt OPI_GetTestData.WriteLog(Result, "CreateVideoTweet"); + +Check_TwitterText(Result, Text); + +DeleteFiles(AndVF); + +OPI_Tools.Pause(20); + +EndProcedure + +Procedure Twitter_CreateTweetWithGif() Export + +Parameters = GetTwitterParameters(); +Text = "TestTweet" + String(New UniqueIdentifier); +GIF = OPI_GetTestData.GetBinary("GIF"); +AndVF = GetTempFileName("gif"); +GIF.Write(AndVF); + +Result = OPI_Twitter.CreateGifTweet(Text, GIF, Parameters); + +// !OInt OPI_GetTestData.WriteLog(Result, "CreateGifTweet"); + +Check_TwitterText(Result, Text); + +Result = OPI_Twitter.CreateGifTweet(Text, AndVF, Parameters); + +// !OInt OPI_GetTestData.WriteLog(Result, "CreateGifTweet"); + +Check_TwitterText(Result, Text); + +DeleteFiles(AndVF); + +OPI_Tools.Pause(20); + +EndProcedure + +Procedure Twitter_CreateTweetWithPoll() Export + +Parameters = GetTwitterParameters(); +Text = "TestTweet" + String(New UniqueIdentifier); +AnswersArray = New Array; +AnswersArray.Add("Option 1"); +AnswersArray.Add("Option 2"); + +Result = OPI_Twitter.CreatePollTweet(Text, AnswersArray, 60, Parameters); + +// !OInt OPI_GetTestData.WriteLog(Result, "CreatePollTweet"); + +Check_TwitterText(Result, Text); + +OPI_Tools.Pause(20); + +EndProcedure + +#EndRegion + +#Region Notion + +Procedure Notion_CreatePage() Export + +Token = OPI_GetTestData.GetParameter("Notion_Token"); +Parent = OPI_GetTestData.GetParameter("Notion_Parent"); +Title = "TestTitle"; + +Result = OPI_Notion.CreatePage(Token, Parent, Title); + +// !OInt OPI_GetTestData.WriteLog(Result, "CreatePage"); + +Check_NotionObject(Result); + +EndProcedure + +Procedure Notion_CreateEditDatabase() Export + +Token = OPI_GetTestData.GetParameter("Notion_Token"); +Parent = OPI_GetTestData.GetParameter("Notion_Parent"); +Title = "TestTitle"; + +Properties = New Match; +Properties.Insert("Name" , "title"); +Properties.Insert("Description" , "rich_text"); +Properties.Insert("Number" , "number"); +Properties.Insert("Status" , "status"); +Properties.Insert("CreationDate" , "date"); +Properties.Insert("Image" , "files"); +Properties.Insert("Active" , "checkbox"); +Properties.Insert("Website" , "url"); +Properties.Insert("Email" , "email"); +Properties.Insert("Phone" , "phone_number"); +Properties.Insert("User" , "people"); + +ValueSelection = New Match; +ValueSelection.Insert("New", "green"); +ValueSelection.Insert("InProgress", "yellow"); +ValueSelection.Insert("Remote", "red"); +Properties.Insert("Status", ValueSelection); + +Result = OPI_Notion.CreateDatabase(Token, Parent, Title, Properties); + +// !OInt OPI_GetTestData.WriteLog(Result, "CreateDatabase"); + +Check_NotionObject(Result, "database"); + +Base = Result["id"]; +Title = "TestTitle"; +Description = "TestDescription"; + +Properties = New Match; +Properties.Insert("Email", "rich_text"); // Type fields "Email" will changed with email to text +Properties.Insert("Website"); // Field "Website" will deleted + +Result = OPI_Notion.EditDatabaseProperties(Token, Base, Properties, Title, Description); + +// !OInt OPI_GetTestData.WriteLog(Result, "EditDatabaseProperties"); + +Check_NotionObject(Result, "database"); + +EndProcedure + +Procedure Notion_GetPageInfo() Export + +Token = OPI_GetTestData.GetParameter("Notion_Token"); +Page = OPI_GetTestData.GetParameter("Notion_Page"); + +Result = OPI_Notion.GetPage(Token, Page); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetPage"); + +Check_NotionObject(Result); + +EndProcedure + +Procedure Notion_GetDatabaseInfo() Export + +Token = OPI_GetTestData.GetParameter("Notion_Token"); +Base = OPI_GetTestData.GetParameter("Notion_Base"); + +Result = OPI_Notion.GetDatabase(Token, Base); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetDatabase"); + +Check_NotionObject(Result, "database"); + +EndProcedure + +Procedure Notion_CreatePageInDatabase() Export + +Token = OPI_GetTestData.GetParameter("Notion_Token"); +Base = OPI_GetTestData.GetParameter("Notion_Base"); + +Image = New Match; +Image.Insert("Logo", OPI_GetTestData.GetParameter("Picture")); + +Properties = New Match; +Properties.Insert("Name" , "LLC Vector"); +Properties.Insert("Description" , "OurFirstClient"); +Properties.Insert("Number" , 1); +Properties.Insert("Status" , "Regular"); +Properties.Insert("CreationDate" , OPI_Tools.GetCurrentDate()); +Properties.Insert("Image" , Image); +Properties.Insert("Active" , True); +Properties.Insert("Website" , "https://vector.ru"); +Properties.Insert("Email" , "mail@vector.ru"); +Properties.Insert("Phone" , "88005553535"); +Properties.Insert("Status" , "New"); + +Result = OPI_Notion.CreatePageInDatabase(Token, Base, Properties); + +// !OInt OPI_GetTestData.WriteLog(Result, "CreatePageInDatabase"); + +Check_NotionObject(Result); + +Parent = StringReplace(Result["parent"]["database_id"], "-", ""); +OPI_GetTestData.ExpectsThat(Parent).Equal(Base); + +EndProcedure + +Procedure Notion_EditPageProperties() Export + +Token = OPI_GetTestData.GetParameter("Notion_Token"); +Page = OPI_GetTestData.GetParameter("Notion_Page"); +Icon = OPI_GetTestData.GetParameter("Picture"); +Cover = OPI_GetTestData.GetParameter("Picture2"); +Archive = False; + +Properties = New Match; +Properties.Insert("Active" , False); +Properties.Insert("Email" , "vector@mail.ru"); + +Result = OPI_Notion.EditPageProperties(Token +, Page +, Properties +, Icon +, Cover +, Archive); + +// !OInt OPI_GetTestData.WriteLog(Result, "EditPageProperties"); + +Check_NotionObject(Result); + +EndProcedure + +Procedure Notion_CreateDeleteBlock() Export + +Token = OPI_GetTestData.GetParameter("Notion_Token"); +Parent = OPI_GetTestData.GetParameter("Notion_Parent"); +Block = OPI_GetTestData.GetParameter("Notion_Block"); + +Result = OPI_Notion.ReturnBlock(Token, Block); + +// !OInt OPI_GetTestData.WriteLog(Result, "ReturnBlock"); + +Check_NotionObject(Result, "block"); + +Result = OPI_Notion.CreateBlock(Token, Parent, Result); + +// !OInt OPI_GetTestData.WriteLog(Result, "CreateBlock"); + +Check_NotionObject(Result, "list"); + +Block = Result["results"][0]["id"]; +Result = OPI_Notion.ReturnChildBlocks(Token, Block); + +// !OInt OPI_GetTestData.WriteLog(Result, "ReturnChildBlocks"); + +Check_NotionObject(Result, "list"); + +Result = OPI_Notion.DeleteBlock(Token, Block); + +// !OInt OPI_GetTestData.WriteLog(Result, "DeleteBlock"); + +Check_NotionObject(Result, "block"); + +EndProcedure + +Procedure Notion_GetUsers() Export + +Token = OPI_GetTestData.GetParameter("Notion_Token"); +Result = OPI_Notion.UserList(Token); + +// !OInt OPI_GetTestData.WriteLog(Result, "UserList"); + +Check_NotionObject(Result, "list"); + +EndProcedure + +Procedure Notion_GetUserData() Export + +Token = OPI_GetTestData.GetParameter("Notion_Token"); +User = OPI_GetTestData.GetParameter("Notion_User"); +Result = OPI_Notion.GetUserData(Token, User); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetUserData"); + +Check_NotionObject(Result, "user"); + +EndProcedure + +#EndRegion + +#Region Slack + +Procedure Slack_GetBotInfo() Export + +Token = OPI_GetTestData.GetParameter("Slack_Token"); +Result = OPI_Slack.GetBotInformation(Token); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetBotInformation"); + +Check_SlackOk(Result); +OPI_GetTestData.ExpectsThat(Result["bot_id"]).Filled(); +OPI_GetTestData.ExpectsThat(Result["user_id"]).Filled(); + +EndProcedure + +Procedure Slack_GetUserList() Export + +Token = OPI_GetTestData.GetParameter("Slack_Token"); +Result = OPI_Slack.GetUserList(Token); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetUserList"); + +Check_SlackOk(Result); +OPI_GetTestData.ExpectsThat(Result["members"]).HasType("Array"); + +EndProcedure + +Procedure Slack_GetRegionList() Export + +Token = OPI_GetTestData.GetParameter("Slack_Token"); +Result = OPI_Slack.GetWorkspaceList(Token); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetWorkspaceList"); + +Check_SlackOk(Result); +OPI_GetTestData.ExpectsThat(Result["teams"]).HasType("Array"); + +EndProcedure + +Procedure Slack_SendDeleteMessage() Export + +Token = OPI_GetTestData.GetParameter("Slack_Token"); +Channel = OPI_GetTestData.GetParameter("Slack_Channel"); +Text = "TestMessage1"; +Text2 = "TestMessage2"; +Tags = New Array; +Image = "https://github.com/Bayselonarrend/OpenIntegrations/raw/main/Media/logo.png?v1"; + +Result = OPI_Slack.SendMessage(Token, Channel, Text); + +// !OInt OPI_GetTestData.WriteLog(Result, "SendMessage"); + +Check_SlackOk(Result); +OPI_GetTestData.ExpectsThat(Result["channel"]).Equal(Channel); +OPI_GetTestData.ExpectsThat(Result["ts"]).Filled(); +OPI_GetTestData.ExpectsThat(Result["message"]["text"]).Equal(Text); + +Timestamp = Result["ts"]; + +Result = OPI_Slack.EditMessage(Token, Channel, Timestamp, Text2); + +// !OInt OPI_GetTestData.WriteLog(Result, "EditMessage"); + +Check_SlackOk(Result); +OPI_GetTestData.ExpectsThat(Result["channel"]).Equal(Channel); +OPI_GetTestData.ExpectsThat(Result["ts"]).Filled(); +OPI_GetTestData.ExpectsThat(Result["message"]["text"]).Equal(Text2); + +Result = OPI_Slack.GetMessageReplyList(Token, Channel, Timestamp); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetMessageReplyList"); + +OPI_GetTestData.ExpectsThat(Result["messages"]).HasType("Array"); + +Result = OPI_Slack.GetMessageLink(Token, Channel, Timestamp); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetMessageLink"); + +OPI_GetTestData.ExpectsThat(Result["channel"]).Equal(Channel); +OPI_GetTestData.ExpectsThat(Result["permalink"]).Filled(); + +Check_SlackOk(Result); + +Tags.Add(Timestamp); + +BlockArray = New Array; +Block = OPI_Slack.GenerateImageBlock(Image, "Yo"); +BlockArray.Add(Block); + +Result = OPI_Slack.SendMessage(Token, Channel, Text, , BlockArray); + +// !OInt OPI_GetTestData.WriteLog(Result, "SendMessage (toартинtoа)"); + +Check_SlackOk(Result); +OPI_GetTestData.ExpectsThat(Result["channel"]).Equal(Channel); +OPI_GetTestData.ExpectsThat(Result["ts"]).Filled(); + +Tags.Add(Result["ts"]); + +Block = OPI_Slack.GenerateImageBlock(Image, "Yo"); +JSONBlock = OPI_Tools.JSONString(Block); + +AndVF = GetTempFileName("json"); + +TextDocument = New TextDocument(); +TextDocument.SetText(JSONBlock); +TextDocument.Write(AndVF); + +Result = OPI_Slack.SendMessage(Token, Channel, Text, , AndVF); + +// !OInt OPI_GetTestData.WriteLog(Result, "SendMessage (json)"); + +Check_SlackOk(Result); +OPI_GetTestData.ExpectsThat(Result["channel"]).Equal(Channel); +OPI_GetTestData.ExpectsThat(Result["ts"]).Filled(); + +Tags.Add(Result["ts"]); + +Blocks = "['" + AndVF + "','" + AndVF + "']"; +Result = OPI_Slack.SendMessage(Token, Channel, Text, , Blocks); + +// !OInt OPI_GetTestData.WriteLog(Result, "SendMessage (json маwithwithиin)"); + +Check_SlackOk(Result); +OPI_GetTestData.ExpectsThat(Result["channel"]).Equal(Channel); +OPI_GetTestData.ExpectsThat(Result["ts"]).Filled(); + +Tags.Add(Result["ts"]); + +DeleteFiles(AndVF); + +For Each Timestamp In Tags Do + +Result = OPI_Slack.DeleteMessage(Token, Channel, Timestamp); + +// !OInt OPI_GetTestData.WriteLog(Result, "DeleteMessage"); + +Check_SlackOk(Result); +OPI_GetTestData.ExpectsThat(Result["channel"]).Equal(Channel); +OPI_GetTestData.ExpectsThat(Result["ts"]).Filled(); + +EndDo; + +Hour = 3600; +Day = 24; +Sending = OPI_Tools.GetCurrentDate() + (Day * Hour); +Result = OPI_Slack.SendMessage(Token, Channel, Text, Sending); + +// !OInt OPI_GetTestData.WriteLog(Result, "SendMessage (отложенное)"); + +Check_SlackOk(Result); +OPI_GetTestData.ExpectsThat(Result["channel"]).Equal(Channel); +OPI_GetTestData.ExpectsThat(Result["scheduled_message_id"]).Filled(); + +Timestamp = Result["scheduled_message_id"]; +Result = OPI_Slack.DeleteMessage(Token, Channel, Timestamp, True); + +// !OInt OPI_GetTestData.WriteLog(Result, "DeleteMessage"); + +Check_SlackOk(Result); + +EndProcedure + +Procedure Slack_SendDeleteEphemeral() Export + +Token = OPI_GetTestData.GetParameter("Slack_Token"); +Channel = OPI_GetTestData.GetParameter("Slack_Channel"); +User = OPI_GetTestData.GetParameter("Slack_User"); +Image = "https://github.com/Bayselonarrend/OpenIntegrations/raw/main/Media/logo.png?v1"; +Text = "TestMessage1"; + +Block = OPI_Slack.GenerateImageBlock(Image, "Yo"); +Result = OPI_Slack.SendEphemeralMessage(Token, Channel, Text, User, Block); + +// !OInt OPI_GetTestData.WriteLog(Result, "SendMessage"); + +Check_SlackOk(Result); +OPI_GetTestData.ExpectsThat(Result["message_ts"]).Filled(); + +EndProcedure + +Procedure Slack_GetScheduledMessages() Export + +Token = OPI_GetTestData.GetParameter("Slack_Token"); +Channel = OPI_GetTestData.GetParameter("Slack_Channel"); + +Result = OPI_Slack.GetDelayedMessageList(Token, Channel); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetDelayedMessageList"); + +Check_SlackOk(Result); +OPI_GetTestData.ExpectsThat(Result["scheduled_messages"]).HasType("Array"); + +EndProcedure + +Procedure Slack_CreateArchiveChannel() Export + +Token = OPI_GetTestData.GetParameter("Slack_Token"); +User = OPI_GetTestData.GetParameter("Slack_User"); +Name = "testconv" + String(New UniqueIdentifier); +Topic = "TestTopic"; +Purpose = "TestGoal"; + +#Region CreateChannel +Result = OPI_Slack.CreateChannel(Token, Name); + +// !OInt OPI_GetTestData.WriteLog(Result, "CreateChannel"); + +Data = Result["channel"]; +Channel = Data["id"]; + +Check_SlackOk(Result); +OPI_GetTestData.ExpectsThat(Data["name"]).Equal(Name); +#EndRegion + +#Region SetChannelTopic +Result = OPI_Slack.SetChannelTopic(Token, Channel, Topic); + +// !OInt OPI_GetTestData.WriteLog(Result, "SetChannelTopic"); + +Data = Result["channel"]; +Channel = Data["id"]; + +Check_SlackOk(Result); +OPI_GetTestData.ExpectsThat(Data["name"]).Equal(Name); +OPI_GetTestData.ExpectsThat(Data["topic"]["value"]).Equal(Topic); +#EndRegion + +#Region SetChannelGoal +Result = OPI_Slack.SetChannelGoal(Token, Channel, Purpose); + +// !OInt OPI_GetTestData.WriteLog(Result, "SetChannelGoal"); + +Check_SlackOk(Result); +#EndRegion + +#Region GetChannel +Result = OPI_Slack.GetChannel(Token, Channel); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetChannel"); + +Data = Result["channel"]; +Channel = Data["id"]; + +Check_SlackOk(Result); +OPI_GetTestData.ExpectsThat(Data["name"]).Equal(Name); +#EndRegion + +#Region InviteUsersToChannel +Result = OPI_Slack.InviteUsersToChannel(Token, Channel, User); + +// !OInt OPI_GetTestData.WriteLog(Result, "InviteUsersToChannel"); + +Data = Result["channel"]; +Channel = Data["id"]; + +Check_SlackOk(Result); +OPI_GetTestData.ExpectsThat(Data["name"]).Equal(Name); +#EndRegion + +#Region KickUserFromChannel +Result = OPI_Slack.KickUserFromChannel(Token, Channel, User); + +// !OInt OPI_GetTestData.WriteLog(Result, "KickUserFromChannel"); + +Check_SlackOk(Result); +#EndRegion + +#Region GetChannelHistory +Result = OPI_Slack.GetChannelHistory(Token, Channel); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetChannelHistory"); + +Check_SlackOk(Result); +OPI_GetTestData.ExpectsThat(Result["messages"]).HasType("Array"); +#EndRegion + +#Region GetChannelUserList +Result = OPI_Slack.GetChannelUserList(Token, Channel); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetChannelUserList"); + +Check_SlackOk(Result); +OPI_GetTestData.ExpectsThat(Result["members"]).HasType("Array"); +#EndRegion + +#Region LeaveChannel +Result = OPI_Slack.LeaveChannel(Token, Channel); + +// !OInt OPI_GetTestData.WriteLog(Result, "LeaveChannel"); + +Check_SlackOk(Result); +#EndRegion + +#Region JoinChannel +Result = OPI_Slack.JoinChannel(Token, Channel); + +// !OInt OPI_GetTestData.WriteLog(Result, "JoinChannel"); + +Data = Result["channel"]; +Channel = Data["id"]; + +Check_SlackOk(Result); +OPI_GetTestData.ExpectsThat(Data["name"]).Equal(Name); +#EndRegion + +#Region RenameChannel +NewName = "testconv" + String(New UniqueIdentifier); +Result = OPI_Slack.RenameChannel(Token, Channel, NewName); + +// !OInt OPI_GetTestData.WriteLog(Result, "RenameChannel"); + +Data = Result["channel"]; +Channel = Data["id"]; + +Check_SlackOk(Result); +OPI_GetTestData.ExpectsThat(Data["name"]).Equal(NewName); +#EndRegion + +#Region ArchiveChannel +Result = OPI_Slack.ArchiveChannel(Token, Channel); + +// !OInt OPI_GetTestData.WriteLog(Result, "ArchiveChannel"); + +Check_SlackOk(Result); +#EndRegion + +EndProcedure + +Procedure Slack_GetChannelList() Export + +Token = OPI_GetTestData.GetParameter("Slack_Token"); + +Result = OPI_Slack.GetChannelList(Token); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetChannelList"); + +Check_SlackOk(Result); +OPI_GetTestData.ExpectsThat(Result["channels"]).HasType("Array"); + +EndProcedure + +Procedure Slack_OpenCloseDialog() Export + +Token = OPI_GetTestData.GetParameter("Slack_Token"); +User = OPI_GetTestData.GetParameter("Slack_User"); +Text = "Yo, dude"; + +Result = OPI_Slack.OpenDialog(Token, User); + +// !OInt OPI_GetTestData.WriteLog(Result, "OpenDialog"); + +Dialog = Result["channel"]["id"]; +Check_SlackOk(Result); +OPI_GetTestData.ExpectsThat(Result["channel"]).HasType("Match"); +OPI_GetTestData.ExpectsThat(Dialog).Filled(); + +Result = OPI_Slack.SendMessage(Token, Dialog, Text); + +// !OInt OPI_GetTestData.WriteLog(Result, "SendMessage"); + +Check_SlackOk(Result); + +Result = OPI_Slack.CloseDialog(Token, Dialog); + +// !OInt OPI_GetTestData.WriteLog(Result, "CloseDialog"); + +Check_SlackOk(Result); + +EndProcedure + +Procedure Slack_GetFileList() Export + +Token = OPI_GetTestData.GetParameter("Slack_Token"); +Channel = OPI_GetTestData.GetParameter("Slack_Channel"); + +Result = OPI_Slack.GetFilesList(Token, Channel); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetFilesList"); + +Check_SlackOk(Result); +OPI_GetTestData.ExpectsThat(Result["files"]).HasType("Array"); + +EndProcedure + +Procedure Slack_UploadDeleteFile() Export + +Token = OPI_GetTestData.GetParameter("Slack_Token"); +File = OPI_GetTestData.GetBinary("Document"); +Channel = OPI_GetTestData.GetParameter("Slack_Channel"); +ArrayOfFiles = New Array; +FileName = "megadoc.docx"; +Title = "NewFile"; + +Result = OPI_Slack.UploadFile(Token, File, FileName, Title); + +// !OInt OPI_GetTestData.WriteLog(Result, "UploadFile"); + +UploadedFile = Result["files"][0]; +ArrayOfFiles.Add(UploadedFile["id"]); + +Check_SlackOk(Result); +OPI_GetTestData.ExpectsThat(UploadedFile["name"]).Equal(FileName); + +Result = OPI_Slack.UploadFile(Token, File, FileName, Title, Channel); + +// !OInt OPI_GetTestData.WriteLog(Result, "UploadFile (in toаtoл)"); + +UploadedFile = Result["files"][0]; +ArrayOfFiles.Add(UploadedFile["id"]); + +Check_SlackOk(Result); +OPI_GetTestData.ExpectsThat(UploadedFile["name"]).Equal(FileName); + +Result = OPI_Slack.GetFileData(Token, UploadedFile["id"]); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetFile"); + +UploadedFile = Result["file"]; + +Check_SlackOk(Result); +OPI_GetTestData.ExpectsThat(UploadedFile["name"]).Equal(FileName); + +For Each UploadedFile In ArrayOfFiles Do + +Result = OPI_Slack.DeleteFile(Token, UploadedFile); + +// !OInt OPI_GetTestData.WriteLog(Result, "DeleteFile"); + +Check_SlackOk(Result); + +EndDo; + +EndProcedure + +Procedure Slack_GetExternalFileList() Export + +Token = OPI_GetTestData.GetParameter("Slack_Token"); +Channel = OPI_GetTestData.GetParameter("Slack_Channel"); + +Result = OPI_Slack.GetExternalFileList(Token); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetExternalFileList"); + +Check_SlackOk(Result); +OPI_GetTestData.ExpectsThat(Result["files"]).HasType("Array"); + +Result = OPI_Slack.GetExternalFileList(Token, Channel); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetExternalFileList"); + +Check_SlackOk(Result); +OPI_GetTestData.ExpectsThat(Result["files"]).HasType("Array"); + +EndProcedure + +Procedure Slack_UploadDeleteExternalFile() Export + +Token = OPI_GetTestData.GetParameter("Slack_Token"); +File = OPI_GetTestData.GetParameter("Document"); +Channel = OPI_GetTestData.GetParameter("Slack_Channel"); +Title = "NewFile"; + +Result = OPI_Slack.AddExternalFile(Token, File, Title); + +// !OInt OPI_GetTestData.WriteLog(Result, "AddExternalFile"); + +UploadedFile = Result["file"]; + +Check_SlackOk(Result); +OPI_GetTestData.ExpectsThat(UploadedFile["title"]).Equal(Title); + +Result = OPI_Slack.GetExternalFile(Token, UploadedFile["id"]); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetExternalFile"); + +UploadedFile = Result["file"]; + +Check_SlackOk(Result); +OPI_GetTestData.ExpectsThat(UploadedFile["title"]).Equal(Title); + +Result = OPI_Slack.SendExternalFile(Token, UploadedFile["id"], Channel); + +// !OInt OPI_GetTestData.WriteLog(Result, "SendExternalFile"); + +Check_SlackOk(Result); + +Result = OPI_Slack.DeleteExternalFile(Token, UploadedFile["id"]); + +// !OInt OPI_GetTestData.WriteLog(Result, "SendExternalFile"); + +Check_SlackOk(Result); + +EndProcedure + +#EndRegion + +#Region Airtable + +Procedure AT_CreateDatabase() Export + +Token = OPI_GetTestData.GetParameter("Airtable_Token"); +Region = OPI_GetTestData.GetParameter("Airtable_Workspace"); +Name = "TestDatabase"; + +FieldArray = New Array; +FieldArray.Add(OPI_Airtable.GetNumberField("Number")); +FieldArray.Add(OPI_Airtable.GetStringField("String")); + +TableName = "TestTable"; + +TableMapping = New Match; +TableMapping.Insert(TableName, FieldArray); + +Result = OPI_Airtable.CreateDatabase(Token, Region, Name, TableMapping); + +// !OInt OPI_GetTestData.WriteLog(Result, "CreateDatabase"); + +OPI_GetTestData.ExpectsThat(Result["id"]).Filled(); +OPI_GetTestData.ExpectsThat(Result["tables"][0]["name"]).Equal(TableName); + +Base = Result["id"]; +OPI_GetTestData.WriteParameter("Airtable_Base", Base); + +Result = OPI_Airtable.GetDatabaseTables(Token, Base); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetDatabaseTables"); + +OPI_GetTestData.ExpectsThat(Result["tables"]).Filled(); +OPI_GetTestData.ExpectsThat(Result["tables"]).HasType("Array"); + +Result = OPI_Airtable.GetListOfBases(Token); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetListOfBases"); + +OPI_GetTestData.ExpectsThat(Result["bases"]).Filled(); +OPI_GetTestData.ExpectsThat(Result["bases"]).HasType("Array"); + +EndProcedure + +Procedure AT_CreateTable() Export + +Token = OPI_GetTestData.GetParameter("Airtable_Token"); +Base = OPI_GetTestData.GetParameter("Airtable_Base"); + +FieldArray = New Array; +FieldArray.Add(OPI_Airtable.GetNumberField("Number")); +// !OInt OPI_GetTestData.WriteLog(FieldArray[0], "GetNumberField"); + +FieldArray.Add(OPI_Airtable.GetStringField("String")); +// !OInt OPI_GetTestData.WriteLog(FieldArray[1], "GetStringField"); + +FieldArray.Add(OPI_Airtable.GetAttachmentField("Attachment")); +// !OInt OPI_GetTestData.WriteLog(FieldArray[2], "GetAttachmentField"); + +FieldArray.Add(OPI_Airtable.GetCheckboxField("Checkbox")); +// !OInt OPI_GetTestData.WriteLog(FieldArray[3], "GetCheckboxField"); + +FieldArray.Add(OPI_Airtable.GetDateField("Date")); +// !OInt OPI_GetTestData.WriteLog(FieldArray[4], "GetDateField"); + +FieldArray.Add(OPI_Airtable.GetPhoneField("Phone")); +// !OInt OPI_GetTestData.WriteLog(FieldArray[5], "GetPhoneField"); + +FieldArray.Add(OPI_Airtable.GetEmailField("Email")); +// !OInt OPI_GetTestData.WriteLog(FieldArray[6], "GetEmailField"); + +FieldArray.Add(OPI_Airtable.GetLinkField("Link")); +// !OInt OPI_GetTestData.WriteLog(FieldArray[7], "GetLinkField"); + +TableName = "TestTable2"; +Description = "NewTable"; + +Result = OPI_Airtable.CreateTable(Token, Base, TableName, FieldArray, Description); + +// !OInt OPI_GetTestData.WriteLog(Result, "CreateTable"); + +OPI_GetTestData.ExpectsThat(Result["name"]).Equal(TableName); +OPI_GetTestData.ExpectsThat(Result["description"]).Equal(Description); + +Table = Result["id"]; +TableName = "TestTable2 (fromм.)"; +Description = "NewTable (fromм.)"; + +OPI_GetTestData.WriteParameter("Airtable_Table", Table); + +Result = OPI_Airtable.ModifyTable(Token, Base, Table, TableName, Description); + +// !OInt OPI_GetTestData.WriteLog(Result, "ModifyTable"); + +OPI_GetTestData.ExpectsThat(Result["name"]).Equal(TableName); +OPI_GetTestData.ExpectsThat(Result["description"]).Equal(Description); + +EndProcedure + +Procedure AT_CreateField() Export + +Token = OPI_GetTestData.GetParameter("Airtable_Token"); +Base = OPI_GetTestData.GetParameter("Airtable_Base"); +Table = OPI_GetTestData.GetParameter("Airtable_Table"); +Name = String(New UniqueIdentifier); + +Field = OPI_Airtable.GetNumberField(Name); + +Result = OPI_Airtable.CreateField(Token, Base, Table, Field); + +// !OInt OPI_GetTestData.WriteLog(Result, "CreateField"); + +OPI_GetTestData.ExpectsThat(Result["name"]).Equal(Name); + +Field = Result["id"]; +Name = Name + "(fromм.)"; +Description = "New description"; + +Result = OPI_Airtable.ModifyField(Token, Base, Table, Field, Name, Description); + +// !OInt OPI_GetTestData.WriteLog(Result, "ModifyField"); + +OPI_GetTestData.ExpectsThat(Result["name"]).Equal(Name); +OPI_GetTestData.ExpectsThat(Result["description"]).Equal(Description); + +EndProcedure + +Procedure AT_CreateDeleteRecords() Export + +Token = OPI_GetTestData.GetParameter("Airtable_Token"); +Base = OPI_GetTestData.GetParameter("Airtable_Base"); +Table = OPI_GetTestData.GetParameter("Airtable_Table"); + +Numeric = 10; +StringType = "Hello"; + +RowDescription1 = New Structure("Number,String", Numeric, StringType); +RowDescription2 = New Structure("Number,String", Numeric, StringType); + +ArrayOfDeletions = New Array; +ArrayOfDescriptions = New Array; +ArrayOfDescriptions.Add(RowDescription1); +ArrayOfDescriptions.Add(RowDescription2); + +Result = OPI_Airtable.CreatePosts(Token, Base, Table, ArrayOfDescriptions); + +// !OInt OPI_GetTestData.WriteLog(Result, "CreatePosts"); + +OPI_GetTestData.ExpectsThat(Result["records"]).HasType("Array"); +OPI_GetTestData.ExpectsThat(Result["records"].Quantity()).Equal(2); + +For Each Record In Result["records"] Do +ArrayOfDeletions.Add(Record["id"]); +EndDo; + +Result = OPI_Airtable.CreatePosts(Token, Base, Table, RowDescription1); + +// !OInt OPI_GetTestData.WriteLog(Result, "CreatePosts (оdto)"); + +SingleRecord = Result["id"]; +OPI_GetTestData.ExpectsThat(SingleRecord).Filled(); +OPI_GetTestData.ExpectsThat(Result["createdTime"]).Filled(); +OPI_GetTestData.ExpectsThat(Result["fields"]["Number"]).Equal(Numeric); +OPI_GetTestData.ExpectsThat(ShortLP(Result["fields"]["String"])).Equal(StringType); + +Result = OPI_Airtable.GetRecord(Token, Base, Table, SingleRecord); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetRecord"); + +OPI_GetTestData.ExpectsThat(Result["id"]).Equal(SingleRecord); + +Text = "TestComment"; +Result = OPI_Airtable.CreateComment(Token, Base, Table, SingleRecord, Text); + +// !OInt OPI_GetTestData.WriteLog(Result, "CreateComment"); + +OPI_GetTestData.ExpectsThat(Result["text"]).Equal(Text); + +Comment = Result["id"]; +Text = "TestComment (fromм.)"; +Result = OPI_Airtable.EditComment(Token, Base, Table, SingleRecord, Comment, Text); + +// !OInt OPI_GetTestData.WriteLog(Result, "EditComment"); + +OPI_GetTestData.ExpectsThat(Result["text"]).Equal(Text); + +Result = OPI_Airtable.GetComments(Token, Base, Table, SingleRecord); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetComments"); + +OPI_GetTestData.ExpectsThat(Result["comments"]).HasType("Array"); + +Result = OPI_Airtable.DeleteComment(Token, Base, Table, SingleRecord, Comment); + +// !OInt OPI_GetTestData.WriteLog(Result, "DeleteComment"); + +OPI_GetTestData.ExpectsThat(Result["deleted"]).Equal(True); +OPI_GetTestData.ExpectsThat(Result["id"]).Equal(Comment); + +Result = OPI_Airtable.GetListOfRecords(Token, Base, Table); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetListOfRecords"); + +OPI_GetTestData.ExpectsThat(Result["records"]).HasType("Array"); +OPI_GetTestData.ExpectsThat(Result["records"]).Filled(); + +Result = OPI_Airtable.DeletePosts(Token, Base, Table, ArrayOfDeletions); + +// !OInt OPI_GetTestData.WriteLog(Result, "DeletePosts"); + +OPI_GetTestData.ExpectsThat(Result["records"]).HasType("Array"); +OPI_GetTestData.ExpectsThat(Result["records"]).Filled(); + +Result = OPI_Airtable.DeletePosts(Token, Base, Table, SingleRecord); + +// !OInt OPI_GetTestData.WriteLog(Result, "DeletePosts (оdto)"); + +OPI_GetTestData.ExpectsThat(Result["records"]).HasType("Array"); +OPI_GetTestData.ExpectsThat(Result["records"]).Filled(); + +EndProcedure + +#EndRegion + +#Region Dropbox + +Procedure Dropbox_GetUpdateToken() Export + +TestParameters = New Structure; +OPI_GetTestData.ParameterToCollection("Dropbox_Appkey" , TestParameters); +OPI_GetTestData.ParameterToCollection("Dropbox_Appsecret", TestParameters); + +Dropbox_GetAuthorizationLink(TestParameters); + +OPI_GetTestData.ParameterToCollection("Dropbox_Code", TestParameters); + +Dropbox_GetToken(TestParameters); + +OPI_GetTestData.ParameterToCollection("Dropbox_Refresh", TestParameters); + +Dropbox_UpdateToken(TestParameters); + +EndProcedure + +Procedure Dropbox_UploadFile() Export + +TestParameters = New Structure; +OPI_GetTestData.ParameterToCollection("Dropbox_Token", TestParameters); +OPI_GetTestData.ParameterToCollection("Picture", TestParameters); + +Dropbox_UploadFile(TestParameters); +Dropbox_GetObjectInformation(TestParameters); +Dropbox_GetObjectVersionList(TestParameters); +Dropbox_RestoreObjectToVersion(TestParameters); +Dropbox_GetPreview(TestParameters); +Dropbox_DownloadFile(TestParameters); +Dropbox_MoveObject(TestParameters); +Dropbox_CopyObject(TestParameters); +Dropbox_DeleteObject(TestParameters); + +EndProcedure + +Procedure Dropbox_CreateFolder() Export + +TestParameters = New Structure; +OPI_GetTestData.ParameterToCollection("Dropbox_Token", TestParameters); + +Dropbox_CreateFolder(TestParameters); +Dropbox_DownloadFolder(TestParameters); + +EndProcedure + +Procedure Dropbox_GetFolderFileList() Export + +TestParameters = New Structure; +OPI_GetTestData.ParameterToCollection("Dropbox_Token", TestParameters); + +Dropbox_GetFolderFileList(TestParameters); + +EndProcedure + +Procedure Dropbox_UploadFileByURL() Export + +TestParameters = New Structure; +OPI_GetTestData.ParameterToCollection("Dropbox_Token", TestParameters); +OPI_GetTestData.ParameterToCollection("Document", TestParameters); + +Dropbox_UploadFileByURL(TestParameters); +Dropbox_GetUploadStatusByURL(TestParameters); + +EndProcedure + +Procedure Dropbox_CreateDeleteTag() Export + +TestParameters = New Structure; +OPI_GetTestData.ParameterToCollection("Dropbox_Token", TestParameters); + +Dropbox_AddTag(TestParameters); +Dropbox_GetTagList(TestParameters); +Dropbox_DeleteTag(TestParameters); + +EndProcedure + +Procedure Dropbox_GetAccount() Export + +TestParameters = New Structure; +OPI_GetTestData.ParameterToCollection("Dropbox_Token", TestParameters); + +Dropbox_GetAccountInformation(TestParameters); +Dropbox_GetSpaceUsageData(TestParameters); + +EndProcedure + +Procedure Dropbox_AccessManagement() Export + +TestParameters = New Structure; +OPI_GetTestData.ParameterToCollection("Dropbox_Token" , TestParameters); +OPI_GetTestData.ParameterToCollection("Dropbox_OtherUser", TestParameters); +OPI_GetTestData.ParameterToCollection("Dropbox_FileID" , TestParameters); + +Dropbox_AddUsersToFile(TestParameters); +Dropbox_PublishFolder(TestParameters); +Dropbox_AddUsersToFolder(TestParameters); +Dropbox_CancelFolderPublication(TestParameters); +Dropbox_CancelFilePublication(TestParameters); + +EndProcedure + +#EndRegion + +#EndRegion + +#EndRegion + +#Region ServiceProceduresAndFunctions + +Function GetVKParameters() + +Parameters = New Structure; +GroupNumber = OPI_GetTestData.GetParameter("VK_GroupID"); + +Parameters.Insert("access_token" , OPI_GetTestData.GetParameter("VK_Token")); +Parameters.Insert("owner_id" , "-" + GroupNumber); +Parameters.Insert("app_id" , OPI_GetTestData.GetParameter("VK_AppID")); +Parameters.Insert("group_id" , GroupNumber); + +Return Parameters; + +EndFunction + +Function GetTwitterParameters() + +Parameters = New Match; + +Parameters.Insert("redirect_uri" , OPI_GetTestData.GetParameter("Twitter_Redirect")); +Parameters.Insert("client_id" , OPI_GetTestData.GetParameter("Twitter_ClinetID")); +Parameters.Insert("client_secret" , OPI_GetTestData.GetParameter("Twitter_ClientSecret")); +Parameters.Insert("access_token" , OPI_GetTestData.GetParameter("Twitter_Token")); +Parameters.Insert("refresh_token" , OPI_GetTestData.GetParameter("Twitter_Refresh")); +Parameters.Insert("oauth_token" , OPI_GetTestData.GetParameter("Twitter_OAuthToken")); +Parameters.Insert("oauth_token_secret" , OPI_GetTestData.GetParameter("Twitter_OAuthSecret")); + +Parameters.Insert("oauth_consumer_key" +, OPI_GetTestData.GetParameter("Twitter_OAuthConsumerKey")); +Parameters.Insert("oauth_consumer_secret" +, OPI_GetTestData.GetParameter("Twitter_OAuthConsumerSecret")); + +Return Parameters; + +EndFunction + +#Region Checks + +Procedure Check_Empty(Val Result) +OPI_GetTestData.ExpectsThat(ValueIsFilled(Result)).Equal(False); +EndProcedure + +Procedure Check_BinaryData(Val Result, Val Size = Undefined) + +MinimumSize = 500000; + +OPI_GetTestData.ExpectsThat(Result).HasType("BinaryData"); + +If Not Size = Undefined Then +OPI_GetTestData.ExpectsThat(Result.Size()).Equal(Size); +Else +OPI_GetTestData.ExpectsThat(Result.Size() > MinimumSize).Equal(True); +EndIf; + +EndProcedure + +Procedure Check_TelegramTrue(Val Result) + +OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); +OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); +OPI_GetTestData.ExpectsThat(Result["result"]).Equal(True); + +EndProcedure + +Procedure Check_TelegramBotInformation(Val Result) + +OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); +OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); +OPI_GetTestData.ExpectsThat(Result["result"]["username"]).Filled(); + +EndProcedure + +Procedure Check_TelegramArray(Result) + +OPI_GetTestData.ExpectsThat(Result).HasType("Match") .Filled(); +OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); +OPI_GetTestData.ExpectsThat(Result["result"]).HasType("Array"); + +EndProcedure + +Procedure Check_TelegramWebhookSetup(Val Result) + +OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); +OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); +OPI_GetTestData.ExpectsThat(Result["result"]).Equal(True); +OPI_GetTestData.ExpectsThat(Result["description"]).Equal("Webhook was set"); + +EndProcedure + +Procedure Check_TelegramWebhookDeletion(Val Result) + +OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); +OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); +OPI_GetTestData.ExpectsThat(Result["result"]).Equal(True); +OPI_GetTestData.ExpectsThat(Result["description"]).Filled(); + +EndProcedure + +Procedure Check_TelegramMessage(Val Result, Val Text) + +OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); +OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); +OPI_GetTestData.ExpectsThat(Result["result"]["text"]).Equal(Text); + +EndProcedure + +Procedure Check_TelegramImage(Val Result, Val Text) + +OPI_GetTestData.ExpectsThat(Result).HasType("Match") .Filled(); +OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); +OPI_GetTestData.ExpectsThat(Result["result"]["caption"]).Equal(Text); +OPI_GetTestData.ExpectsThat(Result["result"]["photo"]).HasType("Array"); + +EndProcedure + +Procedure Check_TelegramVideo(Val Result, Val Text) + +OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); +OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); +OPI_GetTestData.ExpectsThat(Result["result"]["caption"]).Equal(Text); +OPI_GetTestData.ExpectsThat(Result["result"]["video"]["mime_type"]).Equal("video/mp4"); + +EndProcedure + +Procedure Check_TelegramAudio(Val Result, Val Text) + +OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); +OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); +OPI_GetTestData.ExpectsThat(Result["result"]["caption"]).Equal(Text); +OPI_GetTestData.ExpectsThat(Result["result"]["audio"]["mime_type"]).Equal("audio/mpeg"); + +EndProcedure + +Procedure Check_TelegramDocument(Val Result, Val Text) + +OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); +OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); +OPI_GetTestData.ExpectsThat(Result["result"]["caption"]).Equal(Text); +OPI_GetTestData.ExpectsThat(Result["result"]["document"]).HasType("Match").Filled(); + +EndProcedure + +Procedure Check_TelegramGif(Val Result, Val Text) + +Result = "result"; + +OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); +OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); +OPI_GetTestData.ExpectsThat(Result[Result]["caption"]).Equal(Text); +OPI_GetTestData.ExpectsThat(Result[Result]["document"]).HasType("Match").Filled(); +OPI_GetTestData.ExpectsThat(Result[Result]["animation"]["mime_type"]).Equal("video/mp4"); + +EndProcedure + +Procedure Check_TelegramMediaGroup(Val Result) + +OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); +OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); +OPI_GetTestData.ExpectsThat(Result["result"]).HasType("Array"); + +EndProcedure + +Procedure Check_TelegramLocation(Val Result) + +OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); +OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); +OPI_GetTestData.ExpectsThat(Result["result"]["location"]).HasType("Match").Filled(); + +EndProcedure + +Procedure Check_TelegramContact(Val Result, Val Name) + +OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); +OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); +OPI_GetTestData.ExpectsThat(Result["result"]["contact"]).HasType("Match").Filled(); +OPI_GetTestData.ExpectsThat(Result["result"]["contact"]["first_name"]).Equal(Name); + +EndProcedure + +Procedure Check_TelegramPoll(Val Result, Val Question) + +OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); +OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); +OPI_GetTestData.ExpectsThat(Result["result"]["poll"]).HasType("Match").Filled(); +OPI_GetTestData.ExpectsThat(Result["result"]["poll"]["question"]).Equal(Question); + +EndProcedure + +Procedure Check_TelegramForward(Val Result, Val MessageID) + +OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); +OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); +OPI_GetTestData.ExpectsThat(Result["result"]["forward_origin"]["message_id"]).Equal(Number(MessageID)); + +EndProcedure + +Procedure Check_TelegramBan(Val Result) + +OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); +OPI_GetTestData.ExpectsThat(Result["description"]).Equal("Bad Request: can't remove chat owner"); + +EndProcedure + +Procedure Check_TelegramInvitation(Val Result, Val Title, Val UnixExpiration) + +Result = "result"; +OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); +OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); +OPI_GetTestData.ExpectsThat(Result[Result]["member_limit"]).Equal(200); +OPI_GetTestData.ExpectsThat(Result[Result]["name"]).Equal(Title); +OPI_GetTestData.ExpectsThat(Result[Result]["expire_date"]).Equal(Number(UnixExpiration)); + +EndProcedure + +Procedure Check_TelegramNumber(Val Result) + +OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); +OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); +OPI_GetTestData.ExpectsThat(Result["result"]).HasType("Number"); + +EndProcedure + +Procedure Check_TelegramCreateTopic(Val Result, Val Name, Icon) + +OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); +OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); +OPI_GetTestData.ExpectsThat(Result["result"]["name"]).Equal(Name); +OPI_GetTestData.ExpectsThat(Result["result"]["icon_custom_emoji_id"]).Equal(Icon); + +EndProcedure + +Procedure Check_VKPost(Val Result) + +OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); +OPI_GetTestData.ExpectsThat(Result["response"]["post_id"]).HasType("Number").Filled(); + +EndProcedure + +Procedure Check_VKTrue(Val Result) + +OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); +OPI_GetTestData.ExpectsThat(Result["response"]).HasType("Number").Equal(1); + +EndProcedure + +Procedure Check_VKAlbum(Val Result, Val Description) + +OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); +OPI_GetTestData.ExpectsThat(Result["response"]["description"]).Equal(Description); + +EndProcedure + +Procedure Check_VKAlbumPicture(Val Result, Val ImageDescription, Val AlbumID) + +Response = "response"; + +OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); +OPI_GetTestData.ExpectsThat(Result[Response][0]["text"]).Equal(ImageDescription); +OPI_GetTestData.ExpectsThat(Result[Response][0]["album_id"]).Equal(AlbumID); + +EndProcedure + +Procedure Check_VKStory(Val Result) + +OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); +OPI_GetTestData.ExpectsThat(Result["response"]["count"]).HasType("Number").Equal(1); +OPI_GetTestData.ExpectsThat(Result["response"]["items"]).HasType("Array").Filled(); + +EndProcedure + +Procedure Check_VKDiscussion(Val Result) + +OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); +OPI_GetTestData.ExpectsThat(Result["response"]).HasType("Number").Filled(); + +EndProcedure + +Procedure Check_GKObject(Val Result, Val Name, Val Description) + +OPI_GetTestData.ExpectsThat(Result).HasType("Match"); +OPI_GetTestData.ExpectsThat(Result["summary"]).Equal(Name); +OPI_GetTestData.ExpectsThat(Result["description"]).Equal(Description); +OPI_GetTestData.ExpectsThat(Result["id"]).HasType("String").Filled(); + +EndProcedure + +Procedure Check_TwitterText(Val Result, Val Text) + +ReplyText = Result["data"]["text"]; +ReplyText = Left(ReplyText, StrLength(Text)); + +OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); +OPI_GetTestData.ExpectsThat(ReplyText).Equal(Text); + +EndProcedure + +Procedure Check_ViberOk(Val Result) + +OPI_GetTestData.ExpectsThat(Result["status_message"]).Equal("ok"); +OPI_GetTestData.ExpectsThat(Result["status"]).Equal(0); + +EndProcedure + +Procedure Check_NotionObject(Val Result, Val View = "page") + +OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); +OPI_GetTestData.ExpectsThat(Result["object"]).Equal(View); + +EndProcedure + +Procedure Check_SlackOk(Val Result) + +OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); +OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); + +EndProcedure + +Procedure Check_DropboxFile(Val Result, Val Path) + +OPI_GetTestData.ExpectsThat(Result["path_display"]).Equal(Path); + +EndProcedure + +Procedure Check_DropboxMetadata(Val Result, Val Path) + +OPI_GetTestData.ExpectsThat(Result["metadata"]["path_display"]).Equal(Path); + +EndProcedure + +Procedure Check_DropboxArray(Val Result, Val Quantity = Undefined) + +OPI_GetTestData.ExpectsThat(Result["entries"]).HasType("Array"); + +If Not Quantity = Undefined Then +OPI_GetTestData.ExpectsThat(Result["entries"].Quantity()).Equal(Quantity); +EndIf; + +EndProcedure + +Procedure Check_DropboxWork(Val Result) +OPI_GetTestData.ExpectsThat(Result["async_job_id"]).Filled(); +EndProcedure + +Procedure Check_DropboxStatus(Val Result) +OPI_GetTestData.ExpectsThat(Result[".tag"]).Equal("complete"); +EndProcedure + +Procedure Check_DropboxTags(Val Result, Val Quantity) + +OPI_GetTestData.ExpectsThat(Result["paths_to_tags"]).HasType("Array"); +OPI_GetTestData.ExpectsThat(Result["paths_to_tags"].Quantity()).Equal(Quantity); + +EndProcedure + +Procedure Check_DropboxAccount(Val Result) +OPI_GetTestData.ExpectsThat(Result["account_id"]).Filled(); +EndProcedure + +Procedure Check_DropboxSpace(Val Result) +OPI_GetTestData.ExpectsThat(Result["used"]).Filled(); +EndProcedure + +Procedure Check_DropboxMember(Val Result, Val Email, Val ViewOnly) +OPI_GetTestData.ExpectsThat(Result[0]["result"][".tag"]).Equal("success"); +OPI_GetTestData.ExpectsThat(Result[0]["member"]["email"]).Equal(Email); +OPI_GetTestData.ExpectsThat( +Result[0]["result"]["success"][".tag"]).Equal(?(ViewOnly, "viewer", "editor")); +EndProcedure + +Procedure Check_DropboxPublicFolder(Val Result) +OPI_GetTestData.ExpectsThat(Result["shared_folder_id"]).Filled(); +EndProcedure + +#EndRegion + +#Region AtomicTests + +#Region Telegram + +Procedure Telegram_GetBotInformation(FunctionParameters) + +Token = FunctionParameters["Telegram_Token"]; +Result = OPI_Telegram.GetBotInformation(Token); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "GetBotInformation", "Telegram"); + +Check_TelegramBotInformation(Result); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Telegram_GetUpdates(FunctionParameters) + +Token = FunctionParameters["Telegram_Token"]; +Result = OPI_Telegram.GetUpdates(Token); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "GetUpdates", "Telegram"); + +Check_TelegramArray(Result); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Telegram_SetWebhook(FunctionParameters) + +Token = FunctionParameters["Telegram_Token"]; +URL = FunctionParameters["Telegram_URL"]; + +Result = OPI_Telegram.SetWebhook(Token, URL); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "SetWebhook", "Telegram"); + +Check_TelegramWebhookSetup(Result); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Telegram_DeleteWebhook(FunctionParameters) + +Token = FunctionParameters["Telegram_Token"]; +Result = OPI_Telegram.DeleteWebhook(Token); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "DeleteWebhook", "Telegram"); + +Check_TelegramWebhookDeletion(Result); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Telegram_SendTextMessage(FunctionParameters) + +Token = FunctionParameters["Telegram_Token"]; +ChatID = FunctionParameters["Telegram_ChatID"]; +ChannelID = FunctionParameters["Telegram_ChannelID"]; +Text = FunctionParameters["String"]; + +Result = OPI_Telegram.SendTextMessage(Token, ChatID, Text); + +// !OInt OPI_GetTestData.WriteLog(Result, "SendTextMessage", "Telegram"); + +Check_TelegramMessage(Result, Text); // SKIP + +Result = OPI_Telegram.SendTextMessage(Token, ChannelID, Text); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "SendTextMessage (toаtoл)"); + +Check_TelegramMessage(Result, Text); + +MessageID = OPI_Tools.NumberToString(Result["result"]["message_id"]); +OPI_GetTestData.WriteParameter("Telegram_ChannelMessageID", MessageID); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Telegram_SendPicture(FunctionParameters) + +Token = FunctionParameters["Telegram_Token"]; +ChatID = FunctionParameters["Telegram_ChatID"]; +ChannelID = FunctionParameters["Telegram_ChannelID"]; +Text = FunctionParameters["String"]; +Image = FunctionParameters["Picture"]; + +ImagePath = GetTempFileName("png"); +CopyFile(Image, ImagePath); + +ImageDD = New BinaryData(ImagePath); + +Result = OPI_Telegram.SendImage(Token, ChatID, Text, Image); + +// !OInt OPI_GetTestData.WriteLog(Result, "SendImage", "Telegram"); + +Check_TelegramImage(Result, Text); // SKIP + +Result = OPI_Telegram.SendImage(Token, ChannelID, Text, ImagePath); + +// !OInt OPI_GetTestData.WriteLog(Result, "SendImage (Path)"); + +Check_TelegramImage(Result, Text); // SKIP + +Result = OPI_Telegram.SendImage(Token, ChannelID, Text, ImageDD); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "SendImage (BD)"); + +Check_TelegramImage(Result, Text); + +DeleteFiles(ImagePath); + +FileID = Result["result"]["photo"][0]["file_id"]; +OPI_GetTestData.WriteParameter("Telegram_FileID", FileID); + +FunctionParameters.Insert("Telegram_FileID", FileID); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Telegram_SendVideo(FunctionParameters) + +Token = FunctionParameters["Telegram_Token"]; +ChatID = FunctionParameters["Telegram_ChatID"]; +ChannelID = FunctionParameters["Telegram_ChannelID"]; +Text = FunctionParameters["String"]; +Video = FunctionParameters["Video"]; + +VideoPath = GetTempFileName("mp4"); +CopyFile(Video, VideoPath); + +VideoDD = New BinaryData(VideoPath); + +Result = OPI_Telegram.SendVideo(Token, ChatID, Text, Video); + +// !OInt OPI_GetTestData.WriteLog(Result, "SendVideo", "Telegram"); + +Check_TelegramVideo(Result, Text); // SKIP + +Result = OPI_Telegram.SendVideo(Token, ChannelID, Text, VideoPath); + +// !OInt OPI_GetTestData.WriteLog(Result, "SendVideo (Path)"); + +Check_TelegramVideo(Result, Text); // SKIP + +Result = OPI_Telegram.SendVideo(Token, ChannelID, Text, VideoDD); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "SendVideo (BD)"); + +Check_TelegramVideo(Result, Text); + +DeleteFiles(VideoPath); + +FileID = Result["result"]["video"]["file_id"]; +OPI_GetTestData.WriteParameter("Telegram_FileID", FileID); + +FunctionParameters.Insert("Telegram_FileID", FileID); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Telegram_SendAudio(FunctionParameters) + +Token = FunctionParameters["Telegram_Token"]; +ChatID = FunctionParameters["Telegram_ChatID"]; +ChannelID = FunctionParameters["Telegram_ChannelID"]; +Text = FunctionParameters["String"]; +Audio = FunctionParameters["Audio"]; + +AudioPath = GetTempFileName("mp3"); +CopyFile(Audio, AudioPath); + +AudioDD = New BinaryData(AudioPath); + +Result = OPI_Telegram.SendAudio(Token, ChatID, Text, Audio); + +// !OInt OPI_GetTestData.WriteLog(Result, "SendAudio", "Telegram"); + +Check_TelegramAudio(Result, Text); // SKIP + +Result = OPI_Telegram.SendAudio(Token, ChannelID, Text, AudioPath); + +// !OInt OPI_GetTestData.WriteLog(Result, "SendAudio (Path)"); + +Check_TelegramAudio(Result, Text); // SKIP + +Result = OPI_Telegram.SendAudio(Token, ChannelID, Text, AudioDD); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "SendAudio (BD)"); + +Check_TelegramAudio(Result, Text); + +DeleteFiles(AudioPath); + +FileID = Result["result"]["audio"]["file_id"]; +OPI_GetTestData.WriteParameter("Telegram_FileID", FileID); + +FunctionParameters.Insert("Telegram_FileID", FileID); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Telegram_SendDocument(FunctionParameters) + +Token = FunctionParameters["Telegram_Token"]; +ChatID = FunctionParameters["Telegram_ChatID"]; +ChannelID = FunctionParameters["Telegram_ChannelID"]; +Text = FunctionParameters["String"]; +Document = FunctionParameters["Document"]; + +DocumentPath = GetTempFileName("docx"); +CopyFile(Document, DocumentPath); + +DocumentDD = New BinaryData(DocumentPath); + +Result = OPI_Telegram.SendDocument(Token, ChatID, Text, Document); + +// !OInt OPI_GetTestData.WriteLog(Result, "SendDocument", "Telegram"); + +Check_TelegramDocument(Result, Text); // SKIP + +Result = OPI_Telegram.SendDocument(Token, ChannelID, Text, DocumentPath); + +// !OInt OPI_GetTestData.WriteLog(Result, "SendDocument (Path)"); + +Check_TelegramDocument(Result, Text); // SKIP + +Result = OPI_Telegram.SendDocument(Token, ChannelID, Text, DocumentDD); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "SendDocument (BD)"); + +Check_TelegramDocument(Result, Text); + +DeleteFiles(DocumentPath); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Telegram_SendGif(FunctionParameters) + +Token = FunctionParameters["Telegram_Token"]; +ChatID = FunctionParameters["Telegram_ChatID"]; +ChannelID = FunctionParameters["Telegram_ChannelID"]; +Text = FunctionParameters["String"]; +GIF = FunctionParameters["GIF"]; + +GifPath = GetTempFileName("gif"); +CopyFile(GIF, GifPath); + +GifDD = New BinaryData(GifPath); + +Result = OPI_Telegram.SendGif(Token, ChatID, Text, GIF); + +// !OInt OPI_GetTestData.WriteLog(Result, "SendGif", "Telegram"); + +Check_TelegramGif(Result, Text); // SKIP + +Result = OPI_Telegram.SendGif(Token, ChannelID, Text, GifPath); + +// !OInt OPI_GetTestData.WriteLog(Result, "SendGif (Path)"); + +Check_TelegramGif(Result, Text); // SKIP + +Result = OPI_Telegram.SendGif(Token, ChannelID, Text, GifDD); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "SendGif (BD)"); + +Check_TelegramGif(Result, Text); + +DeleteFiles(GifPath); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Telegram_SendMediaGroup(FunctionParameters) + +Token = FunctionParameters["Telegram_Token"]; +ChatID = FunctionParameters["Telegram_ChatID"]; +Text = FunctionParameters["String"]; +Image = FunctionParameters["Picture"]; +Video = FunctionParameters["Video"]; + +ImagePath = GetTempFileName("png"); +CopyFile(Image, ImagePath); + +VideoPath = GetTempFileName("mp4"); +CopyFile(Video, VideoPath); + +VideoDD = New BinaryData(VideoPath); + +MediaGroup = New Match; +MediaGroup.Insert(ImagePath, "photo"); +MediaGroup.Insert(VideoDD , "video"); + +Result = OPI_Telegram.SendMediaGroup(Token, ChatID, Text, MediaGroup); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "SendMediaGroup", "Telegram"); + +Check_TelegramMediaGroup(Result); + +DeleteFiles(VideoPath); +DeleteFiles(ImagePath); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Telegram_SendLocation(FunctionParameters) + +Token = FunctionParameters["Telegram_Token"]; +ChatID = FunctionParameters["Telegram_ChatID"]; +ChannelID = FunctionParameters["Telegram_ChannelID"]; +Width = FunctionParameters["Lat"]; +Longitude = FunctionParameters["Long"]; + +Result = OPI_Telegram.SendLocation(Token, ChatID, Width, Longitude); + +// !OInt OPI_GetTestData.WriteLog(Result, "SendLocation", "Telegram"); + +Check_TelegramLocation(Result); // SKIP + +Result = OPI_Telegram.SendLocation(Token, ChannelID, Width, Longitude); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "SendLocation (toаtoл)"); + +Check_TelegramLocation(Result); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Telegram_SendContact(FunctionParameters) + +Token = FunctionParameters["Telegram_Token"]; +ChatID = FunctionParameters["Telegram_ChatID"]; +ChannelID = FunctionParameters["Telegram_ChannelID"]; +Name = FunctionParameters["Name"]; +Last name = FunctionParameters["Surname"]; +Phone = FunctionParameters["Phone"]; + +Result = OPI_Telegram.SendContact(Token, ChatID , Name, Last name, Phone); + +// !OInt OPI_GetTestData.WriteLog(Result, "SendContact", "Telegram"); + +Check_TelegramContact(Result, Name); // SKIP +OPI_Tools.Pause(20); // SKIP + +Result = OPI_Telegram.SendContact(Token, ChannelID, Name, Last name, Phone); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "SendContact (toаtoл)"); + +Check_TelegramContact(Result, Name); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Telegram_SendPoll(FunctionParameters) + +Token = FunctionParameters["Telegram_Token"]; +ChatID = FunctionParameters["Telegram_ChatID"]; +ChannelID = FunctionParameters["Telegram_ChannelID"]; +Question = "What's your favorite color?"; + +AnswersArray = New Array; +AnswersArray.Add("Red"); +AnswersArray.Add("Yellow"); +AnswersArray.Add("Green"); +AnswersArray.Add("Blue"); + +Result = OPI_Telegram.SendPoll(Token, ChatID , Question, AnswersArray, False); + +// !OInt OPI_GetTestData.WriteLog(Result, "SendPoll", "Telegram"); + +Check_TelegramPoll(Result, Question); // SKIP + +Result = OPI_Telegram.SendPoll(Token, ChannelID, Question, AnswersArray, True); + +// !OInt OPI_GetTestData.WriteLog(Result, "SendPoll (toаtoл)"); + +Check_TelegramPoll(Result, Question); // SKIP + +// END + +StringArray = "['Red', 'Yellow','Green' ,'Blue']"; + +Result = OPI_Telegram.SendPoll(Token, ChannelID, Question, StringArray, True); + +// !OInt OPI_GetTestData.WriteLog(Result, "SendPoll (withтрочный маwithwithиin)"); + +Check_TelegramPoll(Result, Question); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Telegram_DownloadFile(FunctionParameters) + +FileID = FunctionParameters["Telegram_FileID"]; +Token = FunctionParameters["Telegram_Token"]; + +Result = OPI_Telegram.DownloadFile(Token, FileID); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "DownloadFile", "Telegram"); + +OPI_GetTestData.ExpectsThat(Result).HasType("BinaryData"); + +EndProcedure + +Procedure Telegram_ForwardMessage(FunctionParameters) + +Token = FunctionParameters["Telegram_Token"]; +ChatID = FunctionParameters["Telegram_ChatID"]; +ChannelID = FunctionParameters["Telegram_ChannelID"]; +MessageID = FunctionParameters["Telegram_ChannelMessageID"]; + +Result = OPI_Telegram.ForwardMessage(Token, MessageID, ChannelID, ChatID); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "ForwardMessage", "Telegram"); + +Check_TelegramForward(Result, MessageID); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Telegram_Ban(FunctionParameters) + +Token = FunctionParameters["Telegram_Token"]; +UserID = FunctionParameters["Telegram_ChatID"]; +ChannelID = FunctionParameters["Telegram_ChannelID"]; + +Result = OPI_Telegram.Ban(Token, ChannelID, UserID); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "Ban", "Telegram"); + +Check_TelegramBan(Result); +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Telegram_Unban(FunctionParameters) + +Token = FunctionParameters["Telegram_Token"]; +UserID = FunctionParameters["Telegram_ChatID"]; +ChannelID = FunctionParameters["Telegram_ChannelID"]; + +Result = OPI_Telegram.Unban(Token, ChannelID, UserID); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "Unban", "Telegram"); + +Check_TelegramBan(Result); +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Telegram_CreateInviteLink(FunctionParameters) + +Token = FunctionParameters["Telegram_Token"]; +ChannelID = FunctionParameters["Telegram_ChannelID"]; +Day = 86400; +CurrentDate = OPI_Tools.GetCurrentDate(); + +Title = "Link " + String(CurrentDate); +Expiration = CurrentDate + Day; +UnixExpiration = OPI_Tools.UNIXTime(Expiration); + +Result = OPI_Telegram.CreateInvitationLink(Token, ChannelID, Title, Expiration, 200); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "CreateInvitationLink", "Telegram"); + +Check_TelegramInvitation(Result, Title, UnixExpiration); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Telegram_PinMessage(FunctionParameters) + +Token = FunctionParameters["Telegram_Token"]; +ChannelID = FunctionParameters["Telegram_ChannelID"]; +MessageID = FunctionParameters["Telegram_ChannelMessageID"]; + +Result = OPI_Telegram.PinMessage(Token, ChannelID, MessageID); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "PinMessage", "Telegram"); + +Check_TelegramTrue(Result); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Telegram_UnpinMessage(FunctionParameters) + +Token = FunctionParameters["Telegram_Token"]; +ChannelID = FunctionParameters["Telegram_ChannelID"]; +MessageID = FunctionParameters["Telegram_ChannelMessageID"]; + +Result = OPI_Telegram.UnpinMessage(Token, ChannelID, MessageID); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "UnpinMessage", "Telegram"); + +Check_TelegramTrue(Result); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Telegram_GetParticipantCount(FunctionParameters) + +Token = FunctionParameters["Telegram_Token"]; +ChannelID = FunctionParameters["Telegram_ChannelID"]; + +Result = OPI_Telegram.GetParticipantCount(Token, ChannelID); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "GetParticipantCount", "Telegram"); + +Check_TelegramNumber(Result); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Telegram_GetForumAvatarList(FunctionParameters) + +Token = FunctionParameters["Telegram_Token"]; +Result = OPI_Telegram.GetAvatarIconList(Token); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "GetAvatarIconList", "Telegram"); + +OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Telegram_CreateForumTopic(FunctionParameters) + +Token = FunctionParameters["Telegram_Token"]; +Chat = FunctionParameters["Telegram_ForumID"]; +Icon = "5357419403325481346"; +Name = "TestTopic " + String(New UniqueIdentifier); + +Result = OPI_Telegram.CreateForumThread(Token, Chat, Name, Icon); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "CreateForumThread", "Telegram"); + +Topic = Result["result"]["message_thread_id"]; + +FunctionParameters.Insert("Telegram_TopicID", Topic); +OPI_Tools.AddField("Telegram_TopicID", Topic, "String", FunctionParameters); +OPI_GetTestData.WriteParameter("Telegram_TopicID", FunctionParameters["Telegram_TopicID"]); + +Check_TelegramCreateTopic(Result, Name, Icon); + +ChatTopic = Chat + "*" + Topic; +Text = FunctionParameters["String"]; +Result = OPI_Telegram.SendTextMessage(Token, ChatTopic, Text); + +// !OInt OPI_GetTestData.WriteLog(Result, "SendTextMessage (форум)"); + +Check_TelegramMessage(Result, Text); + +EndProcedure + +Procedure Telegram_EditForumTopic(FunctionParameters) + +Token = FunctionParameters["Telegram_Token"]; +Chat = FunctionParameters["Telegram_ForumID"]; +Topic = FunctionParameters["Telegram_TopicID"]; +NewName = "NewTestTitle"; +NewIcon = "5310132165583840589"; + +Result = OPI_Telegram.EditForumTopic(Token, Chat, Topic, NewName, NewIcon); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "EditForumTopic", "Telegram"); + +Check_TelegramTrue(Result); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Telegram_CloseForumTopic(FunctionParameters) + +Token = FunctionParameters["Telegram_Token"]; +Chat = FunctionParameters["Telegram_ForumID"]; +Topic = FunctionParameters["Telegram_TopicID"]; + +OPI_Telegram.OpenForumThread(Token, Chat); // SKIP + +Result = OPI_Telegram.CloseForumThread(Token, Chat); // Closes main topic + +// !OInt OPI_GetTestData.WriteLog(Result, "CloseForumThread (глаintoя)"); + +Check_TelegramTrue(Result); // SKIP + +Result = OPI_Telegram.CloseForumThread(Token, Chat, Topic); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "CloseForumThread", "Telegram"); + +Check_TelegramTrue(Result); + +OPI_Tools.Pause(25); + +EndProcedure + +Procedure Telegram_OpenForumTopic(FunctionParameters) + +Token = FunctionParameters["Telegram_Token"]; +Chat = FunctionParameters["Telegram_ForumID"]; +Topic = FunctionParameters["Telegram_TopicID"]; + +Result = OPI_Telegram.OpenForumThread(Token, Chat); // Opens main topic + +// !OInt OPI_GetTestData.WriteLog(Result, "OpenForumThread (глаintoя)"); + +Check_TelegramTrue(Result); // SKIP + +Result = OPI_Telegram.OpenForumThread(Token, Chat, Topic); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "OpenForumThread", "Telegram"); + +Check_TelegramTrue(Result); + +OPI_Tools.Pause(25); + +EndProcedure + +Procedure Telegram_DeleteForumTopic(FunctionParameters) + +Token = FunctionParameters["Telegram_Token"]; +Chat = FunctionParameters["Telegram_ForumID"]; +Topic = FunctionParameters["Telegram_TopicID"]; + +Result = OPI_Telegram.DeleteForumTopic(Token, Chat, Topic); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "DeleteForumTopic", "Telegram"); + +Check_TelegramTrue(Result); + +OPI_Tools.Pause(25); + +EndProcedure + +Procedure Telegram_ClearPinnedMessagesList(FunctionParameters) + +Token = FunctionParameters["Telegram_Token"]; +Chat = FunctionParameters["Telegram_ForumID"]; +Topic = FunctionParameters["Telegram_TopicID"]; + +Result = OPI_Telegram.ClearThreadPinnedMessagesList(Token, Chat); + +// !OInt OPI_GetTestData.WriteLog(Result, "ClearThreadPinnedMessagesList (глаintoя)"); + +Check_TelegramTrue(Result); // SKIP + +Result = OPI_Telegram.ClearThreadPinnedMessagesList(Token, Chat, Topic); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "ClearThreadPinnedMessagesList", "Telegram"); + +Check_TelegramTrue(Result); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Telegram_HideMainForumTopic(FunctionParameters) + +Token = FunctionParameters["Telegram_Token"]; +Chat = FunctionParameters["Telegram_ForumID"]; + +Result = OPI_Telegram.HideMainForumTopic(Token, Chat); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "HideMainForumTopic", "Telegram"); + +Check_TelegramTrue(Result); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Telegram_ShowMainForumTopic(FunctionParameters) + +Token = FunctionParameters["Telegram_Token"]; +Chat = FunctionParameters["Telegram_ForumID"]; + +Result = OPI_Telegram.ShowMainForumTopic(Token, Chat); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "ShowMainForumTopic", "Telegram"); + +Check_TelegramTrue(Result); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Telegram_ChangeMainTopicName(FunctionParameters) + +Title = "New main thread name " + String(New UniqueIdentifier); +Token = FunctionParameters["Telegram_Token"]; +Chat = FunctionParameters["Telegram_ForumID"]; + +Result = OPI_Telegram.EditMainForumTopicName(Token, Chat, Title); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "EditMainForumTopicName", "Telegram"); + +Check_TelegramTrue(Result); + +OPI_Tools.Pause(5); + +EndProcedure + +#EndRegion + +#Region VK + +Procedure VK_CreateTokenRetrievalLink(FunctionParameters) + +Application = FunctionParameters["VK_AppID"]; +Result = OPI_VK.CreateTokenRetrievalLink(Application); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "CreateTokenRetrievalLink", "VK"); + +OPI_GetTestData.ExpectsThat(Result).HasType("String").Filled(); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure VK_CreatePost(FunctionParameters) + +Parameters = GetVKParameters(); +Text = "Post from autotest"; +URL = "https://github.com/Bayselonarrend/OpenIntegrations"; + +Image = FunctionParameters["Picture"]; // URL, Path or Binary Data +Image2 = FunctionParameters["Picture2"]; // URL, Path or Binary Data + +AndVF = GetTempFileName("png"); +CopyFile(Image2, AndVF); + +ImageArray = New Array; +ImageArray.Add(Image); +ImageArray.Add(AndVF); + +Result = OPI_VK.CreatePost(Text, ImageArray, True, URL, Parameters); + +// !OInt OPI_GetTestData.WriteLog(Result, "CreatePost", "VK"); + +Check_VKPost(Result); // SKIP +PostID = Result["response"]["post_id"]; // SKIP +Result = OPI_VK.DeletePost(PostID, Parameters); // SKIP + +Result = OPI_VK.CreatePost(Text, Image, False , , Parameters); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "CreatePost (оdto toартинtoа)"); + +Check_VKPost(Result); + +PostID = Result["response"]["post_id"]; +Result = OPI_VK.DeletePost(PostID, Parameters); + +OPI_Tools.Pause(5); + +Result = OPI_VK.CreatePost(Text, AndVF , True, URL, Parameters); + +// !OInt OPI_GetTestData.WriteLog(Result, "CreatePost (оdин path)"); + +Check_VKPost(Result); + +PostID = Result["response"]["post_id"]; +OPI_Tools.AddField("VK_PostID", PostID, "String", FunctionParameters); +OPI_GetTestData.WriteParameter("VK_PostID", FunctionParameters["VK_PostID"]); + +DeleteFiles(AndVF); +OPI_Tools.Pause(5); + +EndProcedure + +Procedure VK_DeletePost(FunctionParameters) + +Parameters = GetVKParameters(); +PostID = FunctionParameters["VK_PostID"]; + +Result = OPI_VK.DeletePost(PostID, Parameters); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "DeletePost", "VK"); + +Check_VKTrue(Result); + +EndProcedure + +Procedure VK_CreateCompositePost(FunctionParameters) + +Parameters = GetVKParameters(); +Text = "Post from autotest"; +URL = "https://github.com/Bayselonarrend/OpenIntegrations"; + +Image = FunctionParameters["Picture"]; // URL, Path or Binary Data +Video = FunctionParameters["Video"]; // URL, Path or Binary Data + +AndVF = GetTempFileName("png"); +CopyFile(Image, AndVF); + +ImageUpload = OPI_VK.UploadPhotoToServer(AndVF, Parameters)["response"][0]; +VideoUpload = OPI_VK.UploadVideoToServer(Video, "NewVideo", , , Parameters); + +ImageOwner = OPI_Tools.NumberToString(ImageUpload["owner_id"]); +VideoOwner = OPI_Tools.NumberToString(VideoUpload["owner_id"]); + +ImageID = OPI_Tools.NumberToString(ImageUpload["id"]); +VideoID = OPI_Tools.NumberToString(VideoUpload["video_id"]); + +AttachmentsArray = New Array; +AttachmentsArray.Add("photo" + ImageOwner + "_" + ImageID); +AttachmentsArray.Add("video" + VideoOwner + "_" + VideoID); + +Result = OPI_VK.CreateCompositePost(Text, AttachmentsArray, False, URL, Parameters); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "CreateCompositePost", "VK"); + +Check_VKPost(Result); +DeleteFiles(AndVF); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure VK_CreatePoll() + +Parameters = GetVKParameters(); +Question = "What's your favorite color?"; + +OptionArray = New Array; +OptionArray.Add("Red"); +OptionArray.Add("Yellow"); +OptionArray.Add("Green"); + +Result = OPI_VK.CreatePoll(Question, OptionArray, , Parameters); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "CreatePoll", "VK"); + +Check_VKPost(Result); + +PostID = Result["response"]["post_id"]; +OPI_VK.DeletePost(PostID, Parameters); + +OPI_Tools.Pause(10); + +EndProcedure + +Procedure VK_CreateAlbum(FunctionParameters) + +Parameters = GetVKParameters(); +Name = "AlbumFromAutoTest"; +Description = "NewAlbumFromAutoTest"; + +Result = OPI_VK.CreateAlbum(Name, Description, Parameters); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "CreateAlbum", "VK"); + +Check_VKAlbum(Result, Description); + +AlbumID = Result["response"]["id"]; +FunctionParameters.Insert("VK_AlbumID", AlbumID); +OPI_GetTestData.WriteParameter("VK_AlbumID", AlbumID); + +EndProcedure + +Procedure VK_SavePictureToAlbum(FunctionParameters) + +Parameters = GetVKParameters(); +ImageDescription = "AutoTestImage"; +AlbumID = FunctionParameters["VK_AlbumID"]; + +Image = FunctionParameters["Picture"]; // URL, Path to file or Binary Data +AndVF = GetTempFileName("png"); +CopyFile(Image, AndVF); + +Image = New BinaryData(AndVF); + +Result = OPI_VK.SaveImageToAlbum(AlbumID, Image, ImageDescription, Parameters); + +// !OInt OPI_GetTestData.WriteLog(Result, "SaveImageToAlbum", "VK"); + +Check_VKAlbumPicture(Result, ImageDescription, AlbumID); // SKIP + +ImageID = Result["response"][0]["id"]; // SKIP +Result = OPI_VK.DeleteImage(ImageID, Parameters); // SKIP + +Result = OPI_VK.SaveImageToAlbum(AlbumID, AndVF, ImageDescription, Parameters); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "SaveImageToAlbum (path)"); + +Check_VKAlbumPicture(Result, ImageDescription, AlbumID); // SKIP + +ImageID = Result["response"][0]["id"]; +FunctionParameters.Insert("VK_PictureID", ImageID); +OPI_GetTestData.WriteParameter("VK_PictureID", ImageID); + +DeleteFiles(AndVF); +OPI_Tools.Pause(5); + +EndProcedure + +Procedure VK_DeleteImage(FunctionParameters) + +Parameters = GetVKParameters(); +ImageID = FunctionParameters["VK_PictureID"]; + +Result = OPI_VK.DeleteImage(ImageID, Parameters); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "DeleteImage", "VK"); + +Check_VKTrue(Result); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure VK_DeleteAlbum(FunctionParameters) + +Parameters = GetVKParameters(); +AlbumID = FunctionParameters["VK_AlbumID"]; + +Result = OPI_VK.DeleteAlbum(AlbumID, Parameters); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "DeleteAlbum", "VK"); + +Check_VKTrue(Result); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure VK_CreateStory(FunctionParameters) + +Parameters = GetVKParameters(); +URL = "https://github.com/Bayselonarrend/OpenIntegrations"; + +Image = FunctionParameters["Picture"]; // URL, Path to file or Binary Data +AndVF = GetTempFileName("png"); +CopyFile(Image, AndVF); +Image = New BinaryData(AndVF); + +Result = OPI_VK.CreateStory(Image , URL, Parameters); + +// !OInt OPI_GetTestData.WriteLog(Result, "CreateStory", "VK"); + +Check_VKStory(Result); // SKIP + +Result = OPI_VK.CreateStory(AndVF, , Parameters); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "CreateStory (path)"); + +Check_VKStory(Result); + +DeleteFiles(AndVF); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure VK_CreateDiscussion(FunctionParameters) + +Parameters = GetVKParameters(); +Name = "Discussing: Which color is better?"; +Message = "Red, yellow, blue, or some other?"; + +Result = OPI_VK.CreateDiscussion(Name, Message, Parameters); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "CreateDiscussion", "VK"); + +Check_VKDiscussion(Result); + +DiscussionID = Result["response"]; +FunctionParameters.Insert("VK_ConvID", DiscussionID); +OPI_GetTestData.WriteParameter("VK_ConvID", DiscussionID); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure VK_CloseDiscussion(FunctionParameters) + +Parameters = GetVKParameters(); +DiscussionID = FunctionParameters["VK_ConvID"]; +Result = OPI_VK.CloseDiscussion(DiscussionID, False, Parameters); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "CloseDiscussion", "VK"); + +Check_VKTrue(Result); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure VK_OpenDiscussion(FunctionParameters) + +Parameters = GetVKParameters(); +DiscussionID = FunctionParameters["VK_ConvID"]; +Result = OPI_VK.OpenDiscussion(DiscussionID, Parameters); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "OpenDiscussion", "VK"); + +Check_VKTrue(Result); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure VK_PostToDiscussion(FunctionParameters) + +Parameters = GetVKParameters(); +DiscussionID = FunctionParameters["VK_ConvID"]; +Message = "I like yellow more"; + +Result = OPI_VK.WriteInDiscussion(DiscussionID, Message, Parameters); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "WriteInDiscussion", "VK"); + +Check_VKDiscussion(Result); + +EndProcedure + +#EndRegion + +#Region Dropbox + +Procedure Dropbox_GetAuthorizationLink(FunctionParameters) + +AppKey = FunctionParameters["Dropbox_Appkey"]; +Result = OPI_Dropbox.GetAuthorizationLink(AppKey); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "GetAuthorizationLink", "Dropbox"); + +OPI_GetTestData.ExpectsThat(Result).HasType("String"); + +EndProcedure + +Procedure Dropbox_GetToken(FunctionParameters) + +AppKey = FunctionParameters["Dropbox_Appkey"]; +AppSecret = FunctionParameters["Dropbox_Appsecret"]; +Code = FunctionParameters["Dropbox_Code"]; + +Result = OPI_Dropbox.GetToken(AppKey, AppSecret, Code); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "GetToken"); + +Token = Result["access_token"]; +Refresh = Result["refresh_token"]; + +If ValueIsFilled(Token) Then +OPI_GetTestData.WriteParameter("Dropbox_Token", Token); +EndIf; + +If ValueIsFilled(Refresh) Then +OPI_GetTestData.WriteParameter("Dropbox_Refresh", Refresh); +EndIf; + +EndProcedure + +Procedure Dropbox_UpdateToken(FunctionParameters) + +AppKey = FunctionParameters["Dropbox_Appkey"]; +AppSecret = FunctionParameters["Dropbox_Appsecret"]; +RefreshToken = FunctionParameters["Dropbox_Refresh"]; + +Result = OPI_Dropbox.RefreshToken(AppKey, AppSecret, RefreshToken); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "RefreshToken"); + +Token = Result["access_token"]; + +OPI_GetTestData.ExpectsThat(Token).Filled(); + +OPI_GetTestData.WriteParameter("Dropbox_Token", Token); + +EndProcedure + +Procedure Dropbox_GetObjectInformation(FunctionParameters) + +Path = "/New/pic.png"; +Token = FunctionParameters["Dropbox_Token"]; + +Result = OPI_Dropbox.GetObjectInformation(Token, Path, True); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "GetObjectInformation", "Dropbox"); + +Check_DropboxFile(Result, Path); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Dropbox_GetPreview(FunctionParameters) + +Token = FunctionParameters["Dropbox_Token"]; +Path = "/New/mydoc.docx"; + +Result = OPI_Dropbox.GetPreview(Token, Path); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "GetPreview", "Dropbox"); + +Check_BinaryData(Result, 190834); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Dropbox_UploadFile(FunctionParameters) + +Path = "/New/pic.png"; +Token = FunctionParameters["Dropbox_Token"]; +Image = FunctionParameters["Picture"]; + +ImagePath = GetTempFileName("png"); +CopyFile(Image, ImagePath); + +Result = OPI_Dropbox.UploadFile(Token, ImagePath, Path, True); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "UploadFile", "Dropbox"); + +Check_DropboxFile(Result, Path); +DeleteFiles(ImagePath); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Dropbox_UploadFileByURL(FunctionParameters) + +Path = "/New/url_doc.docx"; +Token = FunctionParameters["Dropbox_Token"]; +URL = FunctionParameters["Document"]; + +Result = OPI_Dropbox.UploadFileByURL(Token, URL, Path); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "UploadFileByURL", "Dropbox"); + +Check_DropboxWork(Result); + +Work = Result["async_job_id"]; + +FunctionParameters.Insert("Dropbox_Job", Work); +OPI_GetTestData.WriteParameter("Dropbox_Job", Work); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Dropbox_GetUploadStatusByURL(FunctionParameters) + +Token = FunctionParameters["Dropbox_Token"]; +WorkID = FunctionParameters["Dropbox_Job"]; +Status = "in_progress"; + +WHile Status = "in_progress" Do + +Result = OPI_Dropbox.GetUploadStatusByURL(Token, WorkID); +Status = Result[".tag"]; + +OPI_Tools.Pause(5); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetUploadStatusByURL", "Dropbox"); + +EndDo; + +// END + +Check_DropboxStatus(Result); + +Path = "/New/url_doc.docx"; +Result = OPI_Dropbox.DeleteObject(Token, Path); + +Check_DropboxMetadata(Result, Path); +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Dropbox_DeleteObject(FunctionParameters) + +Path = "/New/pic.png"; +Token = FunctionParameters["Dropbox_Token"]; + +Result = OPI_Dropbox.DeleteObject(Token, Path); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "DeleteObject", "Dropbox"); + +Check_DropboxMetadata(Result, Path); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Dropbox_CopyObject(FunctionParameters) + +Original = "/New/pic.png"; +Copy = "/New/pic_copy.png"; +Token = FunctionParameters["Dropbox_Token"]; + +Result = OPI_Dropbox.CopyObject(Token, Original, Copy); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "CopyObject", "Dropbox"); + +Check_DropboxMetadata(Result, Copy); + +Result = OPI_Dropbox.DeleteObject(Token, Copy); +Check_DropboxMetadata(Result, Copy); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Dropbox_MoveObject(FunctionParameters) + +OriginalPath = "/New/pic.png"; +TargetPath = "/pic.png"; +Token = FunctionParameters["Dropbox_Token"]; + +Result = OPI_Dropbox.MoveObject(Token, OriginalPath, TargetPath); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "Dropbox_MoveObject", "Dropbox"); + +Check_DropboxMetadata(Result, TargetPath); + +Result = OPI_Dropbox.MoveObject(Token, TargetPath, OriginalPath); +Check_DropboxMetadata(Result, OriginalPath); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Dropbox_CreateFolder(FunctionParameters) + +Token = FunctionParameters["Dropbox_Token"]; +Path = "/New toаталог"; + +Result = OPI_Dropbox.CreateFolder(Token, Path); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "CreateFolder", "Dropbox"); + +Check_DropboxMetadata(Result, Path); + +Result = OPI_Dropbox.DeleteObject(Token, Path); +Check_DropboxMetadata(Result, Path); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Dropbox_DownloadFile(FunctionParameters) + +Token = FunctionParameters["Dropbox_Token"]; +Path = "/New/pic.png"; + +Result = OPI_Dropbox.DownloadFile(Token, Path); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "DownloadFile", "Dropbox"); + +Check_BinaryData(Result, 2114023); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Dropbox_DownloadFolder(FunctionParameters) + +Token = FunctionParameters["Dropbox_Token"]; +Path = "/New"; + +Result = OPI_Dropbox.DownloadFolder(Token, Path); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "DownloadFolder", "Dropbox"); + +Check_BinaryData(Result); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Dropbox_GetFolderFileList(FunctionParameters) + +Path = "/New"; +Token = FunctionParameters["Dropbox_Token"]; + +Result = OPI_Dropbox.GetListOfFolderFiles(Token, Path, True); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "GetListOfFolderFiles", "Dropbox"); + +Check_DropboxArray(Result); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Dropbox_GetObjectVersionList(FunctionParameters) + +Token = FunctionParameters["Dropbox_Token"]; +Path = "/New/pic.png"; + +Result = OPI_Dropbox.GetObjectVersionList(Token, Path, 1); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "GetObjectVersionList", "Dropbox"); + +Check_DropboxArray(Result, 1); + +Revision = Result["entries"][0]["rev"]; + +FunctionParameters.Insert("Dropbox_FileRevision", Revision); +OPI_GetTestData.WriteParameter("Dropbox_FileRevision", Revision); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Dropbox_RestoreObjectToVersion(FunctionParameters) + +Version = FunctionParameters["Dropbox_FileRevision"]; +Token = FunctionParameters["Dropbox_Token"]; +Path = "/New/pic.png"; + +Result = OPI_Dropbox.RestoreObjectToVersion(Token, Path, Version); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "RestoreObjectToVersion", "Dropbox"); + +Check_DropboxFile(Result, Path); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Dropbox_GetTagList(FunctionParameters) + +Token = FunctionParameters["Dropbox_Token"]; + +PathsArray = New Array; +PathsArray.Add("/New/Dogs.mp3"); +PathsArray.Add("/New/mydoc.docx"); + +Result = OPI_Dropbox.GetTagList(Token, PathsArray); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "GetTagList", "Dropbox"); + +Check_DropboxTags(Result, PathsArray.Quantity()); + +Result = OPI_Dropbox.GetTagList(Token, "/New/mydoc.docx"); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetTagList (оdиночный)"); + +Check_DropboxTags(Result, 1); + +HasTag = False; + +For Each Tag In Result["paths_to_tags"][0]["tags"] Do +If Tag["tag_text"] = "important" Then +HasTag = True; +EndIf; +EndDo; + +OPI_GetTestData.ExpectsThat(HasTag).Equal(True); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Dropbox_AddTag(FunctionParameters) + +Tag = "Important"; +Token = FunctionParameters["Dropbox_Token"]; +Path = "/New/mydoc.docx"; + +Result = OPI_Dropbox.AddTag(Token, Path, Tag); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "AddTag", "Dropbox"); + +Check_Empty(Result); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Dropbox_DeleteTag(FunctionParameters) + +Tag = "Important"; +Token = FunctionParameters["Dropbox_Token"]; +Path = "/New/mydoc.docx"; + +Result = OPI_Dropbox.DeleteTag(Token, Path, Tag); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "DeleteTag", "Dropbox"); + +Check_Empty(Result); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Dropbox_GetAccountInformation(FunctionParameters) + +Token = FunctionParameters["Dropbox_Token"]; + +Result = OPI_Dropbox.GetAccountInformation(Token); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "GetAccountInformation", "Dropbox"); + +Check_DropboxAccount(Result); + +Result = OPI_Dropbox.GetAccountInformation(Token, Result["account_id"]); + +// !OInt OPI_GetTestData.WriteLog(Result, "GetAccountInformation (withторонний)"); + +Check_DropboxAccount(Result); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Dropbox_GetSpaceUsageData(FunctionParameters) + +Token = FunctionParameters["Dropbox_Token"]; + +Result = OPI_Dropbox.GetSpaceUsageData(Token); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "GetSpaceUsageData", "Dropbox"); + +Check_DropboxSpace(Result); + +EndProcedure + +Procedure Dropbox_AddUsersToFile(FunctionParameters) + +Token = FunctionParameters["Dropbox_Token"]; +Email = FunctionParameters["Dropbox_OtherUser"]; +File = FunctionParameters["Dropbox_FileID"]; + +Result = OPI_Dropbox.AddUsersToFile(Token, File, Email, False); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "AddUserToFile", "Dropbox"); + +Check_DropboxMember(Result, Email, False); + +Mails = New Array; +Mails.Add(Email); + +Result = OPI_Dropbox.AddUsersToFile(Token, File, Mails, True); + +Check_DropboxMember(Result, Email, True); + +EndProcedure + +Procedure Dropbox_PublishFolder(FunctionParameters) + +Token = FunctionParameters["Dropbox_Token"]; +Path = "/New"; + +Result = OPI_Dropbox.PublishFolder(Token, Path); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "PublishFolder", "Dropbox"); + +Check_DropboxPublicFolder(Result); + +FolderID = Result["shared_folder_id"]; + +FunctionParameters.Insert("Dropbox_SharedFolder", FolderID); +OPI_GetTestData.WriteParameter("Dropbox_SharedFolder", FolderID); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Dropbox_CancelFolderPublication(FunctionParameters) + +Token = FunctionParameters["Dropbox_Token"]; +Folder = FunctionParameters["Dropbox_SharedFolder"]; + +Result = OPI_Dropbox.CancelFolderPublication(Token, Folder); +CurrentStatus = "in_progress"; +JobID = Result["async_job_id"]; + +WHile CurrentStatus = "in_progress" Do +Result = OPI_Dropbox.GetAsynchronousChangeStatus(Token, JobID); +CurrentStatus = Result[".tag"]; +OPI_Tools.Pause(3); +EndDo; + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "CancelFolderPublication", "Dropbox"); + +Check_DropboxStatus(Result); + +OPI_Tools.Pause(5); + +EndProcedure + +Procedure Dropbox_AddUsersToFolder(FunctionParameters) + +Token = FunctionParameters["Dropbox_Token"]; +Email = FunctionParameters["Dropbox_OtherUser"]; +Folder = FunctionParameters["Dropbox_SharedFolder"]; // shared_folder_id + +Result = OPI_Dropbox.AddUsersToFolder(Token, Folder, Email, False); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "AddUserToFile", "Dropbox"); + +Check_Empty(Result); + +Mails = New Array; +Mails.Add(Email); + +Result = OPI_Dropbox.AddUsersToFolder(Token, Folder, Mails, True); + +Check_Empty(Result); + +EndProcedure + +Procedure Dropbox_CancelFilePublication(FunctionParameters) + +Token = FunctionParameters["Dropbox_Token"]; +File = FunctionParameters["Dropbox_FileID"]; + +Result = OPI_Dropbox.CancelFilePublication(Token, File); + +// END + +// !OInt OPI_GetTestData.WriteLog(Result, "CancelFilePublication", "Dropbox"); + +Check_Empty(Result); + +EndProcedure + +#EndRegion + +#EndRegion + +#EndRegion diff --git a/src/en/OPI/src/CommonModules/OPI_Tests/OPI_Tests.mdo b/src/en/OPI/src/CommonModules/OPI_Tests/OPI_Tests.mdo new file mode 100644 index 0000000000..d05c3b53e2 --- /dev/null +++ b/src/en/OPI/src/CommonModules/OPI_Tests/OPI_Tests.mdo @@ -0,0 +1,15 @@ + + +OPI_Tests + + +OPI tests + + +ru +Tests for YaxUnit (OPI) + +true +true +true + diff --git a/src/en/OPI/src/CommonModules/OPI_Tools/Module.bsl b/src/en/OPI/src/CommonModules/OPI_Tools/Module.bsl index 46d68c012c..6dffa2f14d 100644 --- a/src/en/OPI/src/CommonModules/OPI_Tools/Module.bsl +++ b/src/en/OPI/src/CommonModules/OPI_Tools/Module.bsl @@ -41,11 +41,11 @@ #Region RequestsWithoutBody Function Get(Val URL, Val Parameters = "", Val AdditionalHeaders = "", Val ResponseFile = Undefined) Export - Return ExecuteRequestWithoutBody(URL, "GET", Parameters, AdditionalHeaders, ResponseFile); +Return ExecuteRequestWithoutBody(URL, "GET", Parameters, AdditionalHeaders, ResponseFile); EndFunction Function Delete(Val URL, Val Parameters = "", Val AdditionalHeaders = "", Val ResponseFile = Undefined) Export - Return ExecuteRequestWithoutBody(URL, "DELETE", Parameters, AdditionalHeaders, ResponseFile); +Return ExecuteRequestWithoutBody(URL, "DELETE", Parameters, AdditionalHeaders, ResponseFile); EndFunction #EndRegion @@ -53,169 +53,169 @@ EndFunction #Region RequestsWithBody Function Post(Val URL - , Val Parameters = "" - , Val AdditionalHeaders = "" - , Val JSON = True - , Val FullResponse = False - , Val ResponseFile = Undefined) Export - - Return ExecuteRequestWithBody(URL, "POST", Parameters, AdditionalHeaders, JSON, FullResponse, ResponseFile); - +, Val Parameters = "" +, Val AdditionalHeaders = "" +, Val JSON = True +, Val FullResponse = False +, Val ResponseFile = Undefined) Export + +Return ExecuteRequestWithBody(URL, "POST", Parameters, AdditionalHeaders, JSON, FullResponse, ResponseFile); + EndFunction Function Patch(Val URL - , Val Parameters = "" - , Val AdditionalHeaders = "" - , Val JSON = True - , Val FullResponse = False - , Val ResponseFile = Undefined) Export - - Return ExecuteRequestWithBody(URL, "PATCH", Parameters, AdditionalHeaders, JSON, FullResponse, ResponseFile); - +, Val Parameters = "" +, Val AdditionalHeaders = "" +, Val JSON = True +, Val FullResponse = False +, Val ResponseFile = Undefined) Export + +Return ExecuteRequestWithBody(URL, "PATCH", Parameters, AdditionalHeaders, JSON, FullResponse, ResponseFile); + EndFunction Function Put(Val URL - , Val Parameters = "" - , Val AdditionalHeaders = "" - , Val JSON = True - , Val FullResponse = False - , Val ResponseFile = Undefined) Export - - Return ExecuteRequestWithBody(URL, "PUT", Parameters, AdditionalHeaders, JSON, FullResponse, ResponseFile); - +, Val Parameters = "" +, Val AdditionalHeaders = "" +, Val JSON = True +, Val FullResponse = False +, Val ResponseFile = Undefined) Export + +Return ExecuteRequestWithBody(URL, "PUT", Parameters, AdditionalHeaders, JSON, FullResponse, ResponseFile); + EndFunction Function PostBinary(Val URL - , Val Body - , Val AdditionalHeaders - , Val FullResponse = False - , Val DataType = "application/octet-stream") Export - - Return ExecuteRequestWithBinaryData(URL, "POST", Body, AdditionalHeaders, FullResponse, DataType); - +, Val Body +, Val AdditionalHeaders +, Val FullResponse = False +, Val DataType = "application/octet-stream") Export + +Return ExecuteRequestWithBinaryData(URL, "POST", Body, AdditionalHeaders, FullResponse, DataType); + EndFunction -#EndRegion +#EndRegion #Region MultipartRequests Function PostMultipart(Val URL - , Val Parameters = "" - , Val Files = "" - , Val ContentType = "image/jpeg" - , Val AdditionalHeaders = "" - , Val ResponseFile = Undefined) Export +, Val Parameters = "" +, Val Files = "" +, Val ContentType = "image/jpeg" +, Val AdditionalHeaders = "" +, Val ResponseFile = Undefined) Export - Return ExecuteMultipartRequest(URL, "POST", Parameters, Files, ContentType, AdditionalHeaders, ResponseFile); +Return ExecuteMultipartRequest(URL, "POST", Parameters, Files, ContentType, AdditionalHeaders, ResponseFile); EndFunction Function PutMultipart(Val URL - , Val Parameters = "" - , Val Files = "" - , Val ContentType = "image/jpeg" - , Val AdditionalHeaders = "" - , Val ResponseFile = Undefined) Export +, Val Parameters = "" +, Val Files = "" +, Val ContentType = "image/jpeg" +, Val AdditionalHeaders = "" +, Val ResponseFile = Undefined) Export - Return ExecuteMultipartRequest(URL, "PUT", Parameters, Files, ContentType, AdditionalHeaders, ResponseFile); +Return ExecuteMultipartRequest(URL, "PUT", Parameters, Files, ContentType, AdditionalHeaders, ResponseFile); EndFunction Function PostMultipartRelated(Val URL - , Val JSON = "" - , Val Files = "" - , Val AdditionalHeaders = "" - , Val ResponseFile = Undefined) Export - - Return ExecuteMultipartRelatedRequest(URL, "POST", JSON, Files, AdditionalHeaders, ResponseFile); - +, Val JSON = "" +, Val Files = "" +, Val AdditionalHeaders = "" +, Val ResponseFile = Undefined) Export + +Return ExecuteMultipartRelatedRequest(URL, "POST", JSON, Files, AdditionalHeaders, ResponseFile); + EndFunction Function PatchMultipartRelated(Val URL - , Val JSON = "" - , Val Files = "" - , Val AdditionalHeaders = "" - , Val ResponseFile = Undefined) Export - - Return ExecuteMultipartRelatedRequest(URL, "PATCH", JSON, Files, AdditionalHeaders, ResponseFile); - +, Val JSON = "" +, Val Files = "" +, Val AdditionalHeaders = "" +, Val ResponseFile = Undefined) Export + +Return ExecuteMultipartRelatedRequest(URL, "PATCH", JSON, Files, AdditionalHeaders, ResponseFile); + EndFunction #EndRegion #Region Miscellaneous -Procedure ProcessResponse(Response, Val FullResponse = False) Export - - If FullResponse Or TypeValue(Response) <> Type("HTTPResponse") Then - Return; - EndIf; - - BodyFile = Response.GetBodyFileName(); - - If Not BodyFile = Undefined Then - Response = BodyFile; - Return; - EndIf; - - GZip = "gzip"; - NeedsUnpacking = - Response.Headers.Get("Content-Encoding") = GZip - Or Response.Headers.Get("content-encoding") = GZip; - - If NeedsUnpacking Then - Response = UnpackResponse(Response); - EndIf; - - Response = ?(TypeValue(Response) = Type("HTTPResponse"), Response.GetBodyAsBinaryData(), Response); - - If TypeValue(Response) = Type("BinaryData") Then - - Attempt - Response = JsonToStructure(Response); - Exception - Return; - EndOfAttempt; - - EndIf; - +Procedure ProcessResponse(Response, Val FullResponse = False) Export + +If FullResponse Or TypeValue(Response) <> Type("HTTPResponse") Then +Return; +EndIf; + +BodyFile = Response.GetBodyFileName(); + +If Not BodyFile = Undefined Then +Response = BodyFile; +Return; +EndIf; + +GZip = "gzip"; +NeedsUnpacking = +Response.Headers.Get("Content-Encoding") = GZip +Or Response.Headers.Get("content-encoding") = GZip; + +If NeedsUnpacking Then +Response = UnpackResponse(Response); +EndIf; + +Response = ?(TypeValue(Response) = Type("HTTPResponse"), Response.GetBodyAsBinaryData(), Response); + +If TypeValue(Response) = Type("BinaryData") Then + +Try +Response = JsonToStructure(Response); +Except +Return; +EndTry; + +EndIf; + EndProcedure Function CreateRequest(Val Address, Val AdditionalHeaders = "", Val DataType = "") Export - - Headers = New Match; - Headers.Insert("Accept-Encoding", "gzip"); - Headers.Insert("Accept" , "*/*"); - Headers.Insert("Connection" , "keep-alive"); - Headers.Insert("Accept-Charset" , "utf-8"); - - If ValueFilled(DataType) Then - Headers.Insert("Content-Type", DataType); - EndIf; - - If TypeValue(AdditionalHeaders) = Type("Match") Then - - For Each Title Of AdditionalHeaders Loop - Headers.Insert(Title.Key, Title.Value); - EndOfLoop; - - EndIf; - - NewRequest = New HTTPRequest(Address, Headers); - - Return NewRequest; - + +Headers = New Match; +Headers.Insert("Accept-Encoding", "gzip"); +Headers.Insert("Accept" , "*/*"); +Headers.Insert("Connection" , "keep-alive"); +Headers.Insert("Accept-Charset" , "utf-8"); + +If ValueIsFilled(DataType) Then +Headers.Insert("Content-Type", DataType); +EndIf; + +If TypeValue(AdditionalHeaders) = Type("Match") Then + +For Each Title In AdditionalHeaders Do +Headers.Insert(Title.Key, Title.Value); +EndDo; + +EndIf; + +NewRequest = New HTTPRequest(Address, Headers); + +Return NewRequest; + EndFunction Function CreateConnection(Val Server, Val User = "", Val Password = "") Export - - Attempt - SSL = New SecureConnectionOpenSSL; - Return New HTTPConnection(Server, 443, User, Password, , 3000, SSL); - Exception - Return New HTTPConnection(Server, 443, User, Password, , 3000); - EndOfAttempt; - + +Try +SSL = New SecureConnectionOpenSSL; +Return New HTTPConnection(Server, 443, User, Password, , 3000, SSL); +Except +Return New HTTPConnection(Server, 443, User, Password, , 3000); +EndTry; + EndFunction #EndRegion @@ -226,306 +226,306 @@ EndFunction Function RequestParametersToString(Val Parameters) Export - If Parameters.Quantity() = 0 Then - Return ""; - EndIf; +If Parameters.Quantity() = 0 Then +Return ""; +EndIf; - ParameterString = "?"; +ParameterString = "?"; - For Each Parameter Of Parameters Loop - - ParameterValue = ConvertParameterToString(Parameter.Value); - - ParameterString = ParameterString - + Parameter.Key - + "=" - + ParameterValue - + "&"; - EndOfLoop; +For Each Parameter In Parameters Do - ParameterString = Left(ParameterString, StrLength(ParameterString) - 1); +ParameterValue = ConvertParameterToString(Parameter.Value); - Return ParameterString; +ParameterString = ParameterString ++ Parameter.Key ++ "=" ++ ParameterValue ++ "&"; +EndDo; + +ParameterString = Left(ParameterString, StrLength(ParameterString) - 1); + +Return ParameterString; EndFunction Function SplitURL(Val URL) Export - URL = StringReplace(URL, "https://", ""); - URL = StringReplace(URL, "http://", ""); - URL = StringReplace(URL, ":443", ""); +URL = StringReplace(URL, "https://", ""); +URL = StringReplace(URL, "http://", ""); +URL = StringReplace(URL, ":443", ""); - Address = Right(URL, StrLength(URL) - StrFind(URL, "/", SearchDirection.FromStart) + 1); - Server = Left(URL, StrFind(URL, "/", SearchDirection.FromStart) - 1); - - Attempt - SSL = New SecureConnectionOpenSSL; - Exception - Server = "https://" + Server; - EndOfAttempt; - - ReturnStructure = New Structure; - ReturnStructure.Insert("Server", Server); - ReturnStructure.Insert("Address" , Address); +Address = Right(URL, StrLength(URL) - StrFind(URL, "/", SearchDirection.FromStart) + 1); +Server = Left(URL, StrFind(URL, "/", SearchDirection.FromStart) - 1); - Return ReturnStructure; +Try +SSL = New SecureConnectionOpenSSL; +Except +Server = "https://" + Server; +EndTry; + +ReturnStructure = New Structure; +ReturnStructure.Insert("Server", Server); +ReturnStructure.Insert("Address" , Address); + +Return ReturnStructure; EndFunction Function JsonToStructure(Val Text) Export - If Not ValueFilled(Text) Then - Return ""; - EndIf; - - Text = ?(TypeValue(Text) = Type("BinaryData"), GetStringFromBinaryData(Text), Text); +If Not ValueIsFilled(Text) Then +Return ""; +EndIf; - ReadingJSON = New ReadingJSON; - ReadingJSON.SetString(Text); +Text = ?(TypeValue(Text) = Type("BinaryData"), GetStringFromBinaryData(Text), Text); - Data = ReadJSON(ReadingJSON, True, Undefined, JSONDateFormat.ISO); - ReadingJSON.Close(); +ReadingJSON = New ReadingJSON; +ReadingJSON.SetString(Text); - Return Data; +Data = ReadJSON(ReadingJSON, True, Undefined, JSONDateFormat.ISO); +ReadingJSON.Close(); + +Return Data; EndFunction Function JSONString(Val Data, Val Escaping = "No") Export - JSONParameters = New JSONWriteParameters(JSONLineBreak.Windows - , " " - , True - , EscapeJSONCharacters[Escaping] - , False - , False - , False - , False); +JSONParameters = New JSONWriteParameters(JSONLineBreak.Windows +, " " +, True +, EscapeJSONCharacters[Escaping] +, False +, False +, False +, False); - Attempt - - WritingJSON = New WritingJSON; - WritingJSON.SetString(JSONParameters); - - WriteJSON(WritingJSON, Data); - Return WritingJSON.Close(); - - Exception - Return "NOT JSON: " + String(Data); - EndOfAttempt; +Try + +WritingJSON = New WritingJSON; +WritingJSON.SetString(JSONParameters); + +WriteJSON(WritingJSON, Data); +Return WritingJSON.Close(); + +Except +Return "NOT JSON: " + String(Data); +EndTry; EndFunction Function NumberToString(Val Number) Export - Return StringReplace(String(Number), Symbols.NPP, ""); +Return StringReplace(String(Number), Symbols.NPP, ""); EndFunction Function ReadJSONFile(Val Path) Export - - ReadingJSON = New ReadingJSON; - ReadingJSON.OpenFile(Path); - Values = ReadJSON(ReadingJSON); - - ReadingJSON.Close(); - - Return Values; - + +ReadingJSON = New ReadingJSON; +ReadingJSON.OpenFile(Path); +Values = ReadJSON(ReadingJSON); + +ReadingJSON.Close(); + +Return Values; + EndFunction Function RequestParametersToMatch(Val ParameterString) Export - ReturnMapping = New Match; - NumberOfParts = 2; - ParameterArray = StrSplit(ParameterString, "&", False); +ReturnMapping = New Match; +NumberOfParts = 2; +ParameterArray = StrSplit(ParameterString, "&", False); - For Each Parameter Of ParameterArray Loop +For Each Parameter In ParameterArray Do - KeyValueArray = StrSplit(Parameter, "="); +KeyValueArray = StrSplit(Parameter, "="); - If KeyValueArray.Quantity() = NumberOfParts Then - ReturnMapping.Insert(KeyValueArray[0], KeyValueArray[1]); - EndIf; +If KeyValueArray.Quantity() = NumberOfParts Then +ReturnMapping.Insert(KeyValueArray[0], KeyValueArray[1]); +EndIf; - EndOfLoop; +EndDo; - Return ReturnMapping; +Return ReturnMapping; EndFunction Function GetCurrentDate() Export - Return LocalTime(CurrentUniversalDate()); +Return LocalTime(CurrentUniversalDate()); EndFunction Function UNIXTime(Val Date) Export - - OTD = New TypeDescription("Date"); - Date = OTD.ConvertValue(Date); - - UNIX = Format(Date - Date(1970, 1, 1, 1, 0, 0), "HC=10; HDC=0; HG=0"); - UNIX = StringReplace(UNIX, ",", ""); - UNIX = Left(UNIX, 10); - - Return UNIX; - + +OTD = New TypeDescription("Date"); +Date = OTD.ConvertValue(Date); + +UNIX = Format(Date - Date(1970, 1, 1, 1, 0, 0), "HC=10; HDC=0; HG=0"); +UNIX = StringReplace(UNIX, ",", ""); +UNIX = Left(UNIX, 10); + +Return UNIX; + EndFunction Function ProgressInformation(Val Current, Val Total, Val Unit, Val Divider = 1) Export - - Whole = 100; - Current = Round(Current / Divider, 2); - Total = Round(Total / Divider, 2); - Percent = Goal(Current / Total * Whole); - - StrCurrent = NumberToString(Current); - StrTotal = NumberToString(Total); - StrPercentage = NumberToString(Percent); - - Information = StrCurrent + "/" + StrTotal + " " + Unit + " ( " + StrPercentage + "% )"; - - Return Information; - + +Whole = 100; +Current = Round(Current / Divider, 2); +Total = Round(Total / Divider, 2); +Percent = Goal(Current / Total * Whole); + +StrCurrent = NumberToString(Current); +StrTotal = NumberToString(Total); +StrPercentage = NumberToString(Percent); + +Information = StrCurrent + "/" + StrTotal + " " + Unit + " ( " + StrPercentage + "% )"; + +Return Information; + EndFunction Function ConvertDataWithSizeRetrieval(Data, Val MinimumStreamSize = 0) Export - - Size = 0; - - If TypeValue(Data) = Type("String") Then - - FileOnDisk = New File(Data); - - If FileOnDisk.Exists() Then - Size = FileOnDisk.Size(); - Otherwise - OPI_TypeConversion.GetBinaryData(Data); - Size = Data.Size(); - EndIf; - - Otherwise - OPI_TypeConversion.GetBinaryData(Data); - Size = Data.Size(); - EndIf; - - If ValueFilled(MinimumStreamSize) Then - If Size < MinimumStreamSize Then - OPI_TypeConversion.GetBinaryData(Data); - Otherwise - OPI_TypeConversion.GetBinaryOrStream(Data); - EndIf; - Otherwise - OPI_TypeConversion.GetBinaryOrStream(Data); - EndIf; - - Return Size; - + +Size = 0; + +If TypeValue(Data) = Type("String") Then + +FileOnDisk = New File(Data); + +If FileOnDisk.Exists() Then +Size = FileOnDisk.Size(); +Else +OPI_TypeConversion.GetBinaryData(Data); +Size = Data.Size(); +EndIf; + +Else +OPI_TypeConversion.GetBinaryData(Data); +Size = Data.Size(); +EndIf; + +If ValueIsFilled(MinimumStreamSize) Then +If Size < MinimumStreamSize Then +OPI_TypeConversion.GetBinaryData(Data); +Else +OPI_TypeConversion.GetBinaryOrStream(Data); +EndIf; +Else +OPI_TypeConversion.GetBinaryOrStream(Data); +EndIf; + +Return Size; + EndFunction Procedure ValueToArray(Value) Export - - Value_ = New Array; - Value_.Add(Value); - Value = Value_; + +Value_ = New Array; +Value_.Add(Value); +Value = Value_; EndProcedure Procedure ReplaceSpecialCharacters(Text, Markup = "Markdown") Export - - CharacterMapping = New Match; - - If Markup = "HTML" Then - - CharacterMapping.Insert("&", "&"); - - ElseIf Markup = "MarkdownV2" Then - - CharacterMapping.Insert("-", "\-"); - CharacterMapping.Insert("+", "\+"); - CharacterMapping.Insert("#", "\#"); - CharacterMapping.Insert("=", "\="); - CharacterMapping.Insert("{", "\{"); - CharacterMapping.Insert("}", "\}"); - CharacterMapping.Insert(".", "\."); - - Otherwise - Return; - EndIf; - For Each ArraySymbol Of CharacterMapping Loop - Text = StringReplace(Text, ArraySymbol.Key, ArraySymbol.Value); - EndOfLoop; +CharacterMapping = New Match; + +If Markup = "HTML" Then + +CharacterMapping.Insert("&", "&"); + +ElsIf Markup = "MarkdownV2" Then + +CharacterMapping.Insert("-", "\-"); +CharacterMapping.Insert("+", "\+"); +CharacterMapping.Insert("#", "\#"); +CharacterMapping.Insert("=", "\="); +CharacterMapping.Insert("{", "\{"); +CharacterMapping.Insert("}", "\}"); +CharacterMapping.Insert(".", "\."); + +Else +Return; +EndIf; + +For Each ArraySymbol In CharacterMapping Do +Text = StringReplace(Text, ArraySymbol.Key, ArraySymbol.Value); +EndDo; EndProcedure Procedure RemoveEmptyCollectionFields(Collection) Export - - CollectionType = TypeValue(Collection); - OutputCollection = New(CollectionType); - - If CollectionType = Type("Match") Or CollectionType = Type("Structure") Then - - RemoveEmptyKeyValues(Collection, OutputCollection); - - ElseIf CollectionType = Type("Array") Then - - RemoveEmptyArrayElements(Collection, OutputCollection); - - Otherwise - - OutputCollection = Collection; - - EndIf; - - Collection = OutputCollection; - + +CollectionType = TypeValue(Collection); +OutputCollection = New(CollectionType); + +If CollectionType = Type("Match") Or CollectionType = Type("Structure") Then + +RemoveEmptyKeyValues(Collection, OutputCollection); + +ElsIf CollectionType = Type("Array") Then + +RemoveEmptyArrayElements(Collection, OutputCollection); + +Else + +OutputCollection = Collection; + +EndIf; + +Collection = OutputCollection; + EndProcedure Procedure Pause(Val Seconds) Export - - Connection = New HTTPConnection("1C.ru", 11111, , , , Seconds); - Attempt - Connection.Get(New HTTPRequest("")); - Exception - Return; - EndOfAttempt; - + +Connection = New HTTPConnection("1C.ru", 11111, , , , Seconds); +Try +Connection.Get(New HTTPRequest("")); +Except +Return; +EndTry; + EndProcedure Procedure AddField(Val Name, Val Value, Val Type, Collection) Export - - Filled = ValueFilled(Value); - - If Not Filled Then - Return; - EndIf; - - If Type = "Date" Then - OPI_TypeConversion.GetDate(Value); - Value = UNIXTime(Value); - - ElseIf Type = "Collection" Then - OPI_TypeConversion.GetCollection(Value); - - ElseIf Type = "Boolean" Then - OPI_TypeConversion.GetBoolean(Value); - - ElseIf Type = "FileString" Then - OPI_TypeConversion.GetLine(Value, True); - - ElseIf Type = "Array" Then - OPI_TypeConversion.GetArray(Value); - - ElseIf Type = "BinaryData" Then - OPI_TypeConversion.GetBinaryData(Value); - - ElseIf Type = "Number" Then - OPI_TypeConversion.GetNumber(Value); - - Otherwise - OPI_TypeConversion.GetLine(Value); - - EndIf; - - Collection.Insert(Name, Value); - + +Filled = ValueIsFilled(Value); + +If Not Filled Then +Return; +EndIf; + +If Type = "Date" Then +OPI_TypeConversion.GetDate(Value); +Value = UNIXTime(Value); + +ElsIf Type = "Collection" Then +OPI_TypeConversion.GetCollection(Value); + +ElsIf Type = "Boolean" Then +OPI_TypeConversion.GetBoolean(Value); + +ElsIf Type = "FileString" Then +OPI_TypeConversion.GetLine(Value, True); + +ElsIf Type = "Array" Then +OPI_TypeConversion.GetArray(Value); + +ElsIf Type = "BinaryData" Then +OPI_TypeConversion.GetBinaryData(Value); + +ElsIf Type = "Number" Then +OPI_TypeConversion.GetNumber(Value); + +Else +OPI_TypeConversion.GetLine(Value); + +EndIf; + +Collection.Insert(Name, Value); + EndProcedure #EndRegion @@ -535,516 +535,516 @@ EndProcedure #Region ServiceProceduresAndFunctions Function ExecuteRequestWithBody(Val URL - , Val View - , Val Parameters = "" - , Val AdditionalHeaders = "" - , Val JSON = True - , Val FullResponse = False - , Val ResponseFile = Undefined) - - If Not ValueFilled(Parameters) Then - Parameters = New Structure; - EndIf; - - DataType = ?(JSON, "application/json; charset=utf-8", "application/x-www-form-urlencoded; charset=utf-8"); - URLStructure = SplitURL(URL); - Server = URLStructure["Server"]; - Address = URLStructure["Address"]; - - Request = CreateRequest(Address, AdditionalHeaders, DataType); - Connection = CreateConnection(Server); - - SetRequestBody(Request, Parameters, JSON); +, Val View +, Val Parameters = "" +, Val AdditionalHeaders = "" +, Val JSON = True +, Val FullResponse = False +, Val ResponseFile = Undefined) - If ValueFilled(ResponseFile) Then - Response = Connection.CallHTTPMethod(View, Request, ResponseFile); - Otherwise - Response = Connection.CallHTTPMethod(View, Request); - EndIf; - - If ThisIsRedirection(Response) Then - Response = ExecuteRequestWithBody(Response.Headers["Location"] - , View - , Parameters - , AdditionalHeaders - , JSON - , FullResponse - , ResponseFile); - Otherwise - ProcessResponse(Response, FullResponse); - EndIf; +If Not ValueIsFilled(Parameters) Then +Parameters = New Structure; +EndIf; - Return Response; +DataType = ?(JSON, "application/json; charset=utf-8", "application/x-www-form-urlencoded; charset=utf-8"); +URLStructure = SplitURL(URL); +Server = URLStructure["Server"]; +Address = URLStructure["Address"]; + +Request = CreateRequest(Address, AdditionalHeaders, DataType); +Connection = CreateConnection(Server); + +SetRequestBody(Request, Parameters, JSON); + +If ValueIsFilled(ResponseFile) Then +Response = Connection.CallHTTPMethod(View, Request, ResponseFile); +Else +Response = Connection.CallHTTPMethod(View, Request); +EndIf; + +If ThisIsRedirection(Response) Then +Response = ExecuteRequestWithBody(Response.Headers["Location"] +, View +, Parameters +, AdditionalHeaders +, JSON +, FullResponse +, ResponseFile); +Else +ProcessResponse(Response, FullResponse); +EndIf; + +Return Response; EndFunction Function ExecuteRequestWithBinaryData(Val URL - , Val View - , Val Data - , Val AdditionalHeaders - , Val FullResponse - , Val DataType) - - URLStructure = SplitURL(URL); - Server = URLStructure["Server"]; - Address = URLStructure["Address"]; - - Request = CreateRequest(Address, AdditionalHeaders, DataType); - Connection = CreateConnection(Server); - - Request.SetBodyFromBinaryData(Data); - - Response = Connection.CallHTTPMethod(View, Request); +, Val View +, Val Data +, Val AdditionalHeaders +, Val FullResponse +, Val DataType) - If ThisIsRedirection(Response) Then - Response = ExecuteRequestWithBinaryData(Response.Headers["Location"] - , View - , Data - , AdditionalHeaders - , FullResponse - , DataType); - Otherwise - ProcessResponse(Response, FullResponse); - EndIf; +URLStructure = SplitURL(URL); +Server = URLStructure["Server"]; +Address = URLStructure["Address"]; - Return Response; +Request = CreateRequest(Address, AdditionalHeaders, DataType); +Connection = CreateConnection(Server); + +Request.SetBodyFromBinaryData(Data); + +Response = Connection.CallHTTPMethod(View, Request); + +If ThisIsRedirection(Response) Then +Response = ExecuteRequestWithBinaryData(Response.Headers["Location"] +, View +, Data +, AdditionalHeaders +, FullResponse +, DataType); +Else +ProcessResponse(Response, FullResponse); +EndIf; + +Return Response; EndFunction Function ExecuteRequestWithoutBody(Val URL - , Val View - , Val Parameters = "" - , Val AdditionalHeaders = "" - , Val ResponseFile = Undefined) - - If Not ValueFilled(Parameters) Then - Parameters = New Structure; - EndIf; +, Val View +, Val Parameters = "" +, Val AdditionalHeaders = "" +, Val ResponseFile = Undefined) - URLStructure = SplitURL(URL); - Server = URLStructure["Server"]; - Address = URLStructure["Address"] + RequestParametersToString(Parameters); - - Request = CreateRequest(Address, AdditionalHeaders); - Connection = CreateConnection(Server); - - If ValueFilled(ResponseFile) Then - Response = Connection.CallHTTPMethod(View, Request, ResponseFile); - Otherwise - Response = Connection.CallHTTPMethod(View, Request); - EndIf; - - If ThisIsRedirection(Response) Then - Response = ExecuteRequestWithoutBody(Response.Headers["Location"], View, Parameters, AdditionalHeaders, ResponseFile); - Otherwise - ProcessResponse(Response); - EndIf; +If Not ValueIsFilled(Parameters) Then +Parameters = New Structure; +EndIf; + +URLStructure = SplitURL(URL); +Server = URLStructure["Server"]; +Address = URLStructure["Address"] + RequestParametersToString(Parameters); + +Request = CreateRequest(Address, AdditionalHeaders); +Connection = CreateConnection(Server); + +If ValueIsFilled(ResponseFile) Then +Response = Connection.CallHTTPMethod(View, Request, ResponseFile); +Else +Response = Connection.CallHTTPMethod(View, Request); +EndIf; + +If ThisIsRedirection(Response) Then +Response = ExecuteRequestWithoutBody(Response.Headers["Location"], View, Parameters, AdditionalHeaders, ResponseFile); +Else +ProcessResponse(Response); +EndIf; + +Return Response; - Return Response; - EndFunction Function ExecuteMultipartRequest(Val URL - , Val View - , Val Parameters = "" - , Val Files = "" - , Val ContentType = "image/jpeg" - , Val AdditionalHeaders = "" - , Val ResponseFile = Undefined) - - If Not ValueFilled(Parameters) Then - Parameters = New Structure; - EndIf; +, Val View +, Val Parameters = "" +, Val Files = "" +, Val ContentType = "image/jpeg" +, Val AdditionalHeaders = "" +, Val ResponseFile = Undefined) - If Not ValueFilled(Files) Then - Files = New Match; - EndIf; +If Not ValueIsFilled(Parameters) Then +Parameters = New Structure; +EndIf; - Redirection = 300; - Error = 400; - Boundary = StringReplace(String(New UniqueIdentifier), "-", ""); - LineSeparator = Symbols.VK + Symbols.PS; - DataType = "multipart/form-data; boundary=" + Boundary; - URLStructure = SplitURL(URL); - Server = URLStructure["Server"]; - Address = URLStructure["Address"]; - - Request = CreateRequest(Address, AdditionalHeaders, DataType); - Connection = CreateConnection(Server); - - RequestBody = GetTempFileName(); - TextRecord = New DataRecording(RequestBody - , TextEncoding.UTF8 - , ByteOrder.LittleEndian - , "" - , False - , "" - , False); +If Not ValueIsFilled(Files) Then +Files = New Match; +EndIf; - WriteMultipartParameters(TextRecord, Boundary, Parameters); - WriteMultipartFiles(TextRecord, Boundary, ContentType, Files); - - TextRecord.WriteString("--" + boundary + "--" + LineSeparator); - TextRecord.Close(); +Redirection = 300; +Error = 400; +Boundary = StringReplace(String(New UniqueIdentifier), "-", ""); +LineSeparator = Symbols.VK + Symbols.PS; +DataType = "multipart/form-data; boundary=" + Boundary; +URLStructure = SplitURL(URL); +Server = URLStructure["Server"]; +Address = URLStructure["Address"]; + +Request = CreateRequest(Address, AdditionalHeaders, DataType); +Connection = CreateConnection(Server); + +RequestBody = GetTempFileName(); +TextRecord = New DataRecording(RequestBody +, TextEncoding.UTF8 +, ByteOrder.LittleEndian +, "" +, False +, "" +, False); + +WriteMultipartParameters(TextRecord, Boundary, Parameters); +WriteMultipartFiles(TextRecord, Boundary, ContentType, Files); + +TextRecord.WriteString("--" + boundary + "--" + LineSeparator); +TextRecord.Close(); + +Request.SetBodyFileName(RequestBody); + +If ValueIsFilled(ResponseFile) Then +Response = Connection.CallHTTPMethod(View, Request, ResponseFile); +Else +Response = Connection.CallHTTPMethod(View, Request); +EndIf; + +ThisIsRedirection = Response.StatusCode >= Redirection And Response.StatusCode < Error; + +If ThisIsRedirection Then +Response = ExecuteMultipartRequest(Response.Headers["Location"] +, View +, Parameters +, Files +, ContentType +, AdditionalHeaders +, ResponseFile); +Else +ProcessResponse(Response); +EndIf; + +Request = Undefined; +TextRecord = Undefined; + +DeleteFiles(RequestBody); +Return Response; - Request.SetBodyFileName(RequestBody); - - If ValueFilled(ResponseFile) Then - Response = Connection.CallHTTPMethod(View, Request, ResponseFile); - Otherwise - Response = Connection.CallHTTPMethod(View, Request); - EndIf; - - ThisIsRedirection = Response.StatusCode >= Redirection And Response.StatusCode < Error; - - If ThisIsRedirection Then - Response = ExecuteMultipartRequest(Response.Headers["Location"] - , View - , Parameters - , Files - , ContentType - , AdditionalHeaders - , ResponseFile); - Otherwise - ProcessResponse(Response); - EndIf; - - Request = Undefined; - TextRecord = Undefined; - - DeleteFiles(RequestBody); - Return Response; - EndFunction Function ExecuteMultipartRelatedRequest(Val URL - , Val View - , Val JSON = "" - , Val Files = "" - , Val AdditionalHeaders = "" - , Val ResponseFile = Undefined) - - Redirection = 300; - Error = 400; - Boundary = StringReplace(String(New UniqueIdentifier), "-", ""); - LineSeparator = Symbols.VK + Symbols.PS; - DataType = "multipart/related; boundary=" + Boundary; - URLStructure = SplitURL(URL); - Server = URLStructure["Server"]; - Address = URLStructure["Address"]; - - Request = CreateRequest(Address, AdditionalHeaders, DataType); - Connection = CreateConnection(Server); - - RequestBody = GetTempFileName(); - TextRecord = New DataRecording(RequestBody - , TextEncoding.UTF8 - , ByteOrder.LittleEndian - , "" - , False - , "" - , False); - - WriteJSONMultipart(TextRecord, Boundary, JSON); - WriteRelatedFiles(TextRecord, Boundary, Files); - - TextRecord.WriteString("--" + boundary + "--" + LineSeparator); - TextRecord.Close(); - - AddContentLength(Request); - - Request.SetBodyFileName(RequestBody); - - If ValueFilled(ResponseFile) Then - Response = Connection.CallHTTPMethod(View, Request, ResponseFile); - Otherwise - Response = Connection.CallHTTPMethod(View, Request); - EndIf; - - ThisIsRedirection = Response.StatusCode >= Redirection And Response.StatusCode < Error; - - If ThisIsRedirection Then - Response = ExecuteMultipartRelatedRequest(Response.Headers["Location"] - , View - , JSON - , Files - , AdditionalHeaders - , ResponseFile); - Otherwise - ProcessResponse(Response); - EndIf; - - Request = Undefined; - TextRecord = Undefined; +, Val View +, Val JSON = "" +, Val Files = "" +, Val AdditionalHeaders = "" +, Val ResponseFile = Undefined) - DeleteFiles(RequestBody); - Return Response; +Redirection = 300; +Error = 400; +Boundary = StringReplace(String(New UniqueIdentifier), "-", ""); +LineSeparator = Symbols.VK + Symbols.PS; +DataType = "multipart/related; boundary=" + Boundary; +URLStructure = SplitURL(URL); +Server = URLStructure["Server"]; +Address = URLStructure["Address"]; + +Request = CreateRequest(Address, AdditionalHeaders, DataType); +Connection = CreateConnection(Server); + +RequestBody = GetTempFileName(); +TextRecord = New DataRecording(RequestBody +, TextEncoding.UTF8 +, ByteOrder.LittleEndian +, "" +, False +, "" +, False); + +WriteJSONMultipart(TextRecord, Boundary, JSON); +WriteRelatedFiles(TextRecord, Boundary, Files); + +TextRecord.WriteString("--" + boundary + "--" + LineSeparator); +TextRecord.Close(); + +AddContentLength(Request); + +Request.SetBodyFileName(RequestBody); + +If ValueIsFilled(ResponseFile) Then +Response = Connection.CallHTTPMethod(View, Request, ResponseFile); +Else +Response = Connection.CallHTTPMethod(View, Request); +EndIf; + +ThisIsRedirection = Response.StatusCode >= Redirection And Response.StatusCode < Error; + +If ThisIsRedirection Then +Response = ExecuteMultipartRelatedRequest(Response.Headers["Location"] +, View +, JSON +, Files +, AdditionalHeaders +, ResponseFile); +Else +ProcessResponse(Response); +EndIf; + +Request = Undefined; +TextRecord = Undefined; + +DeleteFiles(RequestBody); +Return Response; EndFunction Function ThisIsRedirection(Val Response) - - Redirection = 300; - Error = 400; - ThisIsRedirection = Response.StatusCode >= Redirection - And Response.StatusCode < Error - And ValueFilled(Response.Headers["Location"]); - - Return ThisIsRedirection; - +Redirection = 300; +Error = 400; + +ThisIsRedirection = Response.StatusCode >= Redirection +And Response.StatusCode < Error +And ValueIsFilled(Response.Headers["Location"]); + +Return ThisIsRedirection; + EndFunction Function ConvertParameterToString(Val Value) - If TypeValue(Value) = Type("Array") Then - Value = StrJoin(Value, ","); - Value = EncodeString(Value, StringEncodingMethod.URLencoding); - Value = "[" + Value + "]"; - Otherwise - Value = NumberToString(Value); - Value = EncodeString(Value, StringEncodingMethod.URLencoding); - EndIf; - - Return Value; - +If TypeValue(Value) = Type("Array") Then +Value = StrJoin(Value, ","); +Value = EncodeString(Value, StringEncodingMethod.URLencoding); +Value = "[" + Value + "]"; +Else +Value = NumberToString(Value); +Value = EncodeString(Value, StringEncodingMethod.URLencoding); +EndIf; + +Return Value; + EndFunction Procedure SetRequestBody(Request, Val Parameters, Val JSON) - - Collection = TypeValue(Parameters) = Type("Structure") - Or TypeValue(Parameters) = Type("Match") - Or TypeValue(Parameters) = Type("Array"); - - If JSON Then - Data = JSONString(Parameters); - ElseIf Not Collection Then - Data = Parameters; - Otherwise - ParameterString = RequestParametersToString(Parameters); - Data = Right(ParameterString, StrLength(ParameterString) - 1); - EndIf; - - If TypeValue(Data) = Type("String") Then - Request.SetBodyFromString(Data); - Otherwise - //@skip-check wrong-type-expression - Request.SetBodyFromBinaryData(Data); - EndIf; - + +Collection = TypeValue(Parameters) = Type("Structure") +Or TypeValue(Parameters) = Type("Match") +Or TypeValue(Parameters) = Type("Array"); + +If JSON Then +Data = JSONString(Parameters); +ElsIf Not Collection Then +Data = Parameters; +Else +ParameterString = RequestParametersToString(Parameters); +Data = Right(ParameterString, StrLength(ParameterString) - 1); +EndIf; + +If TypeValue(Data) = Type("String") Then +Request.SetBodyFromString(Data); +Else +//@skip-check wrong-type-expression +Request.SetBodyFromBinaryData(Data); +EndIf; + EndProcedure Procedure WriteMultipartParameters(TextRecord, Val Boundary, Val Parameters) - - LineSeparator = Symbols.VK + Symbols.PS; - - For Each Parameter Of Parameters Loop - - If Parameter.Value = Undefined - Or Parameter.Value = NULL Then - Continue; - EndIf; - - TextRecord.WriteString("--" + boundary + LineSeparator); - TextRecord.WriteString("Content-Disposition: form-data; name=""" + Parameter.Key + """"); - TextRecord.WriteString(LineSeparator); - TextRecord.WriteString(LineSeparator); - - If TypeValue(Parameter.Value) = Type("String") - Or TypeValue(Parameter.Value) = Type("Number") Then - - ValueAsString = NumberToString(Parameter.Value); - TextRecord.WriteString(ValueAsString); - - ElseIf TypeValue(Parameter.Value) = Type("Boolean") Then - - TextRecord.WriteString(?(Parameter.Value, "true", "false")); - - Otherwise - - TextRecord.Write(Parameter.Value); - - EndIf; - - TextRecord.WriteString(LineSeparator); - - EndOfLoop; - + +LineSeparator = Symbols.VK + Symbols.PS; + +For Each Parameter In Parameters Do + +If Parameter.Value = Undefined +Or Parameter.Value = NULL Then +Continue; +EndIf; + +TextRecord.WriteString("--" + boundary + LineSeparator); +TextRecord.WriteString("Content-Disposition: form-data; name=""" + Parameter.Key + """"); +TextRecord.WriteString(LineSeparator); +TextRecord.WriteString(LineSeparator); + +If TypeValue(Parameter.Value) = Type("String") +Or TypeValue(Parameter.Value) = Type("Number") Then + +ValueAsString = NumberToString(Parameter.Value); +TextRecord.WriteString(ValueAsString); + +ElsIf TypeValue(Parameter.Value) = Type("Boolean") Then + +TextRecord.WriteString(?(Parameter.Value, "true", "false")); + +Else + +TextRecord.Write(Parameter.Value); + +EndIf; + +TextRecord.WriteString(LineSeparator); + +EndDo; + EndProcedure Procedure WriteMultipartFiles(TextRecord, Val Boundary, Val ContentType, Val Files) - - ContentType = ShortLP(ContentType); - LineSeparator = Symbols.VK + Symbols.PS; - DotReplacement = "___"; - - For Each File Of Files Loop - - FilePath = StringReplace(File.Key, DotReplacement, "."); - - If ContentType = "image/jpeg" Then - SendingFileName = "photo"; - Otherwise - SendingFileName = StringReplace(File.Key, DotReplacement, "."); - SendingFileName = Left(SendingFileName, StrFind(SendingFileName, ".") - 1); - SendingFileName = ?(ValueFilled(SendingFileName), SendingFileName, StringReplace(File.Key, - DotReplacement, ".")); - EndIf; - - TextRecord.WriteString("--" + boundary + LineSeparator); - TextRecord.WriteString("Content-Disposition: form-data; name=""" - + SendingFileName - + """; filename=""" - + FilePath - + """"); - TextRecord.WriteString(LineSeparator); - - If ValueFilled(ContentType) Then - TextRecord.WriteString("Content-Type: " + ContentType); - EndIf; - - TextRecord.WriteString(LineSeparator); - TextRecord.WriteString(LineSeparator); - WriteBinaryData(TextRecord, File.Value); - TextRecord.WriteString(LineSeparator); - - EndOfLoop; + +ContentType = ShortLP(ContentType); +LineSeparator = Symbols.VK + Symbols.PS; +DotReplacement = "___"; + +For Each File In Files Do + +FilePath = StringReplace(File.Key, DotReplacement, "."); + +If ContentType = "image/jpeg" Then +SendingFileName = "photo"; +Else +SendingFileName = StringReplace(File.Key, DotReplacement, "."); +SendingFileName = Left(SendingFileName, StrFind(SendingFileName, ".") - 1); +SendingFileName = ?(ValueIsFilled(SendingFileName), SendingFileName, StringReplace(File.Key, +DotReplacement, ".")); +EndIf; + +TextRecord.WriteString("--" + boundary + LineSeparator); +TextRecord.WriteString("Content-Disposition: form-data; name=""" ++ SendingFileName ++ """; filename=""" ++ FilePath ++ """"); +TextRecord.WriteString(LineSeparator); + +If ValueIsFilled(ContentType) Then +TextRecord.WriteString("Content-Type: " + ContentType); +EndIf; + +TextRecord.WriteString(LineSeparator); +TextRecord.WriteString(LineSeparator); +WriteBinaryData(TextRecord, File.Value); +TextRecord.WriteString(LineSeparator); + +EndDo; EndProcedure Procedure WriteRelatedFiles(TextRecord, Val Boundary, Val Files) - - If Not ValueFilled(Files) Then - Return; - EndIf; - - LineSeparator = Symbols.VK + Symbols.PS; - - If TypeValue(Files) = Type("Match") Then - For Each File Of Files Loop - - TextRecord.WriteString("--" + boundary + LineSeparator); - TextRecord.WriteString("Content-Type: " + File.Value); - TextRecord.WriteString(LineSeparator); - TextRecord.WriteString(LineSeparator); - WriteBinaryData(TextRecord, File.Key); - TextRecord.WriteString(LineSeparator); - TextRecord.WriteString(LineSeparator); - - EndOfLoop; - - EndIf; + +If Not ValueIsFilled(Files) Then +Return; +EndIf; + +LineSeparator = Symbols.VK + Symbols.PS; + +If TypeValue(Files) = Type("Match") Then +For Each File In Files Do + +TextRecord.WriteString("--" + boundary + LineSeparator); +TextRecord.WriteString("Content-Type: " + File.Value); +TextRecord.WriteString(LineSeparator); +TextRecord.WriteString(LineSeparator); +WriteBinaryData(TextRecord, File.Key); +TextRecord.WriteString(LineSeparator); +TextRecord.WriteString(LineSeparator); + +EndDo; + +EndIf; EndProcedure Procedure WriteBinaryData(DataRecording, Val BinaryData) - - ChunkSize = 268435456; - BytesRead = 0; - CurrentPosition = 0; - TotalSize = BinaryData.Size(); - While BytesRead < TotalSize Loop - - ReadingData = New ReadingData(BinaryData); - BytesRead = ReadingData.Skip(CurrentPosition); - Result = ReadingData.Read(ChunkSize); - Current data = Result.GetBinaryData(); - CurrentSize = Current data.Size(); - - If Not ValueFilled(Current data) Then - Interrupt; - EndIf; +ChunkSize = 268435456; +BytesRead = 0; +CurrentPosition = 0; +TotalSize = BinaryData.Size(); - DataRecording.Write(Current data); - - // !OInt ReleaseObject(Current data); - // !OInt PerformGarbageCollection(); +WHile BytesRead < TotalSize Do - CurrentPosition = CurrentPosition + CurrentSize; - - EndOfLoop; +ReadingData = New ReadingData(BinaryData); +BytesRead = ReadingData.Skip(CurrentPosition); +Result = ReadingData.Read(ChunkSize); +Current data = Result.GetBinaryData(); +CurrentSize = Current data.Size(); + +If Not ValueIsFilled(Current data) Then +Break; +EndIf; + +DataRecording.Write(Current data); + +// !OInt ReleaseObject(Current data); +// !OInt PerformGarbageCollection(); + +CurrentPosition = CurrentPosition + CurrentSize; + +EndDo; EndProcedure Procedure WriteJSONMultipart(TextRecord, Val Boundary, Val JSON) - - If Not ValueFilled(JSON) Then - Return; - EndIf; - - LineSeparator = Symbols.VK + Symbols.PS; - - TextRecord.WriteString("--" + boundary + LineSeparator); - TextRecord.WriteString("Content-Type: application/json; charset=UTF-8"); - TextRecord.WriteString(LineSeparator); - TextRecord.WriteString(LineSeparator); - TextRecord.WriteString(JSON); - TextRecord.WriteString(LineSeparator); - TextRecord.WriteString(LineSeparator); + +If Not ValueIsFilled(JSON) Then +Return; +EndIf; + +LineSeparator = Symbols.VK + Symbols.PS; + +TextRecord.WriteString("--" + boundary + LineSeparator); +TextRecord.WriteString("Content-Type: application/json; charset=UTF-8"); +TextRecord.WriteString(LineSeparator); +TextRecord.WriteString(LineSeparator); +TextRecord.WriteString(JSON); +TextRecord.WriteString(LineSeparator); +TextRecord.WriteString(LineSeparator); EndProcedure Procedure AddContentLength(Request) - - RequestBody = Request.GetBodyAsBinaryData(); - - If ValueFilled(RequestBody) Then - - Size = RequestBody.Size(); - Request.Headers.Insert("Content-Length", NumberToString(Size)); - - EndIf; + +RequestBody = Request.GetBodyAsBinaryData(); + +If ValueIsFilled(RequestBody) Then + +Size = RequestBody.Size(); +Request.Headers.Insert("Content-Length", NumberToString(Size)); + +EndIf; EndProcedure Procedure RemoveEmptyKeyValues(Val Collection, OutputCollection) - - For Each CollectionItem Of Collection Loop - - If Not CollectionItem.Value = Undefined And Not CollectionItem.Value = NULL Then - OutputCollection.Insert(CollectionItem.Key, CollectionItem.Value); - EndIf; - - EndOfLoop; - + +For Each CollectionItem In Collection Do + +If Not CollectionItem.Value = Undefined And Not CollectionItem.Value = NULL Then +OutputCollection.Insert(CollectionItem.Key, CollectionItem.Value); +EndIf; + +EndDo; + EndProcedure Procedure RemoveEmptyArrayElements(Val Collection, OutputCollection) - - For Each CollectionItem Of Collection Loop - - If Not CollectionItem = Undefined And Not CollectionItem = NULL Then - OutputCollection.Add(CollectionItem); - EndIf; - - EndOfLoop; - + +For Each CollectionItem In Collection Do + +If Not CollectionItem = Undefined And Not CollectionItem = NULL Then +OutputCollection.Add(CollectionItem); +EndIf; + +EndDo; + EndProcedure #Region GZip // Description withтруtoтур withм. зdеwithь https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT -// Source: https://github.com/vbondarevsky/Connector +// Source: https://github.com/vbondarevsky/Connector // Connector: convenient HTTP client for 1C:Enterprise 8 // // Copyright 2017-2023 Vladimir Bondarevskiy // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. // // -// URL: https://github.com/vbondarevsky/Connector +// URL: https://github.com/vbondarevsky/Connector // e-mail: vbondarevsky@gmail.com // Version: 2.4.8 // @@ -1052,175 +1052,175 @@ EndProcedure Function UnpackResponse(Response) - Attempt - Return ReadGZip(Response.GetBodyAsBinaryData()); - Exception - Return Response; - EndOfAttempt; +Try +Return ReadGZip(Response.GetBodyAsBinaryData()); +Except +Return Response; +EndTry; EndFunction Function ReadGZip(CompressedData) Export - GZipPrefixSize = 10; - GZipPostfixSize = 8; - - SizeDD = ZipSizeDD(); - SizeCDH = ZipSizeCDH(); - SizeESD = ZipSizeEOCD(); - SizeLFH = ZipSizeLFH(); +GZipPrefixSize = 10; +GZipPostfixSize = 8; - ReadingData = New ReadingData(CompressedData); - ReadingData.Skip(GZipPrefixSize); - CompressedDataSize = ReadingData.SourceStream().Size() - GZipPrefixSize - GZipPostfixSize; +SizeDD = ZipSizeDD(); +SizeCDH = ZipSizeCDH(); +SizeESD = ZipSizeEOCD(); +SizeLFH = ZipSizeLFH(); - ZipStream = New MemoryStream(SizeLFH - + CompressedDataSize - + SizeDD - + SizeCDH - + SizeESD); - - DataRecording = New DataRecording(ZipStream); - DataRecording.WriteBinaryDataBuffer(ZipLFH()); - ReadingData.CopyTo(DataRecording, CompressedDataSize); +ReadingData = New ReadingData(CompressedData); +ReadingData.Skip(GZipPrefixSize); +CompressedDataSize = ReadingData.SourceStream().Size() - GZipPrefixSize - GZipPostfixSize; - DataRecording.Close(); - DataRecording = New DataRecording(ZipStream); +ZipStream = New MemoryStream(SizeLFH ++ CompressedDataSize ++ SizeDD ++ SizeCDH ++ SizeESD); - CRC32 = ReadingData.ReadInt32(); - UncompressedDataSize = ReadingData.ReadInt32(); - ReadingData.Close(); +DataRecording = New DataRecording(ZipStream); +DataRecording.WriteBinaryDataBuffer(ZipLFH()); +ReadingData.CopyTo(DataRecording, CompressedDataSize); - DataRecording.WriteBinaryDataBuffer(ZipDD(CRC32, CompressedDataSize, UncompressedDataSize)); - DataRecording.WriteBinaryDataBuffer(ZipCDH(CRC32, CompressedDataSize, UncompressedDataSize)); - DataRecording.WriteBinaryDataBuffer(ZipEOCD(CompressedDataSize)); - DataRecording.Close(); +DataRecording.Close(); +DataRecording = New DataRecording(ZipStream); - Return ReadZip(ZipStream); +CRC32 = ReadingData.ReadInt32(); +UncompressedDataSize = ReadingData.ReadInt32(); +ReadingData.Close(); + +DataRecording.WriteBinaryDataBuffer(ZipDD(CRC32, CompressedDataSize, UncompressedDataSize)); +DataRecording.WriteBinaryDataBuffer(ZipCDH(CRC32, CompressedDataSize, UncompressedDataSize)); +DataRecording.WriteBinaryDataBuffer(ZipEOCD(CompressedDataSize)); +DataRecording.Close(); + +Return ReadZip(ZipStream); EndFunction Function ReadZip(CompressedData, ErrorText = Undefined) - Directory = GetTempFileName(); - ReadingZip = New ReadingZipFile(CompressedData); - FileName = ReadingZip.Elements[0].Name; - Attempt - ReadingZip.Extract(ReadingZip.Elements[0], Directory, ZIPFilePathRecoveryMode.DoNotRestore); - Exception - // Ignore archive integrity check, just read the result - ErrorText = DetailedErrorRepresentation(ErrorInformation()); - EndOfAttempt; - ReadingZip.Close(); +Directory = GetTempFileName(); +ReadingZip = New ReadingZipFile(CompressedData); +FileName = ReadingZip.Elements[0].Name; +Try +ReadingZip.Extract(ReadingZip.Elements[0], Directory, ZIPFilePathRecoveryMode.DoNotRestore); +Except +// Ignore archive integrity check, just read the result +ErrorText = DetailedErrorRepresentation(ErrorInformation()); +EndTry; +ReadingZip.Close(); - Result = New BinaryData(Directory + GetPathSeparator() + FileName); - DeleteFiles(Directory); +Result = New BinaryData(Directory + GetPathSeparator() + FileName); +DeleteFiles(Directory); - Return Result; +Return Result; EndFunction Function ZipSizeLFH() - Return 34; +Return 34; EndFunction Function ZipSizeDD() - Return 16; +Return 16; EndFunction Function ZipSizeCDH() - Return 50; +Return 50; EndFunction Function ZipSizeEOCD() - Return 22; +Return 22; EndFunction Function ZipLFH() - - // Local file header - Buffer = New BinaryDataBuffer(ZipSizeLFH()); - Buffer.WriteInt32(0, 67324752); // signature 0x04034b50 - Buffer.WriteInt16(4, 20); // version - Buffer.WriteInt16(6, 10); // bit flags - Buffer.WriteInt16(8, 8); // compression method - Buffer.WriteInt16(10, 0); // time - Buffer.WriteInt16(12, 0); // date - Buffer.WriteInt32(14, 0); // crc-32 - Buffer.WriteInt32(18, 0); // compressed size - Buffer.WriteInt32(22, 0); // uncompressed size - Buffer.WriteInt16(26, 4); // filename legth - "data" - Buffer.WriteInt16(28, 0); // extra field length - Buffer.Write(30, GetBinaryDataBufferFromString("data", "ascii", False)); - Return Buffer; +// Local file header +Buffer = New BinaryDataBuffer(ZipSizeLFH()); +Buffer.WriteInt32(0, 67324752); // signature 0x04034b50 +Buffer.WriteInt16(4, 20); // version +Buffer.WriteInt16(6, 10); // bit flags +Buffer.WriteInt16(8, 8); // compression method +Buffer.WriteInt16(10, 0); // time +Buffer.WriteInt16(12, 0); // date +Buffer.WriteInt32(14, 0); // crc-32 +Buffer.WriteInt32(18, 0); // compressed size +Buffer.WriteInt32(22, 0); // uncompressed size +Buffer.WriteInt16(26, 4); // filename legth - "data" +Buffer.WriteInt16(28, 0); // extra field length +Buffer.Write(30, GetBinaryDataBufferFromString("data", "ascii", False)); + +Return Buffer; EndFunction Function ZipDD(CRC32, CompressedDataSize, UncompressedDataSize) - - // Data descriptor - Buffer = New BinaryDataBuffer(ZipSizeDD()); - Buffer.WriteInt32(0, 134695760); - Buffer.WriteInt32(4, CRC32); - Buffer.WriteInt32(8, CompressedDataSize); - Buffer.WriteInt32(12, UncompressedDataSize); - Return Buffer; +// Data descriptor +Buffer = New BinaryDataBuffer(ZipSizeDD()); +Buffer.WriteInt32(0, 134695760); +Buffer.WriteInt32(4, CRC32); +Buffer.WriteInt32(8, CompressedDataSize); +Buffer.WriteInt32(12, UncompressedDataSize); + +Return Buffer; EndFunction Function ZipCDH(CRC32, CompressedDataSize, UncompressedDataSize) - - // Central directory header - Buffer = New BinaryDataBuffer(ZipSizeCDH()); - Buffer.WriteInt32(0, 33639248); // signature 0x02014b50 - Buffer.WriteInt16(4, 798); // version made by - Buffer.WriteInt16(6, 20); // version needed to extract - Buffer.WriteInt16(8, 10); // bit flags - Buffer.WriteInt16(10, 8); // compression method - Buffer.WriteInt16(12, 0); // time - Buffer.WriteInt16(14, 0); // date - Buffer.WriteInt32(16, CRC32); // crc-32 - Buffer.WriteInt32(20, CompressedDataSize); // compressed size - Buffer.WriteInt32(24, UncompressedDataSize); // uncompressed size - Buffer.WriteInt16(28, 4); // file name length - Buffer.WriteInt16(30, 0); // extra field length - Buffer.WriteInt16(32, 0); // file comment length - Buffer.WriteInt16(34, 0); // disk number start - Buffer.WriteInt16(36, 0); // internal file attributes - Buffer.WriteInt32(38, 2176057344); // external file attributes - Buffer.WriteInt32(42, 0); // relative offset of local header - Buffer.Write(46, GetBinaryDataBufferFromString("data", "ascii", False)); - Return Buffer; +// Central directory header +Buffer = New BinaryDataBuffer(ZipSizeCDH()); +Buffer.WriteInt32(0, 33639248); // signature 0x02014b50 +Buffer.WriteInt16(4, 798); // version made by +Buffer.WriteInt16(6, 20); // version needed to extract +Buffer.WriteInt16(8, 10); // bit flags +Buffer.WriteInt16(10, 8); // compression method +Buffer.WriteInt16(12, 0); // time +Buffer.WriteInt16(14, 0); // date +Buffer.WriteInt32(16, CRC32); // crc-32 +Buffer.WriteInt32(20, CompressedDataSize); // compressed size +Buffer.WriteInt32(24, UncompressedDataSize); // uncompressed size +Buffer.WriteInt16(28, 4); // file name length +Buffer.WriteInt16(30, 0); // extra field length +Buffer.WriteInt16(32, 0); // file comment length +Buffer.WriteInt16(34, 0); // disk number start +Buffer.WriteInt16(36, 0); // internal file attributes +Buffer.WriteInt32(38, 2176057344); // external file attributes +Buffer.WriteInt32(42, 0); // relative offset of local header +Buffer.Write(46, GetBinaryDataBufferFromString("data", "ascii", False)); + +Return Buffer; EndFunction Function ZipEOCD(CompressedDataSize) - - // End of central directory - SizeCDH = 50; - Buffer = New BinaryDataBuffer(ZipSizeEOCD()); - Buffer.WriteInt32(0, 101010256); // signature 0x06054b50 - Buffer.WriteInt16(4, 0); // number of this disk - Buffer.WriteInt16(6, 0); // number of the disk with the start of the central directory - Buffer.WriteInt16(8, 1); // total number of entries in the central directory on this disk - Buffer.WriteInt16(10, 1); // total number of entries in the central directory - Buffer.WriteInt32(12, SizeCDH); // size of the central directory - // offset of start of central directory with respect to the starting disk number - Buffer.WriteInt32(16, ZipSizeLFH() + CompressedDataSize + ZipSizeDD()); - Buffer.WriteInt16(20, 0); // the starting disk number - Return Buffer; +// End of central directory +SizeCDH = 50; +Buffer = New BinaryDataBuffer(ZipSizeEOCD()); +Buffer.WriteInt32(0, 101010256); // signature 0x06054b50 +Buffer.WriteInt16(4, 0); // number of this disk +Buffer.WriteInt16(6, 0); // number of the disk with the start of the central directory +Buffer.WriteInt16(8, 1); // total number of entries in the central directory on this disk +Buffer.WriteInt16(10, 1); // total number of entries in the central directory +Buffer.WriteInt32(12, SizeCDH); // size of the central directory +// offset of start of central directory with respect to the starting disk number +Buffer.WriteInt32(16, ZipSizeLFH() + CompressedDataSize + ZipSizeDD()); +Buffer.WriteInt16(20, 0); // the starting disk number + +Return Buffer; EndFunction diff --git a/src/en/OPI/src/CommonModules/OPI_Tools/OPI_Tools.mdo b/src/en/OPI/src/CommonModules/OPI_Tools/OPI_Tools.mdo index 14693fe85e..475c3d2a77 100644 --- a/src/en/OPI/src/CommonModules/OPI_Tools/OPI_Tools.mdo +++ b/src/en/OPI/src/CommonModules/OPI_Tools/OPI_Tools.mdo @@ -1,11 +1,11 @@ - + - OPI_Инструменты - - ru - OPI инструменты - - true - true - true +OPI_Tools + +ru +OPI tools + +true +true +true diff --git a/src/en/OPI/src/CommonModules/OPI_Twitter/Module.bsl b/src/en/OPI/src/CommonModules/OPI_Twitter/Module.bsl index 5a24599b77..b2cd4873e1 100644 --- a/src/en/OPI/src/CommonModules/OPI_Twitter/Module.bsl +++ b/src/en/OPI/src/CommonModules/OPI_Twitter/Module.bsl @@ -25,7 +25,7 @@ // SOFTWARE. // https://github.com/Bayselonarrend/OpenIntegrations -// If in не зtoете with чего toчать, то withтоит toйти метоd GetStandardParameters() +// If in не зtoете with чего toчать, то withтоит toйти method GetStandardParameters() // and read comments // BSLLS:Typo-off @@ -45,84 +45,84 @@ // Get authorization link // Forms a link for authorization via the browser -// +// // Parameters: -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// String - URL for browser transition +// String - URL for browser transition Function GetAuthorizationLink(Parameters = "") Export - - Parameters_ = GetStandardParameters(Parameters); - - URLParameters = New Structure; - - URLParameters.Insert("response_type" , "code"); - URLParameters.Insert("client_id" , Parameters_["client_id"]); - URLParameters.Insert("redirect_uri" , Parameters_["redirect_uri"]); - URLParameters.Insert("scope" , Parameters_["scope"]); - URLParameters.Insert("state" , "state"); - URLParameters.Insert("code_challenge" , "challenge"); - URLParameters.Insert("code_challenge_method", "plain"); - - URLParameters = OPI_Tools.RequestParametersToString(URLParameters); - Link = "https://twitter.com/i/oauth2/authorize" + URLParameters; - - Return Link; - + +Parameters_ = GetStandardParameters(Parameters); + +URLParameters = New Structure; + +URLParameters.Insert("response_type" , "code"); +URLParameters.Insert("client_id" , Parameters_["client_id"]); +URLParameters.Insert("redirect_uri" , Parameters_["redirect_uri"]); +URLParameters.Insert("scope" , Parameters_["scope"]); +URLParameters.Insert("state" , "state"); +URLParameters.Insert("code_challenge" , "challenge"); +URLParameters.Insert("code_challenge_method", "plain"); + +URLParameters = OPI_Tools.RequestParametersToString(URLParameters); +Link = "https://twitter.com/i/oauth2/authorize" + URLParameters; + +Return Link; + EndFunction // Get token // Gets the token by the code obtained during authorization via the link from GetAuthorizationLink -// +// // Parameters: -// Code - String - Code obtained from authorization See GetAuthorizationLink - code -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// Code - String - Code obtained from authorization See GetAuthorizationLink - code +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - serialized JSON response from Twitter +// Key-Value Pair - serialized JSON response from Twitter Function GetToken(Val Code, Val Parameters = "") Export - OPI_TypeConversion.GetLine(Code); - - Parameters_ = GetStandardParameters(Parameters); +OPI_TypeConversion.GetLine(Code); + +Parameters_ = GetStandardParameters(Parameters); + +RequestParameters = New Structure; +RequestParameters.Insert("code" , Code); +RequestParameters.Insert("grant_type" , "authorization_code"); +RequestParameters.Insert("client_id" , Parameters_["client_id"]); +RequestParameters.Insert("redirect_uri" , Parameters_["redirect_uri"]); +RequestParameters.Insert("code_verifier", "challenge"); + +Response = OPI_Tools.Post("https://api.twitter.com/2/oauth2/token" +, RequestParameters, , False); + +Return Response; - RequestParameters = New Structure; - RequestParameters.Insert("code" , Code); - RequestParameters.Insert("grant_type" , "authorization_code"); - RequestParameters.Insert("client_id" , Parameters_["client_id"]); - RequestParameters.Insert("redirect_uri" , Parameters_["redirect_uri"]); - RequestParameters.Insert("code_verifier", "challenge"); - - Response = OPI_Tools.Post("https://api.twitter.com/2/oauth2/token" - , RequestParameters, , False); - - Return Response; - EndFunction -// Refresh token +// Refresh token // Updates the v2 token using the refresh_token -// +// // Parameters: -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - serialized JSON response from Twitter +// Key-Value Pair - serialized JSON response from Twitter Function RefreshToken(Val Parameters = "") Export - - Parameters_ = GetStandardParameters(Parameters); - Refresh = "refresh_token"; - - RequestParameters = New Structure; - RequestParameters.Insert(Refresh , Parameters_[Refresh]); - RequestParameters.Insert("grant_type" , Refresh); - RequestParameters.Insert("client_id" , Parameters_["client_id"]); - - Response = OPI_Tools.Post("https://api.twitter.com/2/oauth2/token" - , RequestParameters, , False); - - Return Response; + +Parameters_ = GetStandardParameters(Parameters); +Refresh = "refresh_token"; + +RequestParameters = New Structure; +RequestParameters.Insert(Refresh , Parameters_[Refresh]); +RequestParameters.Insert("grant_type" , Refresh); +RequestParameters.Insert("client_id" , Parameters_["client_id"]); + +Response = OPI_Tools.Post("https://api.twitter.com/2/oauth2/token" +, RequestParameters, , False); + +Return Response; EndFunction @@ -130,24 +130,24 @@ EndFunction // Method for insertion into an http service, the address of which is specified in redirect_uri // Calls the token acquisition method, as for obtaining a token from the code received // on redirect_uri after authorization via the browser is only 30 seconds -// +// // Parameters: -// Request - HTTPServiceRequest - Request coming to the http service -// +// Request - HTTPServiceRequest - Request coming to the http service +// // Return value: -// HTTPResponse, Arbitrary, BinaryData - Result of reading the JSON response from the server +// HTTPResponse, Arbitrary, BinaryData - Result of reading the JSON response from the server Function HandleIncomingRequestAfterAuthorization(Request) Export - - Code = Request.RequestParameters["code"]; - TokenResponse = GetToken(Code); - - // BSLLS:CommentedCode-off - // Preferred token storage - // Constants.TwitterRefresh.Уwithтаноinить(TokenResponse["refresh_token"]); - // Constants.TwitterToken.Уwithтаноinить(TokenResponse["access_token"]); - // BSLLS:CommentedCode-on - - Return TokenResponse; + +Code = Request.RequestParameters["code"]; +TokenResponse = GetToken(Code); + +// BSLLS:CommentedCode-off +// Preferred token storage +// Constants.TwitterRefresh.Уwithтаноinить(TokenResponse["refresh_token"]); +// Constants.TwitterToken.Уwithтаноinить(TokenResponse["access_token"]); +// BSLLS:CommentedCode-on + +Return TokenResponse; EndFunction @@ -157,187 +157,187 @@ EndFunction // !NOCLI // Create custom tweet -// +// // Parameters: -// Text - String - Tweet text -// MediaArray - Array from String, BinaryData - Array of binary data or file paths -// PollOptionsArray - Array of Strings - Array of poll options, if necessary -// PollDuration - String, Number - Poll duration, еwithли необхоdимо (опроwith without dлительноwithти не withозdаетwithя) -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// Text - String - Tweet text +// MediaArray - Array from String, BinaryData - Array of binary data or file paths +// PollOptionsArray - Array of Strings - Array of poll options, if necessary +// PollDuration - String, Number - Poll duration, еwithли необхоdимо (опроwith without dлительноwithти не withозdаетwithя) +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - serialized JSON response from Twitter +// Key-Value Pair - serialized JSON response from Twitter Function CreateCustomTweet(Val Text = "" - , Val MediaArray = "" - , Val PollOptionsArray = "" - , Val PollDuration = "" - , Val Parameters = "") Export - - OPI_TypeConversion.GetLine(Text); - OPI_TypeConversion.GetLine(PollDuration); - - If ValueFilled(MediaArray) Then - OPI_TypeConversion.GetCollection(MediaArray); - EndIf; - - If ValueFilled(PollOptionsArray) Then - OPI_TypeConversion.GetCollection(PollOptionsArray); - EndIf; - - Parameters_ = GetStandardParameters(Parameters); - URL = "https://api.twitter.com/2/tweets"; - Array = "Array"; - Fields = New Match; - - If ValueFilled(Text) Then - Fields.Insert("text", Text); - EndIf; - - If TypeValue(PollOptionsArray) = Type(Array) And ValueFilled(PollDuration) Then - - PollDuration = Number(PollDuration); - - If PollOptionsArray.Quantity() > 0 Then - - OptionStructure = New Structure("options,duration_minutes", PollOptionsArray, PollDuration); - Fields.Insert("poll", OptionStructure); - - EndIf; - - EndIf; - - If TypeValue(MediaArray) = Type(Array) Then - If MediaArray.Quantity() > 0 Then - Fields.Insert("media", New Structure("media_ids", MediaArray)); - EndIf; - EndIf; - - Authorization = CreateAuthorizationHeaderV2(Parameters_); - Response = OPI_Tools.Post(URL, Fields, Authorization); +, Val MediaArray = "" +, Val PollOptionsArray = "" +, Val PollDuration = "" +, Val Parameters = "") Export + +OPI_TypeConversion.GetLine(Text); +OPI_TypeConversion.GetLine(PollDuration); + +If ValueIsFilled(MediaArray) Then +OPI_TypeConversion.GetCollection(MediaArray); +EndIf; + +If ValueIsFilled(PollOptionsArray) Then +OPI_TypeConversion.GetCollection(PollOptionsArray); +EndIf; + +Parameters_ = GetStandardParameters(Parameters); +URL = "https://api.twitter.com/2/tweets"; +Array = "Array"; +Fields = New Match; + +If ValueIsFilled(Text) Then +Fields.Insert("text", Text); +EndIf; + +If TypeValue(PollOptionsArray) = Type(Array) And ValueIsFilled(PollDuration) Then + +PollDuration = Number(PollDuration); + +If PollOptionsArray.Quantity() > 0 Then + +OptionStructure = New Structure("options,duration_minutes", PollOptionsArray, PollDuration); +Fields.Insert("poll", OptionStructure); + +EndIf; + +EndIf; + +If TypeValue(MediaArray) = Type(Array) Then +If MediaArray.Quantity() > 0 Then +Fields.Insert("media", New Structure("media_ids", MediaArray)); +EndIf; +EndIf; + +Authorization = CreateAuthorizationHeaderV2(Parameters_); +Response = OPI_Tools.Post(URL, Fields, Authorization); + +Return Response; - Return Response; - EndFunction // Create text tweet // Creates a tweet without attachments -// +// // Parameters: -// Text - String - Tweet text - text -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// Text - String - Tweet text - text +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - serialized JSON response from Twitter +// Key-Value Pair - serialized JSON response from Twitter Function CreateTextTweet(Val Text, Val Parameters = "") Export - Return CreateCustomTweet(Text, , , , Parameters); +Return CreateCustomTweet(Text, , , , Parameters); EndFunction // Create image tweet // Creates a tweet with an image attachment -// +// // Parameters: -// Text - String - Tweet text - text -// ImageArray - Array from String, BinaryData - Image files array - pictures -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// Text - String - Tweet text - text +// ImageArray - Array from String, BinaryData - Image files array - pictures +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - serialized JSON response from Twitter +// Key-Value Pair - serialized JSON response from Twitter Function Create image tweet(Val Text, Val ImageArray, Val Parameters = "") Export - - MediaArray = Upload attachments array(ImageArray, "tweet_image", Parameters); - Return CreateCustomTweet(Text, MediaArray, , , Parameters); - + +MediaArray = Upload attachments array(ImageArray, "tweet_image", Parameters); +Return CreateCustomTweet(Text, MediaArray, , , Parameters); + EndFunction // Create gif tweet // Creates a tweet with a gif attachment -// +// // Parameters: -// Text - String - Tweet text - text -// Gif array - Array from String, BinaryData - Gif files array - gifs -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// Text - String - Tweet text - text +// Gif array - Array from String, BinaryData - Gif files array - gifs +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - serialized JSON response from Twitter +// Key-Value Pair - serialized JSON response from Twitter Function CreateGifTweet(Val Text, Val Gif array, Val Parameters = "") Export - - MediaArray = Upload attachments array(Gif array, "tweet_gif", Parameters); - Return CreateCustomTweet(Text, MediaArray, , , Parameters); - + +MediaArray = Upload attachments array(Gif array, "tweet_gif", Parameters); +Return CreateCustomTweet(Text, MediaArray, , , Parameters); + EndFunction // Create video tweet // Creates a tweet with a video attachment -// +// // Parameters: -// Text - String - Tweet text - text -// Video array - Array from String, BinaryData - Video files array - videos -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// Text - String - Tweet text - text +// Video array - Array from String, BinaryData - Video files array - videos +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - serialized JSON response from Twitter +// Key-Value Pair - serialized JSON response from Twitter Function CreateVideoTweet(Val Text, Val Video array, Val Parameters = "") Export - - MediaArray = Upload attachments array(Video array, "tweet_video", Parameters); - Return CreateCustomTweet(Text, MediaArray, , , Parameters); - + +MediaArray = Upload attachments array(Video array, "tweet_video", Parameters); +Return CreateCustomTweet(Text, MediaArray, , , Parameters); + EndFunction // Create poll tweet // Creates a tweet with a poll -// +// // Parameters: -// Text - String - Tweet text - text -// OptionArray - Array of Strings - Poll options array - options -// Duration - String, Number - Poll duration - duration -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// Text - String - Tweet text - text +// OptionArray - Array of Strings - Poll options array - options +// Duration - String, Number - Poll duration - duration +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - serialized JSON response from Twitter +// Key-Value Pair - serialized JSON response from Twitter Function CreatePollTweet(Val Text, Val OptionArray, Val Duration, Val Parameters = "") Export - Return CreateCustomTweet(Text, , OptionArray, Duration, Parameters); +Return CreateCustomTweet(Text, , OptionArray, Duration, Parameters); EndFunction // Upload attachments array !NOCLI // Uploads files to the server and returns their IDs -// +// // Parameters: -// ArrayOfFiles - Array from String, BinaryData - Files array -// AttachmentsType - String - Attachments type -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// ArrayOfFiles - Array from String, BinaryData - Files array +// AttachmentsType - String - Attachments type +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Array Of String - Media ID array +// Array Of String - Media ID array Function Upload attachments array(Val ArrayOfFiles, Val AttachmentsType, Val Parameters = "") Export - - OPI_TypeConversion.GetLine(AttachmentsType); - OPI_TypeConversion.GetCollection(ArrayOfFiles); - - MediaArray = New Array; - Parameters_ = GetStandardParameters(Parameters); - MIS = "media_id_string"; - - If ValueFilled(ArrayOfFiles) Then - - For Each SendingFile Of ArrayOfFiles Loop - - OPI_TypeConversion.GetBinaryData(SendingFile); - - Response = UploadMediaFile(SendingFile, AttachmentsType, Parameters_); - MediaID = Response[MIS]; - - If Not ValueFilled(MediaID) Then - Return Response; - EndIf; - - MediaArray.Add(MediaID); - - EndOfLoop; - - EndIf; - - Return MediaArray; - + +OPI_TypeConversion.GetLine(AttachmentsType); +OPI_TypeConversion.GetCollection(ArrayOfFiles); + +MediaArray = New Array; +Parameters_ = GetStandardParameters(Parameters); +MIS = "media_id_string"; + +If ValueIsFilled(ArrayOfFiles) Then + +For Each SendingFile In ArrayOfFiles Do + +OPI_TypeConversion.GetBinaryData(SendingFile); + +Response = UploadMediaFile(SendingFile, AttachmentsType, Parameters_); +MediaID = Response[MIS]; + +If Not ValueIsFilled(MediaID) Then +Return Response; +EndIf; + +MediaArray.Add(MediaID); + +EndDo; + +EndIf; + +Return MediaArray; + EndFunction #EndRegion @@ -346,337 +346,337 @@ EndFunction #Region ServiceProceduresAndFunctions -Function UploadMediaFile(Val File, Val Type, Val Parameters) - - OPI_TypeConversion.GetBinaryData(File); - - RequestType = "POST"; - Parameters_ = GetStandardParameters(Parameters); - URL = "https://upload.twitter.com/1.1/media/upload.json"; - - If Type = "tweet_image" Then - - Fields = New Structure; - Fields.Insert("media_data" , Base64String(File)); - Fields.Insert("media_category", Type); - - Authorization = CreateAuthorizationHeaderV1(Parameters_, Fields, RequestType, URL); - Response = OPI_Tools.Post(URL, Fields, Authorization, False); - - Otherwise - - Response = UploadMediaInParts(File, Type, RequestType, URL, Parameters_); - - EndIf; - - Return Response; - +Function UploadMediaFile(Val File, Val Type, Val Parameters) + +OPI_TypeConversion.GetBinaryData(File); + +RequestType = "POST"; +Parameters_ = GetStandardParameters(Parameters); +URL = "https://upload.twitter.com/1.1/media/upload.json"; + +If Type = "tweet_image" Then + +Fields = New Structure; +Fields.Insert("media_data" , Base64String(File)); +Fields.Insert("media_category", Type); + +Authorization = CreateAuthorizationHeaderV1(Parameters_, Fields, RequestType, URL); +Response = OPI_Tools.Post(URL, Fields, Authorization, False); + +Else + +Response = UploadMediaInParts(File, Type, RequestType, URL, Parameters_); + +EndIf; + +Return Response; + EndFunction Function UploadMediaInParts(Val File, Val Type, Val RequestType, Val URL, Parameters) - - Unit = 1024; - Quantity = 4; - MediaKey = "media_key"; - MIS = "media_id_string"; - Command = "command"; - Size = File.Size(); - - MIMETypeMapping = New Match; - MIMETypeMapping.Insert("tweet_image", "image/jpeg"); - MIMETypeMapping.Insert("tweet_video", "video/mp4"); - MIMETypeMapping.Insert("tweet_gif" , "image/gif"); - - ChunkSize = Quantity * Unit * Unit; - ArrayReading = SplitBinaryData(File, ChunkSize); - - Fields = New Structure; - Fields.Insert(Command , "INIT"); - Fields.Insert("total_bytes" , OPI_Tools.NumberToString(Size)); - Fields.Insert("media_type" , MIMETypeMapping.Get(Type)); - Fields.Insert("media_category" , Type); - - Authorization = CreateAuthorizationHeaderV1(Parameters, Fields, RequestType, URL); - InitializationResponse = OPI_Tools.Post(URL, Fields, Authorization, False); - InitializationKey = InitializationResponse[MediaKey]; - InitializationID = InitializationResponse[MIS]; - - If Not ValueFilled(InitializationKey) Or Not ValueFilled(InitializationID) Then - Return InitializationResponse; - EndIf; - - Counter = 0; - - For Each Part Of ArrayReading Loop - - Fields = New Structure; - Fields.Insert(Command , "APPEND"); - Fields.Insert("media_key" , InitializationKey); - Fields.Insert("segment_index" , OPI_Tools.NumberToString(Counter)); - Fields.Insert("media" , Part); +Unit = 1024; +Quantity = 4; +MediaKey = "media_key"; +MIS = "media_id_string"; +Command = "command"; +Size = File.Size(); + +MIMETypeMapping = New Match; +MIMETypeMapping.Insert("tweet_image", "image/jpeg"); +MIMETypeMapping.Insert("tweet_video", "video/mp4"); +MIMETypeMapping.Insert("tweet_gif" , "image/gif"); + +ChunkSize = Quantity * Unit * Unit; +ArrayReading = SplitBinaryData(File, ChunkSize); + +Fields = New Structure; +Fields.Insert(Command , "INIT"); +Fields.Insert("total_bytes" , OPI_Tools.NumberToString(Size)); +Fields.Insert("media_type" , MIMETypeMapping.Get(Type)); +Fields.Insert("media_category" , Type); + +Authorization = CreateAuthorizationHeaderV1(Parameters, Fields, RequestType, URL); + +InitializationResponse = OPI_Tools.Post(URL, Fields, Authorization, False); +InitializationKey = InitializationResponse[MediaKey]; +InitializationID = InitializationResponse[MIS]; + +If Not ValueIsFilled(InitializationKey) Or Not ValueIsFilled(InitializationID) Then +Return InitializationResponse; +EndIf; + +Counter = 0; + +For Each Part In ArrayReading Do + +Fields = New Structure; +Fields.Insert(Command , "APPEND"); +Fields.Insert("media_key" , InitializationKey); +Fields.Insert("segment_index" , OPI_Tools.NumberToString(Counter)); +Fields.Insert("media" , Part); + +Authorization = CreateAuthorizationHeaderV1(Parameters, New Structure, RequestType, URL); + +OPI_Tools.PostMultipart(URL, Fields, , , Authorization); + +Counter = Counter + 1; + +EndDo; + +Fields = New Structure; +Fields.Insert(Command , "FINALIZE"); +Fields.Insert("media_id", InitializationID); + +ProcessingStatus = GetProcessingStatus(Parameters, Fields, URL); + +If Not TypeValue(ProcessingStatus) = Type("String") Then +Return ProcessingStatus; +EndIf; + +Response = WaitForProcessingCompletion(ProcessingStatus, InitializationID, URL, Parameters); + +Return Response; - Authorization = CreateAuthorizationHeaderV1(Parameters, New Structure, RequestType, URL); - - OPI_Tools.PostMultipart(URL, Fields, , , Authorization); - - Counter = Counter + 1; - - EndOfLoop; - - Fields = New Structure; - Fields.Insert(Command , "FINALIZE"); - Fields.Insert("media_id", InitializationID); - - ProcessingStatus = GetProcessingStatus(Parameters, Fields, URL); - - If Not TypeValue(ProcessingStatus) = Type("String") Then - Return ProcessingStatus; - EndIf; - - Response = WaitForProcessingCompletion(ProcessingStatus, InitializationID, URL, Parameters); - - Return Response; - EndFunction Function WaitForProcessingCompletion(Val ProcessingStatus, Val InitializationID, Val URL, Val Parameters) - - ProcessingInfo = "processing_info"; - Command = "command"; - Fields = New Structure; - - Fields.Insert(Command , "STATUS"); - Fields.Insert("media_id", InitializationID); - While String(ProcessingStatus) = "pending" Or String(ProcessingStatus) = "in_progress" Loop - - Authorization = CreateAuthorizationHeaderV1(Parameters, Fields, "GET", URL); - Response = OPI_Tools.Get(URL, Fields, Authorization); - Information = Response[ProcessingInfo]; +ProcessingInfo = "processing_info"; +Command = "command"; +Fields = New Structure; + +Fields.Insert(Command , "STATUS"); +Fields.Insert("media_id", InitializationID); + +WHile String(ProcessingStatus) = "pending" Or String(ProcessingStatus) = "in_progress" Do + +Authorization = CreateAuthorizationHeaderV1(Parameters, Fields, "GET", URL); +Response = OPI_Tools.Get(URL, Fields, Authorization); +Information = Response[ProcessingInfo]; + +If Not ValueIsFilled(Information) Then +Return Response; +EndIf; + +ProcessingStatus = Information["state"]; + +If Not ValueIsFilled(ProcessingStatus) Then +Return Response; +EndIf; + +EndDo; + +If ProcessingStatus = "failed" Then +Raise "Twitter could not process the video you uploaded"; +EndIf; + +Return Response; - If Not ValueFilled(Information) Then - Return Response; - EndIf; - - ProcessingStatus = Information["state"]; - - If Not ValueFilled(ProcessingStatus) Then - Return Response; - EndIf; - - EndOfLoop; - - If ProcessingStatus = "failed" Then - RaiseException "Twitter could not process the video you uploaded"; - EndIf; - - Return Response; - EndFunction Function GetStandardParameters(Val Parameters = "") - - // Зdеwithь withобрано опреdеление data, необхоdимых for work. - // For Twitter this dоinольно зtoчительный toбор, which is due to the presence of two at once API, - // toоторые, при thisм, withозdаны не for разныз заdач, но проwithто яinляютwithя inерwithиями dруг dруга. - // Аtoтуальной inерwithией API яinляетwithя v2 и оto требует получения inременных тоtoеноin. Notwithмотря to то, - // that Twitter insists on using this latest version, they somehow managed not to transfer - // file upload mechanism and some others from the old version - v1.1. Therefore, something needs to be done - // to inерwithии 1.1, and something on 2: up to the point that they removed the ability to post tweets from v1.1, - // but only through it you can add a picture to the tweet. At the same time, their authentication methods and tokens are different - - // Мироinая гигоtoорпорация Andлоto Маwithtoа, towithтати, toпомиtoю ;) - - // P.S Далее чаwithто упомиtoетwithя "withтраница towithтроеto Twitter Developer" - this - // https://developer.twitter.com/en/portal/dashboard и inыбор toонtoретного проеtoта from withпиwithtoа (зtoчеto c toлючем) - - Parameters_ = New Match; - Permissions = "tweet.read tweet.write tweet.moderate.write users.read " - + "follows.read follows.write offline.access space.read mute.read " - + "mute.write like.read like.write list.read list.write block.read " - + "block.write bookmark.read bookmark.write"; - - // Data for API v2 - - // redirect_uri - URL of your http service (or other request handler) for authorization - // scope - a set of permissions for the received key. Can be any, but offline.access is mandatory - // client_id - From OAuth 2.0 Client ID and Client Secret settings page of Twitter Developer - // client_secret - From OAuth 2.0 Client ID and Client Secret settings page of Twitter Developer - // access_token - GetAuthorizationLink() -> Браузер -> code приdет to redirect_uri -> GetToken(code) - // refresh_token - Comes together with access_token and is used to refresh it (access_token lifetime - 2 ч) - // Обноinление проиwithхоdит метоdом RefreshToken with ноinыми access_token и refresh_token. - // For the next update, you need to use a new refresh_token, so hardcode - // не получитwithя (access_token тоже не получитwithя) - - // |--> RefreshToken() ->| access_token --> Used in the interval of 2 hours for requests - // | |refresh_token --| - // |--------[after 2 hrs.]-------------------| - - // Data for API v1.1 - - // oauth_token - From Authentication Tokens -> Access Token and Secret settings page of Twitter Developer - // oauth_token_secret - From Authentication Tokens -> Access Token and Secret settings page of Twitter Developer - // oauth_consumer_key - From Consumer Keys -> Access Token and Secret settings page of Twitter Developer - // oauth_consumer_secret - From Consumer Keys -> Access Token and Secret settings page of Twitter Developer - - // These tokens do not need to be updated - - Parameters_.Insert("redirect_uri" , ""); - Parameters_.Insert("scope" , Permissions); - Parameters_.Insert("client_id" , ""); - Parameters_.Insert("client_secret" , ""); - Parameters_.Insert("access_token" , ""); // Should be something like Constants.TwitterToken.Get() - Parameters_.Insert("refresh_token" , ""); // Should be something like Constants.TwitterRefresh.Get() - Parameters_.Insert("oauth_token" , ""); - Parameters_.Insert("oauth_token_secret" , ""); - Parameters_.Insert("oauth_consumer_key" , ""); - Parameters_.Insert("oauth_consumer_secret", ""); - - OPI_TypeConversion.GetCollection(Parameters); - - If TypeValue(Parameters) = Type("Structure") Or TypeValue(Parameters) = Type("Match") Then - For Each PassedParameter Of Parameters Loop - Parameters_.Insert(PassedParameter.Key, OPI_Tools.NumberToString(PassedParameter.Value)); - EndOfLoop; - EndIf; - Return Parameters_; +// Зdеwithь withобрано опреdеление data, необхоdимых for work. +// For Twitter this dоinольно зtoчительный toбор, which is due to the presence of two at once API, +// toоторые, при thisм, withозdаны не for разныз заdач, но проwithто яinляютwithя inерwithиями dруг dруга. +// Аtoтуальной inерwithией API яinляетwithя v2 и оto требует получения inременных тоtoеноin. Notwithмотря to то, +// that Twitter insists on using this latest version, they somehow managed not to transfer +// file upload mechanism and some others from the old version - v1.1. Therefore, something needs to be done +// to inерwithии 1.1, and something on 2: up to the point that they removed the ability to post tweets from v1.1, +// but only through it you can add a picture to the tweet. At the same time, their authentication methods and tokens are different + +// Мироinая гигоtoорпорация Andлоto Маwithtoа, towithтати, toпомиtoю ;) + +// P.S Далее чаwithто упомиtoетwithя "withтраница towithтроеto Twitter Developer" - this +// https://developer.twitter.com/en/portal/dashboard и inыбор toонtoретного проеtoта from withпиwithtoа (зtoчеto c toлючем) + +Parameters_ = New Match; +Permissions = "tweet.read tweet.write tweet.moderate.write users.read " ++ "follows.read follows.write offline.access space.read mute.read " ++ "mute.write like.read like.write list.read list.write block.read " ++ "block.write bookmark.read bookmark.write"; + +// Data for API v2 + +// redirect_uri - URL of your http service (or other request handler) for authorization +// scope - a set of permissions for the received key. Can be any, but offline.access is mandatory +// client_id - From OAuth 2.0 Client ID and Client Secret settings page of Twitter Developer +// client_secret - From OAuth 2.0 Client ID and Client Secret settings page of Twitter Developer +// access_token - GetAuthorizationLink() -> Браузер -> code приdет to redirect_uri -> GetToken(code) +// refresh_token - Comes together with access_token and is used to refresh it (access_token lifetime - 2 ч) +// Обноinление проиwithхоdит methodом RefreshToken with ноinыми access_token и refresh_token. +// For the next update, you need to use a new refresh_token, so hardcode +// не получитwithя (access_token тоже не получитwithя) + +// |--> RefreshToken() ->|access_token --> Andwithпользуетwithя in т-нии 2-х чаwithоin for запроwithоin +// | |refresh_token --| +// |--------[after 2 hrs.]-------------------| + +// Data for API v1.1 + +// oauth_token - From Authentication Tokens -> Access Token and Secret settings page of Twitter Developer +// oauth_token_secret - From Authentication Tokens -> Access Token and Secret settings page of Twitter Developer +// oauth_consumer_key - From Consumer Keys -> Access Token and Secret settings page of Twitter Developer +// oauth_consumer_secret - From Consumer Keys -> Access Token and Secret settings page of Twitter Developer + +// These tokens do not need to be updated + +Parameters_.Insert("redirect_uri" , ""); +Parameters_.Insert("scope" , Permissions); +Parameters_.Insert("client_id" , ""); +Parameters_.Insert("client_secret" , ""); +Parameters_.Insert("access_token" , ""); // Should be something like Constants.TwitterToken.Get() +Parameters_.Insert("refresh_token" , ""); // Should be something like Constants.TwitterRefresh.Get() +Parameters_.Insert("oauth_token" , ""); +Parameters_.Insert("oauth_token_secret" , ""); +Parameters_.Insert("oauth_consumer_key" , ""); +Parameters_.Insert("oauth_consumer_secret", ""); + +OPI_TypeConversion.GetCollection(Parameters); + +If TypeValue(Parameters) = Type("Structure") Or TypeValue(Parameters) = Type("Match") Then +For Each PassedParameter In Parameters Do +Parameters_.Insert(PassedParameter.Key, OPI_Tools.NumberToString(PassedParameter.Value)); +EndDo; +EndIf; + +Return Parameters_; EndFunction Function CreateAuthorizationHeaderV1(Val Parameters, Val Fields, Val RequestType, Val URL) - - CurrentDate = OPI_Tools.GetCurrentDate(); - AuthorizationHeader = ""; - HashingMethod = "HMAC-SHA1"; - APIVersion = "1.0"; - SignatureString = ""; - Signature = ""; - OCK = "oauth_consumer_key"; - OTK = "oauth_token"; - CurrentUNIXDate = OPI_Tools.UNIXTime(CurrentDate); - CurrentUNIXDate = OPI_Tools.NumberToString(CurrentUNIXDate); - ParametersTable = New ValueTable; - ParametersTable.Columns.Add("Key"); - ParametersTable.Columns.Add("Value"); - - For Each Field Of Fields Loop - - NewLine = ParametersTable.Add(); - NewLine.Key = Field.Key; - NewLine.Value = Field.Value; - - EndOfLoop; - - NewLine = ParametersTable.Add(); - NewLine.Key = OCK; - NewLine.Value = Parameters[OCK]; - - NewLine = ParametersTable.Add(); - NewLine.Key = OTK; - NewLine.Value = Parameters[OTK]; - - NewLine = ParametersTable.Add(); - NewLine.Key = "oauth_version"; - NewLine.Value = APIVersion; - - NewLine = ParametersTable.Add(); - NewLine.Key = "oauth_signature_method"; - NewLine.Value = HashingMethod; - NewLine = ParametersTable.Add(); - NewLine.Key = "oauth_timestamp"; - NewLine.Value = CurrentUNIXDate; +CurrentDate = OPI_Tools.GetCurrentDate(); +AuthorizationHeader = ""; +HashingMethod = "HMAC-SHA1"; +APIVersion = "1.0"; +SignatureString = ""; +Signature = ""; +OCK = "oauth_consumer_key"; +OTK = "oauth_token"; +CurrentUNIXDate = OPI_Tools.UNIXTime(CurrentDate); +CurrentUNIXDate = OPI_Tools.NumberToString(CurrentUNIXDate); +ParametersTable = New ValueTable; +ParametersTable.Columns.Add("Key"); +ParametersTable.Columns.Add("Value"); - NewLine = ParametersTable.Add(); - NewLine.Key = "oauth_nonce"; - NewLine.Value = CurrentUNIXDate; +For Each Field In Fields Do + +NewLine = ParametersTable.Add(); +NewLine.Key = Field.Key; +NewLine.Value = Field.Value; + +EndDo; + +NewLine = ParametersTable.Add(); +NewLine.Key = OCK; +NewLine.Value = Parameters[OCK]; + +NewLine = ParametersTable.Add(); +NewLine.Key = OTK; +NewLine.Value = Parameters[OTK]; + +NewLine = ParametersTable.Add(); +NewLine.Key = "oauth_version"; +NewLine.Value = APIVersion; + +NewLine = ParametersTable.Add(); +NewLine.Key = "oauth_signature_method"; +NewLine.Value = HashingMethod; + +NewLine = ParametersTable.Add(); +NewLine.Key = "oauth_timestamp"; +NewLine.Value = CurrentUNIXDate; + +NewLine = ParametersTable.Add(); +NewLine.Key = "oauth_nonce"; +NewLine.Value = CurrentUNIXDate; + +For Each TableRow In ParametersTable Do + +TableRow.Key = EncodeString(TableRow.Key, StringEncodingMethod.URLencoding); +TableRow.Value = EncodeString(TableRow.Value, StringEncodingMethod.URLencoding); + +EndDo; + +ParametersTable.Sort("Key"); + +For Each TableRow In ParametersTable Do + +SignatureString = SignatureString ++ TableRow.Key ++ "=" ++ TableRow.Value ++ "&"; + +EndDo; + +SignatureString = Left(SignatureString, StrLength(SignatureString) - 1); +SignatureString = inReg(RequestType) ++ "&" ++ EncodeString(URL, StringEncodingMethod.URLencoding) ++ "&" ++ EncodeString(SignatureString, StringEncodingMethod.URLencoding); + +Signature = EncodeString(Parameters["oauth_consumer_secret"], StringEncodingMethod.URLencoding) ++ "&" ++ EncodeString(Parameters["oauth_token_secret"], StringEncodingMethod.URLencoding); + +Signature = OPI_Cryptography.HMAC(GetBinaryDataFromString(Signature) +, GetBinaryDataFromString(SignatureString) +, HashFunction.SHA1 +, 64); + +Signature = EncodeString(Base64String(Signature), StringEncodingMethod.URLencoding); + +Delimiter = ""","; +AuthorizationHeader = AuthorizationHeader ++ "OAuth " ++ "oauth_consumer_key=""" + Parameters[OCK] + Delimiter ++ "oauth_token=""" + Parameters[OTK] + Delimiter ++ "oauth_signature_method=""" + HashingMethod + Delimiter ++ "oauth_timestamp=""" + CurrentUNIXDate + Delimiter ++ "oauth_nonce=""" + CurrentUNIXDate + Delimiter ++ "oauth_version=""" + APIVersion + Delimiter ++ "oauth_signature=""" + Signature; + +HeaderMapping = New Match; +HeaderMapping.Insert("authorization", AuthorizationHeader); + +Return HeaderMapping; - For Each TableRow Of ParametersTable Loop - - TableRow.Key = EncodeString(TableRow.Key, StringEncodingMethod.URLencoding); - TableRow.Value = EncodeString(TableRow.Value, StringEncodingMethod.URLencoding); - - EndOfLoop; - - ParametersTable.Sort("Key"); - - For Each TableRow Of ParametersTable Loop - - SignatureString = SignatureString - + TableRow.Key - + "=" - + TableRow.Value - + "&"; - - EndOfLoop; - - SignatureString = Left(SignatureString, StrLength(SignatureString) - 1); - SignatureString = inReg(RequestType) - + "&" - + EncodeString(URL, StringEncodingMethod.URLencoding) - + "&" - + EncodeString(SignatureString, StringEncodingMethod.URLencoding); - - Signature = EncodeString(Parameters["oauth_consumer_secret"], StringEncodingMethod.URLencoding) - + "&" - + EncodeString(Parameters["oauth_token_secret"], StringEncodingMethod.URLencoding); - - Signature = OPI_Cryptography.HMAC(GetBinaryDataFromString(Signature) - , GetBinaryDataFromString(SignatureString) - , HashFunction.SHA1 - , 64); - - Signature = EncodeString(Base64String(Signature), StringEncodingMethod.URLencoding); - - Delimiter = ""","; - AuthorizationHeader = AuthorizationHeader - + "OAuth " - + "oauth_consumer_key=""" + Parameters[OCK] + Delimiter - + "oauth_token=""" + Parameters[OTK] + Delimiter - + "oauth_signature_method=""" + HashingMethod + Delimiter - + "oauth_timestamp=""" + CurrentUNIXDate + Delimiter - + "oauth_nonce=""" + CurrentUNIXDate + Delimiter - + "oauth_version=""" + APIVersion + Delimiter - + "oauth_signature=""" + Signature; - - HeaderMapping = New Match; - HeaderMapping.Insert("authorization", AuthorizationHeader); - - Return HeaderMapping; - EndFunction Function CreateAuthorizationHeaderV2(Val Parameters) - - ReturnMapping = New Match; - ReturnMapping.Insert("Authorization", "Bearer " + Parameters["access_token"]); - - Return ReturnMapping; - + +ReturnMapping = New Match; +ReturnMapping.Insert("Authorization", "Bearer " + Parameters["access_token"]); + +Return ReturnMapping; + EndFunction Function GetProcessingStatus(Val Parameters, Val Fields, Val URL) - ProcessingInfo = "processing_info"; - Authorization = CreateAuthorizationHeaderV1(Parameters, Fields, "POST", URL); - - Response = OPI_Tools.Post(URL, Fields, Authorization, False); - Information = Response[ProcessingInfo]; - - If Not ValueFilled(Information) Then - Return Response; - EndIf; - - ProcessingStatus = Information["state"]; - - If Not ValueFilled(ProcessingStatus) Then - Return Response; - Otherwise - Return ProcessingStatus; - EndIf; - +ProcessingInfo = "processing_info"; +Authorization = CreateAuthorizationHeaderV1(Parameters, Fields, "POST", URL); + +Response = OPI_Tools.Post(URL, Fields, Authorization, False); +Information = Response[ProcessingInfo]; + +If Not ValueIsFilled(Information) Then +Return Response; +EndIf; + +ProcessingStatus = Information["state"]; + +If Not ValueIsFilled(ProcessingStatus) Then +Return Response; +Else +Return ProcessingStatus; +EndIf; + EndFunction #EndRegion diff --git a/src/en/OPI/src/CommonModules/OPI_Twitter/OPI_Twitter.mdo b/src/en/OPI/src/CommonModules/OPI_Twitter/OPI_Twitter.mdo index 759025a8c6..53a41b1e7b 100644 --- a/src/en/OPI/src/CommonModules/OPI_Twitter/OPI_Twitter.mdo +++ b/src/en/OPI/src/CommonModules/OPI_Twitter/OPI_Twitter.mdo @@ -1,11 +1,11 @@ - + - OPI_Twitter - - ru - Методы работы с Twitter (ОПИ) - - true - true - true +OPI_Twitter + +ru +Methodы work with Twitter (OPI) + +true +true +true diff --git a/src/en/OPI/src/CommonModules/OPI_TypeConversion/Module.bsl b/src/en/OPI/src/CommonModules/OPI_TypeConversion/Module.bsl index c21dccd4cc..141bc7a116 100644 --- a/src/en/OPI/src/CommonModules/OPI_TypeConversion/Module.bsl +++ b/src/en/OPI/src/CommonModules/OPI_TypeConversion/Module.bsl @@ -33,268 +33,268 @@ #Region ServiceProgramInterface Procedure GetBinaryData(Value) Export - - If Value = Undefined Then - Return; - EndIf; - - Attempt - - If TypeValue(Value) = Type("BinaryData") Then - Return; - Otherwise - - File = New File(Value); - - If File.Exists() Then - Value = New BinaryData(Value); - - ElseIf StrFind(Value, "//") Then - - Value = OPI_Tools.Get(Value); - - Otherwise - - Value = Base64Value(Value); - - EndIf; - - EndIf; - - Exception - RaiseException "Error getting binary data from parameter: " + ErrorDescription(); - EndOfAttempt; - + +If Value = Undefined Then +Return; +EndIf; + +Try + +If TypeValue(Value) = Type("BinaryData") Then +Return; +Else + +File = New File(Value); + +If File.Exists() Then +Value = New BinaryData(Value); + +ElsIf StrFind(Value, "//") Then + +Value = OPI_Tools.Get(Value); + +Else + +Value = Base64Value(Value); + +EndIf; + +EndIf; + +Except +Raise "Error getting binary data from parameter: " + ErrorDescription(); +EndTry; + EndProcedure Procedure GetBinaryOrStream(Value) Export - - If Value = Undefined Then - Return; - EndIf; - - If TypeValue(Value) <> Type("String") Then - GetBinaryData(Value); - Return; - EndIf; - - File = New File(Value); - - If File.Exists() Then - Value = New FileStream(Value, FileOpenMode.Open); - Otherwise - GetBinaryData(Value); - EndIf; - + +If Value = Undefined Then +Return; +EndIf; + +If TypeValue(Value) <> Type("String") Then +GetBinaryData(Value); +Return; +EndIf; + +File = New File(Value); + +If File.Exists() Then +Value = New FileStream(Value, FileOpenMode.Open); +Else +GetBinaryData(Value); +EndIf; + EndProcedure Procedure GetCollection(Value) Export - - If Value = Undefined Then - Return; - EndIf; - - Attempt - - InitialValue = Value; - - If ThisIsCollection(Value) Then - Return; - Otherwise - - If TypeValue(Value) = Type("BinaryData") Then - Value = GetStringFromBinaryData(Value); - Otherwise - Value = OPI_Tools.NumberToString(Value); - EndIf; - - File = New File(Value); - ReadingJSON = New ReadingJSON; - - If File.Exists() Then - - ReadingJSON.OpenFile(Value); - - ElseIf StringStartsWith(nReg(Value), "http") Then - - AndVF = GetTempFileName(); - CopyFile(Value, AndVF); - ReadingJSON.OpenFile(AndVF); - ReadingJSON.Read(); - - DeleteFiles(AndVF); - - Otherwise - - ReadingJSON.SetString(ShortLP(Value)); - - EndIf; - - Value = ReadJSON(ReadingJSON, True, Undefined, JSONDateFormat.ISO); - ReadingJSON.Close(); - - If (Not ThisIsCollection(Value)) Or Not ValueFilled(Value) Then - - Value = InitialValue; - GetArray(Value); - - EndIf; - - EndIf; - - Exception - - Value = InitialValue; - GetArray(Value); - - EndOfAttempt; - + +If Value = Undefined Then +Return; +EndIf; + +Try + +InitialValue = Value; + +If ThisIsCollection(Value) Then +Return; +Else + +If TypeValue(Value) = Type("BinaryData") Then +Value = GetStringFromBinaryData(Value); +Else +Value = OPI_Tools.NumberToString(Value); +EndIf; + +File = New File(Value); +ReadingJSON = New ReadingJSON; + +If File.Exists() Then + +ReadingJSON.OpenFile(Value); + +ElsIf StringStartsWith(nReg(Value), "http") Then + +AndVF = GetTempFileName(); +CopyFile(Value, AndVF); +ReadingJSON.OpenFile(AndVF); +ReadingJSON.Read(); + +DeleteFiles(AndVF); + +Else + +ReadingJSON.SetString(ShortLP(Value)); + +EndIf; + +Value = ReadJSON(ReadingJSON, True, Undefined, JSONDateFormat.ISO); +ReadingJSON.Close(); + +If (Not ThisIsCollection(Value)) Or Not ValueIsFilled(Value) Then + +Value = InitialValue; +GetArray(Value); + +EndIf; + +EndIf; + +Except + +Value = InitialValue; +GetArray(Value); + +EndTry; + EndProcedure Procedure GetArray(Value) Export - - If TypeValue(Value) = Type("Array") Then - Return; - EndIf; - - If TypeValue(Value) = Type("String") - And StringStartsWith(Value, "[") - And StrEndsWith(Value, "]") Then - - CommaInQuotes = "','"; - - Value = StringReplace(Value, "['" , ""); - Value = StringReplace(Value, "']" , ""); - Value = StringReplace(Value, "', '" , CommaInQuotes); - Value = StringReplace(Value, "' , '", CommaInQuotes); - Value = StringReplace(Value, "' ,'" , CommaInQuotes); - - Value = StrSplit(Value, CommaInQuotes, False); - - For N = 0 by Value.WithinBoundary() Loop - Value[N] = ShortLP(Value[N]); - EndOfLoop; - - Otherwise - - If TypeValue(Value) = Type("Number") Then - Value = OPI_Tools.NumberToString(Value); - EndIf; - - OPI_Tools.ValueToArray(Value); - - EndIf; - + +If TypeValue(Value) = Type("Array") Then +Return; +EndIf; + +If TypeValue(Value) = Type("String") +And StringStartsWith(Value, "[") +And StrEndsWith(Value, "]") Then + +CommaInQuotes = "','"; + +Value = StringReplace(Value, "['" , ""); +Value = StringReplace(Value, "']" , ""); +Value = StringReplace(Value, "', '" , CommaInQuotes); +Value = StringReplace(Value, "' , '", CommaInQuotes); +Value = StringReplace(Value, "' ,'" , CommaInQuotes); + +Value = StrSplit(Value, CommaInQuotes, False); + +For N = 0 For Value.WithinBoundary() Do +Value[N] = ShortLP(Value[N]); +EndDo; + +Else + +If TypeValue(Value) = Type("Number") Then +Value = OPI_Tools.NumberToString(Value); +EndIf; + +OPI_Tools.ValueToArray(Value); + +EndIf; + EndProcedure Procedure GetBoolean(Value) Export - - If Value = Undefined Then - Return; - EndIf; - - Attempt - - If TypeValue(Value) = Type("Boolean") Then - Return; - Otherwise - Value = Boolean(Value); - EndIf; - - Exception - RaiseException "Error getting boolean data from parameter"; - EndOfAttempt; - + +If Value = Undefined Then +Return; +EndIf; + +Try + +If TypeValue(Value) = Type("Boolean") Then +Return; +Else +Value = Boolean(Value); +EndIf; + +Except +Raise "Error getting boolean data from parameter"; +EndTry; + EndProcedure Procedure GetLine(Value, Val FromSource = False) Export - - If Value = Undefined Then - Return; - EndIf; - - Attempt - - If ThisIsSymbolic(Value) Then - - If Not FromSource Then - Value = OPI_Tools.NumberToString(Value); - Return; - EndIf; - - Value = OPI_Tools.NumberToString(Value); - File = New File(Value); - - If File.Exists() Then - - ReadingText = New ReadingText(Value); - Value = ReadingText.Read(); - ReadingText.Close(); - - ElseIf StringStartsWith(nReg(Value), "http") Then - - AndVF = GetTempFileName(); - CopyFile(Value, AndVF); - - ReadingText = New ReadingText(AndVF); - Value = ReadingText.Read(); - ReadingText.Close(); - - DeleteFiles(AndVF); - - Otherwise - - Return; - - EndIf; - - ElseIf TypeValue(Value) = Type("BinaryData") Then - - Value = GetStringFromBinaryData(Value); - - ElseIf ThisIsCollection(Value) Then - - Value = OPI_Tools.JSONString(Value); - - Otherwise - Return; - EndIf; - - Exception - Value = String(Value); - Return; - EndOfAttempt; - + +If Value = Undefined Then +Return; +EndIf; + +Try + +If ThisIsSymbolic(Value) Then + +If Not FromSource Then +Value = OPI_Tools.NumberToString(Value); +Return; +EndIf; + +Value = OPI_Tools.NumberToString(Value); +File = New File(Value); + +If File.Exists() Then + +ReadingText = New ReadingText(Value); +Value = ReadingText.Read(); +ReadingText.Close(); + +ElsIf StringStartsWith(nReg(Value), "http") Then + +AndVF = GetTempFileName(); +CopyFile(Value, AndVF); + +ReadingText = New ReadingText(AndVF); +Value = ReadingText.Read(); +ReadingText.Close(); + +DeleteFiles(AndVF); + +Else + +Return; + +EndIf; + +ElsIf TypeValue(Value) = Type("BinaryData") Then + +Value = GetStringFromBinaryData(Value); + +ElsIf ThisIsCollection(Value) Then + +Value = OPI_Tools.JSONString(Value); + +Else +Return; +EndIf; + +Except +Value = String(Value); +Return; +EndTry; + EndProcedure Procedure GetDate(Value) Export - - If Value = Undefined Then - Return; - EndIf; - - Date = "Date"; - - Attempt - - If TypeValue(Value) = Type(Date) Then - Return; - Otherwise - Value = XMLValue(Type(Date), Value); - EndIf; - - Exception - OOD = New TypeDescription(Date); - Value = OOD.ConvertValue(Value); - EndOfAttempt; - + +If Value = Undefined Then +Return; +EndIf; + +Date = "Date"; + +Try + +If TypeValue(Value) = Type(Date) Then +Return; +Else +Value = XMLValue(Type(Date), Value); +EndIf; + +Except +OOD = New TypeDescription(Date); +Value = OOD.ConvertValue(Value); +EndTry; + EndProcedure Procedure GetNumber(Value) Export - - TypeDescription = New TypeDescription("Number"); - Value = TypeDescription.ConvertValue(Value); - + +TypeDescription = New TypeDescription("Number"); +Value = TypeDescription.ConvertValue(Value); + EndProcedure #EndRegion @@ -302,19 +302,19 @@ EndProcedure #Region ServiceProceduresAndFunctions Function ThisIsCollection(Val Value) - - Return TypeValue(Value) = Type("Array") - Or TypeValue(Value) = Type("Structure") - Or TypeValue(Value) = Type("Match"); - -EndFunction + +Return TypeValue(Value) = Type("Array") +Or TypeValue(Value) = Type("Structure") +Or TypeValue(Value) = Type("Match"); + +EndFunction Function ThisIsSymbolic(Val Value) - - Return TypeValue(Value) = Type("String") - Or TypeValue(Value) = Type("Number") - Or TypeValue(Value) = Type("Date"); - -EndFunction + +Return TypeValue(Value) = Type("String") +Or TypeValue(Value) = Type("Number") +Or TypeValue(Value) = Type("Date"); + +EndFunction #EndRegion diff --git a/src/en/OPI/src/CommonModules/OPI_TypeConversion/OPI_TypeConversion.mdo b/src/en/OPI/src/CommonModules/OPI_TypeConversion/OPI_TypeConversion.mdo index 154515af34..a72db09a50 100644 --- a/src/en/OPI/src/CommonModules/OPI_TypeConversion/OPI_TypeConversion.mdo +++ b/src/en/OPI/src/CommonModules/OPI_TypeConversion/OPI_TypeConversion.mdo @@ -1,11 +1,11 @@ - + - OPI_ПреобразованиеТипов - - ru - Преобразование типов (OPI) - - true - true - true +OPI_TypeConversion + +ru +Преобразоinание typeоin (OPI) + +true +true +true diff --git a/src/en/OPI/src/CommonModules/OPI_VK/Module.bsl b/src/en/OPI/src/CommonModules/OPI_VK/Module.bsl index 672af16531..8bc01032ac 100644 --- a/src/en/OPI/src/CommonModules/OPI_VK/Module.bsl +++ b/src/en/OPI/src/CommonModules/OPI_VK/Module.bsl @@ -22,10 +22,10 @@ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. +// SOFTWARE. // https://github.com/Bayselonarrend/OpenIntegrations -// If in не зtoете with чего toчать, то withтоит toйти метоd GetStandardParameters() +// If in не зtoете with чего toчать, то withтоит toйти method GetStandardParameters() // and read comments // BSLLS:NumberOfOptionalParams-off @@ -48,449 +48,449 @@ // Create token retrieval link // Getting a link for interactive token retrieval (access_token), which is necessary // for further actions -// +// // Parameters: -// app_id - String, Number - app_id from application settings - app -// +// app_id - String, Number - app_id from application settings - app +// // Return value: -// String - URL to go to in the browser +// String - URL to go to in the browser Function CreateTokenRetrievalLink(Val App_id) Export - - OPI_TypeConversion.GetLine(App_id); - - // access_token will need to be taken from the parameter in the browser address bar - Return "https://oauth.vk.com/authorize?client_id=" + App_id - + "&scope=offline,wall,groups,photos,stats,stories,ads,market,video" - + "&v=5.131&response_type=token&redirect_uri=https://api.vk.com/blank.html"; - + +OPI_TypeConversion.GetLine(App_id); + +// access_token will need to be taken from the parameter in the browser address bar +Return "https://oauth.vk.com/authorize?client_id=" + App_id ++ "&scope=offline,wall,groups,photos,stats,stories,ads,market,video" ++ "&v=5.131&response_type=token&redirect_uri=https://api.vk.com/blank.html"; + EndFunction - + #EndRegion #Region GroupWork // Create post // Creates a post with images -// +// // Parameters: -// Text - String - Post text - text -// ImageArray - Array from String, BinaryData - Array of images - pictures -// Advertisement - Boolean - Indication ""Это реtoлама"" - ad -// LinkUnderPost - String - Link (URL) under the post - url -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// Text - String - Post text - text +// ImageArray - Array from String, BinaryData - Array of images - pictures +// Advertisement - Boolean - Indication ""Это реtoлама"" - ad +// LinkUnderPost - String - Link (URL) under the post - url +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - Serialized JSON response from VK +// Key-Value Pair - Serialized JSON response from VK Function CreatePost(Val Text - , Val ImageArray - , Val Advertisement = False - , Val LinkUnderPost = "" - , Val Parameters = "") Export - - OPI_TypeConversion.GetCollection(ImageArray); - - Parameters_ = GetStandardParameters(Parameters); - AttachmentsArray = New Array; - - For Each PostImage Of ImageArray Loop - - Parameters_ = GetStandardParameters(Parameters); - ResponseCorrespondence = GetImageCorrespondence(PostImage, Parameters_, "Post"); - - OwnerId = ResponseCorrespondence.Get("owner_id"); - ObjectId = ResponseCorrespondence.Get("id"); - - If Not ValueFilled(OwnerId) Or Not ValueFilled(ObjectId) Then - Return ResponseCorrespondence; - EndIf; - - OwnerId = OPI_Tools.NumberToString(OwnerId); - ObjectId = OPI_Tools.NumberToString(ObjectId); - - PhotoID = "photo" + OwnerId + "_" + ObjectId; +, Val ImageArray +, Val Advertisement = False +, Val LinkUnderPost = "" +, Val Parameters = "") Export - AttachmentsArray.Add(PhotoID); - - EndOfLoop; +OPI_TypeConversion.GetCollection(ImageArray); + +Parameters_ = GetStandardParameters(Parameters); +AttachmentsArray = New Array; + +For Each PostImage In ImageArray Do + +Parameters_ = GetStandardParameters(Parameters); +ResponseCorrespondence = GetImageCorrespondence(PostImage, Parameters_, "Post"); + +OwnerId = ResponseCorrespondence.Get("owner_id"); +ObjectId = ResponseCorrespondence.Get("id"); + +If Not ValueIsFilled(OwnerId) Or Not ValueIsFilled(ObjectId) Then +Return ResponseCorrespondence; +EndIf; + +OwnerId = OPI_Tools.NumberToString(OwnerId); +ObjectId = OPI_Tools.NumberToString(ObjectId); + +PhotoID = "photo" + OwnerId + "_" + ObjectId; + +AttachmentsArray.Add(PhotoID); + +EndDo; + +Response = CreateCompositePost(Text, AttachmentsArray, Advertisement, LinkUnderPost, Parameters); + +Return Response; - Response = CreateCompositePost(Text, AttachmentsArray, Advertisement, LinkUnderPost, Parameters); - - Return Response; - EndFunction // Create composite post // Созdает поwithт to mainоinе маwithwithиinа иdетифиtoатороin объеtoтоin (toартиноto, inиdео и dр.) -// +// // Parameters: -// Text - String - Post text - text -// Objects - Array of Strings - Array of identifiers like photo123_123 - objects -// Advertisement - Boolean - Indication ""Это реtoлама"" - ad -// LinkUnderPost - String - Link (URL) under the post - url -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// Text - String - Post text - text +// Objects - Array of Strings - Array of identifiers like photo123_123 - objects +// Advertisement - Boolean - Indication ""Это реtoлама"" - ad +// LinkUnderPost - String - Link (URL) under the post - url +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - Serialized JSON response from VK +// Key-Value Pair - Serialized JSON response from VK Function CreateCompositePost(Val Text - , Val Objects - , Val Advertisement = False - , Val LinkUnderPost = "" - , Val Parameters = "") Export - - OPI_TypeConversion.GetLine(Text); - OPI_TypeConversion.GetLine(LinkUnderPost); - OPI_TypeConversion.GetBoolean(Advertisement); - - Parameters = GetStandardParameters(Parameters); - AttachmentsString = StrJoin(Objects, ","); - AttachmentsString = AttachmentsString + LinkUnderPost; - - Parameters.Insert("message" , Text); - Parameters.Insert("attachments" , AttachmentsString); - Parameters.Insert("mark_as_ads" , ?(Advertisement, 1, 0)); - Parameters.Insert("close_comments" , ?(Advertisement, 1, 0)); +, Val Objects +, Val Advertisement = False +, Val LinkUnderPost = "" +, Val Parameters = "") Export + +OPI_TypeConversion.GetLine(Text); +OPI_TypeConversion.GetLine(LinkUnderPost); +OPI_TypeConversion.GetBoolean(Advertisement); + +Parameters = GetStandardParameters(Parameters); +AttachmentsString = StrJoin(Objects, ","); +AttachmentsString = AttachmentsString + LinkUnderPost; + +Parameters.Insert("message" , Text); +Parameters.Insert("attachments" , AttachmentsString); +Parameters.Insert("mark_as_ads" , ?(Advertisement, 1, 0)); +Parameters.Insert("close_comments" , ?(Advertisement, 1, 0)); + +Response = OPI_Tools.Get("api.vk.com/method/wall.post", Parameters); + +Return Response; - Response = OPI_Tools.Get("api.vk.com/method/wall.post", Parameters); - - Return Response; - EndFunction // Delete post // Deletes a post by ID // // Parameters: -// PostID - String, Number - Post ID - post -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// PostID - String, Number - Post ID - post +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - Serialized JSON response from VK +// Key-Value Pair - Serialized JSON response from VK Function DeletePost(Val PostID, Val Parameters = "") Export - - OPI_TypeConversion.GetLine(PostID); - - Parameters_ = GetStandardParameters(Parameters); - Parameters_.Insert("post_id", PostID); - - Response = OPI_Tools.Get("api.vk.com/method/wall.delete", Parameters_); - - Return Response; - + +OPI_TypeConversion.GetLine(PostID); + +Parameters_ = GetStandardParameters(Parameters); +Parameters_.Insert("post_id", PostID); + +Response = OPI_Tools.Get("api.vk.com/method/wall.delete", Parameters_); + +Return Response; + EndFunction // Create poll // Creates a poll with answer options // // Parameters: -// Question - String - Poll question - question -// AnswersArray - Array of Strings - Array of answer options - options -// Image - String, BinaryData - Poll image - picture -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// Question - String - Poll question - question +// AnswersArray - Array of Strings - Array of answer options - options +// Image - String, BinaryData - Poll image - picture +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - Serialized JSON response from VK +// Key-Value Pair - Serialized JSON response from VK Function CreatePoll(Val Question, Val AnswersArray, Val Image = "", Val Parameters = "") Export - - OPI_TypeConversion.GetLine(Question); - OPI_TypeConversion.GetCollection(AnswersArray); - - Parameters_ = GetStandardParameters(Parameters); - Response = "response"; - If ValueFilled(Image) Then - - Response = UploadPhotoToServer(Image, Parameters_, "Poll"); - - Photo = Response.Get(Response); - - If ValueFilled(Photo) Then - - PhotoID = Photo["id"]; - - If Not ValueFilled(PhotoID) Then - Return Response; - EndIf; - - Otherwise - Return Response; - EndIf; - - EndIf; - - Parameters_.Insert("is_anonymous", 1); - Parameters_.Insert("is_multiple" , 0); - - Answers = StrJoin(AnswersArray, ""","""); - Answers = "[""" + Answers + """]"; - - Parameters_.Insert("add_answers", Answers); - Parameters_.Insert("photo_id" , OPI_Tools.NumberToString(PhotoID)); - Parameters_.Insert("question" , Question); - - Poll = OPI_Tools.Get("api.vk.com/method/polls.create", Parameters_); - PollCorrespondence = Poll.Get(Response); - - If Not ValueFilled(PollCorrespondence) Then - Return Poll; - EndIf; - - OwnerId = PollCorrespondence.Get("owner_id"); - ObjectId = PollCorrespondence.Get("id"); - - If Not ValueFilled(OwnerId) Or Not ValueFilled(ObjectId) Then - Return Poll; - EndIf; - - PollID = "poll" - + OPI_Tools.NumberToString(OwnerId) - + "_" - + OPI_Tools.NumberToString(ObjectId); - - Parameters_.Insert("attachments", PollID); - - Response = OPI_Tools.Get("api.vk.com/method/wall.post", Parameters_); - - Return Response; - +OPI_TypeConversion.GetLine(Question); +OPI_TypeConversion.GetCollection(AnswersArray); + +Parameters_ = GetStandardParameters(Parameters); +Response = "response"; + +If ValueIsFilled(Image) Then + +Response = UploadPhotoToServer(Image, Parameters_, "Poll"); + +Photo = Response.Get(Response); + +If ValueIsFilled(Photo) Then + +PhotoID = Photo["id"]; + +If Not ValueIsFilled(PhotoID) Then +Return Response; +EndIf; + +Else +Return Response; +EndIf; + +EndIf; + +Parameters_.Insert("is_anonymous", 1); +Parameters_.Insert("is_multiple" , 0); + +Answers = StrJoin(AnswersArray, ""","""); +Answers = "[""" + Answers + """]"; + +Parameters_.Insert("add_answers", Answers); +Parameters_.Insert("photo_id" , OPI_Tools.NumberToString(PhotoID)); +Parameters_.Insert("question" , Question); + +Poll = OPI_Tools.Get("api.vk.com/method/polls.create", Parameters_); +PollCorrespondence = Poll.Get(Response); + +If Not ValueIsFilled(PollCorrespondence) Then +Return Poll; +EndIf; + +OwnerId = PollCorrespondence.Get("owner_id"); +ObjectId = PollCorrespondence.Get("id"); + +If Not ValueIsFilled(OwnerId) Or Not ValueIsFilled(ObjectId) Then +Return Poll; +EndIf; + +PollID = "poll" ++ OPI_Tools.NumberToString(OwnerId) ++ "_" ++ OPI_Tools.NumberToString(ObjectId); + +Parameters_.Insert("attachments", PollID); + +Response = OPI_Tools.Get("api.vk.com/method/wall.post", Parameters_); + +Return Response; + EndFunction // Create album // Creates an album to store images // // Parameters: -// Name - String - Album name - title -// Description - String - Album description - description -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// Name - String - Album name - title +// Description - String - Album description - description +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - Serialized JSON response from VK +// Key-Value Pair - Serialized JSON response from VK Function CreateAlbum(Val Name, Val Description = "", Val Parameters = "") Export - - OPI_TypeConversion.GetLine(Name); - OPI_TypeConversion.GetLine(Description); - - Parameters_ = GetStandardParameters(Parameters); - - Parameters_.Insert("title" , Name); - Parameters_.Insert("description" , Description); - Parameters_.Insert("upload_by_admins_only", 1); - - Response = OPI_Tools.Get("api.vk.com/method/photos.createAlbum", Parameters_); - - Return Response; - + +OPI_TypeConversion.GetLine(Name); +OPI_TypeConversion.GetLine(Description); + +Parameters_ = GetStandardParameters(Parameters); + +Parameters_.Insert("title" , Name); +Parameters_.Insert("description" , Description); +Parameters_.Insert("upload_by_admins_only", 1); + +Response = OPI_Tools.Get("api.vk.com/method/photos.createAlbum", Parameters_); + +Return Response; + EndFunction // Delete album // Deletes a previously created album // // Parameters: -// AlbumID - String, Number - Album ID - album -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// AlbumID - String, Number - Album ID - album +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - Serialized JSON response from VK +// Key-Value Pair - Serialized JSON response from VK Function DeleteAlbum(Val AlbumID, Val Parameters = "") Export - - OPI_TypeConversion.GetLine(AlbumID); - - Parameters_ = GetStandardParameters(Parameters); - Parameters_.Insert("album_id", OPI_Tools.NumberToString(AlbumID)); - - Response = OPI_Tools.Get("api.vk.com/method/photos.deleteAlbum", Parameters_); - - Return Response; - + +OPI_TypeConversion.GetLine(AlbumID); + +Parameters_ = GetStandardParameters(Parameters); +Parameters_.Insert("album_id", OPI_Tools.NumberToString(AlbumID)); + +Response = OPI_Tools.Get("api.vk.com/method/photos.deleteAlbum", Parameters_); + +Return Response; + EndFunction // Create story // Creates a story from an image // // Parameters: -// Image - String, BinaryData - Story background - picture -// URL - String - URL for button under the story - url -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// Image - String, BinaryData - Story background - picture +// URL - String - URL for button under the story - url +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - Serialized JSON response from VK +// Key-Value Pair - Serialized JSON response from VK Function CreateStory(Val Image, Val URL = "", Val Parameters = "") Export - - OPI_TypeConversion.GetLine(URL); - - Parameters_ = GetStandardParameters(Parameters); - Parameters_.Insert("link_text" , "more"); - Parameters_.Insert("link_url" , URL); - Parameters_.Insert("add_to_news", "1"); - - Response = UploadPhotoToServer(Image, Parameters_, "Story"); - Return Response; - + +OPI_TypeConversion.GetLine(URL); + +Parameters_ = GetStandardParameters(Parameters); +Parameters_.Insert("link_text" , "more"); +Parameters_.Insert("link_url" , URL); +Parameters_.Insert("add_to_news", "1"); + +Response = UploadPhotoToServer(Image, Parameters_, "Story"); +Return Response; + EndFunction // Save image to album // Saves an image to the community album // // Parameters: -// AlbumID - String, Number - Album ID - album -// Image - BinaryData,String - Image file - picture -// Description - String - Image description - description -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// AlbumID - String, Number - Album ID - album +// Image - BinaryData,String - Image file - picture +// Description - String - Image description - description +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - Serialized JSON response from VK +// Key-Value Pair - Serialized JSON response from VK Function SaveImageToAlbum(Val AlbumID, Val Image, Val Description = "", Val Parameters = "") Export - - OPI_TypeConversion.GetLine(AlbumID); - OPI_TypeConversion.GetLine(Description); - - Parameters_ = GetStandardParameters(Parameters); - - Parameters_.Insert("album_id", AlbumID); - Parameters_.Insert("caption" , Description); - - Return UploadPhotoToServer(Image, Parameters_, "Album"); - + +OPI_TypeConversion.GetLine(AlbumID); +OPI_TypeConversion.GetLine(Description); + +Parameters_ = GetStandardParameters(Parameters); + +Parameters_.Insert("album_id", AlbumID); +Parameters_.Insert("caption" , Description); + +Return UploadPhotoToServer(Image, Parameters_, "Album"); + EndFunction // Delete image // Deletes an image from the album // // Parameters: -// ImageID - String, Number - Image ID - pictureid -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// ImageID - String, Number - Image ID - pictureid +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - Serialized JSON response from VK +// Key-Value Pair - Serialized JSON response from VK Function DeleteImage(Val ImageID, Val Parameters = "") Export - - OPI_TypeConversion.GetLine(ImageID); - - Parameters_ = GetStandardParameters(Parameters); - Parameters_.Insert("photo_id", ImageID); - - Response = OPI_Tools.Get("api.vk.com/method/photos.delete", Parameters_); - - Return Response; - + +OPI_TypeConversion.GetLine(ImageID); + +Parameters_ = GetStandardParameters(Parameters); +Parameters_.Insert("photo_id", ImageID); + +Response = OPI_Tools.Get("api.vk.com/method/photos.delete", Parameters_); + +Return Response; + EndFunction // Upload video to server // Uploads video to the group for further use -// +// // Parameters: -// Video - String, BinaryData - Video file - file -// Name - String - Video name - title -// Description - String - Video description - description -// Album - String - Album ID, if necessary - album -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// Video - String, BinaryData - Video file - file +// Name - String - Video name - title +// Description - String - Video description - description +// Album - String - Album ID, if necessary - album +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - Serialized JSON response from VK +// Key-Value Pair - Serialized JSON response from VK Function UploadVideoToServer(Val Video - , Val Name - , Val Description = "" - , Val Album = "" - , Val Parameters = "") Export - - String_ = "String"; - Parameters = GetStandardParameters(Parameters); - - OPI_Tools.AddField("name" , Name, String_, Parameters); - OPI_Tools.AddField("description", Description , String_, Parameters); - OPI_Tools.AddField("album_id" , Album , String_, Parameters); - - Response = OPI_Tools.Get("api.vk.com/method/video.save", Parameters); - - Result = Response["response"]; - - If Not ValueFilled(Result) Then - Return Response; - EndIf; - - URL = Result["upload_url"]; - - If Not ValueFilled(URL) Then - Return Response; - EndIf; - - FileMapping = New Match; - OPI_Tools.AddField("video_file.mp4", Video, "BinaryData", FileMapping); - - DataSize = FileMapping["video_file.mp4"].Size(); - DataSize = OPI_Tools.NumberToString(DataSize); - - Response = OPI_Tools.PostMultipart(URL, , FileMapping, "video/mp4"); - - Return Response; - +, Val Name +, Val Description = "" +, Val Album = "" +, Val Parameters = "") Export + +String_ = "String"; +Parameters = GetStandardParameters(Parameters); + +OPI_Tools.AddField("name" , Name, String_, Parameters); +OPI_Tools.AddField("description", Description , String_, Parameters); +OPI_Tools.AddField("album_id" , Album , String_, Parameters); + +Response = OPI_Tools.Get("api.vk.com/method/video.save", Parameters); + +Result = Response["response"]; + +If Not ValueIsFilled(Result) Then +Return Response; +EndIf; + +URL = Result["upload_url"]; + +If Not ValueIsFilled(URL) Then +Return Response; +EndIf; + +FileMapping = New Match; +OPI_Tools.AddField("video_file.mp4", Video, "BinaryData", FileMapping); + +DataSize = FileMapping["video_file.mp4"].Size(); +DataSize = OPI_Tools.NumberToString(DataSize); + +Response = OPI_Tools.PostMultipart(URL, , FileMapping, "video/mp4"); + +Return Response; + EndFunction // Upload photo to server // Uploads photo to server for further use -// +// // Parameters: -// Image - String, BinaryData - Image file - file -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// View - String - View upload (Post, Product, Story, Poll, Miscellaneous) - type -// +// Image - String, BinaryData - Image file - file +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// View - String - View upload (Post, Product, Story, Poll, Miscellaneous) - type +// // Return value: -// Key-Value Pair - Serialized JSON response from VK +// Key-Value Pair - Serialized JSON response from VK Function UploadPhotoToServer(Val Image, Val Parameters = "", Val View = "Post") Export - - Parameters = GetStandardParameters(Parameters); - Method = DetermineImageUploadMethod(View); - Files = New Match; - - Response = "response"; - URL = "api.vk.com/method/"; - Upload = URL + Method["Upload"]; - Save = URL + Method["Save"]; - - If TypeValue(Image) = Type("String") Then - ImageKey = StringReplace(Image, ".", "___"); - OPI_TypeConversion.GetBinaryData(Image); - Otherwise - ImageKey = "image___jpeg"; - EndIf; - - Files.Insert(ImageKey, Image); - - For N = 1 by 5 Loop - - Response = OPI_Tools.Get(Upload, Parameters); - Result = Response[Response]; - - If ValueFilled(Result) Then - - URL = Result["upload_url"]; - - If Not ValueFilled(URL) Then - Return Response; - EndIf; - - Otherwise - Return Response; - EndIf; - - Parameters.Insert("upload_url", URL); - Response = OPI_Tools.PostMultipart(URL, Parameters, Files); - - If TypeValue(Response) = Type("Match") Then - Interrupt; - EndIf; - - EndOfLoop; - - If TypeValue(Response) <> Type("Match") Then - Return GetStringFromBinaryData(Response); - EndIf; - FillPhotoUploadParameters(Method, Response, Parameters); - - Response = OPI_Tools.Get(Save, Parameters); - - Return Response; - +Parameters = GetStandardParameters(Parameters); +Method = DetermineImageUploadMethod(View); +Files = New Match; + +Response = "response"; +URL = "api.vk.com/method/"; +Upload = URL + Method["Upload"]; +Save = URL + Method["Save"]; + +If TypeValue(Image) = Type("String") Then +ImageKey = StringReplace(Image, ".", "___"); +OPI_TypeConversion.GetBinaryData(Image); +Else +ImageKey = "image___jpeg"; +EndIf; + +Files.Insert(ImageKey, Image); + +For N = 1 For 5 Do + +Response = OPI_Tools.Get(Upload, Parameters); +Result = Response[Response]; + +If ValueIsFilled(Result) Then + +URL = Result["upload_url"]; + +If Not ValueIsFilled(URL) Then +Return Response; +EndIf; + +Else +Return Response; +EndIf; + +Parameters.Insert("upload_url", URL); +Response = OPI_Tools.PostMultipart(URL, Parameters, Files); + +If TypeValue(Response) = Type("Match") Then +Break; +EndIf; + +EndDo; + +If TypeValue(Response) <> Type("Match") Then +Return GetStringFromBinaryData(Response); +EndIf; + +FillPhotoUploadParameters(Method, Response, Parameters); + +Response = OPI_Tools.Get(Save, Parameters); + +Return Response; + EndFunction #EndRegion @@ -501,49 +501,49 @@ EndFunction // Creates a new discussion // // Parameters: -// Name - String - Discussion name - title -// Text of the first message - String - Text of the first message - text -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// Name - String - Discussion name - title +// Text of the first message - String - Text of the first message - text +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - Serialized JSON response from VK +// Key-Value Pair - Serialized JSON response from VK Function CreateDiscussion(Val Name, Val Text of the first message, Val Parameters = "") Export - - OPI_TypeConversion.GetLine(Name); - OPI_TypeConversion.GetLine(Text of the first message); - - Parameters_ = GetStandardParameters(Parameters); - Parameters_.Insert("title", Name); - Parameters_.Insert("text" , Text of the first message); - - Response = OPI_Tools.Get("api.vk.com/method/board.addTopic", Parameters_); - - Return Response; - + +OPI_TypeConversion.GetLine(Name); +OPI_TypeConversion.GetLine(Text of the first message); + +Parameters_ = GetStandardParameters(Parameters); +Parameters_.Insert("title", Name); +Parameters_.Insert("text" , Text of the first message); + +Response = OPI_Tools.Get("api.vk.com/method/board.addTopic", Parameters_); + +Return Response; + EndFunction // Close discussion // Close or delete discussion // // Parameters: -// DiscussionID - String, Number - Discussion ID - topic -// Delete completely - Boolean - Delete completely (True) or close - remove -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// DiscussionID - String, Number - Discussion ID - topic +// Delete completely - Boolean - Delete completely (True) or close - remove +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - Serialized JSON response from VK +// Key-Value Pair - Serialized JSON response from VK Function CloseDiscussion(Val DiscussionID, Val Delete completely = False, Val Parameters = "") Export - - OPI_TypeConversion.GetLine(DiscussionID); - OPI_TypeConversion.GetBoolean(Delete completely); - - Parameters_ = GetStandardParameters(Parameters); - Parameters_.Insert("topic_id", DiscussionID); - - Method = ?(Delete completely, "deleteTopic", "closeTopic"); - Response = OPI_Tools.Get("api.vk.com/method/board." + Method, Parameters_); - - Return Response; + +OPI_TypeConversion.GetLine(DiscussionID); +OPI_TypeConversion.GetBoolean(Delete completely); + +Parameters_ = GetStandardParameters(Parameters); +Parameters_.Insert("topic_id", DiscussionID); + +Method = ?(Delete completely, "deleteTopic", "closeTopic"); +Response = OPI_Tools.Get("api.vk.com/method/board." + Method, Parameters_); + +Return Response; EndFunction @@ -551,21 +551,21 @@ EndFunction // Opens a previously closed discussion // // Parameters: -// DiscussionID - String, Number - Discussion ID - topic -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// DiscussionID - String, Number - Discussion ID - topic +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - Serialized JSON response from VK +// Key-Value Pair - Serialized JSON response from VK Function OpenDiscussion(Val DiscussionID, Val Parameters = "") Export - - OPI_TypeConversion.GetLine(DiscussionID); - - Parameters_ = GetStandardParameters(Parameters); - Parameters_.Insert("topic_id", DiscussionID); - - Response = OPI_Tools.Get("api.vk.com/method/board.openTopic", Parameters_); - - Return Response; + +OPI_TypeConversion.GetLine(DiscussionID); + +Parameters_ = GetStandardParameters(Parameters); +Parameters_.Insert("topic_id", DiscussionID); + +Response = OPI_Tools.Get("api.vk.com/method/board.openTopic", Parameters_); + +Return Response; EndFunction @@ -573,24 +573,24 @@ EndFunction // Adds a message to the discussion on behalf of the group // // Parameters: -// DiscussionID - String, Number - Discussion ID - topic -// Text - String - Message text - text -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// DiscussionID - String, Number - Discussion ID - topic +// Text - String - Message text - text +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - Serialized JSON response from VK +// Key-Value Pair - Serialized JSON response from VK Function WriteInDiscussion(Val DiscussionID, Val Text, Val Parameters = "") Export - - OPI_TypeConversion.GetLine(DiscussionID); - OPI_TypeConversion.GetLine(Text); - - Parameters_ = GetStandardParameters(Parameters); - Parameters_.Insert("topic_id", DiscussionID); - Parameters_.Insert("message" , Text); - - Response = OPI_Tools.Get("api.vk.com/method/board.createComment", Parameters_); - - Return Response; + +OPI_TypeConversion.GetLine(DiscussionID); +OPI_TypeConversion.GetLine(Text); + +Parameters_ = GetStandardParameters(Parameters); +Parameters_.Insert("topic_id", DiscussionID); +Parameters_.Insert("message" , Text); + +Response = OPI_Tools.Get("api.vk.com/method/board.createComment", Parameters_); + +Return Response; EndFunction @@ -602,30 +602,30 @@ EndFunction // Likes a post // // Parameters: -// PostID - String, Number - Post ID - post -// WallID - String, Number - ID of the wall where the post is located - wall -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// PostID - String, Number - Post ID - post +// WallID - String, Number - ID of the wall where the post is located - wall +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - Serialized JSON response from VK +// Key-Value Pair - Serialized JSON response from VK Function LikePost(Val PostID, Val WallID = "", Val Parameters = "") Export - - OPI_TypeConversion.GetLine(PostID); - OPI_TypeConversion.GetLine(WallID); - - Parameters_ = GetStandardParameters(Parameters); - WallID = ?(ValueFilled(WallID), WallID, Parameters_["owner_id"]); - VKObject = "wall" + WallID + "_" + OPI_Tools.NumberToString(PostID); - - Parameters_.Insert("type" , "post"); - Parameters_.Insert("object" , VKObject); - Parameters_.Insert("item_id" , OPI_Tools.NumberToString(PostID)); - Parameters_.Insert("owner_id" , OPI_Tools.NumberToString(WallID)); - Parameters_.Insert("from_group" , 0); - - Response = OPI_Tools.Get("api.vk.com/method/likes.add", Parameters_); - - Return Response; + +OPI_TypeConversion.GetLine(PostID); +OPI_TypeConversion.GetLine(WallID); + +Parameters_ = GetStandardParameters(Parameters); +WallID = ?(ValueIsFilled(WallID), WallID, Parameters_["owner_id"]); +VKObject = "wall" + WallID + "_" + OPI_Tools.NumberToString(PostID); + +Parameters_.Insert("type" , "post"); +Parameters_.Insert("object" , VKObject); +Parameters_.Insert("item_id" , OPI_Tools.NumberToString(PostID)); +Parameters_.Insert("owner_id" , OPI_Tools.NumberToString(WallID)); +Parameters_.Insert("from_group" , 0); + +Response = OPI_Tools.Get("api.vk.com/method/likes.add", Parameters_); + +Return Response; EndFunction @@ -633,39 +633,39 @@ EndFunction // Reposts the record // // Parameters: -// PostID - String, Number - Post ID - post -// WallID - String, Number - ID of the wall where the post is located - from -// Target wall - String, Number - ID of the target wall or group - to -// Advertising - Boolean - Sign of an advertising post - ad -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// PostID - String, Number - Post ID - post +// WallID - String, Number - ID of the wall where the post is located - from +// Target wall - String, Number - ID of the target wall or group - to +// Advertising - Boolean - Sign of an advertising post - ad +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - Serialized JSON response from VK +// Key-Value Pair - Serialized JSON response from VK Function MakeRepost(Val PostID - , Val WallID = "" - , Val Target wall = "" - , Val Advertising = False - , Val Parameters = "") Export - - Parameters_ = GetStandardParameters(Parameters); - GroupId = Parameters_["group_id"]; - - OPI_TypeConversion.GetLine(GroupId); - OPI_TypeConversion.GetLine(PostID); - OPI_TypeConversion.GetLine(WallID); - OPI_TypeConversion.GetLine(Target wall); - OPI_TypeConversion.GetBoolean(Advertising); - - Source = ?(ValueFilled(WallID), WallID, GroupId); - Receiver = ?(ValueFilled(Target wall), Target wall, GroupId); +, Val WallID = "" +, Val Target wall = "" +, Val Advertising = False +, Val Parameters = "") Export - Parameters_.Insert("object" , "wall" + Source + "_" + OPI_Tools.NumberToString(PostID)); - Parameters_.Insert("group_id" , StringReplace(Receiver, "-", "")); - Parameters_.Insert("mark_as_ads" , ?(Advertising, 1, 0)); - - Response = OPI_Tools.Get("api.vk.com/method/wall.repost", Parameters_); - - Return Response; +Parameters_ = GetStandardParameters(Parameters); +GroupId = Parameters_["group_id"]; + +OPI_TypeConversion.GetLine(GroupId); +OPI_TypeConversion.GetLine(PostID); +OPI_TypeConversion.GetLine(WallID); +OPI_TypeConversion.GetLine(Target wall); +OPI_TypeConversion.GetBoolean(Advertising); + +Source = ?(ValueIsFilled(WallID), WallID, GroupId); +Receiver = ?(ValueIsFilled(Target wall), Target wall, GroupId); + +Parameters_.Insert("object" , "wall" + Source + "_" + OPI_Tools.NumberToString(PostID)); +Parameters_.Insert("group_id" , StringReplace(Receiver, "-", "")); +Parameters_.Insert("mark_as_ads" , ?(Advertising, 1, 0)); + +Response = OPI_Tools.Get("api.vk.com/method/wall.repost", Parameters_); + +Return Response; EndFunction @@ -673,41 +673,41 @@ EndFunction // Write a message to a user in the community's dialog // // Parameters: -// Text - String - Message text - text -// UserID - String - Recipient user ID - user -// Communitytoken - String - Community chat bot token, which can be obtained in the settings - ct -// Keyboard - String - JSON keyboard. See FormKeyboard - keyboard -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// Text - String - Message text - text +// UserID - String - Recipient user ID - user +// Communitytoken - String - Community chat bot token, which can be obtained in the settings - ct +// Keyboard - String - JSON keyboard. See FormKeyboard - keyboard +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - Serialized JSON response from VK +// Key-Value Pair - Serialized JSON response from VK Function WriteMessage(Val Text - , Val UserID - , Val Communitytoken - , Val Keyboard = "" - , Val Parameters = "") Export - - OPI_TypeConversion.GetLine(Text); - OPI_TypeConversion.GetLine(UserID); - OPI_TypeConversion.GetLine(Communitytoken); - OPI_TypeConversion.GetLine(Keyboard); - - Parameters_ = GetStandardParameters(Parameters); - Parameters_.Insert("access_token", Communitytoken); - - Parameters_.Insert("user_id" , UserID); - Parameters_.Insert("peer_id" , UserID); - Parameters_.Insert("parse_mode" , "Markdown"); - Parameters_.Insert("random_id" , 0); - Parameters_.Insert("message" , Text); - - If ValueFilled(Keyboard) Then - Parameters_.Insert("keyboard", Keyboard); - EndIf; - - Response = OPI_Tools.Get("api.vk.com/method/messages.send", Parameters_); - - Return Response; +, Val UserID +, Val Communitytoken +, Val Keyboard = "" +, Val Parameters = "") Export + +OPI_TypeConversion.GetLine(Text); +OPI_TypeConversion.GetLine(UserID); +OPI_TypeConversion.GetLine(Communitytoken); +OPI_TypeConversion.GetLine(Keyboard); + +Parameters_ = GetStandardParameters(Parameters); +Parameters_.Insert("access_token", Communitytoken); + +Parameters_.Insert("user_id" , UserID); +Parameters_.Insert("peer_id" , UserID); +Parameters_.Insert("parse_mode" , "Markdown"); +Parameters_.Insert("random_id" , 0); +Parameters_.Insert("message" , Text); + +If ValueIsFilled(Keyboard) Then +Parameters_.Insert("keyboard", Keyboard); +EndIf; + +Response = OPI_Tools.Get("api.vk.com/method/messages.send", Parameters_); + +Return Response; EndFunction @@ -715,33 +715,33 @@ EndFunction // Creates a comment under the selected record // // Parameters: -// PostID - String, Number - ID of the target post - post -// WallID - String, Number - ID of the wall where the post is located - wall -// Text - String - Comment text - text -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// PostID - String, Number - ID of the target post - post +// WallID - String, Number - ID of the wall where the post is located - wall +// Text - String - Comment text - text +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - Serialized JSON response from VK +// Key-Value Pair - Serialized JSON response from VK Function WriteComment(Val PostID, Val WallID, Val Text, Val Parameters = "") Export - Parameters_ = GetStandardParameters(Parameters); - GroupId = Parameters_["group_id"]; - - OPI_TypeConversion.GetLine(GroupId); - OPI_TypeConversion.GetLine(PostID); - OPI_TypeConversion.GetLine(WallID); - OPI_TypeConversion.GetLine(Text); - - Parameters_.Insert("owner_id" , WallID); - Parameters_.Insert("from_group" , GroupId); - Parameters_.Insert("post_id" , PostID); - Parameters_.Insert("message" , Text); - - Parameters_.Delete("group_id"); - - Response = OPI_Tools.Get("api.vk.com/method/wall.createComment", Parameters_); - - Return Response; +Parameters_ = GetStandardParameters(Parameters); +GroupId = Parameters_["group_id"]; + +OPI_TypeConversion.GetLine(GroupId); +OPI_TypeConversion.GetLine(PostID); +OPI_TypeConversion.GetLine(WallID); +OPI_TypeConversion.GetLine(Text); + +Parameters_.Insert("owner_id" , WallID); +Parameters_.Insert("from_group" , GroupId); +Parameters_.Insert("post_id" , PostID); +Parameters_.Insert("message" , Text); + +Parameters_.Delete("group_id"); + +Response = OPI_Tools.Get("api.vk.com/method/wall.createComment", Parameters_); + +Return Response; EndFunction @@ -749,37 +749,37 @@ EndFunction // Creates a shortened URL from a regular one // // Parameters: -// URL - String - URL for shortening - url -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// URL - String - URL for shortening - url +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// String - Shortened URL +// String - Shortened URL Function ShortenLink(Val URL, Val Parameters = "") Export - - OPI_TypeConversion.GetLine(URL); - - Response = "response"; - Parameters_ = New Structure; - Parameters_ = GetStandardParameters(Parameters); - Parameters_.Insert("url", URL); - - Response = OPI_Tools.Get("https://api.vk.com/method/utils.getShortLink", Parameters_); - Result = Response[Response]; - - If ValueFilled(Result) Then - - URL = Result["short_url"]; - - If ValueFilled(URL) Then - Return URL; - Otherwise - Return Response; - EndIf; - - Otherwise - Return Response; - EndIf; - + +OPI_TypeConversion.GetLine(URL); + +Response = "response"; +Parameters_ = New Structure; +Parameters_ = GetStandardParameters(Parameters); +Parameters_.Insert("url", URL); + +Response = OPI_Tools.Get("https://api.vk.com/method/utils.getShortLink", Parameters_); +Result = Response[Response]; + +If ValueIsFilled(Result) Then + +URL = Result["short_url"]; + +If ValueIsFilled(URL) Then +Return URL; +Else +Return Response; +EndIf; + +Else +Return Response; +EndIf; + EndFunction #EndRegion @@ -790,89 +790,89 @@ EndFunction // Gets the overall community statistics for a period // // Parameters: -// StartDate - Date - Start date of the period - datefrom -// EndDate - Date - End date of the period - dateto -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// StartDate - Date - Start date of the period - datefrom +// EndDate - Date - End date of the period - dateto +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - Serialized JSON response from VK +// Key-Value Pair - Serialized JSON response from VK Function GetStatistics(Val StartDate, Val EndDate, Val Parameters = "") Export - - OPI_TypeConversion.GetDate(StartDate); - OPI_TypeConversion.GetDate(EndDate); - - Parameters_ = GetStandardParameters(Parameters); - - StartDate = OPI_Tools.UNIXTime(StartDate); - EndDate = OPI_Tools.UNIXTime(EndDate); - - Parameters_.Insert("timestamp_from", StartDate); - Parameters_.Insert("timestamp_to" , EndDate); - Parameters_.Insert("stats_groups" , "visitors, reach, activity"); - - Response = OPI_Tools.Get("api.vk.com/method/stats.get", Parameters_); - - Return Response; - + +OPI_TypeConversion.GetDate(StartDate); +OPI_TypeConversion.GetDate(EndDate); + +Parameters_ = GetStandardParameters(Parameters); + +StartDate = OPI_Tools.UNIXTime(StartDate); +EndDate = OPI_Tools.UNIXTime(EndDate); + +Parameters_.Insert("timestamp_from", StartDate); +Parameters_.Insert("timestamp_to" , EndDate); +Parameters_.Insert("stats_groups" , "visitors, reach, activity"); + +Response = OPI_Tools.Get("api.vk.com/method/stats.get", Parameters_); + +Return Response; + EndFunction // Get post statistics // Gets statistics in terms of posts // // Parameters: -// Array of post IDs - Array of String,Number - Array of post IDs - posts -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// Array of post IDs - Array of String,Number - Array of post IDs - posts +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Array of Arbitrary - Array of post statistics data +// Array of Arbitrary - Array of post statistics data Function GetPostStatistics(Val Array of post IDs, Val Parameters = "") Export - - OPI_TypeConversion.GetCollection(Array of post IDs); - - Parameters_ = GetStandardParameters(Parameters); - AnswersArray = New Array; - Array of Sets = New Array; - MaximumPosts = 30; - Response = "response"; - - For Each Post Of Array of post IDs Loop - - Array of Sets.Add(OPI_Tools.NumberToString(Post)); - - If Array of Sets.Quantity() = MaximumPosts Then - - NumbersString = StrJoin(Array of Sets, ","); - Parameters_.Insert("post_ids", NumbersString); - - Statistics = OPI_Tools.Get("api.vk.com/method/stats.getPostReach", Parameters_); - Array of Statistics = Statistics[Response]; - - For Each StatisticsItem Of Array of Statistics Loop - AnswersArray.Add(StatisticsItem); - EndOfLoop; - - Array of Sets = New Array; - - EndIf; - - EndOfLoop; - - NumbersString = StrJoin(Array of Sets, ","); - Parameters_.Insert("post_ids", NumbersString); - - Statistics = OPI_Tools.Get("api.vk.com/method/stats.getPostReach", Parameters_); - Array of Statistics = Statistics[Response]; - - If TypeValue(Array of Statistics) = Type("Array") Then - For Each StatisticsItem Of Array of Statistics Loop - AnswersArray.Add(StatisticsItem); - EndOfLoop; - EndIf; - Return AnswersArray; - +OPI_TypeConversion.GetCollection(Array of post IDs); + +Parameters_ = GetStandardParameters(Parameters); +AnswersArray = New Array; +Array of Sets = New Array; +MaximumPosts = 30; +Response = "response"; + +For Each Post In Array of post IDs Do + +Array of Sets.Add(OPI_Tools.NumberToString(Post)); + +If Array of Sets.Quantity() = MaximumPosts Then + +NumbersString = StrJoin(Array of Sets, ","); +Parameters_.Insert("post_ids", NumbersString); + +Statistics = OPI_Tools.Get("api.vk.com/method/stats.getPostReach", Parameters_); +Array of Statistics = Statistics[Response]; + +For Each StatisticsItem In Array of Statistics Do +AnswersArray.Add(StatisticsItem); +EndDo; + +Array of Sets = New Array; + +EndIf; + +EndDo; + +NumbersString = StrJoin(Array of Sets, ","); +Parameters_.Insert("post_ids", NumbersString); + +Statistics = OPI_Tools.Get("api.vk.com/method/stats.getPostReach", Parameters_); +Array of Statistics = Statistics[Response]; + +If TypeValue(Array of Statistics) = Type("Array") Then +For Each StatisticsItem In Array of Statistics Do +AnswersArray.Add(StatisticsItem); +EndDo; +EndIf; + +Return AnswersArray; + EndFunction - + #EndRegion #Region AdAccountManagement @@ -881,163 +881,163 @@ EndFunction // Creates a campaign in the selected advertising account // // Parameters: -// AccountID - String, Number - Advertising account ID - cabinet -// Name - String - Campaign name - title -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// AccountID - String, Number - Advertising account ID - cabinet +// Name - String - Campaign name - title +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - Serialized JSON response from VK +// Key-Value Pair - Serialized JSON response from VK Function CreateAdvertisingCampaign(Val AccountID, Val Name, Val Parameters = "") Export - - OPI_TypeConversion.GetLine(AccountID); - OPI_TypeConversion.GetLine(Name); - - CurrentDate = OPI_Tools.GetCurrentDate(); - EndDate = AddMonth(CurrentDate, 24); - - Parameters_ = GetStandardParameters(Parameters); - Parameters_.Insert("account_id", AccountID); - - Array of Structures = New Array; - StartDate = OPI_Tools.UNIXTime(CurrentDate); - EndDate = OPI_Tools.UNIXTime(EndDate); - - CampaignStructure = New Structure; - CampaignStructure.Insert("type" , "promoted_posts"); - CampaignStructure.Insert("name" , Name); - CampaignStructure.Insert("day_limit" , 0); - CampaignStructure.Insert("all_limit" , 0); - CampaignStructure.Insert("start_time" , StartDate); - CampaignStructure.Insert("stop_time" , EndDate); - CampaignStructure.Insert("status" , 1); - - Array of Structures.Add(CampaignStructure); - - JSONDate = OPI_Tools.JSONString(Array of Structures); - - Parameters_.Insert("data", JSONDate); - - Response = OPI_Tools.Get("api.vk.com/method/ads.createCampaigns", Parameters_); - - Return Response; - + +OPI_TypeConversion.GetLine(AccountID); +OPI_TypeConversion.GetLine(Name); + +CurrentDate = OPI_Tools.GetCurrentDate(); +EndDate = AddMonth(CurrentDate, 24); + +Parameters_ = GetStandardParameters(Parameters); +Parameters_.Insert("account_id", AccountID); + +Array of Structures = New Array; +StartDate = OPI_Tools.UNIXTime(CurrentDate); +EndDate = OPI_Tools.UNIXTime(EndDate); + +CampaignStructure = New Structure; +CampaignStructure.Insert("type" , "promoted_posts"); +CampaignStructure.Insert("name" , Name); +CampaignStructure.Insert("day_limit" , 0); +CampaignStructure.Insert("all_limit" , 0); +CampaignStructure.Insert("start_time" , StartDate); +CampaignStructure.Insert("stop_time" , EndDate); +CampaignStructure.Insert("status" , 1); + +Array of Structures.Add(CampaignStructure); + +JSONDate = OPI_Tools.JSONString(Array of Structures); + +Parameters_.Insert("data", JSONDate); + +Response = OPI_Tools.Get("api.vk.com/method/ads.createCampaigns", Parameters_); + +Return Response; + EndFunction // Create advertising post // Creates an advertising post based on a post // // Parameters: -// CampaignNumber - String, Number - Advertising campaign ID - campaign -// DailyLimit - String, Number - Daily limit in rubles - limit -// CategoryNumber - String, Number - Advertising category number - category -// PostID - String, Number - ID of the post used for advertising - post -// AccountID - String, Number - Advertising account ID - cabinet -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// CampaignNumber - String, Number - Advertising campaign ID - campaign +// DailyLimit - String, Number - Daily limit in rubles - limit +// CategoryNumber - String, Number - Advertising category number - category +// PostID - String, Number - ID of the post used for advertising - post +// AccountID - String, Number - Advertising account ID - cabinet +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - Serialized JSON response from VK +// Key-Value Pair - Serialized JSON response from VK Function CreateAd(Val CampaignNumber - , Val DailyLimit - , Val CategoryNumber - , Val PostID - , Val AccountID - , Val Parameters = "") Export - - Parameters_ = GetStandardParameters(Parameters); - GroupId = Parameters_["group_id"]; - - OPI_TypeConversion.GetLine(GroupId); - OPI_TypeConversion.GetLine(CampaignNumber); - OPI_TypeConversion.GetLine(DailyLimit); - OPI_TypeConversion.GetLine(CategoryNumber); - OPI_TypeConversion.GetLine(PostID); - OPI_TypeConversion.GetLine(AccountID); - - Link = "https://vk.com/wall-" + GroupId + "_" + PostID; - - Array of Structures = New Array; - CampaignStructure = New Structure; - CampaignStructure.Insert("campaign_id" , CampaignNumber); - CampaignStructure.Insert("ad_format" , 9); - CampaignStructure.Insert("conversion_event_id" , 1); - CampaignStructure.Insert("autobidding" , 1); - CampaignStructure.Insert("cost_type" , 3); - CampaignStructure.Insert("goal_type" , 2); - CampaignStructure.Insert("ad_platform" , "all"); - CampaignStructure.Insert("publisher_platforms" , "vk"); - CampaignStructure.Insert("publisher_platforms_auto" , "1"); - CampaignStructure.Insert("day_limit" , DailyLimit); - CampaignStructure.Insert("all_limit" , "0"); - CampaignStructure.Insert("category1_id" , CategoryNumber); - CampaignStructure.Insert("age_restriction" , 0); - CampaignStructure.Insert("status" , 1); - CampaignStructure.Insert("name" , "Ad"); - CampaignStructure.Insert("link_url" , Link); - - Array of Structures.Add(CampaignStructure); - - OPI_TypeConversion.GetLine(Array of Structures, True); - - Parameters_.Insert("data" , Array of Structures); - Parameters_.Insert("account_id" , AccountID); - - Response = OPI_Tools.Get("api.vk.com/method/ads.createAds", Parameters_); - - Return Response; - +, Val DailyLimit +, Val CategoryNumber +, Val PostID +, Val AccountID +, Val Parameters = "") Export + +Parameters_ = GetStandardParameters(Parameters); +GroupId = Parameters_["group_id"]; + +OPI_TypeConversion.GetLine(GroupId); +OPI_TypeConversion.GetLine(CampaignNumber); +OPI_TypeConversion.GetLine(DailyLimit); +OPI_TypeConversion.GetLine(CategoryNumber); +OPI_TypeConversion.GetLine(PostID); +OPI_TypeConversion.GetLine(AccountID); + +Link = "https://vk.com/wall-" + GroupId + "_" + PostID; + +Array of Structures = New Array; +CampaignStructure = New Structure; +CampaignStructure.Insert("campaign_id" , CampaignNumber); +CampaignStructure.Insert("ad_format" , 9); +CampaignStructure.Insert("conversion_event_id" , 1); +CampaignStructure.Insert("autobidding" , 1); +CampaignStructure.Insert("cost_type" , 3); +CampaignStructure.Insert("goal_type" , 2); +CampaignStructure.Insert("ad_platform" , "all"); +CampaignStructure.Insert("publisher_platforms" , "vk"); +CampaignStructure.Insert("publisher_platforms_auto" , "1"); +CampaignStructure.Insert("day_limit" , DailyLimit); +CampaignStructure.Insert("all_limit" , "0"); +CampaignStructure.Insert("category1_id" , CategoryNumber); +CampaignStructure.Insert("age_restriction" , 0); +CampaignStructure.Insert("status" , 1); +CampaignStructure.Insert("name" , "Ad"); +CampaignStructure.Insert("link_url" , Link); + +Array of Structures.Add(CampaignStructure); + +OPI_TypeConversion.GetLine(Array of Structures, True); + +Parameters_.Insert("data" , Array of Structures); +Parameters_.Insert("account_id" , AccountID); + +Response = OPI_Tools.Get("api.vk.com/method/ads.createAds", Parameters_); + +Return Response; + EndFunction // Pause advertising post // Pauses the display of the advertising post // // Parameters: -// AccountID - String, Number - Advertising account ID - cabinet -// AdID - String, Number - Ad ID - adv -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// AccountID - String, Number - Advertising account ID - cabinet +// AdID - String, Number - Ad ID - adv +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - Serialized JSON response from VK +// Key-Value Pair - Serialized JSON response from VK Function PauseAdvertisingAd(Val AccountID, Val AdID, Val Parameters = "") Export - - OPI_TypeConversion.GetLine(AccountID); - OPI_TypeConversion.GetLine(AdID); - - Parameters_ = GetStandardParameters(Parameters); - Parameters_.Insert("account_id", AccountID); - - Array of Structures = New Array; - CampaignStructure = New Structure; - - CampaignStructure.Insert("ad_id" , AdID); - CampaignStructure.Insert("status" , 0); - - Array of Structures.Add(CampaignStructure); - - OPI_TypeConversion.GetLine(Array of Structures, True); - - Parameters_.Insert("data", Array of Structures); - - Response = OPI_Tools.Get("api.vk.com/method/ads.updateAds", Parameters_); - - Return Response; - +OPI_TypeConversion.GetLine(AccountID); +OPI_TypeConversion.GetLine(AdID); + +Parameters_ = GetStandardParameters(Parameters); + +Parameters_.Insert("account_id", AccountID); + +Array of Structures = New Array; +CampaignStructure = New Structure; + +CampaignStructure.Insert("ad_id" , AdID); +CampaignStructure.Insert("status" , 0); + +Array of Structures.Add(CampaignStructure); + +OPI_TypeConversion.GetLine(Array of Structures, True); + +Parameters_.Insert("data", Array of Structures); + +Response = OPI_Tools.Get("api.vk.com/method/ads.updateAds", Parameters_); + +Return Response; + EndFunction // Get a list of advertising categories // Gets a list of advertising category IDs for creating an advertising post // // Parameters: -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - Serialized JSON response from VK +// Key-Value Pair - Serialized JSON response from VK Function GetAdvertisingCategoryList(Val Parameters = "") Export - - Parameters_ = GetStandardParameters(Parameters); - Response = OPI_Tools.Get("api.vk.com/method/ads.getCategories", Parameters_); - - Return Response; + +Parameters_ = GetStandardParameters(Parameters); +Response = OPI_Tools.Get("api.vk.com/method/ads.getCategories", Parameters_); + +Return Response; EndFunction @@ -1049,246 +1049,246 @@ EndFunction // Gets a list of product category IDs to specify when creating a product // // Parameters: -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Compliance From String - Key - ID, Value - Name +// Compliance From String - Key - ID, Value - Name Function GetProductCategoryList(Val Parameters = "") Export - - Response = "response"; - Parameters_ = GetStandardParameters(Parameters); - Response = OPI_Tools.Get("api.vk.com/method/market.getCategories", Parameters_); - Result = Response[Response]; - - If ValueFilled(Result) Then - - Quantity = Result["count"]; - - If Not ValueFilled(Quantity) Then - Return Response; - EndIf; - - Otherwise - Return Response; - EndIf; - - Parameters_.Insert("count", Quantity); - Response = OPI_Tools.Get("api.vk.com/method/market.getCategories", Parameters_); - Result = Response[Response]; - - If ValueFilled(Result) Then - - Categories = Result["items"]; - - If Not ValueFilled(Categories) Then - Return Response; - EndIf; - - Otherwise - Return Response; - EndIf; - - CategoryCorrespondence = New Match; - - For Each Category Of Categories Loop - CategoryCorrespondence.Insert(Category["id"], Category["name"]); - EndOfLoop; - - Return CategoryCorrespondence; - + +Response = "response"; +Parameters_ = GetStandardParameters(Parameters); +Response = OPI_Tools.Get("api.vk.com/method/market.getCategories", Parameters_); +Result = Response[Response]; + +If ValueIsFilled(Result) Then + +Quantity = Result["count"]; + +If Not ValueIsFilled(Quantity) Then +Return Response; +EndIf; + +Else +Return Response; +EndIf; + +Parameters_.Insert("count", Quantity); +Response = OPI_Tools.Get("api.vk.com/method/market.getCategories", Parameters_); +Result = Response[Response]; + +If ValueIsFilled(Result) Then + +Categories = Result["items"]; + +If Not ValueIsFilled(Categories) Then +Return Response; +EndIf; + +Else +Return Response; +EndIf; + +CategoryCorrespondence = New Match; + +For Each Category In Categories Do +CategoryCorrespondence.Insert(Category["id"], Category["name"]); +EndDo; + +Return CategoryCorrespondence; + EndFunction // Get product list // Gets the community's product list // // Parameters: -// Selection - String, Number - Selection ID, if filtering is needed - sel -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// Selection - String, Number - Selection ID, if filtering is needed - sel +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - Array of product matches +// Key-Value Pair - Array of product matches Function GetProductList(Val Selection = "", Val Parameters = "") Export - - OPI_TypeConversion.GetLine(Selection); - - Parameters_ = GetStandardParameters(Parameters); - Parameters_.Insert("count" , 200); - Parameters_.Insert("extended" , 1); - Parameters_.Insert("with_disabled", 1); - - If ValueFilled(Selection) Then - Parameters_.Insert("album_id", Selection); - EndIf; - - Array of products = New Array; - GetProductListRecursively(Array of products, Parameters_); - - Return Array of products; - + +OPI_TypeConversion.GetLine(Selection); + +Parameters_ = GetStandardParameters(Parameters); +Parameters_.Insert("count" , 200); +Parameters_.Insert("extended" , 1); +Parameters_.Insert("with_disabled", 1); + +If ValueIsFilled(Selection) Then +Parameters_.Insert("album_id", Selection); +EndIf; + +Array of products = New Array; +GetProductListRecursively(Array of products, Parameters_); + +Return Array of products; + EndFunction // Get products by ID // Gets information about products by array of IDs // // Parameters: -// Products - String, Array of Strings - Array of product IDs - items -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// Products - String, Array of Strings - Array of product IDs - items +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - Serialized JSON response from VK +// Key-Value Pair - Serialized JSON response from VK Function GetProductsByID(Val Products, Val Parameters = "") Export - - OPI_TypeConversion.GetCollection(Products); - - Parameters_ = GetStandardParameters(Parameters); - ProductsString = ""; - Owner = "owner_id"; - - For Each Product Of Products Loop - CurrentProduct = Parameters_[Owner] + "_" + Product; - CurrentProduct = OPI_Tools.NumberToString(CurrentProduct); - ProductsString = ProductsString + CurrentProduct + ","; - EndOfLoop; - - ProductsString = Left(ProductsString, StrLength(ProductsString) - 1); - Parameters_.Insert("item_ids", ProductsString); - Parameters_.Insert("extended", 1); - - Response = OPI_Tools.Get("api.vk.com/method/market.getById", Parameters_); - - Return Response; - + +OPI_TypeConversion.GetCollection(Products); + +Parameters_ = GetStandardParameters(Parameters); +ProductsString = ""; +Owner = "owner_id"; + +For Each Product In Products Do +CurrentProduct = Parameters_[Owner] + "_" + Product; +CurrentProduct = OPI_Tools.NumberToString(CurrentProduct); +ProductsString = ProductsString + CurrentProduct + ","; +EndDo; + +ProductsString = Left(ProductsString, StrLength(ProductsString) - 1); +Parameters_.Insert("item_ids", ProductsString); +Parameters_.Insert("extended", 1); + +Response = OPI_Tools.Get("api.vk.com/method/market.getById", Parameters_); + +Return Response; + EndFunction // Add product // Adds a new product to the community's catalog // // Parameters: -// ProductDescription - Key-Value Pair - See GetProductDescription - product - JSON description of the product or path -// Selection - String - Selection ID for placing the product, if needed - sel -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// ProductDescription - Key-Value Pair - See GetProductDescription - product - JSON description of the product or path +// Selection - String - Selection ID for placing the product, if needed - sel +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - Serialized JSON response from VK -Function AddProduct(Val ProductDescription, Val Selection = "", Val Parameters = "") Export - Return ProductManagement(ProductDescription, , Selection, Parameters); +// Key-Value Pair - Serialized JSON response from VK +Function AddProduct(Val ProductDescription, Val Selection = "", Val Parameters = "") Export +Return ProductManagement(ProductDescription, , Selection, Parameters); EndFunction // Edit product // Edits a previously created product // // Parameters: -// Product - Number, String - Identifier of the product being edited - item -// ProductDescription - Key-Value Pair - See GetProductDescription - product - JSON description of the product or path -// Selection - String - Identifier of the new selection, if needed - sel -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// Product - Number, String - Identifier of the product being edited - item +// ProductDescription - Key-Value Pair - See GetProductDescription - product - JSON description of the product or path +// Selection - String - Identifier of the new selection, if needed - sel +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - Serialized JSON response from VK +// Key-Value Pair - Serialized JSON response from VK Function EditProduct(Val Product, Val ProductDescription, Val Selection = "", Val Parameters = "") Export - Return ProductManagement(ProductDescription, Product, Selection, Parameters); +Return ProductManagement(ProductDescription, Product, Selection, Parameters); EndFunction // Delete product // Deletes a previously created product // // Parameters: -// Product - String, Number - Product ID - item -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// Product - String, Number - Product ID - item +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - Serialized JSON response from VK +// Key-Value Pair - Serialized JSON response from VK Function DeleteProduct(Val Product, Val Parameters = "") Export - - OPI_TypeConversion.GetLine(Product); - - Parameters_ = GetStandardParameters(Parameters); - Parameters_.Insert("item_id", Product); - - Response = OPI_Tools.Get("api.vk.com/method/market.delete", Parameters_); - - Return Response; - + +OPI_TypeConversion.GetLine(Product); + +Parameters_ = GetStandardParameters(Parameters); +Parameters_.Insert("item_id", Product); + +Response = OPI_Tools.Get("api.vk.com/method/market.delete", Parameters_); + +Return Response; + EndFunction // Group products // Groups products based on similar sets of properties // // Parameters: -// Array of products - Array Of String - Array of product IDs - items -// ExistingGroup - String - ID of the existing group, if needed - sellgroup -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// Array of products - Array Of String - Array of product IDs - items +// ExistingGroup - String - ID of the existing group, if needed - sellgroup +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - Serialized JSON response from VK +// Key-Value Pair - Serialized JSON response from VK Function GroupProducts(Val Array of products, Val ExistingGroup = "", Val Parameters = "") Export - - OPI_TypeConversion.GetLine(ExistingGroup); - OPI_TypeConversion.GetCollection(Array of products); - - Parameters_ = GetStandardParameters(Parameters); - Array_of_Products = New Array; - - For Each Product Of Array of products Loop - Array_of_Products.Add(OPI_Tools.NumberToString(Product)); - EndOfLoop; - - Products = StrJoin(Array_of_Products, ","); - - Parameters_.Insert("item_ids", Products); - - If ValueFilled(ExistingGroup) Then - Parameters_.Insert("item_group_id", ExistingGroup); - EndIf; - - Response = OPI_Tools.Get("api.vk.com/method/market.groupItems", Parameters_); - - Return Response; + +OPI_TypeConversion.GetLine(ExistingGroup); +OPI_TypeConversion.GetCollection(Array of products); + +Parameters_ = GetStandardParameters(Parameters); +Array_of_Products = New Array; + +For Each Product In Array of products Do +Array_of_Products.Add(OPI_Tools.NumberToString(Product)); +EndDo; + +Products = StrJoin(Array_of_Products, ","); + +Parameters_.Insert("item_ids", Products); + +If ValueIsFilled(ExistingGroup) Then +Parameters_.Insert("item_group_id", ExistingGroup); +EndIf; + +Response = OPI_Tools.Get("api.vk.com/method/market.groupItems", Parameters_); + +Return Response; EndFunction // Get product description. !NOCLI -// +// // Return value: -// Key-Value Pair - Empty product description: -// *Name - String - Product name -// *Description - String - Product description -// *Category - String - See GetProductCategoryList -// *Price - Number - Product price -// *OldPrice - Number - For displaying discount/changing price -// *MainPhoto - String, BinaryData - Binary data or path to photo -// *URL - String - Link to the store's website page -// *AdditionalPhotos - Array Of String - Binary Data or Photo Paths -// *PropertyValues - Array Of String - See AddPropertyVariant -// *MainInGroup - Boolean - Main in the group, if exists in the group -// *Width - Number - Width product in мм. -// *Height - Number - Height product in мм. -// *Depth - Number - Depth product in мм. -// *Weight - Number - Weight in гр. -// *SKU - String - SKU -// *AvailableBalance - Number - Balance. -1 - unlimited +// Key-Value Pair - Empty product description: +// *Name - String - Product name +// *Description - String - Product description +// *Category - String - See GetProductCategoryList +// *Price - Number - Product price +// *OldPrice - Number - For displaying discount/changing price +// *MainPhoto - String, BinaryData - Binary data or path to photo +// *URL - String - Link to the store's website page +// *AdditionalPhotos - Array Of String - Binary Data or Photo Paths +// *PropertyValues - Array Of String - See AddPropertyVariant +// *MainInGroup - Boolean - Main in the group, if exists in the group +// *Width - Number - Width product in мм. +// *Height - Number - Height product in мм. +// *Depth - Number - Depth product in мм. +// *Weight - Number - Weight in гр. +// *SKU - String - SKU +// *AvailableBalance - Number - Balance. -1 - unlimited Function GetProductDescription() Export - - Product = New Match(); - Product.Insert("Name" , "New product"); // Product name - Product.Insert("Description" , "Product description"); // Product description - Product.Insert("Category" , "20173"); // See GetProductCategoryList() - Product.Insert("Price" , 1); // Price. - Product.Insert("OldPrice" , Undefined); // For reflection change price - Product.Insert("MainPhoto" , Undefined); // BD or path to main. photo - Product.Insert("URL" , Undefined); // Link to page store - Product.Insert("AdditionalPhotos" , New Array); // Array paths or BD for add. photo - Product.Insert("PropertyValues" , New Array); // Values properties (variants). Maximum 2 - Product.Insert("MainInGroup" , False); // Make main in of its group - Product.Insert("Width" , Undefined); // In millimeters - Product.Insert("Height" , Undefined); // In millimeters - Product.Insert("Depth" , Undefined); // In millimeters - Product.Insert("Weight" , Undefined); // In grams - Product.Insert("SKU" , Undefined); // SKU - Product.Insert("AvailableBalance" , 1); - - Return Product; - + +Product = New Match(); +Product.Insert("Name" , "New product"); // Product name +Product.Insert("Description" , "Product description"); // Product description +Product.Insert("Category" , "20173"); // See GetProductCategoryList() +Product.Insert("Price" , 1); // Price. +Product.Insert("OldPrice" , Undefined); // For reflection change price +Product.Insert("MainPhoto" , Undefined); // BD or path to main. photo +Product.Insert("URL" , Undefined); // Link to page store +Product.Insert("AdditionalPhotos" , New Array); // Array paths or BD for add. photo +Product.Insert("PropertyValues" , New Array); // Values properties (variants). Maximum 2 +Product.Insert("MainInGroup" , False); // Make main in of its group +Product.Insert("Width" , Undefined); // In millimeters +Product.Insert("Height" , Undefined); // In millimeters +Product.Insert("Depth" , Undefined); // In millimeters +Product.Insert("Weight" , Undefined); // In grams +Product.Insert("SKU" , Undefined); // SKU +Product.Insert("AvailableBalance" , 1); + +Return Product; + EndFunction #EndRegion @@ -1299,178 +1299,178 @@ EndFunction // Gets the list of product selections // // Parameters: -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - Array of selection matches +// Key-Value Pair - Array of selection matches Function GetSelectionList(Val Parameters = "") Export - - Parameters_ = GetStandardParameters(Parameters); - Parameters_.Insert("count", 100); - - ArrayOfAlbums = New Array; - GetAlbumListRecursively(ArrayOfAlbums, Parameters_); - - Return ArrayOfAlbums; - + +Parameters_ = GetStandardParameters(Parameters); +Parameters_.Insert("count", 100); + +ArrayOfAlbums = New Array; +GetAlbumListRecursively(ArrayOfAlbums, Parameters_); + +Return ArrayOfAlbums; + EndFunction // Get selections by ID // Gets the list of selections by array of IDs // // Parameters: -// Selections - String, Array of Strings - Selection IDs - sels -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// Selections - String, Array of Strings - Selection IDs - sels +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - Serialized JSON response from VK +// Key-Value Pair - Serialized JSON response from VK Function GetSelectionsByID(Val Selections, Val Parameters = "") Export - - OPI_TypeConversion.GetCollection(Selections); - - Parameters_ = GetStandardParameters(Parameters); - Selections_ = New Array; - SelectionsString = ""; - - For Each Selection Of Selections Loop - Selections_.Add(OPI_Tools.NumberToString(Selection)); - EndOfLoop; - - SelectionsString = StrJoin(Selections_, ","); - - Parameters_.Insert("album_ids", SelectionsString); - - Response = OPI_Tools.Get("api.vk.com/method/market.getAlbumById", Parameters_); - - Return Response; - + +OPI_TypeConversion.GetCollection(Selections); + +Parameters_ = GetStandardParameters(Parameters); +Selections_ = New Array; +SelectionsString = ""; + +For Each Selection In Selections Do +Selections_.Add(OPI_Tools.NumberToString(Selection)); +EndDo; + +SelectionsString = StrJoin(Selections_, ","); + +Parameters_.Insert("album_ids", SelectionsString); + +Response = OPI_Tools.Get("api.vk.com/method/market.getAlbumById", Parameters_); + +Return Response; + EndFunction // Create product selection // Creates an empty product selection // // Parameters: -// Name - String - Selection name - title -// Image - String, BinaryData - Image file - picture -// Main - Boolean - Main - main -// Hidden - Boolean - Hidden - hidden -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// Name - String - Selection name - title +// Image - String, BinaryData - Image file - picture +// Main - Boolean - Main - main +// Hidden - Boolean - Hidden - hidden +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - Serialized JSON response from VK +// Key-Value Pair - Serialized JSON response from VK Function CreateProductCollection(Val Name - , Val Image - , Val Main = False - , Val Hidden = False - , Val Parameters = "") Export - - Return SelectionManagement(Name, Image, , Main, Hidden, Parameters); - +, Val Image +, Val Main = False +, Val Hidden = False +, Val Parameters = "") Export + +Return SelectionManagement(Name, Image, , Main, Hidden, Parameters); + EndFunction // Edit product selection // Edits the properties of a product selection // // Parameters: -// Name - String - New selection name - title -// Selection - String - Selection ID - sel -// Image - String, BinaryData - New selection image - picture -// Main - Boolean - Main - main -// Hidden - Boolean - Hidden - hidden -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// Name - String - New selection name - title +// Selection - String - Selection ID - sel +// Image - String, BinaryData - New selection image - picture +// Main - Boolean - Main - main +// Hidden - Boolean - Hidden - hidden +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - Serialized JSON response from VK +// Key-Value Pair - Serialized JSON response from VK Function EditProductCollection(Val Name - , Val Selection - , Val Image = "" - , Val Main = False - , Val Hidden = False - , Val Parameters = "") Export - - Return SelectionManagement(Name, Image, Selection, Main, Hidden, Parameters); - +, Val Selection +, Val Image = "" +, Val Main = False +, Val Hidden = False +, Val Parameters = "") Export + +Return SelectionManagement(Name, Image, Selection, Main, Hidden, Parameters); + EndFunction // Add product to selection // Adds a product to the selection // // Parameters: -// Array of products - Array of string, number - Array of products or product - items -// Selection - String - Selection ID - sel -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// Array of products - Array of string, number - Array of products or product - items +// Selection - String - Selection ID - sel +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - Serialized JSON response from VK +// Key-Value Pair - Serialized JSON response from VK Function AddProductToSelection(Val Array of products, Val Selection, Val Parameters = "") Export - - OPI_TypeConversion.GetCollection(Array of products); - OPI_TypeConversion.GetLine(Selection); - - Parameters_ = GetStandardParameters(Parameters); - Array_of_Products = New Array; - - For Each Product Of Array of products Loop - Array_of_Products.Add(OPI_Tools.NumberToString(Product)); - EndOfLoop; - - ProductList = StrJoin(Array_of_Products, ","); - - Parameters_.Insert("item_ids" , ProductList); - Parameters_.Insert("album_ids", Selection); - - Response = OPI_Tools.Get("api.vk.com/method/market.addToAlbum", Parameters_); - - Return Response; - + +OPI_TypeConversion.GetCollection(Array of products); +OPI_TypeConversion.GetLine(Selection); + +Parameters_ = GetStandardParameters(Parameters); +Array_of_Products = New Array; + +For Each Product In Array of products Do +Array_of_Products.Add(OPI_Tools.NumberToString(Product)); +EndDo; + +ProductList = StrJoin(Array_of_Products, ","); + +Parameters_.Insert("item_ids" , ProductList); +Parameters_.Insert("album_ids", Selection); + +Response = OPI_Tools.Get("api.vk.com/method/market.addToAlbum", Parameters_); + +Return Response; + EndFunction // Remove product from selection // Removes a previously added product from the selection -// +// // Parameters: -// Product - String - Product ID - item -// Selection - String - Selection ID - sel -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// Product - String - Product ID - item +// Selection - String - Selection ID - sel +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - Serialized JSON response from VK +// Key-Value Pair - Serialized JSON response from VK Function RemoveProductFromSelection(Val Product, Val Selection, Val Parameters = "") Export - - OPI_TypeConversion.GetLine(Product); - OPI_TypeConversion.GetLine(Selection); - Parameters_ = GetStandardParameters(Parameters); - - Parameters_.Insert("item_id" , Product); - Parameters_.Insert("album_ids", Selection); - - Response = OPI_Tools.Get("api.vk.com/method/market.removeFromAlbum", Parameters_); - - Return Response; - +OPI_TypeConversion.GetLine(Product); +OPI_TypeConversion.GetLine(Selection); + +Parameters_ = GetStandardParameters(Parameters); + +Parameters_.Insert("item_id" , Product); +Parameters_.Insert("album_ids", Selection); + +Response = OPI_Tools.Get("api.vk.com/method/market.removeFromAlbum", Parameters_); + +Return Response; + EndFunction // DeleteSelection // Deletes the selection by ID // // Parameters: -// Selection - String - Selection ID - sel -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// Selection - String - Selection ID - sel +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - Serialized JSON response from VK +// Key-Value Pair - Serialized JSON response from VK Function DeleteSelection(Val Selection, Val Parameters = "") Export - - OPI_TypeConversion.GetLine(Selection); - - Parameters_ = GetStandardParameters(Parameters); - Parameters_.Insert("album_id", Selection); - - Response = OPI_Tools.Get("api.vk.com/method/market.deleteAlbum", Parameters_); - - Return Response; - + +OPI_TypeConversion.GetLine(Selection); + +Parameters_ = GetStandardParameters(Parameters); +Parameters_.Insert("album_id", Selection); + +Response = OPI_Tools.Get("api.vk.com/method/market.deleteAlbum", Parameters_); + +Return Response; + EndFunction #EndRegion @@ -1479,167 +1479,167 @@ EndFunction // Get property list // Gets the list of properties of group products -// +// // Parameters: -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - Serialized JSON response from VK +// Key-Value Pair - Serialized JSON response from VK Function GetPropertyList(Val Parameters = "") Export - - Response = "response"; - Parameters_ = GetStandardParameters(Parameters); - - Response = OPI_Tools.Get("api.vk.com/method/market.getProperties", Parameters_); - Properties = Response[Response]["items"]; - - Return Properties; - + +Response = "response"; +Parameters_ = GetStandardParameters(Parameters); + +Response = OPI_Tools.Get("api.vk.com/method/market.getProperties", Parameters_); +Properties = Response[Response]["items"]; + +Return Properties; + EndFunction // Create product property // Creates a new property for use in products -// +// // Parameters: -// Name - String - Property name - title -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// Name - String - Property name - title +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - Serialized JSON response from VK +// Key-Value Pair - Serialized JSON response from VK Function CreateProductProperty(Val Name, Val Parameters = "") Export - - OPI_TypeConversion.GetLine(Name); - - Parameters_ = GetStandardParameters(Parameters); - Parameters_.Insert("title", Name); - - Response = OPI_Tools.Get("api.vk.com/method/market.addProperty", Parameters_); - - Return Response; + +OPI_TypeConversion.GetLine(Name); + +Parameters_ = GetStandardParameters(Parameters); +Parameters_.Insert("title", Name); + +Response = OPI_Tools.Get("api.vk.com/method/market.addProperty", Parameters_); + +Return Response; EndFunction // Edit product property // Edits the existing product property -// +// // Parameters: -// Name - String - New name - title -// Property - String, Number - Property ID - prop -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// Name - String - New name - title +// Property - String, Number - Property ID - prop +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - Serialized JSON response from VK +// Key-Value Pair - Serialized JSON response from VK Function EditProductProperty(Val Name, Val Property, Val Parameters = "") Export - - OPI_TypeConversion.GetLine(Name); - OPI_TypeConversion.GetLine(Property); - - Parameters_ = GetStandardParameters(Parameters); - Parameters_.Insert("title" , Name); - Parameters_.Insert("property_id", Property); - Parameters_.Insert("type" , "text"); - - Response = OPI_Tools.Get("api.vk.com/method/market.editProperty", Parameters_); - - Return Response; + +OPI_TypeConversion.GetLine(Name); +OPI_TypeConversion.GetLine(Property); + +Parameters_ = GetStandardParameters(Parameters); +Parameters_.Insert("title" , Name); +Parameters_.Insert("property_id", Property); +Parameters_.Insert("type" , "text"); + +Response = OPI_Tools.Get("api.vk.com/method/market.editProperty", Parameters_); + +Return Response; EndFunction // Delete product property // Deletes the existing product property -// +// // Parameters: -// Property - String, Number - Property ID - prop -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// Property - String, Number - Property ID - prop +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - Serialized JSON response from VK +// Key-Value Pair - Serialized JSON response from VK Function DeleteProductProperty(Val Property, Val Parameters = "") Export - - OPI_TypeConversion.GetLine(Property); - - Parameters_ = GetStandardParameters(Parameters); - Parameters_.Insert("property_id", Property); - - Response = OPI_Tools.Get("api.vk.com/method/market.deleteProperty", Parameters_); - - Return Response; - + +OPI_TypeConversion.GetLine(Property); + +Parameters_ = GetStandardParameters(Parameters); +Parameters_.Insert("property_id", Property); + +Response = OPI_Tools.Get("api.vk.com/method/market.deleteProperty", Parameters_); + +Return Response; + EndFunction // Add product property variant // Adds a variant for an existing property -// +// // Parameters: -// Value - String - Property value - value -// Property - String, Number - Property ID where the variant is added - prop -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// Value - String - Property value - value +// Property - String, Number - Property ID where the variant is added - prop +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - Serialized JSON response from VK +// Key-Value Pair - Serialized JSON response from VK Function AddProductPropertyVariant(Val Value, Val Property, Val Parameters = "") Export - - OPI_TypeConversion.GetLine(Property); - OPI_TypeConversion.GetLine(Value); - - Parameters_ = GetStandardParameters(Parameters); - Parameters_.Insert("property_id", Property); - Parameters_.Insert("title" , Value); - - Response = OPI_Tools.Get("api.vk.com/method/market.addPropertyVariant", Parameters_); - - Return Response; - + +OPI_TypeConversion.GetLine(Property); +OPI_TypeConversion.GetLine(Value); + +Parameters_ = GetStandardParameters(Parameters); +Parameters_.Insert("property_id", Property); +Parameters_.Insert("title" , Value); + +Response = OPI_Tools.Get("api.vk.com/method/market.addPropertyVariant", Parameters_); + +Return Response; + EndFunction // Edit product property variant // Edits the value of an existing product property variant -// +// // Parameters: -// Value - String - New property value - value -// Property - String, Number - Property ID - prop -// Option - String, Number - Variant ID - option -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// Value - String - New property value - value +// Property - String, Number - Property ID - prop +// Option - String, Number - Variant ID - option +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - Serialized JSON response from VK +// Key-Value Pair - Serialized JSON response from VK Function EditProductPropertyVariant(Val Value, Val Property, Val Option, Val Parameters = "") Export - - OPI_TypeConversion.GetLine(Value); - OPI_TypeConversion.GetLine(Property); - OPI_TypeConversion.GetLine(Option); - - Parameters_ = GetStandardParameters(Parameters); - Parameters_.Insert("property_id", Property); - Parameters_.Insert("variant_id" , Option); - Parameters_.Insert("title" , Value); - - Response = OPI_Tools.Get("api.vk.com/method/market.editPropertyVariant", Parameters_); - - Return Response; - + +OPI_TypeConversion.GetLine(Value); +OPI_TypeConversion.GetLine(Property); +OPI_TypeConversion.GetLine(Option); + +Parameters_ = GetStandardParameters(Parameters); +Parameters_.Insert("property_id", Property); +Parameters_.Insert("variant_id" , Option); +Parameters_.Insert("title" , Value); + +Response = OPI_Tools.Get("api.vk.com/method/market.editPropertyVariant", Parameters_); + +Return Response; + EndFunction // Delete product property variant // Deletes the previously created product property variant -// +// // Parameters: -// Option - String, Number - Variant ID - option -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// Option - String, Number - Variant ID - option +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - Serialized JSON response from VK +// Key-Value Pair - Serialized JSON response from VK Function DeleteProductPropertyVariant(Val Option, Val Parameters = "") Export - - OPI_TypeConversion.GetLine(Option); - - Parameters_ = GetStandardParameters(Parameters); - Parameters_.Insert("variant_id", Option); - - Response = OPI_Tools.Get("api.vk.com/method/market.deletePropertyVariant", Parameters_); - - Return Response; - + +OPI_TypeConversion.GetLine(Option); + +Parameters_ = GetStandardParameters(Parameters); +Parameters_.Insert("variant_id", Option); + +Response = OPI_Tools.Get("api.vk.com/method/market.deletePropertyVariant", Parameters_); + +Return Response; + EndFunction #EndRegion @@ -1648,22 +1648,22 @@ EndFunction // Get order list // Returns the community's order list -// +// // Parameters: -// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json -// +// Parameters - Structure Of String - See GetStandardParameters - auth - Authorization JSON or path to .json +// // Return value: -// Key-Value Pair - Serialized JSON response from VK +// Key-Value Pair - Serialized JSON response from VK Function GetOrderList(Val Parameters = "") Export - - Parameters = GetStandardParameters(Parameters); - Parameters.Insert("count", 50); - - ArrayOfOrders = New Array; - GetOrderListRecursively(ArrayOfOrders, Parameters); - - Return ArrayOfOrders; - + +Parameters = GetStandardParameters(Parameters); +Parameters.Insert("count", 50); + +ArrayOfOrders = New Array; +GetOrderListRecursively(ArrayOfOrders, Parameters); + +Return ArrayOfOrders; + EndFunction #EndRegion @@ -1672,40 +1672,40 @@ EndFunction // Create keyboard // Forms a keyboard from an array of buttons -// +// // Parameters: -// ButtonArray - Array of Strings - Array of button titles - buttons -// +// ButtonArray - Array of Strings - Array of button titles - buttons +// // Return value: -// String - Keyboard JSON +// String - Keyboard JSON Function FormKeyboard(Val ButtonArray) Export - - OPI_TypeConversion.GetCollection(ButtonArray); - - Keyboard = New Structure; - KeyboardArray = New Array; - ArrayBlock = New Array; - - For Each Action Of ButtonArray Loop - - Button = New Structure; - Expression = New Structure; - - Expression.Insert("type" , "text"); - Expression.Insert("label", Action); - - Button.Insert("action", Expression); - ArrayBlock.Add(Button); - - EndOfLoop; - - KeyboardArray.Add(ArrayBlock); - - Keyboard.Insert("buttons" , KeyboardArray); - Keyboard.Insert("one_time", False); - - Return OPI_Tools.JSONString(Keyboard); - + +OPI_TypeConversion.GetCollection(ButtonArray); + +Keyboard = New Structure; +KeyboardArray = New Array; +ArrayBlock = New Array; + +For Each Action In ButtonArray Do + +Button = New Structure; +Expression = New Structure; + +Expression.Insert("type" , "text"); +Expression.Insert("label", Action); + +Button.Insert("action", Expression); +ArrayBlock.Add(Button); + +EndDo; + +KeyboardArray.Add(ArrayBlock); + +Keyboard.Insert("buttons" , KeyboardArray); +Keyboard.Insert("one_time", False); + +Return OPI_Tools.JSONString(Keyboard); + EndFunction #EndRegion @@ -1715,476 +1715,476 @@ EndFunction #Region ServiceProceduresAndFunctions Function GetStandardParameters(Val Parameters = "") - - // Here is a collection of data definitions for working with the VK API - // You can override them by passing them as a parameter - // Matching fields will be overwritten with the parameter of the function - - Parameters_ = New Structure; - - // access_token - можно получить in браузере по URL from фунtoции CreateTokenRetrievalLink() - // from_group - actions will be performed on behalf of the group - // owner_id - group ID with "-" at the beginning. Can be found in the settings of the VK group or in its URL if not set - // set your - // app_id - application ID that needs to be created in the profile on the developer page - // group_id - owner_id, но without "-" - - Parameters_.Insert("access_token" , ""); - Parameters_.Insert("from_group" , "1"); - Parameters_.Insert("owner_id" , ""); - Parameters_.Insert("v" , "5.131"); - Parameters_.Insert("app_id" , ""); - Parameters_.Insert("group_id" , ""); - - OPI_TypeConversion.GetCollection(Parameters); - - If TypeValue(Parameters) = Type("Structure") Or TypeValue(Parameters) = Type("Match") Then - For Each PassedParameter Of Parameters Loop - Parameters_.Insert(PassedParameter.Key, OPI_Tools.NumberToString(PassedParameter.Value)); - EndOfLoop; - EndIf; - Return Parameters_; +// Here is a collection of data definitions for working with the VK API +// You can override them by passing them as a parameter +// Matching fields will be overwritten with the parameter of the function + +Parameters_ = New Structure; + +// access_token - можно получить in браузере по URL from фунtoции CreateTokenRetrievalLink() +// from_group - actions will be performed on behalf of the group +// owner_id - group ID with "-" at the beginning. Can be found in the settings of the VK group or in its URL if not set +// set your +// app_id - application ID that needs to be created in the profile on the developer page +// group_id - owner_id, но without "-" + +Parameters_.Insert("access_token" , ""); +Parameters_.Insert("from_group" , "1"); +Parameters_.Insert("owner_id" , ""); +Parameters_.Insert("v" , "5.131"); +Parameters_.Insert("app_id" , ""); +Parameters_.Insert("group_id" , ""); + +OPI_TypeConversion.GetCollection(Parameters); + +If TypeValue(Parameters) = Type("Structure") Or TypeValue(Parameters) = Type("Match") Then +For Each PassedParameter In Parameters Do +Parameters_.Insert(PassedParameter.Key, OPI_Tools.NumberToString(PassedParameter.Value)); +EndDo; +EndIf; + +Return Parameters_; EndFunction Function GetImageID(Val Image, Val Parameters, Val View) - - Response = "response"; - Response = UploadPhotoToServer(Image, Parameters, View); - Result = Response[Response]; - If ValueFilled(Result) Then - PhotoID = Result["photo_id"]; - - If Not ValueFilled(PhotoID) Then - Return Response; - EndIf; - - Otherwise - Return Response; - EndIf; - - PhotoID = OPI_Tools.NumberToString(PhotoID); - Return PhotoID; - +Response = "response"; +Response = UploadPhotoToServer(Image, Parameters, View); +Result = Response[Response]; + +If ValueIsFilled(Result) Then +PhotoID = Result["photo_id"]; + +If Not ValueIsFilled(PhotoID) Then +Return Response; +EndIf; + +Else +Return Response; +EndIf; + +PhotoID = OPI_Tools.NumberToString(PhotoID); +Return PhotoID; + EndFunction Function GetImageCorrespondence(Val Image, Val Parameters, Val View) - - Response = UploadPhotoToServer(Image, Parameters, View); - ResponseArray = Response.Get("response"); - - If Not ValueFilled(ResponseArray) Or Not TypeValue(ResponseArray) = Type("Array") Then - Return Response; - Otherwise - If ResponseArray.Quantity() = 0 Then - Return Response; - Otherwise - ResponseCorrespondence = ResponseArray[0]; - EndIf; - EndIf; - - Return ResponseCorrespondence; - + +Response = UploadPhotoToServer(Image, Parameters, View); +ResponseArray = Response.Get("response"); + +If Not ValueIsFilled(ResponseArray) Or Not TypeValue(ResponseArray) = Type("Array") Then +Return Response; +Else +If ResponseArray.Quantity() = 0 Then +Return Response; +Else +ResponseCorrespondence = ResponseArray[0]; +EndIf; +EndIf; + +Return ResponseCorrespondence; + EndFunction Function GetSelectionArray(Val Selections, Val Parameters = "") - - Response = "response"; - Selections = GetSelectionsByID(Selections, Parameters); - Result = Selections[Response]; - - If ValueFilled(Result) Then - - SelectionArray = Result["items"]; - - If Not ValueFilled(SelectionArray) Then - Return Selections; - EndIf; - - Otherwise - Return Selections; - EndIf; - - Return SelectionArray; - + +Response = "response"; +Selections = GetSelectionsByID(Selections, Parameters); +Result = Selections[Response]; + +If ValueIsFilled(Result) Then + +SelectionArray = Result["items"]; + +If Not ValueIsFilled(SelectionArray) Then +Return Selections; +EndIf; + +Else +Return Selections; +EndIf; + +Return SelectionArray; + EndFunction Function DetermineImageUploadMethod(Val View) - - MethodCorrespondence = New Match; - Upload = "Upload"; - Save = "Save"; - Method = "Method"; - Photo = "Photo"; - - If View = "Post" Then - - MethodCorrespondence.Insert(Upload , "photos.getWallUploadServer"); - MethodCorrespondence.Insert(Save, "photos.saveWallPhoto"); - MethodCorrespondence.Insert(Photo , "photo"); - MethodCorrespondence.Insert(Method , 1); - - ElseIf View = "Product" Then - - MethodCorrespondence.Insert(Upload , "market.getProductPhotoUploadServer"); - MethodCorrespondence.Insert(Save, "market.saveProductPhoto"); - MethodCorrespondence.Insert(Method , 2); - - ElseIf View = "Story" Then - - MethodCorrespondence.Insert(Upload , "stories.getPhotoUploadServer"); - MethodCorrespondence.Insert(Save, "stories.save"); - MethodCorrespondence.Insert(Method , 3); - - ElseIf View = "Poll" Then - - MethodCorrespondence.Insert(Upload , "polls.getPhotoUploadServer"); - MethodCorrespondence.Insert(Save, "polls.savePhoto"); - MethodCorrespondence.Insert(Photo , "photo"); - MethodCorrespondence.Insert(Method , 1); - - Otherwise - - MethodCorrespondence.Insert(Upload , "photos.getUploadServer"); - MethodCorrespondence.Insert(Save, "photos.save"); - MethodCorrespondence.Insert(Photo , "photos_list"); - MethodCorrespondence.Insert(Method , 1); - - EndIf; - - Return MethodCorrespondence; - + +MethodCorrespondence = New Match; +Upload = "Upload"; +Save = "Save"; +Method = "Method"; +Photo = "Photo"; + +If View = "Post" Then + +MethodCorrespondence.Insert(Upload , "photos.getWallUploadServer"); +MethodCorrespondence.Insert(Save, "photos.saveWallPhoto"); +MethodCorrespondence.Insert(Photo , "photo"); +MethodCorrespondence.Insert(Method , 1); + +ElsIf View = "Product" Then + +MethodCorrespondence.Insert(Upload , "market.getProductPhotoUploadServer"); +MethodCorrespondence.Insert(Save, "market.saveProductPhoto"); +MethodCorrespondence.Insert(Method , 2); + +ElsIf View = "Story" Then + +MethodCorrespondence.Insert(Upload , "stories.getPhotoUploadServer"); +MethodCorrespondence.Insert(Save, "stories.save"); +MethodCorrespondence.Insert(Method , 3); + +ElsIf View = "Poll" Then + +MethodCorrespondence.Insert(Upload , "polls.getPhotoUploadServer"); +MethodCorrespondence.Insert(Save, "polls.savePhoto"); +MethodCorrespondence.Insert(Photo , "photo"); +MethodCorrespondence.Insert(Method , 1); + +Else + +MethodCorrespondence.Insert(Upload , "photos.getUploadServer"); +MethodCorrespondence.Insert(Save, "photos.save"); +MethodCorrespondence.Insert(Photo , "photos_list"); +MethodCorrespondence.Insert(Method , 1); + +EndIf; + +Return MethodCorrespondence; + EndFunction Function GetProductParameterMapping() - - Fields = New Match(); - Fields.Insert("Name" , "name"); - Fields.Insert("Description" , "description"); - Fields.Insert("Category" , "category_id"); - Fields.Insert("Price" , "price"); - Fields.Insert("OldPrice" , "old_price"); - Fields.Insert("URL" , "url"); - Fields.Insert("MainInGroup" , "is_main_variant"); - Fields.Insert("Width" , "dimension_width"); - Fields.Insert("Height" , "dimension_height"); - Fields.Insert("Depth" , "dimension_length"); - Fields.Insert("Weight" , "weight"); - Fields.Insert("SKU" , "sku"); - Fields.Insert("AvailableBalance" , "stock_amount"); - - Return Fields; + +Fields = New Match(); +Fields.Insert("Name" , "name"); +Fields.Insert("Description" , "description"); +Fields.Insert("Category" , "category_id"); +Fields.Insert("Price" , "price"); +Fields.Insert("OldPrice" , "old_price"); +Fields.Insert("URL" , "url"); +Fields.Insert("MainInGroup" , "is_main_variant"); +Fields.Insert("Width" , "dimension_width"); +Fields.Insert("Height" , "dimension_height"); +Fields.Insert("Depth" , "dimension_length"); +Fields.Insert("Weight" , "weight"); +Fields.Insert("SKU" , "sku"); +Fields.Insert("AvailableBalance" , "stock_amount"); + +Return Fields; EndFunction Function ProductManagement(Val ProductDescription, Val ProductID = "", Val Selection = "", Val Parameters = "") - - OPI_TypeConversion.GetLine(ProductID); - OPI_TypeConversion.GetLine(Selection); - OPI_TypeConversion.GetCollection(ProductDescription); - - Parameters_ = GetStandardParameters(Parameters); - Parameters_.Insert("v", "5.199"); - - Response = "response"; - - FillProductRequestFields(ProductDescription, Parameters_); - - If ValueFilled(ProductID) Then - Parameters_.Insert("item_id", ProductID); - Method = "edit"; - Otherwise - Method = "add"; - EndIf; - - Response = OPI_Tools.Get("api.vk.com/method/market." + Method, Parameters_); - Result = Response[Response]; - - If Not ValueFilled(ProductID) And ValueFilled(Result) Then - - ProductID = Result["market_item_id"]; - - If Not ValueFilled(ProductID) Then - Return Response; - EndIf; - - Otherwise - Return Response; - EndIf; - - If ValueFilled(Selection) And ValueFilled(ProductID) Then - AddProductToSelection(ProductID, Selection, Parameters_); - EndIf; - - Return Response; + +OPI_TypeConversion.GetLine(ProductID); +OPI_TypeConversion.GetLine(Selection); +OPI_TypeConversion.GetCollection(ProductDescription); + +Parameters_ = GetStandardParameters(Parameters); +Parameters_.Insert("v", "5.199"); + +Response = "response"; + +FillProductRequestFields(ProductDescription, Parameters_); + +If ValueIsFilled(ProductID) Then +Parameters_.Insert("item_id", ProductID); +Method = "edit"; +Else +Method = "add"; +EndIf; + +Response = OPI_Tools.Get("api.vk.com/method/market." + Method, Parameters_); +Result = Response[Response]; + +If Not ValueIsFilled(ProductID) And ValueIsFilled(Result) Then + +ProductID = Result["market_item_id"]; + +If Not ValueIsFilled(ProductID) Then +Return Response; +EndIf; + +Else +Return Response; +EndIf; + +If ValueIsFilled(Selection) And ValueIsFilled(ProductID) Then +AddProductToSelection(ProductID, Selection, Parameters_); +EndIf; + +Return Response; EndFunction Function SelectionManagement(Val Name - , Val Image = "" - , Val SelectionID = "" - , Val Main = False - , Val Hidden = False - , Val Parameters = "") - - OPI_TypeConversion.GetLine(Name); - OPI_TypeConversion.GetLine(SelectionID); - OPI_TypeConversion.GetBoolean(Main); - OPI_TypeConversion.GetBoolean(Hidden); - - Parameters_ = GetStandardParameters(Parameters); - Response = AddImageParameter(Image, SelectionID, Parameters_); - - If ValueFilled(Response) Then - Return Response; - EndIf; - - Parameters_.Insert("title" , Name); - Parameters_.Insert("main_album" , ?(Main, 1, 0)); - Parameters_.Insert("is_hidden" , ?(Hidden, 1, 0)); - - If ValueFilled(SelectionID) Then - Parameters_.Insert("album_id", SelectionID); - Method = "editAlbum"; - Otherwise - Method = "addAlbum"; - EndIf; - - Response = OPI_Tools.Get("api.vk.com/method/market." + Method, Parameters_); - - Return Response; +, Val Image = "" +, Val SelectionID = "" +, Val Main = False +, Val Hidden = False +, Val Parameters = "") + +OPI_TypeConversion.GetLine(Name); +OPI_TypeConversion.GetLine(SelectionID); +OPI_TypeConversion.GetBoolean(Main); +OPI_TypeConversion.GetBoolean(Hidden); + +Parameters_ = GetStandardParameters(Parameters); +Response = AddImageParameter(Image, SelectionID, Parameters_); + +If ValueIsFilled(Response) Then +Return Response; +EndIf; + +Parameters_.Insert("title" , Name); +Parameters_.Insert("main_album" , ?(Main, 1, 0)); +Parameters_.Insert("is_hidden" , ?(Hidden, 1, 0)); + +If ValueIsFilled(SelectionID) Then +Parameters_.Insert("album_id", SelectionID); +Method = "editAlbum"; +Else +Method = "addAlbum"; +EndIf; + +Response = OPI_Tools.Get("api.vk.com/method/market." + Method, Parameters_); + +Return Response; EndFunction Function AddImageParameter(Val Image, Val SelectionID, Parameters) - - PhotoID = "photo_id"; - - If ValueFilled(Image) Then - - PhotoID = GetImageID(Image, Parameters, "Product"); - - If Not TypeValue(PhotoID) = Type("String") Then - Return PhotoID; - EndIf; - - Parameters.Insert(PhotoID, PhotoID); - - Otherwise - - If ValueFilled(SelectionID) Then - - Selections = GetSelectionArray(SelectionID, Parameters); - - If Not TypeValue(Selections) = Type("Array") Then - Return Selections; - EndIf; - - If Not Selections.Quantity() = 0 Then - PhotoID = Selections[0]["photo"]["id"]; - OPI_TypeConversion.GetLine(PhotoID); - Parameters.Insert(PhotoID, PhotoID); - EndIf; - - EndIf; - - EndIf; - - Return ""; - + +PhotoID = "photo_id"; + +If ValueIsFilled(Image) Then + +PhotoID = GetImageID(Image, Parameters, "Product"); + +If Not TypeValue(PhotoID) = Type("String") Then +Return PhotoID; +EndIf; + +Parameters.Insert(PhotoID, PhotoID); + +Else + +If ValueIsFilled(SelectionID) Then + +Selections = GetSelectionArray(SelectionID, Parameters); + +If Not TypeValue(Selections) = Type("Array") Then +Return Selections; +EndIf; + +If Not Selections.Quantity() = 0 Then +PhotoID = Selections[0]["photo"]["id"]; +OPI_TypeConversion.GetLine(PhotoID); +Parameters.Insert(PhotoID, PhotoID); +EndIf; + +EndIf; + +EndIf; + +Return ""; + EndFunction Procedure FillPhotoUploadParameters(Val Method, Val Response, Parameters) - - Response = "response"; - Method = Method["Method"]; - StandardMethod = 1; - NewMethod = 2; - If Method = StandardMethod Then - - Hash = "hash"; - Serv = "server"; - Aid = "aid"; - Photo = Method["Photo"]; - - Parameters.Insert(Hash, Response[Hash]); - Parameters.Insert(Photo, Response[Photo]); - - PhotoServer = Response.Get(Serv); - - If ValueFilled(PhotoServer) Then - PhotoServer = OPI_Tools.NumberToString(PhotoServer); - Parameters.Insert(Serv, PhotoServer); - EndIf; - - Identifier = Response.Get(Aid); - - If ValueFilled(Identifier) Then - Identifier = OPI_Tools.NumberToString(Identifier); - Parameters.Insert(Aid , Identifier); - EndIf; - - ElseIf Method = NewMethod Then - - ResponseString = OPI_Tools.JSONString(Response); - Parameters.Insert("upload_response", ResponseString); - - Otherwise - - Parameters.Insert("upload_results", Response[Response]["upload_result"]); - - EndIf; +Response = "response"; +Method = Method["Method"]; +StandardMethod = 1; +NewMethod = 2; + +If Method = StandardMethod Then + +Hash = "hash"; +Serv = "server"; +Aid = "aid"; +Photo = Method["Photo"]; + +Parameters.Insert(Hash, Response[Hash]); +Parameters.Insert(Photo, Response[Photo]); + +PhotoServer = Response.Get(Serv); + +If ValueIsFilled(PhotoServer) Then +PhotoServer = OPI_Tools.NumberToString(PhotoServer); +Parameters.Insert(Serv, PhotoServer); +EndIf; + +Identifier = Response.Get(Aid); + +If ValueIsFilled(Identifier) Then +Identifier = OPI_Tools.NumberToString(Identifier); +Parameters.Insert(Aid , Identifier); +EndIf; + +ElsIf Method = NewMethod Then + +ResponseString = OPI_Tools.JSONString(Response); +Parameters.Insert("upload_response", ResponseString); + +Else + +Parameters.Insert("upload_results", Response[Response]["upload_result"]); + +EndIf; EndProcedure Procedure FillProductRequestFields(Val ProductDescription, Parameters) - - Response = "response"; - MainPhoto = ProductDescription["MainPhoto"]; - AdditionalPhoto = ProductDescription["AdditionalPhotos"]; - Properties = ProductDescription["PropertyValues"]; - - If ValueFilled(MainPhoto) Then - - Response = UploadPhotoToServer(MainPhoto, Parameters, "Product"); - Result = Response[Response]; - - If ValueFilled(Result) Then - PhotoID = Result["photo_id"]; - - If Not ValueFilled(PhotoID) Then - Return; - EndIf; - - Otherwise - Return; - EndIf; - - PhotoID = OPI_Tools.NumberToString(PhotoID); - Parameters.Insert("main_photo_id", PhotoID); - - EndIf; - - If TypeValue(Properties) = Type("Array") Then - - Properties_ = New Array; - - For Each Property Of Properties Loop - Properties_.Add(OPI_Tools.NumberToString(Property)); - EndOfLoop; - - Properties = StrJoin(Properties_, ","); - - EndIf; - - If ValueFilled(Properties) Then - Parameters.Insert("variant_ids", OPI_Tools.NumberToString(Properties)); - EndIf; - - AddAdditionalProductPhotos(AdditionalPhoto, Parameters); - - For Each Field Of GetProductParameterMapping() Loop - - Value = ProductDescription[Field.Key]; - - If Value <> Undefined Then - Parameters.Insert(Field.Value, ProductDescription[Field.Key]); - EndIf; - - EndOfLoop; + +Response = "response"; +MainPhoto = ProductDescription["MainPhoto"]; +AdditionalPhoto = ProductDescription["AdditionalPhotos"]; +Properties = ProductDescription["PropertyValues"]; + +If ValueIsFilled(MainPhoto) Then + +Response = UploadPhotoToServer(MainPhoto, Parameters, "Product"); +Result = Response[Response]; + +If ValueIsFilled(Result) Then +PhotoID = Result["photo_id"]; + +If Not ValueIsFilled(PhotoID) Then +Return; +EndIf; + +Else +Return; +EndIf; + +PhotoID = OPI_Tools.NumberToString(PhotoID); +Parameters.Insert("main_photo_id", PhotoID); + +EndIf; + +If TypeValue(Properties) = Type("Array") Then + +Properties_ = New Array; + +For Each Property In Properties Do +Properties_.Add(OPI_Tools.NumberToString(Property)); +EndDo; + +Properties = StrJoin(Properties_, ","); + +EndIf; + +If ValueIsFilled(Properties) Then +Parameters.Insert("variant_ids", OPI_Tools.NumberToString(Properties)); +EndIf; + +AddAdditionalProductPhotos(AdditionalPhoto, Parameters); + +For Each Field In GetProductParameterMapping() Do + +Value = ProductDescription[Field.Key]; + +If Value <> Undefined Then +Parameters.Insert(Field.Value, ProductDescription[Field.Key]); +EndIf; + +EndDo; EndProcedure Procedure AddAdditionalProductPhotos(Val PhotoArray, Parameters) - - If TypeValue(PhotoArray) = Type("Array") Then - If PhotoArray.Quantity() > 0 Then - - PhotoString = ""; - - For Each Photo Of PhotoArray Loop - - PhotoID = GetImageID(Photo, Parameters, "Product"); - - If Not TypeValue(PhotoID) = Type("String") Then - Return; - EndIf; - PhotoString = PhotoString + PhotoID + ","; - - EndOfLoop; - - PhotoString = Left(PhotoString, StrLength(PhotoString) - 1); - Parameters.Insert("photo_ids", PhotoString); - EndIf; - EndIf; - +If TypeValue(PhotoArray) = Type("Array") Then +If PhotoArray.Quantity() > 0 Then + +PhotoString = ""; + +For Each Photo In PhotoArray Do + +PhotoID = GetImageID(Photo, Parameters, "Product"); + +If Not TypeValue(PhotoID) = Type("String") Then +Return; +EndIf; + +PhotoString = PhotoString + PhotoID + ","; + +EndDo; + +PhotoString = Left(PhotoString, StrLength(PhotoString) - 1); +Parameters.Insert("photo_ids", PhotoString); +EndIf; +EndIf; + EndProcedure Procedure GetProductListRecursively(Array of products, Parameters, Shift = 0) - - Response = "response"; - MaxInRequest = 200; - Response = OPI_Tools.Get("api.vk.com/method/market.get", Parameters); - Products = Response[Response]["items"]; - - If Products.Quantity() = 0 Then - Return; - EndIf; - - For Each Product Of Products Loop - Array of products.Add(Product); - EndOfLoop; - - Shift = Shift + MaxInRequest; - Parameters.Insert("offset", Shift); - GetProductListRecursively(Array of products, Parameters, Shift); - + +Response = "response"; +MaxInRequest = 200; +Response = OPI_Tools.Get("api.vk.com/method/market.get", Parameters); +Products = Response[Response]["items"]; + +If Products.Quantity() = 0 Then +Return; +EndIf; + +For Each Product In Products Do +Array of products.Add(Product); +EndDo; + +Shift = Shift + MaxInRequest; +Parameters.Insert("offset", Shift); +GetProductListRecursively(Array of products, Parameters, Shift); + EndProcedure Procedure GetAlbumListRecursively(ArrayOfAlbums, Parameters, Shift = 0) - - Response = "response"; - MaxInRequest = 100; - Response = OPI_Tools.Get("api.vk.com/method/market.getAlbums", Parameters); - Albums = Response[Response]["items"]; - - If Albums.Quantity() = 0 Then - Return; - EndIf; - - For Each Album Of Albums Loop - ArrayOfAlbums.Add(Album); - EndOfLoop; - - Shift = Shift + MaxInRequest; - Parameters.Insert("offset", Shift); - GetAlbumListRecursively(ArrayOfAlbums, Parameters, Shift); - + +Response = "response"; +MaxInRequest = 100; +Response = OPI_Tools.Get("api.vk.com/method/market.getAlbums", Parameters); +Albums = Response[Response]["items"]; + +If Albums.Quantity() = 0 Then +Return; +EndIf; + +For Each Album In Albums Do +ArrayOfAlbums.Add(Album); +EndDo; + +Shift = Shift + MaxInRequest; +Parameters.Insert("offset", Shift); +GetAlbumListRecursively(ArrayOfAlbums, Parameters, Shift); + EndProcedure Procedure GetOrderListRecursively(ArrayOfOrders, Parameters, Shift = 0) - - Response = "response"; - MaxInRequest = 50; - Response = OPI_Tools.Get("api.vk.com/method/market.getGroupOrders", Parameters); - Orders = Response[Response]["items"]; - - If Orders.Quantity() = 0 Then - Return; - EndIf; - - For Each Order Of Orders Loop - ArrayOfOrders.Add(Order); - EndOfLoop; - - Shift = Shift + MaxInRequest; - Parameters.Insert("offset", Shift); - GetOrderListRecursively(ArrayOfOrders, Parameters, Shift); - + +Response = "response"; +MaxInRequest = 50; +Response = OPI_Tools.Get("api.vk.com/method/market.getGroupOrders", Parameters); +Orders = Response[Response]["items"]; + +If Orders.Quantity() = 0 Then +Return; +EndIf; + +For Each Order In Orders Do +ArrayOfOrders.Add(Order); +EndDo; + +Shift = Shift + MaxInRequest; +Parameters.Insert("offset", Shift); +GetOrderListRecursively(ArrayOfOrders, Parameters, Shift); + EndProcedure #EndRegion diff --git a/src/en/OPI/src/CommonModules/OPI_VK/OPI_VK.mdo b/src/en/OPI/src/CommonModules/OPI_VK/OPI_VK.mdo index f0ebc10c6b..376f601cf4 100644 --- a/src/en/OPI/src/CommonModules/OPI_VK/OPI_VK.mdo +++ b/src/en/OPI/src/CommonModules/OPI_VK/OPI_VK.mdo @@ -1,11 +1,11 @@ - + - OPI_VK - - ru - Методы интеграции с VK (ОПИ) - - true - true - true +OPI_VK + +ru +Methodы интеграции with VK (OPI) + +true +true +true diff --git a/src/en/OPI/src/CommonModules/OPI_Viber/Module.bsl b/src/en/OPI/src/CommonModules/OPI_Viber/Module.bsl index b16e27e300..5b672ff216 100644 --- a/src/en/OPI/src/CommonModules/OPI_Viber/Module.bsl +++ b/src/en/OPI/src/CommonModules/OPI_Viber/Module.bsl @@ -23,7 +23,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. - + // https://github.com/Bayselonarrend/OpenIntegrations // BSLLS:LatinAndCyrillicSymbolInWord-off @@ -41,80 +41,80 @@ // which will return 200 and a genuine SSL certificate. If there is a certificate and the database is published // on the server - you can use an HTTP service. Information about new messages will also be sent there // Viber periodically knocks on the Webhook address, so if it is inactive, everything will stop working -// +// // Parameters: -// Token - String - Viber Token - token -// URL - String - URL for setting up Webhook - url -// +// Token - String - Viber Token - token +// URL - String - URL for setting up Webhook - url +// // Return value: -// Key-Value Pair - serialized JSON response from Viber +// Key-Value Pair - serialized JSON response from Viber Function SetWebhook(Val Token, Val URL) Export - - Parameters = New Structure; - OPI_Tools.AddField("url" , URL , "String", Parameters); - OPI_Tools.AddField("auth_token" , Token, "String", Parameters); - - Return OPI_Tools.Post("https://chatapi.viber.com/pa/set_webhook", Parameters); - + +Parameters = New Structure; +OPI_Tools.AddField("url" , URL , "String", Parameters); +OPI_Tools.AddField("auth_token" , Token, "String", Parameters); + +Return OPI_Tools.Post("https://chatapi.viber.com/pa/set_webhook", Parameters); + EndFunction // Get channel information // Here you can get the channel's user IDs. Bot IDs need to be obtained from the Webhook arrivals // The user ID from channel information is not suitable for sending messages through the bot - they are different -// +// // Parameters: -// Token - String - Token - token -// +// Token - String - Token - token +// // Return value: -// Key-Value Pair - serialized JSON response from Viber +// Key-Value Pair - serialized JSON response from Viber Function GetChannelInformation(Val Token) Export - - URL = "https://chatapi.viber.com/pa/get_account_info"; - Return OPI_Tools.Get(URL, , TokenInHeaders(Token)); - + +URL = "https://chatapi.viber.com/pa/get_account_info"; +Return OPI_Tools.Get(URL, , TokenInHeaders(Token)); + EndFunction // Get user data // Gets user information by ID -// +// // Parameters: -// Token - String - Token - token -// UserID - String, Number - Viber User ID - user -// +// Token - String - Token - token +// UserID - String, Number - Viber User ID - user +// // Return value: -// Key-Value Pair - serialized JSON response from Viber +// Key-Value Pair - serialized JSON response from Viber Function GetUserData(Val Token, Val UserID) Export - - URL = "https://chatapi.viber.com/pa/get_user_details"; - - Parameters = New Structure; - OPI_Tools.AddField("id", UserID, "String", Parameters); - - Response = OPI_Tools.Post(URL, Parameters, TokenInHeaders(Token)); - Return Response; +URL = "https://chatapi.viber.com/pa/get_user_details"; + +Parameters = New Structure; +OPI_Tools.AddField("id", UserID, "String", Parameters); + +Response = OPI_Tools.Post(URL, Parameters, TokenInHeaders(Token)); + +Return Response; EndFunction // Get online users // Gets the status of a user or several users by ID -// +// // Parameters: -// Token - String - Viber Token - token -// UserIDs - String,Number,Array of String,Number - Viber User(s) ID - users -// +// Token - String - Viber Token - token +// UserIDs - String,Number,Array of String,Number - Viber User(s) ID - users +// // Return value: -// Key-Value Pair - serialized JSON response from Viber +// Key-Value Pair - serialized JSON response from Viber Function GetOnlineUsers(Val Token, Val UserIDs) Export - - URL = "https://chatapi.viber.com/pa/get_online"; - - Parameters = New Structure; - OPI_Tools.AddField("ids", UserIDs, "Collection", Parameters); - - Response = OPI_Tools.Post(URL, Parameters, TokenInHeaders(Token)); - - Return Response; + +URL = "https://chatapi.viber.com/pa/get_online"; + +Parameters = New Structure; +OPI_Tools.AddField("ids", UserIDs, "Collection", Parameters); + +Response = OPI_Tools.Post(URL, Parameters, TokenInHeaders(Token)); + +Return Response; EndFunction @@ -124,185 +124,185 @@ EndFunction // Send text message // Sends a text message to a chat or channel -// +// // Parameters: -// Token - String - Token - token -// Text - String - Message text - text -// UserID - String, Number - User ID. For channel > administrator, for bot > recipient - user -// SendingToChannel - Boolean - Sending to channel or bot chat - ischannel -// Keyboard - Structure Of String - See CreateKeyboardFromArrayButton - keyboard -// +// Token - String - Token - token +// Text - String - Message text - text +// UserID - String, Number - User ID. For channel > administrator, for bot > recipient - user +// SendingToChannel - Boolean - Sending to channel or bot chat - ischannel +// Keyboard - Structure Of String - See CreateKeyboardFromArrayButton - keyboard +// // Return value: -// Key-Value Pair - serialized JSON response from Viber +// Key-Value Pair - serialized JSON response from Viber Function SendTextMessage(Val Token - , Val Text - , Val UserID - , Val SendingToChannel - , Val Keyboard = "") Export - - Return SendMessage(Token, "text", UserID, SendingToChannel, , Text, Keyboard); - +, Val Text +, Val UserID +, Val SendingToChannel +, Val Keyboard = "") Export + +Return SendMessage(Token, "text", UserID, SendingToChannel, , Text, Keyboard); + EndFunction // Send image // Sends an image to a chat or channel -// +// // Parameters: -// Token - String - Token - token -// URL - String - Image URL - picture -// UserID - String, Number - User ID. For channel > administrator, for bot > recipient - user -// SendingToChannel - boolean - Sending to channel or bot chat - ischannel -// Description - String - Image annotation - description -// +// Token - String - Token - token +// URL - String - Image URL - picture +// UserID - String, Number - User ID. For channel > administrator, for bot > recipient - user +// SendingToChannel - boolean - Sending to channel or bot chat - ischannel +// Description - String - Image annotation - description +// // Return value: -// Key-Value Pair - serialized JSON response from Viber +// Key-Value Pair - serialized JSON response from Viber Function SendImage(Val Token, Val URL, Val UserID, Val SendingToChannel, Val Description = "") Export - - Return SendMessage(Token, "picture", UserID, SendingToChannel, URL, Description); - + +Return SendMessage(Token, "picture", UserID, SendingToChannel, URL, Description); + EndFunction // SendFile // Sends a file (document) to a chat or channel -// +// // Parameters: -// Token - String - Token - token -// URL - String - File URL - file -// UserID - String, Number - User ID. For channel > administrator, for bot > recipient - user -// SendingToChannel - Boolean - Sending to channel or bot chat - ischannel -// Extension - String - File extension - ext -// Size - Number - File size. If not filled in > determined automatically by downloading the file - size -// +// Token - String - Token - token +// URL - String - File URL - file +// UserID - String, Number - User ID. For channel > administrator, for bot > recipient - user +// SendingToChannel - Boolean - Sending to channel or bot chat - ischannel +// Extension - String - File extension - ext +// Size - Number - File size. If not filled in > determined automatically by downloading the file - size +// // Return value: -// Key-Value Pair - serialized JSON response from Viber +// Key-Value Pair - serialized JSON response from Viber Function SendFile(Val Token - , Val URL - , Val UserID - , Val SendingToChannel - , Val Extension - , Val Size = "") Export - - If Not ValueFilled(Size) Then - - Response = OPI_Tools.Get(URL); - Size = Response.Size(); - - EndIf; - - String_ = "String"; - Extension = StringReplace(Extension, ".", ""); - - Parameters = New Structure; - OPI_Tools.AddField("URL" , URL , String_, Parameters); - OPI_Tools.AddField("Size" , Size , String_, Parameters); - OPI_Tools.AddField("Extension", Extension, String_, Parameters); - - Return SendMessage(Token, "file", UserID, SendingToChannel, Parameters); - +, Val URL +, Val UserID +, Val SendingToChannel +, Val Extension +, Val Size = "") Export + +If Not ValueIsFilled(Size) Then + +Response = OPI_Tools.Get(URL); +Size = Response.Size(); + +EndIf; + +String_ = "String"; +Extension = StringReplace(Extension, ".", ""); + +Parameters = New Structure; +OPI_Tools.AddField("URL" , URL , String_, Parameters); +OPI_Tools.AddField("Size" , Size , String_, Parameters); +OPI_Tools.AddField("Extension", Extension, String_, Parameters); + +Return SendMessage(Token, "file", UserID, SendingToChannel, Parameters); + EndFunction // Send contact // Sends a contact with a phone number to a chat or channel -// +// // Parameters: -// Token - String - Token - token -// ContactName - String - Contact name - name -// PhoneNumber - String - Phone number - phone -// UserID - String, Number - User ID. For channel > administrator, for bot > recipient - user -// SendingToChannel - Boolean - Sending to channel or bot chat - ischannel -// +// Token - String - Token - token +// ContactName - String - Contact name - name +// PhoneNumber - String - Phone number - phone +// UserID - String, Number - User ID. For channel > administrator, for bot > recipient - user +// SendingToChannel - Boolean - Sending to channel or bot chat - ischannel +// // Return value: -// Key-Value Pair - serialized JSON response from Viber +// Key-Value Pair - serialized JSON response from Viber Function SendContact(Val Token - , Val ContactName - , Val PhoneNumber - , Val UserID - , Val SendingToChannel) Export - - Parameters = New Structure; - OPI_Tools.AddField("name" , ContactName , "String", Parameters); - OPI_Tools.AddField("phone_number", PhoneNumber, "String", Parameters); - - Return SendMessage(Token, "contact", UserID, SendingToChannel, Parameters); - +, Val ContactName +, Val PhoneNumber +, Val UserID +, Val SendingToChannel) Export + +Parameters = New Structure; +OPI_Tools.AddField("name" , ContactName , "String", Parameters); +OPI_Tools.AddField("phone_number", PhoneNumber, "String", Parameters); + +Return SendMessage(Token, "contact", UserID, SendingToChannel, Parameters); + EndFunction // SendLocation // Sends geographic coordinates to a chat or channel -// +// // Parameters: -// Token - String - Token - token -// Latitude - String, Number - Geographic latitude - lat -// Longitude - String, Number - Geographic longitude - long -// UserID - String, Number - User ID. For channel > administrator, for bot > recipient - user -// SendingToChannel - Boolean - Sending to channel or bot chat - ischannel -// +// Token - String - Token - token +// Latitude - String, Number - Geographic latitude - lat +// Longitude - String, Number - Geographic longitude - long +// UserID - String, Number - User ID. For channel > administrator, for bot > recipient - user +// SendingToChannel - Boolean - Sending to channel or bot chat - ischannel +// // Return value: -// Key-Value Pair - serialized JSON response from Viber +// Key-Value Pair - serialized JSON response from Viber Function SendLocation(Val Token, Val Latitude, Val Longitude, Val UserID, Val SendingToChannel) Export - - Parameters = New Structure; - OPI_Tools.AddField("lat", Latitude , "String", Parameters); - OPI_Tools.AddField("lon", Longitude, "String", Parameters); - - Return SendMessage(Token, "location", UserID, SendingToChannel, Parameters); - + +Parameters = New Structure; +OPI_Tools.AddField("lat", Latitude , "String", Parameters); +OPI_Tools.AddField("lon", Longitude, "String", Parameters); + +Return SendMessage(Token, "location", UserID, SendingToChannel, Parameters); + EndFunction // SendLink // Sends a URL with a preview to a chat or channel -// +// // Parameters: -// Token - String - Token - token -// URL - String - SentLink - url -// UserID - String, Number - User ID. For channel > administrator, for bot > recipient - user -// SendingToChannel - Boolean - Sending to channel or bot chat - ischannel -// +// Token - String - Token - token +// URL - String - SentLink - url +// UserID - String, Number - User ID. For channel > administrator, for bot > recipient - user +// SendingToChannel - Boolean - Sending to channel or bot chat - ischannel +// // Return value: -// Key-Value Pair - serialized JSON response from Viber +// Key-Value Pair - serialized JSON response from Viber Function SendLink(Val Token, Val URL, Val UserID, Val SendingToChannel) Export - - Return SendMessage(Token, "url", UserID, SendingToChannel, URL); - + +Return SendMessage(Token, "url", UserID, SendingToChannel, URL); + EndFunction // Create a keyboard from an array of buttons // Returns a keyboard structure for messages -// +// // Parameters: -// ButtonArray - Array of Strings - Array of buttons - buttons -// ButtonColor - String - HEX color of buttons with # at the beginning - color -// +// ButtonArray - Array of Strings - Array of buttons - buttons +// ButtonColor - String - HEX color of buttons with # at the beginning - color +// // Return value: -// Structure - Create a keyboard from an array of buttons: -// * Buttons - Array of Structure - Array of formed buttons -// * Type - String - KeyboardType +// Structure - Create a keyboard from an array of buttons: +// * Buttons - Array of Structure - Array of formed buttons +// * Type - String - KeyboardType Function CreateKeyboardFromArrayButton(Val ButtonArray, Val ButtonColor = "#2db9b9") Export - - OPI_TypeConversion.GetLine(ButtonColor); - OPI_TypeConversion.GetCollection(ButtonArray); - - ArrayOfButtonStructures = New Array; - KeyboardStructure = New Structure; - - For Each ButtonText Of ButtonArray Loop - - ButtonStructure = New Structure; - ButtonStructure.Insert("ActionType", "reply"); - ButtonStructure.Insert("ActionBody", ButtonText); - ButtonStructure.Insert("Text" , ButtonText); - ButtonStructure.Insert("BgColor" , ButtonColor); - ButtonStructure.Insert("Coloumns" , 3); - - ArrayOfButtonStructures.Add(ButtonStructure); - - EndOfLoop; - - KeyboardStructure.Insert("Buttons", ArrayOfButtonStructures); - KeyboardStructure.Insert("Type" , "keyboard"); - - Return KeyboardStructure; - + +OPI_TypeConversion.GetLine(ButtonColor); +OPI_TypeConversion.GetCollection(ButtonArray); + +ArrayOfButtonStructures = New Array; +KeyboardStructure = New Structure; + +For Each ButtonText In ButtonArray Do + +ButtonStructure = New Structure; +ButtonStructure.Insert("ActionType", "reply"); +ButtonStructure.Insert("ActionBody", ButtonText); +ButtonStructure.Insert("Text" , ButtonText); +ButtonStructure.Insert("BgColor" , ButtonColor); +ButtonStructure.Insert("Coloumns" , 3); + +ArrayOfButtonStructures.Add(ButtonStructure); + +EndDo; + +KeyboardStructure.Insert("Buttons", ArrayOfButtonStructures); +KeyboardStructure.Insert("Type" , "keyboard"); + +Return KeyboardStructure; + EndFunction #EndRegion @@ -312,103 +312,103 @@ EndFunction #Region ServiceProceduresAndFunctions // Send message. -// +// // Parameters: -// Token - String - Token -// Type - String - TypeOfSentMessage -// UserID - String, Number - Viber User ID -// IsChannel - Boolean - Sending to channel or bot chat -// Value - String, Structure - Value: -// * URL - String - When sending URL +// Token - String - Token +// Type - String - TypeOfSentMessage +// UserID - String, Number - Viber User ID +// IsChannel - Boolean - Sending to channel or bot chat +// Value - String, Structure - Value: +// * URL - String - При отпраintoе URL // * Size - Number, String - File size in case of sending // * Extension - String - File extension in case of sending -// Text - String - Message text -// Keyboard - Structure Of String - Keyboard, if needed, see CreateKeyboardFromArrayButton -// +// Text - String - Message text +// Keyboard - Structure Of String - Keyboard, if needed, see CreateKeyboardFromArrayButton +// // Return value: -// Arbitrary, HTTP Response - Send message +// Arbitrary, HTTP Response - Send message Function SendMessage(Val Token - , Val Type - , Val UserID - , Val IsChannel - , Val Value = "" - , Val Text = "" - , Val Keyboard = "") - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Type); - OPI_TypeConversion.GetLine(UserID); - OPI_TypeConversion.GetLine(Text); - OPI_TypeConversion.GetBoolean(IsChannel); - OPI_TypeConversion.GetCollection(Keyboard); - - ParametersStructure = ReturnStandardParameters(); - ParametersStructure.Insert("type", Type); - - If (Type = "text" Or Type = "picture") And ValueFilled(Text) Then - ParametersStructure.Insert("text", Text); - EndIf; - - If TypeValue(Keyboard) = Type("Structure") Then - ParametersStructure.Insert("keyboard", Keyboard); - EndIf; - - If ValueFilled(Value) Then - - If Type = "file" Then - ParametersStructure.Insert("media" , Value["URL"]); - ParametersStructure.Insert("size" , Value["Size"]); - ParametersStructure.Insert("file_name", "File." + Value["Extension"]); - ElseIf Type = "contact" Then - ParametersStructure.Insert("contact" , Value); - ElseIf Type = "location" Then - ParametersStructure.Insert("location" , Value); - Otherwise - ParametersStructure.Insert("media" , Value); - EndIf; - - EndIf; - - If IsChannel Then - ParametersStructure.Insert("from", UserID); - URL = "https://chatapi.viber.com/pa/post"; - Otherwise - ParametersStructure.Insert("receiver", UserID); - URL = "https://chatapi.viber.com/pa/send_message"; - EndIf; - - Response = OPI_Tools.Post(URL, ParametersStructure, TokenInHeaders(Token)); - - Attempt - Return OPI_Tools.JsonToStructure(Response.GetBodyAsBinaryData()); - Exception - Return Response; - EndOfAttempt; - +, Val Type +, Val UserID +, Val IsChannel +, Val Value = "" +, Val Text = "" +, Val Keyboard = "") + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(Type); +OPI_TypeConversion.GetLine(UserID); +OPI_TypeConversion.GetLine(Text); +OPI_TypeConversion.GetBoolean(IsChannel); +OPI_TypeConversion.GetCollection(Keyboard); + +ParametersStructure = ReturnStandardParameters(); +ParametersStructure.Insert("type", Type); + +If (Type = "text" Or Type = "picture") And ValueIsFilled(Text) Then +ParametersStructure.Insert("text", Text); +EndIf; + +If TypeValue(Keyboard) = Type("Structure") Then +ParametersStructure.Insert("keyboard", Keyboard); +EndIf; + +If ValueIsFilled(Value) Then + +If Type = "file" Then +ParametersStructure.Insert("media" , Value["URL"]); +ParametersStructure.Insert("size" , Value["Size"]); +ParametersStructure.Insert("file_name", "File." + Value["Extension"]); +ElsIf Type = "contact" Then +ParametersStructure.Insert("contact" , Value); +ElsIf Type = "location" Then +ParametersStructure.Insert("location" , Value); +Else +ParametersStructure.Insert("media" , Value); +EndIf; + +EndIf; + +If IsChannel Then +ParametersStructure.Insert("from", UserID); +URL = "https://chatapi.viber.com/pa/post"; +Else +ParametersStructure.Insert("receiver", UserID); +URL = "https://chatapi.viber.com/pa/send_message"; +EndIf; + +Response = OPI_Tools.Post(URL, ParametersStructure, TokenInHeaders(Token)); + +Try +Return OPI_Tools.JsonToStructure(Response.GetBodyAsBinaryData()); +Except +Return Response; +EndTry; + EndFunction -Function ReturnStandardParameters() - - SenderStructure = New Structure; - SenderStructure.Insert("name" , "Bot"); - SenderStructure.Insert("avatar", ""); - - ParametersStructure = New Structure; - ParametersStructure.Insert("sender", SenderStructure); - ParametersStructure.Insert("min_api_version", 1); - - Return ParametersStructure; - +Function ReturnStandardParameters() + +SenderStructure = New Structure; +SenderStructure.Insert("name" , "Bot"); +SenderStructure.Insert("avatar", ""); + +ParametersStructure = New Structure; +ParametersStructure.Insert("sender", SenderStructure); +ParametersStructure.Insert("min_api_version", 1); + +Return ParametersStructure; + EndFunction Function TokenInHeaders(Val Token) - - OPI_TypeConversion.GetLine(Token); - - HeadersStructure = New Match; - HeadersStructure.Insert("X-Viber-Auth-Token", Token); - Return HeadersStructure; - + +OPI_TypeConversion.GetLine(Token); + +HeadersStructure = New Match; +HeadersStructure.Insert("X-Viber-Auth-Token", Token); +Return HeadersStructure; + EndFunction #EndRegion diff --git a/src/en/OPI/src/CommonModules/OPI_Viber/OPI_Viber.mdo b/src/en/OPI/src/CommonModules/OPI_Viber/OPI_Viber.mdo index dc7840096f..7f26465e4c 100644 --- a/src/en/OPI/src/CommonModules/OPI_Viber/OPI_Viber.mdo +++ b/src/en/OPI/src/CommonModules/OPI_Viber/OPI_Viber.mdo @@ -1,11 +1,11 @@ - + - OPI_Viber - - ru - Методы интеграции с Viber (ОПИ) - - true - true - true +OPI_Viber + +ru +Methodы интеграции with Viber (OPI) + +true +true +true diff --git a/src/en/OPI/src/CommonModules/OPI_YandexDisk/Module.bsl b/src/en/OPI/src/CommonModules/OPI_YandexDisk/Module.bsl index 27c61a4b6b..b3e38b49fa 100644 --- a/src/en/OPI/src/CommonModules/OPI_YandexDisk/Module.bsl +++ b/src/en/OPI/src/CommonModules/OPI_YandexDisk/Module.bsl @@ -34,7 +34,7 @@ //@skip-check method-too-many-params // Uncomment if OneScript is executed -// #Use "../../tools" +// #Use "../../tools" #Region ProgrammingInterface @@ -42,367 +42,367 @@ // Get disk information // Gets information about the current disk -// +// // Parameters: -// Token - String - Token - token -// +// Token - String - Token - token +// // Return value: -// Key-Value Pair - serialized JSON response from Yandex +// Key-Value Pair - serialized JSON response from Yandex Function GetDiskInformation(Val Token) Export - - OPI_TypeConversion.GetLine(Token); - - Headers = AuthorizationHeader(Token); - Response = OPI_Tools.Get("https://cloud-api.yandex.net/v1/disk", , Headers); - - Return Response; - + +OPI_TypeConversion.GetLine(Token); + +Headers = AuthorizationHeader(Token); +Response = OPI_Tools.Get("https://cloud-api.yandex.net/v1/disk", , Headers); + +Return Response; + EndFunction // Create folder // Creates a directory on the disk -// +// // Parameters: -// Token - String - Token - token -// Path - String - Path to the created folder - path -// +// Token - String - Token - token +// Path - String - Path to the created folder - path +// // Return value: -// Key-Value Pair - serialized JSON response from Yandex +// Key-Value Pair - serialized JSON response from Yandex Function CreateFolder(Val Token, Val Path) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Path); - - Headers = AuthorizationHeader(Token); - URL = "https://cloud-api.yandex.net/v1/disk/resources"; - Href = "href"; - - Parameters = New Structure; - Parameters.Insert("path", Path); - - Parameters = OPI_Tools.RequestParametersToString(Parameters); - Response = OPI_Tools.Put(URL + Parameters, , Headers, False); - - ResponseURL = Response[Href]; - - If Not ValueFilled(ResponseURL) Then - Return Response; - EndIf; - - Response = OPI_Tools.Get(ResponseURL, , Headers); - - Return Response; + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(Path); + +Headers = AuthorizationHeader(Token); +URL = "https://cloud-api.yandex.net/v1/disk/resources"; +Href = "href"; + +Parameters = New Structure; +Parameters.Insert("path", Path); + +Parameters = OPI_Tools.RequestParametersToString(Parameters); +Response = OPI_Tools.Put(URL + Parameters, , Headers, False); + +ResponseURL = Response[Href]; + +If Not ValueIsFilled(ResponseURL) Then +Return Response; +EndIf; + +Response = OPI_Tools.Get(ResponseURL, , Headers); + +Return Response; EndFunction // Get object // Gets information about a disk object at the specified path -// +// // Parameters: -// Token - String - Token - token -// Path - String - Path to folder or file - path -// +// Token - String - Token - token +// Path - String - Path to folder or file - path +// // Return value: -// Key-Value Pair - serialized JSON response from Yandex +// Key-Value Pair - serialized JSON response from Yandex Function GetObject(Val Token, Val Path) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Path); - - Headers = AuthorizationHeader(Token); - Parameters = New Structure; - Parameters.Insert("path", Path); - - Response = OPI_Tools.Get("https://cloud-api.yandex.net/v1/disk/resources", Parameters, Headers); - - Return Response; + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(Path); + +Headers = AuthorizationHeader(Token); +Parameters = New Structure; +Parameters.Insert("path", Path); + +Response = OPI_Tools.Get("https://cloud-api.yandex.net/v1/disk/resources", Parameters, Headers); + +Return Response; EndFunction // Delete object // Deletes an object at the specified path -// +// // Parameters: -// Token - String - Token - token -// Path - String - Path to the folder or file to be deleted - path -// ToCart - Boolean - To cart - can -// +// Token - String - Token - token +// Path - String - Path to the folder or file to be deleted - path +// ToCart - Boolean - To cart - can +// // Return value: -// Key-Value Pair - serialized JSON response from Yandex +// Key-Value Pair - serialized JSON response from Yandex Function DeleteObject(Val Token, Val Path, Val ToCart = True) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Path); - OPI_TypeConversion.GetBoolean(ToCart); - - Headers = AuthorizationHeader(Token); - - Parameters = New Structure; - Parameters.Insert("path" , Path); - Parameters.Insert("permanently", Not ToCart); - - Response = OPI_Tools.Delete("https://cloud-api.yandex.net/v1/disk/resources", Parameters, Headers); - - Return Response; + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(Path); +OPI_TypeConversion.GetBoolean(ToCart); + +Headers = AuthorizationHeader(Token); + +Parameters = New Structure; +Parameters.Insert("path" , Path); +Parameters.Insert("permanently", Not ToCart); + +Response = OPI_Tools.Delete("https://cloud-api.yandex.net/v1/disk/resources", Parameters, Headers); + +Return Response; EndFunction // Create object copy // Creates a copy of the object at the specified path and path to the original -// +// // Parameters: -// Token - String - Token - token -// Original - String - Path to the original file or directory - from -// Path - String - Destination path for the copy - to -// Overwrite - Boolean - Overwrite if a file with the same name already exists - rewrite -// +// Token - String - Token - token +// Original - String - Path to the original file or directory - from +// Path - String - Destination path for the copy - to +// Overwrite - Boolean - Overwrite if a file with the same name already exists - rewrite +// // Return value: -// Key-Value Pair - serialized JSON response from Yandex +// Key-Value Pair - serialized JSON response from Yandex Function CreateObjectCopy(Val Token, Val Original, Val Path, Val Overwrite = False) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Original); - OPI_TypeConversion.GetLine(Path); - OPI_TypeConversion.GetBoolean(Overwrite); - - Headers = AuthorizationHeader(Token); - URL = "https://cloud-api.yandex.net/v1/disk/resources/copy"; - Href = "href"; - - Parameters = New Structure; - Parameters.Insert("from" , Original); - Parameters.Insert("path" , Path); - Parameters.Insert("overwrite" , Overwrite); - - Parameters = OPI_Tools.RequestParametersToString(Parameters); - Response = OPI_Tools.Post(URL + Parameters, , Headers, False); - - ResponseURL = Response[Href]; - - If Not ValueFilled(ResponseURL) Then - Return Response; - EndIf; - - Response = OPI_Tools.Get(ResponseURL, , Headers); - - Return Response; - + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(Original); +OPI_TypeConversion.GetLine(Path); +OPI_TypeConversion.GetBoolean(Overwrite); + +Headers = AuthorizationHeader(Token); +URL = "https://cloud-api.yandex.net/v1/disk/resources/copy"; +Href = "href"; + +Parameters = New Structure; +Parameters.Insert("from" , Original); +Parameters.Insert("path" , Path); +Parameters.Insert("overwrite" , Overwrite); + +Parameters = OPI_Tools.RequestParametersToString(Parameters); +Response = OPI_Tools.Post(URL + Parameters, , Headers, False); + +ResponseURL = Response[Href]; + +If Not ValueIsFilled(ResponseURL) Then +Return Response; +EndIf; + +Response = OPI_Tools.Get(ResponseURL, , Headers); + +Return Response; + EndFunction // Get download link // Gets a download link for the file -// +// // Parameters: -// Token - String - Token - token -// Path - String - Path to the file for downloading - path -// +// Token - String - Token - token +// Path - String - Path to the file for downloading - path +// // Return value: -// Key-Value Pair - serialized JSON response from Yandex +// Key-Value Pair - serialized JSON response from Yandex Function GetDownloadLink(Val Token, Val Path) Export - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Path); - - Headers = AuthorizationHeader(Token); - - Parameters = New Structure; - Parameters.Insert("path", Path); - - Response = OPI_Tools.Get("https://cloud-api.yandex.net/v1/disk/resources/download", Parameters, Headers); - - Return Response; - +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(Path); + +Headers = AuthorizationHeader(Token); + +Parameters = New Structure; +Parameters.Insert("path", Path); + +Response = OPI_Tools.Get("https://cloud-api.yandex.net/v1/disk/resources/download", Parameters, Headers); + +Return Response; + EndFunction // Download file // Downloads a file at the specified path -// +// // Parameters: -// Token - String - Token - token -// Path - String - Path to the file for downloading - path -// SavePath - String - File save path - out -// +// Token - String - Token - token +// Path - String - Path to the file for downloading - path +// SavePath - String - File save path - out +// // Return value: -// BinaryData,String - Binary data or file path when SavePath parameter is specified +// BinaryData,String - Binary data or file path when SavePath parameter is specified Function DownloadFile(Val Token, Val Path, Val SavePath = "") Export - - OPI_TypeConversion.GetLine(SavePath); - Response = GetDownloadLink(Token, Path); - URL = Response["href"]; - - If Not ValueFilled(URL) Then - Return Response; - EndIf; - - Response = OPI_Tools.Get(URL, , , SavePath); - - Return Response; - + +OPI_TypeConversion.GetLine(SavePath); +Response = GetDownloadLink(Token, Path); +URL = Response["href"]; + +If Not ValueIsFilled(URL) Then +Return Response; +EndIf; + +Response = OPI_Tools.Get(URL, , , SavePath); + +Return Response; + EndFunction // Get list of files // Gets a list of files with or without filtering by type -// List available typeоin: audio, backup, book, compressed, data, development, -// diskimage, document, encoded, executable, flash, font, -// mage, settings, spreadsheet, text, unknown, video, web -// +// List available typeоin: audio, backup, book, compressed, data, development, +// diskimage, document, encoded, executable, flash, font, +// mage, settings, spreadsheet, text, unknown, video, web +// // Parameters: -// Token - String - Token - token -// Quantity - Number, String - Number of returned objects - amount -// OffsetFromStart - Number - Offset for getting objects not from the beginning of the list - offset -// FilterByType - String - Filter by file type - type -// SortByDate - Boolean - True > sort by date, False > alphabetically - datesort -// +// Token - String - Token - token +// Quantity - Number, String - Number of returned objects - amount +// OffsetFromStart - Number - Offset for getting objects not from the beginning of the list - offset +// FilterByType - String - Filter by file type - type +// SortByDate - Boolean - True > sort by date, False > alphabetically - datesort +// // Return value: -// Key-Value Pair - serialized JSON response from Yandex +// Key-Value Pair - serialized JSON response from Yandex Function GetFilesList(Val Token - , Val Quantity = 0 - , Val OffsetFromStart = 0 - , Val FilterByType = "" - , Val SortByDate = False) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Quantity); - OPI_TypeConversion.GetLine(OffsetFromStart); - OPI_TypeConversion.GetLine(FilterByType); - OPI_TypeConversion.GetBoolean(SortByDate); - - Headers = AuthorizationHeader(Token); - - Parameters = New Structure; - - If ValueFilled(Quantity) Then - Parameters.Insert("limit", OPI_Tools.NumberToString(Quantity)); - EndIf; - - If ValueFilled(OffsetFromStart) Then - Parameters.Insert("offset", OPI_Tools.NumberToString(OffsetFromStart)); - EndIf; - - If ValueFilled(FilterByType) Then - Parameters.Insert("media_type", FilterByType); - EndIf; - - If SortByDate Then - Destination = "last-uploaded"; - Otherwise - Destination = "files"; - EndIf; - - Response = OPI_Tools.Get("https://cloud-api.yandex.net/v1/disk/resources/" + Destination, Parameters, Headers); - - Return Response; - +, Val Quantity = 0 +, Val OffsetFromStart = 0 +, Val FilterByType = "" +, Val SortByDate = False) Export + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(Quantity); +OPI_TypeConversion.GetLine(OffsetFromStart); +OPI_TypeConversion.GetLine(FilterByType); +OPI_TypeConversion.GetBoolean(SortByDate); + +Headers = AuthorizationHeader(Token); + +Parameters = New Structure; + +If ValueIsFilled(Quantity) Then +Parameters.Insert("limit", OPI_Tools.NumberToString(Quantity)); +EndIf; + +If ValueIsFilled(OffsetFromStart) Then +Parameters.Insert("offset", OPI_Tools.NumberToString(OffsetFromStart)); +EndIf; + +If ValueIsFilled(FilterByType) Then +Parameters.Insert("media_type", FilterByType); +EndIf; + +If SortByDate Then +Destination = "last-uploaded"; +Else +Destination = "files"; +EndIf; + +Response = OPI_Tools.Get("https://cloud-api.yandex.net/v1/disk/resources/" + Destination, Parameters, Headers); + +Return Response; + EndFunction // Move object // Moves the object to the specified path and path to the original -// +// // Parameters: -// Token - String - Token - token -// Original - String - Path to the original file or folder - from -// Path - String - Destination path for moving - to -// Overwrite - Boolean - Overwrite if a file with the same name already exists - rewrite -// +// Token - String - Token - token +// Original - String - Path to the original file or folder - from +// Path - String - Destination path for moving - to +// Overwrite - Boolean - Overwrite if a file with the same name already exists - rewrite +// // Return value: -// Key-Value Pair - serialized JSON response from Yandex +// Key-Value Pair - serialized JSON response from Yandex Function MoveObject(Val Token, Val Original, Val Path, Val Overwrite = False) Export - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Original); - OPI_TypeConversion.GetLine(Path); - OPI_TypeConversion.GetBoolean(Overwrite); - - Headers = AuthorizationHeader(Token); - URL = "https://cloud-api.yandex.net/v1/disk/resources/move"; - Href = "href"; - - Parameters = New Structure; - Parameters.Insert("from" , Original); - Parameters.Insert("path" , Path); - Parameters.Insert("overwrite" , Overwrite); - - Parameters = OPI_Tools.RequestParametersToString(Parameters); - Response = OPI_Tools.Post(URL + Parameters, , Headers, False); - ResponseURL = Response[Href]; - - If Not ValueFilled(ResponseURL) Then - Return Response; - EndIf; - - Response = OPI_Tools.Get(ResponseURL, , Headers); - - Return Response; - +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(Original); +OPI_TypeConversion.GetLine(Path); +OPI_TypeConversion.GetBoolean(Overwrite); + +Headers = AuthorizationHeader(Token); +URL = "https://cloud-api.yandex.net/v1/disk/resources/move"; +Href = "href"; + +Parameters = New Structure; +Parameters.Insert("from" , Original); +Parameters.Insert("path" , Path); +Parameters.Insert("overwrite" , Overwrite); + +Parameters = OPI_Tools.RequestParametersToString(Parameters); +Response = OPI_Tools.Post(URL + Parameters, , Headers, False); +ResponseURL = Response[Href]; + +If Not ValueIsFilled(ResponseURL) Then +Return Response; +EndIf; + +Response = OPI_Tools.Get(ResponseURL, , Headers); + +Return Response; + EndFunction // Upload file // Uploads a file to disk at the specified path -// +// // Parameters: -// Token - String - Token - token -// Path - String - Path for saving the file to disk - path -// File - String, BinaryData - File for upload - file -// Overwrite - Boolean - Overwrite if a file with the same name already exists - rewrite -// +// Token - String - Token - token +// Path - String - Path for saving the file to disk - path +// File - String, BinaryData - File for upload - file +// Overwrite - Boolean - Overwrite if a file with the same name already exists - rewrite +// // Return value: -// Key-Value Pair - serialized JSON response from Yandex +// Key-Value Pair - serialized JSON response from Yandex Function UploadFile(Val Token, Val Path, Val File, Val Overwrite = False) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Path); - OPI_TypeConversion.GetBoolean(Overwrite); - OPI_TypeConversion.GetBinaryData(File); - - Headers = AuthorizationHeader(Token); - Href = "href"; - File = New Structure("file", File); - - Parameters = New Structure; - Parameters.Insert("path" , Path); - Parameters.Insert("overwrite" , Overwrite); - - Response = OPI_Tools.Get("https://cloud-api.yandex.net/v1/disk/resources/upload", Parameters, Headers); - URL = Response[Href]; - - If Not ValueFilled(URL) Then - Return Response; - EndIf; - - Response = OPI_Tools.PutMultipart(URL, New Structure(), File, "multipart", Headers); - - Return Response; - + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(Path); +OPI_TypeConversion.GetBoolean(Overwrite); +OPI_TypeConversion.GetBinaryData(File); + +Headers = AuthorizationHeader(Token); +Href = "href"; +File = New Structure("file", File); + +Parameters = New Structure; +Parameters.Insert("path" , Path); +Parameters.Insert("overwrite" , Overwrite); + +Response = OPI_Tools.Get("https://cloud-api.yandex.net/v1/disk/resources/upload", Parameters, Headers); +URL = Response[Href]; + +If Not ValueIsFilled(URL) Then +Return Response; +EndIf; + +Response = OPI_Tools.PutMultipart(URL, New Structure(), File, "multipart", Headers); + +Return Response; + EndFunction // Upload file by URL // Downloads a file to disk from the specified URL -// +// // Parameters: -// Token - String - Token - token -// Path - String - Path to place the downloaded file - path -// Address - String - File URL - url -// +// Token - String - Token - token +// Path - String - Path to place the downloaded file - path +// Address - String - File URL - url +// // Return value: -// Key-Value Pair - serialized JSON response from Yandex +// Key-Value Pair - serialized JSON response from Yandex Function UploadFileByURL(Val Token, Val Path, Val Address) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Path); - OPI_TypeConversion.GetLine(Address); - - Headers = AuthorizationHeader(Token); - URL = "https://cloud-api.yandex.net/v1/disk/resources/upload"; - - Parameters = New Structure; - Parameters.Insert("url" , EncodeString(Address, StringEncodingMethod.URLInURLEncoding)); - Parameters.Insert("path", Path); - - Parameters = OPI_Tools.RequestParametersToString(Parameters); - Response = OPI_Tools.Post(URL + Parameters, , Headers, False); - - Return Response; - + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(Path); +OPI_TypeConversion.GetLine(Address); + +Headers = AuthorizationHeader(Token); +URL = "https://cloud-api.yandex.net/v1/disk/resources/upload"; + +Parameters = New Structure; +Parameters.Insert("url" , EncodeString(Address, StringEncodingMethod.URLInURLEncoding)); +Parameters.Insert("path", Path); + +Parameters = OPI_Tools.RequestParametersToString(Parameters); +Response = OPI_Tools.Post(URL + Parameters, , Headers, False); + +Return Response; + EndFunction #EndRegion @@ -411,182 +411,182 @@ EndFunction // Publish object // Publishes the disk object for public access -// +// // Parameters: -// Token - String - Token - token -// Path - String - Path to the object to be published - path -// +// Token - String - Token - token +// Path - String - Path to the object to be published - path +// // Return value: -// Key-Value Pair - serialized JSON response from Yandex +// Key-Value Pair - serialized JSON response from Yandex Function PublishObject(Val Token, Val Path) Export - Return TogglePublicAccess(Token, Path, True); +Return TogglePublicAccess(Token, Path, True); EndFunction // Unpublish object // Unpublishes a previously published object -// +// // Parameters: -// Token - String - Token - token -// Path - String - Path to the previously published object - path -// +// Token - String - Token - token +// Path - String - Path to the previously published object - path +// // Return value: -// Key-Value Pair - serialized JSON response from Yandex +// Key-Value Pair - serialized JSON response from Yandex Function CancelObjectPublication(Val Token, Val Path) Export - Return TogglePublicAccess(Token, Path, False); +Return TogglePublicAccess(Token, Path, False); EndFunction // Get published list объеtoтоin. // Gets a list of published objects -// +// // Parameters: -// Token - String - Token - token -// Quantity - Number - Number of returned objects - amount -// OffsetFromStart - Number - Offset for getting objects not from the beginning of the list - offset -// +// Token - String - Token - token +// Quantity - Number - Number of returned objects - amount +// OffsetFromStart - Number - Offset for getting objects not from the beginning of the list - offset +// // Return value: -// Key-Value Pair - serialized JSON response from Yandex +// Key-Value Pair - serialized JSON response from Yandex Function GetPublishedObjectsList(Val Token, Val Quantity = 0, Val OffsetFromStart = 0) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Quantity); - OPI_TypeConversion.GetLine(OffsetFromStart); - - Headers = AuthorizationHeader(Token); - - Parameters = New Structure; - - If ValueFilled(Quantity) Then - Parameters.Insert("limit", Quantity); - EndIf; - - If ValueFilled(OffsetFromStart) Then - Parameters.Insert("offset", OffsetFromStart); - EndIf; - - Response = OPI_Tools.Get("https://cloud-api.yandex.net/v1/disk/resources/public", Parameters, Headers); - - Return Response; - + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(Quantity); +OPI_TypeConversion.GetLine(OffsetFromStart); + +Headers = AuthorizationHeader(Token); + +Parameters = New Structure; + +If ValueIsFilled(Quantity) Then +Parameters.Insert("limit", Quantity); +EndIf; + +If ValueIsFilled(OffsetFromStart) Then +Parameters.Insert("offset", OffsetFromStart); +EndIf; + +Response = OPI_Tools.Get("https://cloud-api.yandex.net/v1/disk/resources/public", Parameters, Headers); + +Return Response; + EndFunction // Get public object // Gets information about the published object by its URL -// +// // Parameters: -// Token - String - Token - token -// URL - String - Object address - url -// Quantity - Number - Quantity inозinращаемых inложенных объеtoтоin (for directory) - amount -// OffsetFromStart - Number - Offset for getting nested objects not from the beginning of the list - offset -// +// Token - String - Token - token +// URL - String - Object address - url +// Quantity - Number - Quantity inозinращаемых inложенных объеtoтоin (for directory) - amount +// OffsetFromStart - Number - Offset for getting nested objects not from the beginning of the list - offset +// // Return value: -// Key-Value Pair - serialized JSON response from Yandex +// Key-Value Pair - serialized JSON response from Yandex Function GetPublicObject(Val Token, Val URL, Val Quantity = 0, Val OffsetFromStart = 0) Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(URL); - OPI_TypeConversion.GetLine(Quantity); - OPI_TypeConversion.GetLine(OffsetFromStart); - - Headers = AuthorizationHeader(Token); - - Parameters = New Structure; - - If ValueFilled(Quantity) Then - Parameters.Insert("limit", OPI_Tools.NumberToString(Quantity)); - EndIf; - - If ValueFilled(OffsetFromStart) Then - Parameters.Insert("offset", OPI_Tools.NumberToString(OffsetFromStart)); - EndIf; - - Parameters.Insert("public_key", URL); - - Response = OPI_Tools.Get("https://cloud-api.yandex.net/v1/disk/public/resources", Parameters, Headers); - - Return Response; - + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(URL); +OPI_TypeConversion.GetLine(Quantity); +OPI_TypeConversion.GetLine(OffsetFromStart); + +Headers = AuthorizationHeader(Token); + +Parameters = New Structure; + +If ValueIsFilled(Quantity) Then +Parameters.Insert("limit", OPI_Tools.NumberToString(Quantity)); +EndIf; + +If ValueIsFilled(OffsetFromStart) Then +Parameters.Insert("offset", OPI_Tools.NumberToString(OffsetFromStart)); +EndIf; + +Parameters.Insert("public_key", URL); + +Response = OPI_Tools.Get("https://cloud-api.yandex.net/v1/disk/public/resources", Parameters, Headers); + +Return Response; + EndFunction // Get download link for public object // Gets a direct link to download the public object -// +// // Parameters: -// Token - String - Token - token -// URL - String - Object address - url -// Path - String - Path inside the object - path -// +// Token - String - Token - token +// URL - String - Object address - url +// Path - String - Path inside the object - path +// // Return value: -// Key-Value Pair - serialized JSON response from Yandex +// Key-Value Pair - serialized JSON response from Yandex Function GetDownloadLinkForPublicObject(Val Token, Val URL, Val Path = "") Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(URL); - OPI_TypeConversion.GetLine(Path); - - Headers = AuthorizationHeader(Token); - - Parameters = New Structure; - - If ValueFilled(Path) Then - Parameters.Insert("path", Path); - EndIf; - - Parameters.Insert("public_key", URL); - - Response = OPI_Tools.Get("https://cloud-api.yandex.net/v1/disk/public/resources/download", Parameters, Headers); - - Return Response; - + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(URL); +OPI_TypeConversion.GetLine(Path); + +Headers = AuthorizationHeader(Token); + +Parameters = New Structure; + +If ValueIsFilled(Path) Then +Parameters.Insert("path", Path); +EndIf; + +Parameters.Insert("public_key", URL); + +Response = OPI_Tools.Get("https://cloud-api.yandex.net/v1/disk/public/resources/download", Parameters, Headers); + +Return Response; + EndFunction - + // Save public object to disk // Saves the public object to your disk -// +// // Parameters: -// Token - String - Token - token -// URL - String - Object address - url -// From - String - Path inнутри публичного directory (тольtoо for папоto) - from -// To - String - File save path - to -// +// Token - String - Token - token +// URL - String - Object address - url +// From - String - Path inнутри публичного directory (тольtoо for папоto) - from +// To - String - File save path - to +// // Return value: -// Key-Value Pair - serialized JSON response from Yandex +// Key-Value Pair - serialized JSON response from Yandex Function SavePublicObjectToDisk(Val Token, Val URL, From = "", To = "") Export - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(URL); - OPI_TypeConversion.GetLine(From); - OPI_TypeConversion.GetLine(To); - - Headers = AuthorizationHeader(Token); - Address = "https://cloud-api.yandex.net/v1/disk/public/resources/save-to-disk"; - Href = "href"; - - Parameters = New Structure; - Parameters.Insert("public_key", URL); - - If ValueFilled(From) Then - Parameters.Insert("path", From); - EndIf; - - If ValueFilled(To) Then - Parameters.Insert("save_path", To); - EndIf; - - Parameters = OPI_Tools.RequestParametersToString(Parameters); - Response = OPI_Tools.Post(Address + Parameters, , Headers, False); - - ResponseURL = Response[Href]; - - If Not ValueFilled(ResponseURL) Then - Return Response; - EndIf; - - Response = OPI_Tools.Get(ResponseURL, , Headers); - - Return Response; - + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(URL); +OPI_TypeConversion.GetLine(From); +OPI_TypeConversion.GetLine(To); + +Headers = AuthorizationHeader(Token); +Address = "https://cloud-api.yandex.net/v1/disk/public/resources/save-to-disk"; +Href = "href"; + +Parameters = New Structure; +Parameters.Insert("public_key", URL); + +If ValueIsFilled(From) Then +Parameters.Insert("path", From); +EndIf; + +If ValueIsFilled(To) Then +Parameters.Insert("save_path", To); +EndIf; + +Parameters = OPI_Tools.RequestParametersToString(Parameters); +Response = OPI_Tools.Post(Address + Parameters, , Headers, False); + +ResponseURL = Response[Href]; + +If Not ValueIsFilled(ResponseURL) Then +Return Response; +EndIf; + +Response = OPI_Tools.Get(ResponseURL, , Headers); + +Return Response; + EndFunction - + #EndRegion #EndRegion @@ -594,42 +594,42 @@ EndFunction #Region ServiceProceduresAndFunctions Function AuthorizationHeader(Val Token) - - Headers = New Match; - Headers.Insert("Authorization", "OAuth " + Token); - - Return Headers; - + +Headers = New Match; +Headers.Insert("Authorization", "OAuth " + Token); + +Return Headers; + EndFunction -Function TogglePublicAccess(Val Token, Val Path, Val PublicAccess) - - OPI_TypeConversion.GetLine(Token); - OPI_TypeConversion.GetLine(Path); - OPI_TypeConversion.GetBoolean(PublicAccess); - - Headers = AuthorizationHeader(Token); - Destination = ?(PublicAccess, "publish", "unpublish"); - Href = "href"; - - URL = "https://cloud-api.yandex.net/v1/disk/resources/" + Destination; - - Parameters = New Structure; - Parameters.Insert("path", Path); - - Parameters = OPI_Tools.RequestParametersToString(Parameters); - Response = OPI_Tools.Put(URL + Parameters, , Headers, False); - - ResponseURL = Response[Href]; - - If Not ValueFilled(ResponseURL) Then - Return Response; - EndIf; - - Response = OPI_Tools.Get(ResponseURL, , Headers); - - Return Response; - +Function TogglePublicAccess(Val Token, Val Path, Val PublicAccess) + +OPI_TypeConversion.GetLine(Token); +OPI_TypeConversion.GetLine(Path); +OPI_TypeConversion.GetBoolean(PublicAccess); + +Headers = AuthorizationHeader(Token); +Destination = ?(PublicAccess, "publish", "unpublish"); +Href = "href"; + +URL = "https://cloud-api.yandex.net/v1/disk/resources/" + Destination; + +Parameters = New Structure; +Parameters.Insert("path", Path); + +Parameters = OPI_Tools.RequestParametersToString(Parameters); +Response = OPI_Tools.Put(URL + Parameters, , Headers, False); + +ResponseURL = Response[Href]; + +If Not ValueIsFilled(ResponseURL) Then +Return Response; +EndIf; + +Response = OPI_Tools.Get(ResponseURL, , Headers); + +Return Response; + EndFunction #EndRegion diff --git a/src/en/OPI/src/CommonModules/OPI_YandexDisk/OPI_YandexDisk.mdo b/src/en/OPI/src/CommonModules/OPI_YandexDisk/OPI_YandexDisk.mdo index 6846d3d51e..9b087975fb 100644 --- a/src/en/OPI/src/CommonModules/OPI_YandexDisk/OPI_YandexDisk.mdo +++ b/src/en/OPI/src/CommonModules/OPI_YandexDisk/OPI_YandexDisk.mdo @@ -1,11 +1,11 @@ - + - OPI_YandexDisk - - ru - Методы работы с Yandex Disk (ОПИ) - - true - true - true +OPI_YandexDisk + +ru +Methodы work with Yandex Disk (OPI) + +true +true +true diff --git a/src/en/OPI/src/CommonModules/OPI_YandexID/Module.bsl b/src/en/OPI/src/CommonModules/OPI_YandexID/Module.bsl index a62bc29112..0ba3454fc0 100644 --- a/src/en/OPI/src/CommonModules/OPI_YandexID/Module.bsl +++ b/src/en/OPI/src/CommonModules/OPI_YandexID/Module.bsl @@ -36,77 +36,77 @@ // Get confirmation code // Gets the confirmation code and the address of the page where it needs to be entered -// +// // Parameters: -// ClientId - String - Client id - id -// +// ClientId - String - Client id - id +// // Return value: -// Key-Value Pair - serialized JSON response from Yandex +// Key-Value Pair - serialized JSON response from Yandex Function GetConfirmationCode(Val ClientId) Export - OPI_TypeConversion.GetLine(ClientId); - - Parameters = New Structure("client_id", ClientId); - Response = OPI_Tools.Post("https://oauth.yandex.ru/device/code", Parameters, , False); - - Return Response; - +OPI_TypeConversion.GetLine(ClientId); + +Parameters = New Structure("client_id", ClientId); +Response = OPI_Tools.Post("https://oauth.yandex.ru/device/code", Parameters, , False); + +Return Response; + EndFunction // Convert code to token // Converts the code to a token after entering the code when executing GetConfirmationCode -// +// // Parameters: -// ClientId - String - Client id - id -// ClientSecret - String - Client secret - secret -// DeviceCode - String - device_code from GetConfirmationCode() - device -// +// ClientId - String - Client id - id +// ClientSecret - String - Client secret - secret +// DeviceCode - String - device_code from GetConfirmationCode() - device +// // Return value: -// Key-Value Pair - serialized JSON response from Yandex +// Key-Value Pair - serialized JSON response from Yandex Function ConvertCodeToToken(Val ClientId, Val ClientSecret, Val DeviceCode) Export - - OPI_TypeConversion.GetLine(ClientId); - OPI_TypeConversion.GetLine(ClientSecret); - OPI_TypeConversion.GetLine(DeviceCode); - - Parameters = New Structure; - Parameters.Insert("grant_type" , "device_code"); - Parameters.Insert("code" , DeviceCode); - Parameters.Insert("client_id" , ClientId); - Parameters.Insert("client_secret" , ClientSecret); - - Response = OPI_Tools.Post("https://oauth.yandex.ru/token", Parameters, , False); - - Return Response; - + +OPI_TypeConversion.GetLine(ClientId); +OPI_TypeConversion.GetLine(ClientSecret); +OPI_TypeConversion.GetLine(DeviceCode); + +Parameters = New Structure; +Parameters.Insert("grant_type" , "device_code"); +Parameters.Insert("code" , DeviceCode); +Parameters.Insert("client_id" , ClientId); +Parameters.Insert("client_secret" , ClientSecret); + +Response = OPI_Tools.Post("https://oauth.yandex.ru/token", Parameters, , False); + +Return Response; + EndFunction // Refresh token // Updates token by Refresh token -// +// // Parameters: -// ClientId - String - Client id - id -// ClientSecret - String - Client secret - secret -// RefreshToken - String - Refresh token - refresh -// +// ClientId - String - Client id - id +// ClientSecret - String - Client secret - secret +// RefreshToken - String - Refresh token - refresh +// // Return value: -// Key-Value Pair - serialized JSON response from Yandex +// Key-Value Pair - serialized JSON response from Yandex Function RefreshToken(Val ClientId, Val ClientSecret, Val RefreshToken) Export - - OPI_TypeConversion.GetLine(ClientId); - OPI_TypeConversion.GetLine(ClientSecret); - OPI_TypeConversion.GetLine(RefreshToken); - - Parameters = New Structure; - Parameters.Insert("grant_type" , "refresh_token"); - Parameters.Insert("refresh_token" , RefreshToken); - Parameters.Insert("client_id" , ClientId); - Parameters.Insert("client_secret" , ClientSecret); - - Response = OPI_Tools.Post("https://oauth.yandex.ru/token", Parameters, , False); - - Return Response; - + +OPI_TypeConversion.GetLine(ClientId); +OPI_TypeConversion.GetLine(ClientSecret); +OPI_TypeConversion.GetLine(RefreshToken); + +Parameters = New Structure; +Parameters.Insert("grant_type" , "refresh_token"); +Parameters.Insert("refresh_token" , RefreshToken); +Parameters.Insert("client_id" , ClientId); +Parameters.Insert("client_secret" , ClientSecret); + +Response = OPI_Tools.Post("https://oauth.yandex.ru/token", Parameters, , False); + +Return Response; + EndFunction #EndRegion diff --git a/src/en/OPI/src/CommonModules/OPI_YandexID/OPI_YandexID.mdo b/src/en/OPI/src/CommonModules/OPI_YandexID/OPI_YandexID.mdo index 7b8489440d..c3df5601df 100644 --- a/src/en/OPI/src/CommonModules/OPI_YandexID/OPI_YandexID.mdo +++ b/src/en/OPI/src/CommonModules/OPI_YandexID/OPI_YandexID.mdo @@ -1,11 +1,11 @@ - + - OPI_YandexID - - ru - Методы работы с Yandex ID (ОПИ) - - true - true - true +OPI_YandexID + +ru +Methodы work with Yandex ID (OPI) + +true +true +true diff --git a/src/en/OPI/src/CommonModules/OPI_Тесты/Module.bsl b/src/en/OPI/src/CommonModules/OPI_Тесты/Module.bsl deleted file mode 100644 index 4699050476..0000000000 --- a/src/en/OPI/src/CommonModules/OPI_Тесты/Module.bsl +++ /dev/null @@ -1,5307 +0,0 @@ -// Location OS: ./OInt/tests/Modules/internal/OPI_Tests.os - -// MIT License - -// Copyright (c) 2023 Anton Tsitavets - -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: - -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. - -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -// https://github.com/Bayselonarrend/OpenIntegrations - -// Test suite for YAxUnit - -// BSLLS:Typo-off -// BSLLS:LatinAndCyrillicSymbolInWord-off -// BSLLS:IncorrectLineBreak-off -// BSLLS:UsingServiceTag-off -// BSLLS:UnusedParameters-off -// BSLLS:DuplicateStringLiteral-off - -// @skip-check undefined-variable -// @skip-check wrong-string-literal-content - -// Uncomment if OneScript is executed -// #Use oint -// #Use asserts - -#Region ServiceProgramInterface - -// For YAxUnit - -Procedure ExecutableScripts() Export - - OPI_GetTestData.FormYAXTests(); - -EndProcedure - -// For Asserts - -Function GetTestList(UnitTesting) Export - - Return OPI_GetTestData.FormAssertsTests(); - -EndFunction - -#Region RunnableTests - -#Region Telegram - -Procedure Telegram_GetBotInfo() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Telegram_Token", TestParameters); - - Telegram_GetBotInformation(TestParameters); - -EndProcedure - -Procedure Telegram_GetUpdates() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Telegram_Token", TestParameters); - - Telegram_DeleteWebhook(TestParameters); - Telegram_GetUpdates(TestParameters); - -EndProcedure - -Procedure Telegram_SetWebhook() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Telegram_Token", TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_URL" , TestParameters); - - Telegram_SetWebhook(TestParameters); - Telegram_DeleteWebhook(TestParameters); - -EndProcedure - -Procedure Telegram_SendTextMessage() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChatID" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChannelID", TestParameters); - OPI_GetTestData.ParameterToCollection("String" , TestParameters); - - Telegram_SendTextMessage(TestParameters); - -EndProcedure - -Procedure Telegram_SendImage() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChatID" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChannelID", TestParameters); - OPI_GetTestData.ParameterToCollection("String" , TestParameters); - OPI_GetTestData.ParameterToCollection("Picture" , TestParameters); - - Telegram_SendPicture(TestParameters); - Telegram_DownloadFile(TestParameters); - -EndProcedure - -Procedure Telegram_SendVideo() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChatID" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChannelID", TestParameters); - OPI_GetTestData.ParameterToCollection("String" , TestParameters); - OPI_GetTestData.ParameterToCollection("Video" , TestParameters); - - Telegram_SendVideo(TestParameters); - Telegram_DownloadFile(TestParameters); - -EndProcedure - -Procedure Telegram_SendAudio() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChatID" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChannelID", TestParameters); - OPI_GetTestData.ParameterToCollection("String" , TestParameters); - OPI_GetTestData.ParameterToCollection("Audio" , TestParameters); - - Telegram_SendAudio(TestParameters); - Telegram_DownloadFile(TestParameters); - -EndProcedure - -Procedure Telegram_SendDocument() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChatID" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChannelID", TestParameters); - OPI_GetTestData.ParameterToCollection("String" , TestParameters); - OPI_GetTestData.ParameterToCollection("Document" , TestParameters); - - Telegram_SendDocument(TestParameters); - -EndProcedure - -Procedure Telegram_SendGIF() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChatID" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChannelID", TestParameters); - OPI_GetTestData.ParameterToCollection("String" , TestParameters); - OPI_GetTestData.ParameterToCollection("GIF" , TestParameters); - - Telegram_SendGif(TestParameters); - -EndProcedure - -Procedure Telegram_SendMediaGroup() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChatID" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChannelID", TestParameters); - OPI_GetTestData.ParameterToCollection("String" , TestParameters); - OPI_GetTestData.ParameterToCollection("Picture" , TestParameters); - OPI_GetTestData.ParameterToCollection("Video" , TestParameters); - - Telegram_SendMediaGroup(TestParameters); - -EndProcedure - -Procedure Telegram_SendLocation() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChatID" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChannelID", TestParameters); - OPI_GetTestData.ParameterToCollection("Long" , TestParameters); - OPI_GetTestData.ParameterToCollection("Lat" , TestParameters); - - Telegram_SendLocation(TestParameters); - -EndProcedure - -Procedure Telegram_SendContact() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChatID" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChannelID", TestParameters); - OPI_GetTestData.ParameterToCollection("Name" , TestParameters); - OPI_GetTestData.ParameterToCollection("Surname" , TestParameters); - OPI_GetTestData.ParameterToCollection("Phone" , TestParameters); - - Telegram_SendContact(TestParameters); - -EndProcedure - -Procedure Telegram_SendPoll() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChatID" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChannelID", TestParameters); - - Telegram_SendPoll(TestParameters); - -EndProcedure - -Procedure Telegram_ForwardMessage() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChatID" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChannelID" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChannelMessageID", TestParameters); - - Telegram_ForwardMessage(TestParameters); - -EndProcedure - -Procedure Telegram_BanUnban() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChatID" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChannelID" , TestParameters); - - Telegram_Ban(TestParameters); - Telegram_Unban(TestParameters); - -EndProcedure - -Procedure Telegram_CreateInvitationLink() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChannelID", TestParameters); - - Telegram_CreateInviteLink(TestParameters); - -EndProcedure - -Procedure Telegram_PinUnpinMessage() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChannelID" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChannelMessageID", TestParameters); - - Telegram_PinMessage(TestParameters); - Telegram_UnpinMessage(TestParameters); - -EndProcedure - -Procedure Telegram_GetMemberCount() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ChannelID", TestParameters); - - Telegram_GetParticipantCount(TestParameters); - -EndProcedure - -Procedure Telegram_GetForumAvatarsList() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Telegram_Token", TestParameters); - - Telegram_GetForumAvatarList(TestParameters); - -EndProcedure - -Procedure Telegram_CreateDeleteForumTopic() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ForumID", TestParameters); - OPI_GetTestData.ParameterToCollection("Picture" , TestParameters); - OPI_GetTestData.ParameterToCollection("String" , TestParameters); - - Telegram_CreateForumTopic(TestParameters); - Telegram_EditForumTopic(TestParameters); - Telegram_CloseForumTopic(TestParameters); - Telegram_OpenForumTopic(TestParameters); - Telegram_ClearPinnedMessagesList(TestParameters); - Telegram_DeleteForumTopic(TestParameters); - -EndProcedure - -Procedure Telegram_HideShowMainTopic() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ForumID", TestParameters); - - Telegram_HideMainForumTopic(TestParameters); - Telegram_ShowMainForumTopic(TestParameters); - -EndProcedure - -Procedure Telegram_ChangeMainTopicName() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Telegram_Token" , TestParameters); - OPI_GetTestData.ParameterToCollection("Telegram_ForumID", TestParameters); - - Telegram_ChangeMainTopicName(TestParameters); - -EndProcedure - -#EndRegion - -#Region VK - -Procedure VK_CreateTokenLink() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("VK_AppID", TestParameters); - - VK_CreateTokenRetrievalLink(TestParameters); - -EndProcedure - -Procedure VK_CreateDeletePost() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Picture" , TestParameters); - OPI_GetTestData.ParameterToCollection("Picture2", TestParameters); - - VK_CreatePost(TestParameters); - VK_DeletePost(TestParameters); - -EndProcedure - -Procedure VK_CreateCompositePost() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Picture" , TestParameters); - OPI_GetTestData.ParameterToCollection("Video" , TestParameters); - - VK_CreateCompositePost(TestParameters); - -EndProcedure - -Procedure VK_CreatePoll() Export - - VK_CreatePoll(); - -EndProcedure - -Procedure VK_SaveDeleteImage() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Picture" , TestParameters); - - VK_CreateAlbum(TestParameters); - VK_SavePictureToAlbum(TestParameters); - VK_DeleteImage(TestParameters); - VK_DeleteAlbum(TestParameters); - -EndProcedure - -Procedure VK_CreateStory() Export - - TestParameters = New Match; - OPI_GetTestData.ParameterToCollection("Picture" , TestParameters); - - VK_CreateStory(TestParameters); - -EndProcedure - -Procedure VK_DiscussionMethods() Export - - TestParameters = New Structure; - Parameters = GetVKParameters(); - - VK_CreateDiscussion(TestParameters); - VK_CloseDiscussion(TestParameters); - VK_OpenDiscussion(TestParameters); - VK_PostToDiscussion(TestParameters); - - OPI_VK.CloseDiscussion(TestParameters["VK_ConvID"], True, Parameters); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure VK_LikeRepostComment() Export - - Parameters = GetVKParameters(); - Text = "Post from autotest"; - Message = "Message from autotest"; - TypeMatch = Type("Match"); - TypeNumber = Type("Number"); - Response = "response"; - - Result = OPI_VK.CreatePost(Text, New Array, , , Parameters); - - PostID = Result[Response]["post_id"]; - Result = OPI_VK.LikePost(PostID, , Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "LikePost"); - - OPI_Tools.Pause(5); - - OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch).Filled(); - OPI_GetTestData.ExpectsThat(Result[Response]["likes"]).HasType(TypeNumber).Filled(); - - ExternalPost = 2571; - ExternalWall = -218704372; - - Result = OPI_VK.MakeRepost(ExternalPost, ExternalWall, , , Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "MakeRepost"); - - OPI_Tools.Pause(5); - - OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch).Filled(); - OPI_GetTestData.ExpectsThat(Result[Response]["success"]).HasType(TypeNumber).Equal(1); - OPI_GetTestData.ExpectsThat(Result[Response]["wall_repost_count"]).HasType(TypeNumber).Equal(1); - - Result = OPI_VK.WriteComment(PostID, Parameters["owner_id"], Message, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "WriteComment"); - - OPI_Tools.Pause(5); - - OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch).Filled(); - OPI_GetTestData.ExpectsThat(Result[Response]["comment_id"]).HasType(TypeNumber).Filled(); - - OPI_VK.DeletePost(PostID, Parameters); - OPI_VK.DeletePost(Result[Response]["post_id"], Parameters); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure VK_GetStatistics() Export - - CurrentDate = OPI_Tools.GetCurrentDate(); - Parameters = GetVKParameters(); - Date0 = StartOfDay(CurrentDate); - Date1 = EndOfDay(Date0); - TypeMatch = Type("Match"); - - Result = OPI_VK.GetStatistics(Date0, Date1, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetStatistics"); - - OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch).Filled(); - OPI_GetTestData.ExpectsThat(Result["response"][0]["visitors"]).HasType(TypeMatch).Filled(); - OPI_GetTestData.ExpectsThat(Result["response"][0]["reach"]).HasType(TypeMatch).Filled(); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure VK_GetPostStatistics() Export - - Parameters = GetVKParameters(); - - ArrayOfPosts = New Array; - ArrayOfPosts.Add(214); - ArrayOfPosts.Add(215); - - Result = OPI_VK.GetPostStatistics(ArrayOfPosts, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetPostStatistics"); - - OPI_GetTestData.ExpectsThat(Result).HasType("Array").HasLength(2); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure VK_CreateAdCampaign() Export - - Parameters = GetVKParameters(); - CabinetID = OPI_GetTestData.GetParameter("VK_AdsCabinetID"); - Name = "TestCampaign"; - TypeMatch = Type("Match"); - TypeNumber = Type("Number"); - Response = "response"; - UID = "id"; - - Result = OPI_VK.CreateAdvertisingCampaign(CabinetID, Name, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateAdvertisingCampaign"); - - Result = Result[Response][0]; - - OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); - OPI_GetTestData.ExpectsThat(Result["error_code"]).HasType(TypeNumber).Equal(602); - OPI_GetTestData.ExpectsThat(Result[UID]).HasType(TypeNumber).Filled(); - - CampaignID = Result[UID]; - CategoryID = 126; - Limit = 150; - - Result = OPI_VK.CreatePost(Name, New Array, , , Parameters); - PostID = Result[Response]["post_id"]; - - Result = OPI_VK.CreateAd(CampaignID - , Limit - , CategoryID - , PostID - , CabinetID - , Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateAd"); - - Result = Result[Response][0]; - - OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); - OPI_GetTestData.ExpectsThat(Result["error_code"]).HasType(TypeNumber).Equal(602); - OPI_GetTestData.ExpectsThat(Result[UID]).HasType(TypeNumber).Filled(); - - AnnouncementID = Result[UID]; - Result = OPI_VK.PauseAdvertisingAd(CabinetID, AnnouncementID, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "PauseAdvertisingAd"); - - Result = Result[Response][0]; - - OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); - OPI_GetTestData.ExpectsThat(Result[UID]).HasType(TypeNumber).Filled(); - - OPI_VK.DeletePost(PostID, Parameters); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure VK_SendMessage() Export - - Parameters = GetVKParameters(); - User = OPI_GetTestData.GetParameter("VK_UserID"); - Token = OPI_GetTestData.GetParameter("VK_CommunityToken"); - Text = "Message from autotest"; - - ButtonArray = New Array; - ButtonArray.Add("Button 1"); - ButtonArray.Add("Button 2"); - - Keyboard = OPI_VK.FormKeyboard(ButtonArray); - Result = OPI_VK.WriteMessage(Text, User, Token, Keyboard, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "WriteMessage"); - - OPI_GetTestData.ExpectsThat(Result).HasType("Match"); - OPI_GetTestData.ExpectsThat(Result["response"]).HasType("Number").Filled(); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure VK_GetProductCategories() Export - - Parameters = GetVKParameters(); - Result = OPI_VK.GetProductCategoryList(Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetProductCategoryList"); - - OPI_GetTestData.ExpectsThat(Result) - .HasType("Match") - .Filled(); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure VK_CreateProductSelection() Export - - Parameters = GetVKParameters(); - TypeMatch = Type("Match"); - TypeNumber = Type("Number"); - Response = "response"; - Image = OPI_GetTestData.GetBinary("Picture"); - AndVF = GetTempFileName("png"); - Image.Write(AndVF); - - Result = OPI_VK.CreateProductCollection("TestCollection" - , Image - , True - , False - , Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateProductCollection"); - - OPI_Tools.Pause(5); - - OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); - OPI_GetTestData.ExpectsThat(Result[Response]["albums_count"]).HasType(TypeNumber).Filled(); - OPI_GetTestData.ExpectsThat(Result[Response]["market_album_id"]).HasType(TypeNumber).Filled(); - - SelectionID = Result[Response]["market_album_id"]; - - Result = OPI_VK.EditProductCollection("EditedCollection", SelectionID, , , , Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "EditProductCollection"); - - OPI_Tools.Pause(5); - - OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); - OPI_GetTestData.ExpectsThat(Result[Response]).HasType(TypeNumber).Equal(1); - - ImageArray = New Array; - ImageArray.Add(OPI_GetTestData.GetBinary("Picture")); - ImageArray.Add(OPI_GetTestData.GetBinary("Picture2")); - - Product = New Match(); - Product.Insert("Name" , "TestProduct"); - Product.Insert("Description" , "Product description"); - Product.Insert("Category" , "20173"); - Product.Insert("Price" , 1); - Product.Insert("OldPrice" , 15); - Product.Insert("MainPhoto" , Image); - Product.Insert("URL" , "https://github.com/Bayselonarrend/OpenIntegrations"); - Product.Insert("AdditionalPhotos" , ImageArray); - Product.Insert("MainInGroup" , True); - Product.Insert("Width" , 20); - Product.Insert("Height" , 30); - Product.Insert("Depth" , 40); - Product.Insert("Weight" , 100); - Product.Insert("SKU" , "12345"); - Product.Insert("AvailableBalance" , "10"); - - Result = OPI_VK.AddProduct(Product, SelectionID, Parameters); // Adding product - - // !OInt OPI_GetTestData.WriteLog(Result, "AddProduct"); - - OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); - OPI_GetTestData.ExpectsThat(Result[Response]["market_item_id"]).HasType(TypeNumber).Filled(); - - ProductID = Result[Response]["market_item_id"]; - - Product = New Match; - Product.Insert("Name", "EditedTestProduct"); - - Result = OPI_VK.EditProduct(ProductID, Product, , Parameters); // Change product - - // !OInt OPI_GetTestData.WriteLog(Result, "EditProduct"); - - Check_VKTrue(Result); - - Result = OPI_VK.AddProductToSelection(ProductID, SelectionID, Parameters); // Adding in selection - - // !OInt OPI_GetTestData.WriteLog(Result, "AddProductToSelection"); - - OPI_Tools.Pause(5); - - OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); - OPI_GetTestData.ExpectsThat(Result[Response]).HasType(TypeNumber).Filled(); - - Result = OPI_VK.RemoveProductFromSelection(ProductID, SelectionID, Parameters); // Deletes from selections - - // !OInt OPI_GetTestData.WriteLog(Result, "RemoveProductFromSelection"); - - OPI_Tools.Pause(5); - Check_VKTrue(Result); - - Result = OPI_VK.DeleteProduct(ProductID, Parameters); // Deletion product - - // !OInt OPI_GetTestData.WriteLog(Result, "DeleteProduct"); - - OPI_Tools.Pause(5); - Check_VKTrue(Result); - - Result = OPI_VK.DeleteSelection(SelectionID, Parameters); // Removal selections - - // !OInt OPI_GetTestData.WriteLog(Result, "DeleteSelection"); - - OPI_Tools.Pause(5); - Check_VKTrue(Result); - - DeleteFiles(AndVF); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure VK_CreateProductWithProperties() Export - - Parameters = GetVKParameters(); - TypeMatch = Type("Match"); - TypeNumber = Type("Number"); - MII = "market_item_id"; - Response = "response"; - Yellow = "Yellow"; - Red = "Red"; - Image = OPI_GetTestData.GetBinary("Picture"); - AndVF = GetTempFileName("png"); - Image.Write(AndVF); - - OptionArray = New Array; - OptionArray.Add(Yellow); - OptionArray.Add("Blue"); - OptionArray.Add(Red); - - Result = OPI_VK.CreateProductProperty("Color", Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateProductProperty"); - - OPI_Tools.Pause(5); - - Property = Result[Response]["property_id"]; - Property = OPI_Tools.NumberToString(Property); - - PropertyMatch = New Match; - - OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); - OPI_GetTestData.ExpectsThat(Result[Response]["property_id"]).HasType(TypeNumber).Filled(); - - Result = OPI_VK.EditProductProperty("Color (fromм.)", Property, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "EditProductProperty"); - - OPI_Tools.Pause(5); - - Check_VKTrue(Result); - - For Each Option Of OptionArray Loop - - Result = OPI_VK.AddProductPropertyVariant(Option, Property, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "AddProductPropertyVariant"); - - OPI_Tools.Pause(5); - - OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); - OPI_GetTestData.ExpectsThat(Result[Response]["variant_id"]).HasType(TypeNumber).Filled(); - - VariantID = Result[Response]["variant_id"]; - PropertyMatch.Insert(Option, VariantID); - - Result = OPI_VK.EditProductPropertyVariant(Option + String(New UniqueIdentifier()) - , Property - , VariantID - , Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "EditProductPropertyVariant"); - - Check_VKTrue(Result); - - EndOfLoop; - - ImageArray = New Array; - ImageArray.Add(AndVF); - ImageArray.Add(Image); - - Product = New Match(); - Product.Insert("Name" , "TestProduct (" + Yellow + ")"); - Product.Insert("Description" , "Product description"); - Product.Insert("Category" , "20173"); - Product.Insert("Price" , 1); - Product.Insert("OldPrice" , 15); - Product.Insert("MainPhoto" , Image); - Product.Insert("URL" , "https://github.com/Bayselonarrend/OpenIntegrations"); - Product.Insert("AdditionalPhotos" , ImageArray); - Product.Insert("MainInGroup" , True); - Product.Insert("GroupNumber" , Undefined); - Product.Insert("Width" , 20); - Product.Insert("Height" , 30); - Product.Insert("Depth" , 40); - Product.Insert("Weight" , 100); - Product.Insert("SKU" , 12345); - Product.Insert("AvailableBalance" , "10"); - Product.Insert("PropertyValues" , PropertyMatch[Yellow]); - - Result = OPI_VK.AddProduct(Product, , Parameters); // Adding product - - // !OInt OPI_GetTestData.WriteLog(Result, "AddProduct"); - - OPI_Tools.Pause(5); - - YellowID = Result[Response]["market_item_id"]; - - OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); - OPI_GetTestData.ExpectsThat(Result[Response][MII]).HasType(TypeNumber).Filled(); - - Product.Insert("Name" , "TestProduct (" + Red + ")"); - Product.Insert("PropertyValues", PropertyMatch[Red]); - - Result = OPI_VK.AddProduct(Product, , Parameters); // Adding product - - // !OInt OPI_GetTestData.WriteLog(Result, "AddProduct"); - - OPI_Tools.Pause(5); - - RedID = Result[Response][MII]; - - OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); - OPI_GetTestData.ExpectsThat(Result[Response][MII]).HasType(TypeNumber).Filled(); - - Array of products = New Array; - Array of products.Add(YellowID); - Array of products.Add(RedID); - - Result = OPI_VK.GetProductsByID(Array of products, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetProductsByID"); - - OPI_Tools.Pause(5); - - OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); - OPI_GetTestData.ExpectsThat(Result[Response]["items"]).HasType("Array").HasLength(2); - - Result = OPI_VK.GroupProducts(Array of products, , Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "GroupProducts"); - - OPI_Tools.Pause(5); - - OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); - OPI_GetTestData.ExpectsThat(Result[Response]["item_group_id"]).HasType(TypeNumber).Filled(); - - OPI_VK.DeleteProduct(YellowID , Parameters); - OPI_VK.DeleteProduct(RedID, Parameters); - - For Each Option Of PropertyMatch Loop - - Deletion = OPI_VK.DeleteProductPropertyVariant(Option.Value, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "DeleteProductPropertyVariant"); - - OPI_Tools.Pause(5); - Check_VKTrue(Deletion); - - EndOfLoop; - - Deletion = OPI_VK.DeleteProductProperty(Property, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "DeleteProductProperty"); - - OPI_Tools.Pause(5); - - Check_VKTrue(Deletion); - - DeleteFiles(AndVF); - -EndProcedure - -Procedure VK_GetProductList() Export - - Parameters = GetVKParameters(); - Image = OPI_GetTestData.GetBinary("Picture"); - - ImageArray = New Array; - ImageArray.Add(Image); - - Product = New Match(); - Product.Insert("Name" , "TestProduct2"); - Product.Insert("Description" , "Product description"); - Product.Insert("Category" , "20173"); - Product.Insert("Price" , 1); - Product.Insert("OldPrice" , 15); - Product.Insert("MainPhoto" , Image); - Product.Insert("URL" , "https://github.com/Bayselonarrend/OpenIntegrations"); - Product.Insert("AdditionalPhotos" , ImageArray); - Product.Insert("MainInGroup" , True); - Product.Insert("GroupNumber" , Undefined); - Product.Insert("Width" , 20); - Product.Insert("Height" , 30); - Product.Insert("Depth" , 40); - Product.Insert("Weight" , 100); - Product.Insert("SKU" , 12345); - Product.Insert("AvailableBalance" , "10"); - - Result = OPI_VK.AddProduct(Product, , Parameters); - ProductID = Result["response"]["market_item_id"]; - OPI_Tools.Pause(5); - - Result = OPI_VK.GetProductList(, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetProductList"); - - OPI_Tools.Pause(5); - - OPI_GetTestData.ExpectsThat(Result) - .HasType("Array").Filled(); - - OPI_VK.DeleteProduct(ProductID, Parameters); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure VK_GetSelectionList() Export - - Parameters = GetVKParameters(); - Image = OPI_GetTestData.GetBinary("Picture"); - Result = OPI_VK.CreateProductCollection("TestCollection" - , Image - , True - , False - , Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateProductCollection"); - - SelectionID = Result["response"]["market_album_id"]; - Result = OPI_VK.GetSelectionList(Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetSelectionList"); - - OPI_Tools.Pause(5); - - OPI_GetTestData.ExpectsThat(Result) - .HasType("Array").Filled(); - - OPI_VK.DeleteSelection(SelectionID, Parameters); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure VK_GetPropertyList() Export - - Parameters = GetVKParameters(); - Result = OPI_VK.GetPropertyList(Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetPropertyList"); - - OPI_Tools.Pause(5); - - OPI_GetTestData.ExpectsThat(Result) - .HasType("Array").Filled(); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure VK_GetOrderList() Export - - Parameters = GetVKParameters(); - Result = OPI_VK.GetOrderList(Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetOrderList"); - - OPI_Tools.Pause(5); - - OPI_GetTestData.ExpectsThat(Result) - .HasType("Array").Filled(); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure VK_UploadVideo() Export - - Parameters = GetVKParameters(); - Video = OPI_GetTestData.GetParameter("Video"); - Name = "NewVideo"; - Description = "Video description"; - - Result = OPI_VK.UploadVideoToServer(Video, Name, Description, , Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetOrderList"); - - OPI_GetTestData.ExpectsThat(Result["video_id"]).Filled(); - OPI_GetTestData.ExpectsThat(Result["video_hash"]).Filled(); - - OPI_Tools.Pause(5); - -EndProcedure - -#EndRegion - -#Region YandexDisk - -Procedure YDisk_GetDiskInfo() Export - - Token = OPI_GetTestData.GetParameter("YandexDisk_Token"); - Match = "Match"; - - Result = OPI_YandexDisk.GetDiskInformation(Token); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetDiskInformation"); - - OPI_GetTestData.ExpectsThat(Result).HasType(Match).Filled(); - OPI_GetTestData.ExpectsThat(Result["system_folders"]).HasType(Match); - OPI_GetTestData.ExpectsThat(Result["user"]).HasType(Match); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure YDisk_CreateFolder() Export - - Token = OPI_GetTestData.GetParameter("YandexDisk_Token"); - Path = "/" + String(New UniqueIdentifier); - - Result = OPI_YandexDisk.CreateFolder(Token, Path); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateFolder"); - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["type"]).Equal("dir"); - OPI_GetTestData.ExpectsThat(Result["path"]).Equal("disk:" + Path); - - OPI_YandexDisk.DeleteObject(Token, Path, False); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure YDisk_UploadByUrlAndGetObject() Export - - Token = OPI_GetTestData.GetParameter("YandexDisk_Token"); - Path = "/" + String(New UniqueIdentifier) + ".png"; - URL = "https://raw.githubusercontent.com/Bayselonarrend/OpenIntegrations/main/Media/logo.png"; - - OPI_YandexDisk.UploadFileByURL(Token, Path, URL); - OPI_Tools.Pause(5); - - Result = OPI_YandexDisk.GetObject(Token, Path); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetObject"); - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["type"]).Equal("file"); - OPI_GetTestData.ExpectsThat(Result["path"]).Equal("disk:" + Path); - - OPI_YandexDisk.DeleteObject(Token, Path, False); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure YDisk_UploadDeleteFile() Export - - Token = OPI_GetTestData.GetParameter("YandexDisk_Token"); - Path = "/" + String(New UniqueIdentifier) + ".png"; - Image = OPI_GetTestData.GetBinary("Picture"); - AndVF = GetTempFileName("png"); - Image.Write(AndVF); - - Result = OPI_YandexDisk.UploadFile(Token, Path, Image, True); - - // !OInt OPI_GetTestData.WriteLog(Result, "UploadFile"); - - Check_Empty(Result); - OPI_Tools.Pause(5); - - Result = OPI_YandexDisk.DeleteObject(Token, Path, False); - - // !OInt OPI_GetTestData.WriteLog(Result, "DeleteObject"); - - Check_Empty(Result); - - Result = OPI_YandexDisk.UploadFile(Token, Path, AndVF, True); - - // !OInt OPI_GetTestData.WriteLog(Result, "UploadFile"); - - Check_Empty(Result); - OPI_Tools.Pause(5); - - Result = OPI_YandexDisk.DeleteObject(Token, Path, False); - - // !OInt OPI_GetTestData.WriteLog(Result, "DeleteObject"); - - Check_Empty(Result); - - DeleteFiles(AndVF); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure YDisk_CreateObjectCopy() Export - - Token = OPI_GetTestData.GetParameter("YandexDisk_Token"); - OriginalPath = "/" + String(New UniqueIdentifier) + ".png"; - CopyPath = "/" + String(New UniqueIdentifier) + ".png"; - URL = "https://raw.githubusercontent.com/Bayselonarrend/" - + "OpenIntegrations/main/Media/logo.png"; - - OPI_YandexDisk.UploadFileByURL(Token, OriginalPath, URL); - OPI_Tools.Pause(5); - - Result = OPI_YandexDisk.CreateObjectCopy(Token, OriginalPath, CopyPath, True); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateObjectCopy"); - - OPI_Tools.Pause(5); - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["type"]).Equal("file"); - OPI_GetTestData.ExpectsThat(Result["path"]).Equal("disk:" + CopyPath); - - OPI_YandexDisk.DeleteObject(Token, OriginalPath, False); - OPI_YandexDisk.DeleteObject(Token, CopyPath, False); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure YDisk_GetDownloadLink() Export - - Token = OPI_GetTestData.GetParameter("YandexDisk_Token"); - Path = "/" + String(New UniqueIdentifier) + ".png"; - URL = "https://raw.githubusercontent.com/Bayselonarrend/OpenIntegrations/main/Media/logo.png"; - - OPI_YandexDisk.UploadFileByURL(Token, Path, URL); - OPI_Tools.Pause(5); - - Result = OPI_YandexDisk.GetDownloadLink(Token, Path); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetDownloadLink"); - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["method"]).Equal("GET"); - OPI_GetTestData.ExpectsThat(Result["href"]).HasType("String").Filled(); - - URL = Result["href"]; - - Result = OPI_YandexDisk.DownloadFile(Token, Path); - - OPI_GetTestData.ExpectsThat(Result).HasType("BinaryData").Filled(); - - OPI_YandexDisk.DeleteObject(Token, Path, False); - -EndProcedure - -Procedure YDisk_GetFileList() Export - - Token = OPI_GetTestData.GetParameter("YandexDisk_Token"); - Quantity = 2; - Indent = 1; - - Result = OPI_YandexDisk.GetFilesList(Token, Quantity, Indent, "image"); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetFilesList"); - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["limit"]).Equal(Quantity); - OPI_GetTestData.ExpectsThat(Result["offset"]).Equal(Indent); - OPI_GetTestData.ExpectsThat(Result["items"]).HasType("Array"); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure YDisk_MoveObject() Export - - Token = OPI_GetTestData.GetParameter("YandexDisk_Token"); - OriginalPath = "/" + String(New UniqueIdentifier) + ".png"; - CopyPath = "/" + String(New UniqueIdentifier) + ".png"; - URL = "https://raw.githubusercontent.com/Bayselonarrend/" - + "OpenIntegrations/main/Media/logo.png"; - - OPI_YandexDisk.UploadFileByURL(Token, OriginalPath, URL); - OPI_Tools.Pause(15); - - Result = OPI_YandexDisk.MoveObject(Token, OriginalPath, CopyPath, True); - - // !OInt OPI_GetTestData.WriteLog(Result, "MoveObject"); - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["type"]).Equal("file"); - OPI_GetTestData.ExpectsThat(Result["path"]).Equal("disk:" + CopyPath); - - OPI_YandexDisk.DeleteObject(Token, OriginalPath, False); - OPI_YandexDisk.DeleteObject(Token, CopyPath, False); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure YDisk_PublicObjectActions() Export - - PUrl = "public_url"; - Match = "Match"; - Token = OPI_GetTestData.GetParameter("YandexDisk_Token"); - Path = "/" + String(New UniqueIdentifier) + ".png"; - URL = "https://raw.githubusercontent.com/Bayselonarrend/OpenIntegrations/main/Media/logo.png"; - - OPI_YandexDisk.UploadFileByURL(Token, Path, URL); - OPI_Tools.Pause(5); - - ResultArray = New Array; - - ResultArray.Add(OPI_YandexDisk.PublishObject(Token, Path)); - PublicURL = ResultArray[0][PUrl]; - - Result = OPI_YandexDisk.GetDownloadLinkForPublicObject(Token, PublicURL); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetDownloadLinkForPublicObject"); - - OPI_GetTestData.ExpectsThat(Result).HasType(Match).Filled(); - OPI_GetTestData.ExpectsThat(Result["method"]).Equal("GET"); - OPI_GetTestData.ExpectsThat(Result["href"]).HasType("String").Filled(); - - Result = OPI_YandexDisk.GetPublicObject(Token, PublicURL); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetPublicObject"); - - OPI_GetTestData.ExpectsThat(Result).HasType(Match).Filled(); - OPI_GetTestData.ExpectsThat(Result["type"]).Equal("file"); - OPI_GetTestData.ExpectsThat(Result["path"]).Equal("/"); - - ResultArray.Add(OPI_YandexDisk.SavePublicObjectToDisk(Token, PublicURL)); - - ResultArray.Add(OPI_YandexDisk.CancelObjectPublication(Token, Path)); - - Counter = 0; - For Each Result Of ResultArray Loop - - // !OInt OPI_GetTestData.WriteLog(Result, "PublicationChange"); - - OPI_GetTestData.ExpectsThat(Result).HasType(Match).Filled(); - OPI_GetTestData.ExpectsThat(Result["type"]).Equal("file"); - OPI_GetTestData.ExpectsThat(Result["path"]).Filled(); - - If Counter = 0 Then - OPI_GetTestData.ExpectsThat(Result[PUrl]).HasType("String").Filled(); - Otherwise - OPI_GetTestData.ExpectsThat(Result[PUrl]).HasType("Undefined"); - EndIf; - - Counter = Counter + 1; - - EndOfLoop; - - OPI_YandexDisk.DeleteObject(Token, Path, False); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure YDisk_GetPublishedList() Export - - Token = OPI_GetTestData.GetParameter("YandexDisk_Token"); - Quantity = 2; - Indent = 1; - - Result = OPI_YandexDisk.GetPublishedObjectsList(Token, Quantity, Indent); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetPublishedObjectsList"); - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["limit"]).Equal(Quantity); - OPI_GetTestData.ExpectsThat(Result["offset"]).Equal(Indent); - OPI_GetTestData.ExpectsThat(Result["items"]).HasType("Array"); - - OPI_Tools.Pause(5); - -EndProcedure - -#EndRegion - -#Region Viber - -Procedure Viber_GetChannelInfo() Export - - Token = OPI_GetTestData.GetParameter("Viber_ChannelToken"); - Result = OPI_Viber.GetChannelInformation(Token); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetChannelInformation"); - - Check_ViberOk(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Viber_GetUserData() Export - - Token = OPI_GetTestData.GetParameter("Viber_ChannelToken"); - User = OPI_GetTestData.GetParameter("Viber_ChannelAdminID"); - Result = OPI_Viber.GetUserData(Token, User); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetUserData"); - - OPI_GetTestData.ExpectsThat(Result["chat_hostname"]).Filled(); - OPI_GetTestData.ExpectsThat(Result["status_message"]).Filled(); - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Viber_GetOnlineUsers() Export - - Token = OPI_GetTestData.GetParameter("Viber_ChannelToken"); - User = OPI_GetTestData.GetParameter("Viber_UserID"); - Result = OPI_Viber.GetOnlineUsers(Token, User); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetOnlineUsers"); - - OPI_GetTestData.ExpectsThat(Result["users"]).HasType("Array"); - Check_ViberOk(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Viber_SendTextMessage() Export - - Text = "TestMessage"; - ChannelToken = OPI_GetTestData.GetParameter("Viber_ChannelToken"); - BotToken = OPI_GetTestData.GetParameter("Viber_Token"); - User = OPI_GetTestData.GetParameter("Viber_UserID"); - Administrator = OPI_GetTestData.GetParameter("Viber_ChannelAdminID"); - - ButtonArray = New Array; - ButtonArray.Add("Button 1"); - ButtonArray.Add("Button 2"); - ButtonArray.Add("Button 3"); - - Keyboard = OPI_Viber.CreateKeyboardFromArrayButton(ButtonArray); - - Result = OPI_Viber.SendTextMessage(BotToken, Text, User, False, Keyboard); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendTextMessage"); - - OPI_GetTestData.ExpectsThat(Result["message_token"]).Filled(); - Check_ViberOk(Result); - - Result = OPI_Viber.SendTextMessage(ChannelToken, Text, Administrator, True, Keyboard); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendTextMessage"); - - OPI_GetTestData.ExpectsThat(Result["message_token"]).Filled(); - Check_ViberOk(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Viber_SendImage() Export - - Text = "TestMessage"; - Image = OPI_GetTestData.GetParameter("Picture"); - ChannelToken = OPI_GetTestData.GetParameter("Viber_ChannelToken"); - BotToken = OPI_GetTestData.GetParameter("Viber_Token"); - User = OPI_GetTestData.GetParameter("Viber_UserID"); - Administrator = OPI_GetTestData.GetParameter("Viber_ChannelAdminID"); - - Result = OPI_Viber.SendImage(BotToken, Image, User, False, Text); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendImage"); - - OPI_GetTestData.ExpectsThat(Result["message_token"]).Filled(); - Check_ViberOk(Result); - - Result = OPI_Viber.SendImage(ChannelToken, Image, Administrator, True, Text); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendImage"); - - OPI_GetTestData.ExpectsThat(Result["message_token"]).Filled(); - Check_ViberOk(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Viber_SendFile() Export - - Document = OPI_GetTestData.GetParameter("Document"); - ChannelToken = OPI_GetTestData.GetParameter("Viber_ChannelToken"); - BotToken = OPI_GetTestData.GetParameter("Viber_Token"); - User = OPI_GetTestData.GetParameter("Viber_UserID"); - Administrator = OPI_GetTestData.GetParameter("Viber_ChannelAdminID"); - - Result = OPI_Viber.SendFile(BotToken, Document, User, False, "docx"); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendFile"); - - OPI_GetTestData.ExpectsThat(Result["message_token"]).Filled(); - Check_ViberOk(Result); - - Result = OPI_Viber.SendFile(ChannelToken, Document, Administrator, True, "docx"); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendFile"); - - OPI_GetTestData.ExpectsThat(Result["message_token"]).Filled(); - Check_ViberOk(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Viber_SendContact() Export - - Name = "Petr Petrov"; - Phone = "+123456789"; - ChannelToken = OPI_GetTestData.GetParameter("Viber_ChannelToken"); - BotToken = OPI_GetTestData.GetParameter("Viber_Token"); - User = OPI_GetTestData.GetParameter("Viber_UserID"); - Administrator = OPI_GetTestData.GetParameter("Viber_ChannelAdminID"); - - Result = OPI_Viber.SendContact(BotToken, Name, Phone, User, False); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendContact"); - - OPI_GetTestData.ExpectsThat(Result["message_token"]).Filled(); - Check_ViberOk(Result); - - Result = OPI_Viber.SendContact(ChannelToken, Name, Phone, Administrator, True); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendContact"); - - OPI_GetTestData.ExpectsThat(Result["message_token"]).Filled(); - Check_ViberOk(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Viber_SendLocation() Export - - Latitude = "48.87373649724122"; - Longitude = "2.2954639195323967"; - ChannelToken = OPI_GetTestData.GetParameter("Viber_ChannelToken"); - BotToken = OPI_GetTestData.GetParameter("Viber_Token"); - User = OPI_GetTestData.GetParameter("Viber_UserID"); - Administrator = OPI_GetTestData.GetParameter("Viber_ChannelAdminID"); - - Result = OPI_Viber.SendLocation(BotToken, Latitude, Longitude, User, False); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendLocation"); - - OPI_GetTestData.ExpectsThat(Result["message_token"]).Filled(); - Check_ViberOk(Result); - - Result = OPI_Viber.SendLocation(ChannelToken, Latitude, Longitude, Administrator, True); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendLocation"); - - OPI_GetTestData.ExpectsThat(Result["message_token"]).Filled(); - Check_ViberOk(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Viber_SendLink() Export - - URL = "https://github.com/Bayselonarrend/OpenIntegrations"; - ChannelToken = OPI_GetTestData.GetParameter("Viber_ChannelToken"); - BotToken = OPI_GetTestData.GetParameter("Viber_Token"); - User = OPI_GetTestData.GetParameter("Viber_UserID"); - Administrator = OPI_GetTestData.GetParameter("Viber_ChannelAdminID"); - - Result = OPI_Viber.SendLink(BotToken, URL, User, False); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendLink"); - - OPI_GetTestData.ExpectsThat(Result["message_token"]).Filled(); - Check_ViberOk(Result); - - Result = OPI_Viber.SendLink(ChannelToken, URL, Administrator, True); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendLink"); - - OPI_GetTestData.ExpectsThat(Result["message_token"]).Filled(); - Check_ViberOk(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -#EndRegion - -#Region GoogleWorkspace - -Procedure GV_GetAuthorizationLink() Export - - ClientID = OPI_GetTestData.GetParameter("Google_ClientID"); - Result = OPI_GoogleWorkspace.FormCodeRetrievalLink(ClientID); - - OPI_GetTestData.ExpectsThat(Result) - .HasType("String") - .Filled(); - - OPI_GetTestData.WriteParameter("Google_Link", Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure GV_GetToken() Export - - ClientID = OPI_GetTestData.GetParameter("Google_ClientID"); - ClientSecret = OPI_GetTestData.GetParameter("Google_ClientSecret"); - Code = OPI_GetTestData.GetParameter("Google_Code"); - - Result = OPI_GoogleWorkspace.GetTokenByCode(ClientID, ClientSecret, Code); - - If ValueFilled(Result["access_token"]) - And ValueFilled(Result["refresh_token"]) Then - - OPI_GetTestData.WriteParameter("Google_Token" , Result["access_token"]); - OPI_GetTestData.WriteParameter("Google_Refresh", Result["refresh_token"]); - - EndIf; - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure GV_UpdateToken() Export - - ClientID = OPI_GetTestData.GetParameter("Google_ClientID"); - ClientSecret = OPI_GetTestData.GetParameter("Google_ClientSecret"); - RefreshToken = OPI_GetTestData.GetParameter("Google_Refresh"); - - Result = OPI_GoogleWorkspace.RefreshToken(ClientID, ClientSecret, RefreshToken); - - OPI_GetTestData.ExpectsThat(Result).HasType("Match"); - OPI_GetTestData.ExpectsThat(Result["access_token"]).Filled(); - - OPI_GetTestData.WriteParameter("Google_Token", Result["access_token"]); - - OPI_Tools.Pause(5); - -EndProcedure - -#EndRegion - -#Region GoogleCalendar - -Procedure GC_GetCalendarList() Export - - Token = OPI_GetTestData.GetParameter("Google_Token"); - Result = OPI_GoogleCalendar.GetCalendarList(Token); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetCalendarList"); - - OPI_GetTestData.ExpectsThat(Result) - .HasType("Array"); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure GC_CreateDeleteCalendar() Export - - Token = OPI_GetTestData.GetParameter("Google_Token"); - Name = "TestCalendar"; - Description = "TestDescription"; - EditedName = Name + " (fromм.)"; - TypeMatch = Type("Match"); - TypeString = Type("String"); - Summary = "summary"; - Black = "#000000"; - Yellow = "#ffd800"; - - Result = OPI_GoogleCalendar.CreateCalendar(Token, Name); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateCalendar"); - - OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); - OPI_GetTestData.ExpectsThat(Result[Summary]).Equal(Name); - OPI_GetTestData.ExpectsThat(Result["id"]).HasType(TypeString).Filled(); - - Calendar = Result["id"]; - - Result = OPI_GoogleCalendar.EditCalendarMetadata(Token - , Calendar - , EditedName - , Description); - - // !OInt OPI_GetTestData.WriteLog(Result, "EditCalendarMetadata"); - - Check_GKObject(Result, EditedName, Description); - - Result = OPI_GoogleCalendar.GetCalendarMetadata(Token, Calendar); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetCalendarMetadata"); - - Check_GKObject(Result, EditedName, Description); - - Result = OPI_GoogleCalendar.AddCalendarToList(Token, Calendar); - - // !OInt OPI_GetTestData.WriteLog(Result, "AddCalendarToList"); - - Check_GKObject(Result, EditedName, Description); - - Result = OPI_GoogleCalendar.EditListCalendar(Token, Calendar, Black, Yellow, False); - - // !OInt OPI_GetTestData.WriteLog(Result, "EditListCalendar"); - - OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); - OPI_GetTestData.ExpectsThat(Result[Summary]).Equal(EditedName); - OPI_GetTestData.ExpectsThat(Result["foregroundColor"]).Equal(Black); - OPI_GetTestData.ExpectsThat(Result["backgroundColor"]).Equal(Yellow); - - Result = OPI_GoogleCalendar.GetListCalendar(Token, Calendar); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetListCalendar"); - - OPI_GetTestData.ExpectsThat(Result).HasType(TypeMatch); - OPI_GetTestData.ExpectsThat(Result[Summary]).Equal(EditedName); - OPI_GetTestData.ExpectsThat(Result["foregroundColor"]).Equal(Black); - OPI_GetTestData.ExpectsThat(Result["backgroundColor"]).Equal(Yellow); - - Result = OPI_GoogleCalendar.ClearMainCalendar(Token); - - // !OInt OPI_GetTestData.WriteLog(Result, "ClearMainCalendar"); - - Check_Empty(Result); - - Result = OPI_GoogleCalendar.DeleteCalendarFromList(Token, Calendar); - - // !OInt OPI_GetTestData.WriteLog(Result, "DeleteCalendarFromList"); - - Check_Empty(Result); - - Result = OPI_GoogleCalendar.DeleteCalendar(Token, Calendar); - - // !OInt OPI_GetTestData.WriteLog(Result, "DeleteCalendar"); - - Check_Empty(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure GC_CreateDeleteEvent() Export - - CurrentDate = OPI_Tools.GetCurrentDate(); - Token = OPI_GetTestData.GetParameter("Google_Token"); - Calendar = OPI_GetTestData.GetParameter("Google_CalendarID"); - Name = "New event"; - Description = "TestEventDescription"; - EditedDescription = "TestEventDescription (fromм.)"; - UID = "id"; - Hour = 3600; - - Attachments = New Match; - - Attachments.Insert("Image1" - , "https://opi.neocities.org/assets/images/logo_long-e8fdcca6ff8b32e679ea49a1ccdd3eac.png"); - Attachments.Insert("Image2" - , "https://github.com/Bayselonarrend/OpenIntegrations/raw/main/Media/logo.png?v1"); - - EventMatch = New Match; - EventMatch.Insert("Description" , Description); - EventMatch.Insert("Title" , Name); - EventMatch.Insert("Venue" , "InOffice"); - EventMatch.Insert("StartDate" , CurrentDate); - EventMatch.Insert("EndDate" , EventMatch["StartDate"] + Hour); - EventMatch.Insert("ArrayOfAttachmentURLs" , Attachments); - EventMatch.Insert("SendNotifications" , True); - - Result = OPI_GoogleCalendar.CreateEvent(Token, Calendar, EventMatch); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateEvent"); - - Event = Result[UID]; - - Check_GKObject(Result, Name, Description); - - EventMatch = New Match; - EventMatch.Insert("Description", EditedDescription); - - Result = OPI_GoogleCalendar.EditEvent(Token, Calendar, EventMatch, Event); - - // !OInt OPI_GetTestData.WriteLog(Result, "EditEvent"); - - Check_GKObject(Result, Name, EditedDescription); - - Result = OPI_GoogleCalendar.GetEvent(Token, Calendar, Event); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetEvent"); - - Check_GKObject(Result, Name, EditedDescription); - - Result = OPI_GoogleCalendar.MoveEvent(Token, Calendar, Calendar, Event); - - // !OInt OPI_GetTestData.WriteLog(Result, "MoveEvent"); - - Check_GKObject(Result, Name, EditedDescription); - - Result = OPI_GoogleCalendar.DeleteEvent(Token, Calendar, Event); - - // !OInt OPI_GetTestData.WriteLog(Result, "DeleteEvent"); - - Check_Empty(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure GC_GetEventList() Export - - Token = OPI_GetTestData.GetParameter("Google_Token"); - Calendar = OPI_GetTestData.GetParameter("Google_CalendarID"); - - Result = OPI_GoogleCalendar.GetEventList(Token, Calendar); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetEventList"); - - OPI_GetTestData.ExpectsThat(Result).HasType("Array"); - - OPI_Tools.Pause(5); - -EndProcedure - -#EndRegion - -#Region GoogleDrive - -Procedure GD_GetCatalogList() Export - - MimeType = "mimeType"; - Name = "name"; - Name = "TestFolder"; - Token = OPI_GetTestData.GetParameter("Google_Token"); - Result = OPI_GoogleDrive.GetDirectoriesList(Token, Name, True); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetDirectoriesList"); - - Result = Result[0]; - - OPI_GetTestData.ExpectsThat(Result["files"]).HasType("Array"); - OPI_GetTestData.ExpectsThat(Result[MimeType]).Equal("application/vnd.google-apps.folder"); - OPI_GetTestData.ExpectsThat(Result[Name]).Filled(); - - OPI_Tools.Pause(5); - Identifier = Result["id"]; - - OPI_GetTestData.WriteParameter("GD_Catalog", Identifier); - - Result = OPI_GoogleDrive.GetObjectInformation(Token, Identifier); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetObjectInformation"); - - OPI_GetTestData.ExpectsThat(Result[MimeType]).Equal("application/vnd.google-apps.folder"); - OPI_GetTestData.ExpectsThat(Result[Name]).Filled(); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure GD_UploadDeleteFile() Export - - ExtraBytes = 2; - - Kind = "kind"; - Content = "content"; - MIME = "MIME"; - MimeType = "mimeType"; - Name = "name"; - Id_ = "id"; - - ArrayOfDeletions = New Array; - Token = OPI_GetTestData.GetParameter("Google_Token"); - Image = OPI_GetTestData.GetBinary("Picture"); - ReplacementImage = OPI_GetTestData.GetBinary("Picture2"); - Directory = OPI_GetTestData.GetParameter("GD_Catalog"); - - Description = OPI_GoogleDrive.GetFileDescription(); - Description.Insert("Parent", Directory); - - Result = OPI_GoogleDrive.UploadFile(Token, Image, Description); - - // !OInt OPI_GetTestData.WriteLog(Result, "UploadFile"); - - OPI_GetTestData.ExpectsThat(Result[MimeType]).Equal(Description[MIME]); - OPI_GetTestData.ExpectsThat(Result[Name]).Equal(Description["Name"]); - - Identifier = Result[Id_]; - ArrayOfDeletions.Add(Identifier); - - NewName = "CopiedFile.jpeg"; - Result = OPI_GoogleDrive.CopyObject(Token, Identifier, NewName, "root"); - - // !OInt OPI_GetTestData.WriteLog(Result, "CopyObject"); - - OPI_Tools.Pause(5); - - OPI_GetTestData.ExpectsThat(Result[MimeType]).Equal(Description[MIME]); - OPI_GetTestData.ExpectsThat(Result[Name]).Equal(NewName); - - ArrayOfDeletions.Add(Result[Id_]); - - Result = OPI_GoogleDrive.DownloadFile(Token, Identifier); - - // !OInt OPI_GetTestData.WriteLog(Result, "DownloadFile"); - - OPI_GetTestData.ExpectsThat(Result.Size()).Equal(Image.Size() + ExtraBytes); - OPI_Tools.Pause(5); - - NewName = "UpdatedFile.jpg"; - Result = OPI_GoogleDrive.UpdateFile(Token, Identifier, ReplacementImage, NewName); - - // !OInt OPI_GetTestData.WriteLog(Result, "UpdateFile"); - - OPI_GetTestData.ExpectsThat(Result[MimeType]).Equal(Description[MIME]); - OPI_GetTestData.ExpectsThat(Result[Name]).Equal(NewName); - - OPI_Tools.Pause(5); - - Comment = "Yo"; - Result = OPI_GoogleDrive.CreateComment(Token, Identifier, Comment); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateComment"); - - OPI_GetTestData.ExpectsThat(Result[Content]).Equal(Comment); - OPI_GetTestData.ExpectsThat(Result[Kind]).Equal("drive#comment"); - - OPI_Tools.Pause(5); - - For Each Deletable Of ArrayOfDeletions Loop - Result = OPI_GoogleDrive.DeleteObject(Token, Deletable); - - // !OInt OPI_GetTestData.WriteLog(Result, "DeleteObject"); - - OPI_GetTestData.ExpectsThat(ValueFilled(Result)).Equal(False); - OPI_Tools.Pause(2); - EndOfLoop; - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure GD_CreateDeleteComment() Export - - Kind = "kind"; - Content = "content"; - Id_ = "id"; - Comments = "comments"; - Token = OPI_GetTestData.GetParameter("Google_Token"); - Directory = OPI_GetTestData.GetParameter("GD_Catalog"); - Image = OPI_GetTestData.GetBinary("Picture"); - - Description = OPI_GoogleDrive.GetFileDescription(); - Description.Insert("Parent", Directory); - - Result = OPI_GoogleDrive.UploadFile(Token, Image, Description); - Identifier = Result[Id_]; - - Comment = "NewComment"; - ResultArray = New Array; - Result = OPI_GoogleDrive.CreateComment(Token, Identifier, Comment); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateComment"); - - CommentID = Result[Id_]; - - ResultArray.Add(Result); - - Result = OPI_GoogleDrive.GetComment(Token, Identifier, CommentID); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetComment"); - - ResultArray.Add(Result); - - Result = OPI_GoogleDrive.GetCommentList(Token, Identifier); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetCommentList"); - - Comments = Result[Comments]; - CommentObject = Comments[Comments.WithinBoundary()]; - - ResultArray.Add(CommentObject); - - For Each Result Of ResultArray Loop - OPI_GetTestData.ExpectsThat(Result[Content]).Equal(Comment); - OPI_GetTestData.ExpectsThat(Result[Kind]).Equal("drive#comment"); - EndOfLoop; - - Result = OPI_GoogleDrive.DeleteComment(Token, Identifier, CommentID); - - // !OInt OPI_GetTestData.WriteLog(Result, "DeleteComment"); - - OPI_GetTestData.ExpectsThat(ValueFilled(Result)).Equal(False); - - OPI_GoogleDrive.DeleteObject(Token, Identifier); - -EndProcedure - -Procedure GD_CreateCatalog() Export - - Name = "name"; - Name = "TestFolder"; - Token = OPI_GetTestData.GetParameter("Google_Token"); - Directory = OPI_GetTestData.GetParameter("GD_Catalog"); - - ResultArray = New Array; - - ResultArray.Add(OPI_GoogleDrive.CreateFolder(Token, Name)); - ResultArray.Add(OPI_GoogleDrive.CreateFolder(Token, Name, Directory)); - - For Each Result Of ResultArray Loop - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateFolder"); - - CatalogID = Result["id"]; - - OPI_GetTestData.ExpectsThat(Result[Name]).Equal(Name); - - OPI_GoogleDrive.DeleteObject(Token, CatalogID); - - EndOfLoop; - -EndProcedure - -#EndRegion - -#Region GoogleSheets - -Procedure GT_CreateTable() Export - - Token = OPI_GetTestData.GetParameter("Google_Token"); - Name = "TestTable"; - - SheetArray = New Array; - SheetArray.Add("Sheet1"); - SheetArray.Add("Sheet2"); - - Result = OPI_GoogleSheets.CreateBook(Token, Name, SheetArray); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateBook"); - - OPI_GetTestData.ExpectsThat(Result["properties"]["title"]).Equal(Name); - - For N = 0 by SheetArray.WithinBoundary() Loop - - SheetName = Result["sheets"][N]["properties"]["title"]; - OPI_GetTestData.ExpectsThat(SheetName).Equal(SheetArray[N]); - Sheet = Result["sheets"][N]["properties"]["sheetId"]; - Sheet = OPI_Tools.NumberToString(Sheet); - - EndOfLoop; - - Book = Result["spreadsheetId"]; - - OPI_GetTestData.WriteParameter("GS_Spreadsheet", Book); - OPI_GetTestData.WriteParameter("GS_Sheet" , Sheet); - - Result = OPI_GoogleSheets.CreateBook(Token, Name, SheetArray); - Book2 = Result["spreadsheetId"]; - - Result = OPI_GoogleSheets.CopySheet(Token, Book, Book2, Sheet); - - // !OInt OPI_GetTestData.WriteLog(Result, "CopySheet"); - - OPI_GetTestData.ExpectsThat(Result["title"]).Equal(SheetName + " (toопия)"); - - Name = "TestSheet"; - - Result = OPI_GoogleSheets.AddSheet(Token, Book, Name); - - // !OInt OPI_GetTestData.WriteLog(Result, "AddSheet"); - - NewSheet = Result["replies"][0]["addSheet"]["properties"]["sheetId"]; - NewSheet = OPI_Tools.NumberToString(NewSheet); - - OPI_GetTestData.ExpectsThat(Result["spreadsheetId"]).Equal(Book); - - Result = OPI_GoogleSheets.DeleteSheet(Token, Book, NewSheet); - - // !OInt OPI_GetTestData.WriteLog(Result, "DeleteSheet"); - - OPI_GetTestData.ExpectsThat(Result["spreadsheetId"]).Equal(Book); - - Name = "TestTable (fromм.)"; - - Result = OPI_GoogleSheets.EditBookTitle(Token, Book, Name); - - // !OInt OPI_GetTestData.WriteLog(Result, "EditBookTitle"); - - OPI_GetTestData.ExpectsThat(Result["spreadsheetId"]).Equal(Book); - -EndProcedure - -Procedure GT_GetTable() Export - - Token = OPI_GetTestData.GetParameter("Google_Token"); - Book = OPI_GetTestData.GetParameter("GS_Spreadsheet"); - Name = "TestTable (fromм.)"; - - Result = OPI_GoogleSheets.GetBook(Token, Book); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetTable"); - - OPI_GetTestData.ExpectsThat(Result["properties"]["title"]).Equal(Name); - -EndProcedure - -Procedure GT_FillClearCells() Export - - Token = OPI_GetTestData.GetParameter("Google_Token"); - Book = OPI_GetTestData.GetParameter("GS_Spreadsheet"); - Sheet = "Sheet2"; - - CellStructure = New Match; - CellStructure.Insert("A1", "ThisIsA1"); - CellStructure.Insert("A2", "ThisIsA2"); - CellStructure.Insert("B2", "ThisIsB2"); - CellStructure.Insert("B3", "ThisIsB3"); - CellStructure.Insert("A3", "ThisIsA3"); - CellStructure.Insert("A4", "ThisIsA4"); - CellStructure.Insert("B1", "ThisIsB1"); - CellStructure.Insert("B4", "ThisIsB4"); - - Cell array = New Array; - Cell array.Add("B2"); - Cell array.Add("A3"); - Cell array.Add("B4"); - - Result = OPI_GoogleSheets.SetCellValues(Token, Book, CellStructure, Sheet); - - // !OInt OPI_GetTestData.WriteLog(Result, "SetCellValues"); - - OPI_GetTestData.ExpectsThat(Result["spreadsheetId"]).Equal(Book); - OPI_GetTestData.ExpectsThat(Result["totalUpdatedCells"]).Equal(CellStructure.Quantity()); - - Result = OPI_GoogleSheets.GetCellValues(Token, Book, Cell array, Sheet); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetCellValues"); - - OPI_GetTestData.ExpectsThat(Result["spreadsheetId"]).Equal(Book); - OPI_GetTestData.ExpectsThat(Result["valueRanges"].Quantity()).Equal(Cell array.Quantity()); - - Result = OPI_GoogleSheets.GetCellValues(Token, Book, , Sheet); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetCellValues"); - - OPI_GetTestData.ExpectsThat(Result["spreadsheetId"]).Equal(Book); - - Cell array = New Array; - Cell array.Add("B2"); - Cell array.Add("A3"); - Cell array.Add("B4"); - - Result = OPI_GoogleSheets.ClearCells(Token, Book, Cell array, Sheet); - - // !OInt OPI_GetTestData.WriteLog(Result, "ClearCells"); - - OPI_GetTestData.ExpectsThat(Result["spreadsheetId"]).Equal(Book); - OPI_GetTestData.ExpectsThat(Result["clearedRanges"].Quantity()).Equal(Cell array.Quantity()); - -EndProcedure - -#EndRegion - -#Region Twitter - -Procedure Twitter_GetAuthorizationLink() Export - - Parameters = GetTwitterParameters(); - Result = OPI_Twitter.GetAuthorizationLink(Parameters); - - OPI_GetTestData.ExpectsThat(Result).HasType("String").Filled(); - - OPI_GetTestData.WriteParameter("Twitter_URL", Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Twitter_UpdateToken() Export - - Parameters = GetTwitterParameters(); - Result = OPI_Twitter.RefreshToken(Parameters); - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["access_token"]).Filled(); - OPI_GetTestData.ExpectsThat(Result["refresh_token"]).Filled(); - - Refresh = Result["refresh_token"]; - Token = Result["access_token"]; - - If ValueFilled(Refresh) And Not Refresh = "null" Then - OPI_GetTestData.WriteParameter("Twitter_Refresh", Refresh); - EndIf; - - If ValueFilled(Token) And Not Token = "null" Then - OPI_GetTestData.WriteParameter("Twitter_Token" , Token); - EndIf; - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Twitter_CreateTextTweet() Export - - Parameters = GetTwitterParameters(); - Text = "TestTweet" + String(New UniqueIdentifier); - - Result = OPI_Twitter.CreateTextTweet(Text, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateTextTweet"); - - Check_TwitterText(Result, Text); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Twitter_CreateTweetWithImage() Export - - Parameters = GetTwitterParameters(); - Text = "TestTweet" + String(New UniqueIdentifier); - Image = OPI_GetTestData.GetBinary("Picture"); - AndVF = GetTempFileName("png"); - Image.Write(AndVF); - - Result = OPI_Twitter.Create image tweet(Text, Image, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "Create image tweet"); - - Check_TwitterText(Result, Text); - - Result = OPI_Twitter.Create image tweet(Text, AndVF, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "Create image tweet"); - - Check_TwitterText(Result, Text); - - DeleteFiles(AndVF); - - OPI_Tools.Pause(20); - -EndProcedure - -Procedure Twitter_CreateTweetWithVideo() Export - - Parameters = GetTwitterParameters(); - Text = "TestTweet" + String(New UniqueIdentifier); - Video = OPI_GetTestData.GetBinary("Video"); - AndVF = GetTempFileName("mp4"); - Video.Write(AndVF); - - Result = OPI_Twitter.CreateVideoTweet(Text, Video, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateVideoTweet"); - - Check_TwitterText(Result, Text); - - Result = OPI_Twitter.CreateVideoTweet(Text, AndVF, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateVideoTweet"); - - Check_TwitterText(Result, Text); - - DeleteFiles(AndVF); - - OPI_Tools.Pause(20); - -EndProcedure - -Procedure Twitter_CreateTweetWithGif() Export - - Parameters = GetTwitterParameters(); - Text = "TestTweet" + String(New UniqueIdentifier); - GIF = OPI_GetTestData.GetBinary("GIF"); - AndVF = GetTempFileName("gif"); - GIF.Write(AndVF); - - Result = OPI_Twitter.CreateGifTweet(Text, GIF, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateGifTweet"); - - Check_TwitterText(Result, Text); - - Result = OPI_Twitter.CreateGifTweet(Text, AndVF, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateGifTweet"); - - Check_TwitterText(Result, Text); - - DeleteFiles(AndVF); - - OPI_Tools.Pause(20); - -EndProcedure - -Procedure Twitter_CreateTweetWithPoll() Export - - Parameters = GetTwitterParameters(); - Text = "TestTweet" + String(New UniqueIdentifier); - AnswersArray = New Array; - AnswersArray.Add("Option 1"); - AnswersArray.Add("Option 2"); - - Result = OPI_Twitter.CreatePollTweet(Text, AnswersArray, 60, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreatePollTweet"); - - Check_TwitterText(Result, Text); - - OPI_Tools.Pause(20); - -EndProcedure - -#EndRegion - -#Region Notion - -Procedure Notion_CreatePage() Export - - Token = OPI_GetTestData.GetParameter("Notion_Token"); - Parent = OPI_GetTestData.GetParameter("Notion_Parent"); - Title = "TestTitle"; - - Result = OPI_Notion.CreatePage(Token, Parent, Title); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreatePage"); - - Check_NotionObject(Result); - -EndProcedure - -Procedure Notion_CreateEditDatabase() Export - - Token = OPI_GetTestData.GetParameter("Notion_Token"); - Parent = OPI_GetTestData.GetParameter("Notion_Parent"); - Title = "TestTitle"; - - Properties = New Match; - Properties.Insert("Name" , "title"); - Properties.Insert("Description" , "rich_text"); - Properties.Insert("Number" , "number"); - Properties.Insert("Status" , "status"); - Properties.Insert("CreationDate" , "date"); - Properties.Insert("Image" , "files"); - Properties.Insert("Active" , "checkbox"); - Properties.Insert("Website" , "url"); - Properties.Insert("Email" , "email"); - Properties.Insert("Phone" , "phone_number"); - Properties.Insert("User" , "people"); - - ValueSelection = New Match; - ValueSelection.Insert("New", "green"); - ValueSelection.Insert("InProgress", "yellow"); - ValueSelection.Insert("Remote", "red"); - Properties.Insert("Status", ValueSelection); - - Result = OPI_Notion.CreateDatabase(Token, Parent, Title, Properties); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateDatabase"); - - Check_NotionObject(Result, "database"); - - Base = Result["id"]; - Title = "TestTitle"; - Description = "TestDescription"; - - Properties = New Match; - Properties.Insert("Email", "rich_text"); // Type fields "Email" will changed with email to text - Properties.Insert("Website"); // Field "Website" will deleted - - Result = OPI_Notion.EditDatabaseProperties(Token, Base, Properties, Title, Description); - - // !OInt OPI_GetTestData.WriteLog(Result, "EditDatabaseProperties"); - - Check_NotionObject(Result, "database"); - -EndProcedure - -Procedure Notion_GetPageInfo() Export - - Token = OPI_GetTestData.GetParameter("Notion_Token"); - Page = OPI_GetTestData.GetParameter("Notion_Page"); - - Result = OPI_Notion.GetPage(Token, Page); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetPage"); - - Check_NotionObject(Result); - -EndProcedure - -Procedure Notion_GetDatabaseInfo() Export - - Token = OPI_GetTestData.GetParameter("Notion_Token"); - Base = OPI_GetTestData.GetParameter("Notion_Base"); - - Result = OPI_Notion.GetDatabase(Token, Base); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetDatabase"); - - Check_NotionObject(Result, "database"); - -EndProcedure - -Procedure Notion_CreatePageInDatabase() Export - - Token = OPI_GetTestData.GetParameter("Notion_Token"); - Base = OPI_GetTestData.GetParameter("Notion_Base"); - - Image = New Match; - Image.Insert("Logo", OPI_GetTestData.GetParameter("Picture")); - - Properties = New Match; - Properties.Insert("Name" , "LLC Vector"); - Properties.Insert("Description" , "OurFirstClient"); - Properties.Insert("Number" , 1); - Properties.Insert("Status" , "Regular"); - Properties.Insert("CreationDate" , OPI_Tools.GetCurrentDate()); - Properties.Insert("Image" , Image); - Properties.Insert("Active" , True); - Properties.Insert("Website" , "https://vector.ru"); - Properties.Insert("Email" , "mail@vector.ru"); - Properties.Insert("Phone" , "88005553535"); - Properties.Insert("Status" , "New"); - - Result = OPI_Notion.CreatePageInDatabase(Token, Base, Properties); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreatePageInDatabase"); - - Check_NotionObject(Result); - - Parent = StringReplace(Result["parent"]["database_id"], "-", ""); - OPI_GetTestData.ExpectsThat(Parent).Equal(Base); - -EndProcedure - -Procedure Notion_EditPageProperties() Export - - Token = OPI_GetTestData.GetParameter("Notion_Token"); - Page = OPI_GetTestData.GetParameter("Notion_Page"); - Icon = OPI_GetTestData.GetParameter("Picture"); - Cover = OPI_GetTestData.GetParameter("Picture2"); - Archive = False; - - Properties = New Match; - Properties.Insert("Active" , False); - Properties.Insert("Email" , "vector@mail.ru"); - - Result = OPI_Notion.EditPageProperties(Token - , Page - , Properties - , Icon - , Cover - , Archive); - - // !OInt OPI_GetTestData.WriteLog(Result, "EditPageProperties"); - - Check_NotionObject(Result); - -EndProcedure - -Procedure Notion_CreateDeleteBlock() Export - - Token = OPI_GetTestData.GetParameter("Notion_Token"); - Parent = OPI_GetTestData.GetParameter("Notion_Parent"); - Block = OPI_GetTestData.GetParameter("Notion_Block"); - - Result = OPI_Notion.ReturnBlock(Token, Block); - - // !OInt OPI_GetTestData.WriteLog(Result, "ReturnBlock"); - - Check_NotionObject(Result, "block"); - - Result = OPI_Notion.CreateBlock(Token, Parent, Result); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateBlock"); - - Check_NotionObject(Result, "list"); - - Block = Result["results"][0]["id"]; - Result = OPI_Notion.ReturnChildBlocks(Token, Block); - - // !OInt OPI_GetTestData.WriteLog(Result, "ReturnChildBlocks"); - - Check_NotionObject(Result, "list"); - - Result = OPI_Notion.DeleteBlock(Token, Block); - - // !OInt OPI_GetTestData.WriteLog(Result, "DeleteBlock"); - - Check_NotionObject(Result, "block"); - -EndProcedure - -Procedure Notion_GetUsers() Export - - Token = OPI_GetTestData.GetParameter("Notion_Token"); - Result = OPI_Notion.UserList(Token); - - // !OInt OPI_GetTestData.WriteLog(Result, "UserList"); - - Check_NotionObject(Result, "list"); - -EndProcedure - -Procedure Notion_GetUserData() Export - - Token = OPI_GetTestData.GetParameter("Notion_Token"); - User = OPI_GetTestData.GetParameter("Notion_User"); - Result = OPI_Notion.GetUserData(Token, User); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetUserData"); - - Check_NotionObject(Result, "user"); - -EndProcedure - -#EndRegion - -#Region Slack - -Procedure Slack_GetBotInfo() Export - - Token = OPI_GetTestData.GetParameter("Slack_Token"); - Result = OPI_Slack.GetBotInformation(Token); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetBotInformation"); - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Result["bot_id"]).Filled(); - OPI_GetTestData.ExpectsThat(Result["user_id"]).Filled(); - -EndProcedure - -Procedure Slack_GetUserList() Export - - Token = OPI_GetTestData.GetParameter("Slack_Token"); - Result = OPI_Slack.GetUserList(Token); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetUserList"); - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Result["members"]).HasType("Array"); - -EndProcedure - -Procedure Slack_GetRegionList() Export - - Token = OPI_GetTestData.GetParameter("Slack_Token"); - Result = OPI_Slack.GetWorkspaceList(Token); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetWorkspaceList"); - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Result["teams"]).HasType("Array"); - -EndProcedure - -Procedure Slack_SendDeleteMessage() Export - - Token = OPI_GetTestData.GetParameter("Slack_Token"); - Channel = OPI_GetTestData.GetParameter("Slack_Channel"); - Text = "TestMessage1"; - Text2 = "TestMessage2"; - Tags = New Array; - Image = "https://github.com/Bayselonarrend/OpenIntegrations/raw/main/Media/logo.png?v1"; - - Result = OPI_Slack.SendMessage(Token, Channel, Text); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendMessage"); - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Result["channel"]).Equal(Channel); - OPI_GetTestData.ExpectsThat(Result["ts"]).Filled(); - OPI_GetTestData.ExpectsThat(Result["message"]["text"]).Equal(Text); - - Timestamp = Result["ts"]; - - Result = OPI_Slack.EditMessage(Token, Channel, Timestamp, Text2); - - // !OInt OPI_GetTestData.WriteLog(Result, "EditMessage"); - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Result["channel"]).Equal(Channel); - OPI_GetTestData.ExpectsThat(Result["ts"]).Filled(); - OPI_GetTestData.ExpectsThat(Result["message"]["text"]).Equal(Text2); - - Result = OPI_Slack.GetMessageReplyList(Token, Channel, Timestamp); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetMessageReplyList"); - - OPI_GetTestData.ExpectsThat(Result["messages"]).HasType("Array"); - - Result = OPI_Slack.GetMessageLink(Token, Channel, Timestamp); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetMessageLink"); - - OPI_GetTestData.ExpectsThat(Result["channel"]).Equal(Channel); - OPI_GetTestData.ExpectsThat(Result["permalink"]).Filled(); - - Check_SlackOk(Result); - - Tags.Add(Timestamp); - - BlockArray = New Array; - Block = OPI_Slack.GenerateImageBlock(Image, "Yo"); - BlockArray.Add(Block); - - Result = OPI_Slack.SendMessage(Token, Channel, Text, , BlockArray); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendMessage (toартинtoа)"); - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Result["channel"]).Equal(Channel); - OPI_GetTestData.ExpectsThat(Result["ts"]).Filled(); - - Tags.Add(Result["ts"]); - - Block = OPI_Slack.GenerateImageBlock(Image, "Yo"); - JSONBlock = OPI_Tools.JSONString(Block); - - AndVF = GetTempFileName("json"); - - TextDocument = New TextDocument(); - TextDocument.SetText(JSONBlock); - TextDocument.Write(AndVF); - - Result = OPI_Slack.SendMessage(Token, Channel, Text, , AndVF); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendMessage (json)"); - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Result["channel"]).Equal(Channel); - OPI_GetTestData.ExpectsThat(Result["ts"]).Filled(); - - Tags.Add(Result["ts"]); - - Blocks = "['" + AndVF + "','" + AndVF + "']"; - Result = OPI_Slack.SendMessage(Token, Channel, Text, , Blocks); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendMessage (json маwithwithиin)"); - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Result["channel"]).Equal(Channel); - OPI_GetTestData.ExpectsThat(Result["ts"]).Filled(); - - Tags.Add(Result["ts"]); - - DeleteFiles(AndVF); - - For Each Timestamp Of Tags Loop - - Result = OPI_Slack.DeleteMessage(Token, Channel, Timestamp); - - // !OInt OPI_GetTestData.WriteLog(Result, "DeleteMessage"); - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Result["channel"]).Equal(Channel); - OPI_GetTestData.ExpectsThat(Result["ts"]).Filled(); - - EndOfLoop; - - Hour = 3600; - Day = 24; - Sending = OPI_Tools.GetCurrentDate() + (Day * Hour); - Result = OPI_Slack.SendMessage(Token, Channel, Text, Sending); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendMessage (отложенное)"); - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Result["channel"]).Equal(Channel); - OPI_GetTestData.ExpectsThat(Result["scheduled_message_id"]).Filled(); - - Timestamp = Result["scheduled_message_id"]; - Result = OPI_Slack.DeleteMessage(Token, Channel, Timestamp, True); - - // !OInt OPI_GetTestData.WriteLog(Result, "DeleteMessage"); - - Check_SlackOk(Result); - -EndProcedure - -Procedure Slack_SendDeleteEphemeral() Export - - Token = OPI_GetTestData.GetParameter("Slack_Token"); - Channel = OPI_GetTestData.GetParameter("Slack_Channel"); - User = OPI_GetTestData.GetParameter("Slack_User"); - Image = "https://github.com/Bayselonarrend/OpenIntegrations/raw/main/Media/logo.png?v1"; - Text = "TestMessage1"; - - Block = OPI_Slack.GenerateImageBlock(Image, "Yo"); - Result = OPI_Slack.SendEphemeralMessage(Token, Channel, Text, User, Block); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendMessage"); - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Result["message_ts"]).Filled(); - -EndProcedure - -Procedure Slack_GetScheduledMessages() Export - - Token = OPI_GetTestData.GetParameter("Slack_Token"); - Channel = OPI_GetTestData.GetParameter("Slack_Channel"); - - Result = OPI_Slack.GetDelayedMessageList(Token, Channel); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetDelayedMessageList"); - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Result["scheduled_messages"]).HasType("Array"); - -EndProcedure - -Procedure Slack_CreateArchiveChannel() Export - - Token = OPI_GetTestData.GetParameter("Slack_Token"); - User = OPI_GetTestData.GetParameter("Slack_User"); - Name = "testconv" + String(New UniqueIdentifier); - Topic = "TestTopic"; - Purpose = "TestGoal"; - - #Region CreateChannel - Result = OPI_Slack.CreateChannel(Token, Name); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateChannel"); - - Data = Result["channel"]; - Channel = Data["id"]; - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Data["name"]).Equal(Name); - #EndRegion - - #Region SetChannelTopic - Result = OPI_Slack.SetChannelTopic(Token, Channel, Topic); - - // !OInt OPI_GetTestData.WriteLog(Result, "SetChannelTopic"); - - Data = Result["channel"]; - Channel = Data["id"]; - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Data["name"]).Equal(Name); - OPI_GetTestData.ExpectsThat(Data["topic"]["value"]).Equal(Topic); - #EndRegion - - #Region SetChannelGoal - Result = OPI_Slack.SetChannelGoal(Token, Channel, Purpose); - - // !OInt OPI_GetTestData.WriteLog(Result, "SetChannelGoal"); - - Check_SlackOk(Result); - #EndRegion - - #Region GetChannel - Result = OPI_Slack.GetChannel(Token, Channel); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetChannel"); - - Data = Result["channel"]; - Channel = Data["id"]; - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Data["name"]).Equal(Name); - #EndRegion - - #Region InviteUsersToChannel - Result = OPI_Slack.InviteUsersToChannel(Token, Channel, User); - - // !OInt OPI_GetTestData.WriteLog(Result, "InviteUsersToChannel"); - - Data = Result["channel"]; - Channel = Data["id"]; - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Data["name"]).Equal(Name); - #EndRegion - - #Region KickUserFromChannel - Result = OPI_Slack.KickUserFromChannel(Token, Channel, User); - - // !OInt OPI_GetTestData.WriteLog(Result, "KickUserFromChannel"); - - Check_SlackOk(Result); - #EndRegion - - #Region GetChannelHistory - Result = OPI_Slack.GetChannelHistory(Token, Channel); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetChannelHistory"); - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Result["messages"]).HasType("Array"); - #EndRegion - - #Region GetChannelUserList - Result = OPI_Slack.GetChannelUserList(Token, Channel); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetChannelUserList"); - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Result["members"]).HasType("Array"); - #EndRegion - - #Region LeaveChannel - Result = OPI_Slack.LeaveChannel(Token, Channel); - - // !OInt OPI_GetTestData.WriteLog(Result, "LeaveChannel"); - - Check_SlackOk(Result); - #EndRegion - - #Region JoinChannel - Result = OPI_Slack.JoinChannel(Token, Channel); - - // !OInt OPI_GetTestData.WriteLog(Result, "JoinChannel"); - - Data = Result["channel"]; - Channel = Data["id"]; - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Data["name"]).Equal(Name); - #EndRegion - - #Region RenameChannel - NewName = "testconv" + String(New UniqueIdentifier); - Result = OPI_Slack.RenameChannel(Token, Channel, NewName); - - // !OInt OPI_GetTestData.WriteLog(Result, "RenameChannel"); - - Data = Result["channel"]; - Channel = Data["id"]; - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Data["name"]).Equal(NewName); - #EndRegion - - #Region ArchiveChannel - Result = OPI_Slack.ArchiveChannel(Token, Channel); - - // !OInt OPI_GetTestData.WriteLog(Result, "ArchiveChannel"); - - Check_SlackOk(Result); - #EndRegion - -EndProcedure - -Procedure Slack_GetChannelList() Export - - Token = OPI_GetTestData.GetParameter("Slack_Token"); - - Result = OPI_Slack.GetChannelList(Token); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetChannelList"); - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Result["channels"]).HasType("Array"); - -EndProcedure - -Procedure Slack_OpenCloseDialog() Export - - Token = OPI_GetTestData.GetParameter("Slack_Token"); - User = OPI_GetTestData.GetParameter("Slack_User"); - Text = "Yo, dude"; - - Result = OPI_Slack.OpenDialog(Token, User); - - // !OInt OPI_GetTestData.WriteLog(Result, "OpenDialog"); - - Dialog = Result["channel"]["id"]; - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Result["channel"]).HasType("Match"); - OPI_GetTestData.ExpectsThat(Dialog).Filled(); - - Result = OPI_Slack.SendMessage(Token, Dialog, Text); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendMessage"); - - Check_SlackOk(Result); - - Result = OPI_Slack.CloseDialog(Token, Dialog); - - // !OInt OPI_GetTestData.WriteLog(Result, "CloseDialog"); - - Check_SlackOk(Result); - -EndProcedure - -Procedure Slack_GetFileList() Export - - Token = OPI_GetTestData.GetParameter("Slack_Token"); - Channel = OPI_GetTestData.GetParameter("Slack_Channel"); - - Result = OPI_Slack.GetFilesList(Token, Channel); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetFilesList"); - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Result["files"]).HasType("Array"); - -EndProcedure - -Procedure Slack_UploadDeleteFile() Export - - Token = OPI_GetTestData.GetParameter("Slack_Token"); - File = OPI_GetTestData.GetBinary("Document"); - Channel = OPI_GetTestData.GetParameter("Slack_Channel"); - ArrayOfFiles = New Array; - FileName = "megadoc.docx"; - Title = "NewFile"; - - Result = OPI_Slack.UploadFile(Token, File, FileName, Title); - - // !OInt OPI_GetTestData.WriteLog(Result, "UploadFile"); - - UploadedFile = Result["files"][0]; - ArrayOfFiles.Add(UploadedFile["id"]); - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(UploadedFile["name"]).Equal(FileName); - - Result = OPI_Slack.UploadFile(Token, File, FileName, Title, Channel); - - // !OInt OPI_GetTestData.WriteLog(Result, "UploadFile (in toаtoл)"); - - UploadedFile = Result["files"][0]; - ArrayOfFiles.Add(UploadedFile["id"]); - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(UploadedFile["name"]).Equal(FileName); - - Result = OPI_Slack.GetFileData(Token, UploadedFile["id"]); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetFile"); - - UploadedFile = Result["file"]; - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(UploadedFile["name"]).Equal(FileName); - - For Each UploadedFile Of ArrayOfFiles Loop - - Result = OPI_Slack.DeleteFile(Token, UploadedFile); - - // !OInt OPI_GetTestData.WriteLog(Result, "DeleteFile"); - - Check_SlackOk(Result); - - EndOfLoop; - -EndProcedure - -Procedure Slack_GetExternalFileList() Export - - Token = OPI_GetTestData.GetParameter("Slack_Token"); - Channel = OPI_GetTestData.GetParameter("Slack_Channel"); - - Result = OPI_Slack.GetExternalFileList(Token); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetExternalFileList"); - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Result["files"]).HasType("Array"); - - Result = OPI_Slack.GetExternalFileList(Token, Channel); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetExternalFileList"); - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(Result["files"]).HasType("Array"); - -EndProcedure - -Procedure Slack_UploadDeleteExternalFile() Export - - Token = OPI_GetTestData.GetParameter("Slack_Token"); - File = OPI_GetTestData.GetParameter("Document"); - Channel = OPI_GetTestData.GetParameter("Slack_Channel"); - Title = "NewFile"; - - Result = OPI_Slack.AddExternalFile(Token, File, Title); - - // !OInt OPI_GetTestData.WriteLog(Result, "AddExternalFile"); - - UploadedFile = Result["file"]; - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(UploadedFile["title"]).Equal(Title); - - Result = OPI_Slack.GetExternalFile(Token, UploadedFile["id"]); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetExternalFile"); - - UploadedFile = Result["file"]; - - Check_SlackOk(Result); - OPI_GetTestData.ExpectsThat(UploadedFile["title"]).Equal(Title); - - Result = OPI_Slack.SendExternalFile(Token, UploadedFile["id"], Channel); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendExternalFile"); - - Check_SlackOk(Result); - - Result = OPI_Slack.DeleteExternalFile(Token, UploadedFile["id"]); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendExternalFile"); - - Check_SlackOk(Result); - -EndProcedure - -#EndRegion - -#Region Airtable - -Procedure AT_CreateDatabase() Export - - Token = OPI_GetTestData.GetParameter("Airtable_Token"); - Region = OPI_GetTestData.GetParameter("Airtable_Workspace"); - Name = "TestDatabase"; - - FieldArray = New Array; - FieldArray.Add(OPI_Airtable.GetNumberField("Number")); - FieldArray.Add(OPI_Airtable.GetStringField("String")); - - TableName = "TestTable"; - - TableMapping = New Match; - TableMapping.Insert(TableName, FieldArray); - - Result = OPI_Airtable.CreateDatabase(Token, Region, Name, TableMapping); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateDatabase"); - - OPI_GetTestData.ExpectsThat(Result["id"]).Filled(); - OPI_GetTestData.ExpectsThat(Result["tables"][0]["name"]).Equal(TableName); - - Base = Result["id"]; - OPI_GetTestData.WriteParameter("Airtable_Base", Base); - - Result = OPI_Airtable.GetDatabaseTables(Token, Base); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetDatabaseTables"); - - OPI_GetTestData.ExpectsThat(Result["tables"]).Filled(); - OPI_GetTestData.ExpectsThat(Result["tables"]).HasType("Array"); - - Result = OPI_Airtable.GetListOfBases(Token); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetListOfBases"); - - OPI_GetTestData.ExpectsThat(Result["bases"]).Filled(); - OPI_GetTestData.ExpectsThat(Result["bases"]).HasType("Array"); - -EndProcedure - -Procedure AT_CreateTable() Export - - Token = OPI_GetTestData.GetParameter("Airtable_Token"); - Base = OPI_GetTestData.GetParameter("Airtable_Base"); - - FieldArray = New Array; - FieldArray.Add(OPI_Airtable.GetNumberField("Number")); - // !OInt OPI_GetTestData.WriteLog(FieldArray[0], "GetNumberField"); - - FieldArray.Add(OPI_Airtable.GetStringField("String")); - // !OInt OPI_GetTestData.WriteLog(FieldArray[1], "GetStringField"); - - FieldArray.Add(OPI_Airtable.GetAttachmentField("Attachment")); - // !OInt OPI_GetTestData.WriteLog(FieldArray[2], "GetAttachmentField"); - - FieldArray.Add(OPI_Airtable.GetCheckboxField("Checkbox")); - // !OInt OPI_GetTestData.WriteLog(FieldArray[3], "GetCheckboxField"); - - FieldArray.Add(OPI_Airtable.GetDateField("Date")); - // !OInt OPI_GetTestData.WriteLog(FieldArray[4], "GetDateField"); - - FieldArray.Add(OPI_Airtable.GetPhoneField("Phone")); - // !OInt OPI_GetTestData.WriteLog(FieldArray[5], "GetPhoneField"); - - FieldArray.Add(OPI_Airtable.GetEmailField("Email")); - // !OInt OPI_GetTestData.WriteLog(FieldArray[6], "GetEmailField"); - - FieldArray.Add(OPI_Airtable.GetLinkField("Link")); - // !OInt OPI_GetTestData.WriteLog(FieldArray[7], "GetLinkField"); - - TableName = "TestTable2"; - Description = "NewTable"; - - Result = OPI_Airtable.CreateTable(Token, Base, TableName, FieldArray, Description); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateTable"); - - OPI_GetTestData.ExpectsThat(Result["name"]).Equal(TableName); - OPI_GetTestData.ExpectsThat(Result["description"]).Equal(Description); - - Table = Result["id"]; - TableName = "TestTable2 (fromм.)"; - Description = "NewTable (fromм.)"; - - OPI_GetTestData.WriteParameter("Airtable_Table", Table); - - Result = OPI_Airtable.ModifyTable(Token, Base, Table, TableName, Description); - - // !OInt OPI_GetTestData.WriteLog(Result, "ModifyTable"); - - OPI_GetTestData.ExpectsThat(Result["name"]).Equal(TableName); - OPI_GetTestData.ExpectsThat(Result["description"]).Equal(Description); - -EndProcedure - -Procedure AT_CreateField() Export - - Token = OPI_GetTestData.GetParameter("Airtable_Token"); - Base = OPI_GetTestData.GetParameter("Airtable_Base"); - Table = OPI_GetTestData.GetParameter("Airtable_Table"); - Name = String(New UniqueIdentifier); - - Field = OPI_Airtable.GetNumberField(Name); - - Result = OPI_Airtable.CreateField(Token, Base, Table, Field); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateField"); - - OPI_GetTestData.ExpectsThat(Result["name"]).Equal(Name); - - Field = Result["id"]; - Name = Name + "(fromм.)"; - Description = "New description"; - - Result = OPI_Airtable.ModifyField(Token, Base, Table, Field, Name, Description); - - // !OInt OPI_GetTestData.WriteLog(Result, "ModifyField"); - - OPI_GetTestData.ExpectsThat(Result["name"]).Equal(Name); - OPI_GetTestData.ExpectsThat(Result["description"]).Equal(Description); - -EndProcedure - -Procedure AT_CreateDeleteRecords() Export - - Token = OPI_GetTestData.GetParameter("Airtable_Token"); - Base = OPI_GetTestData.GetParameter("Airtable_Base"); - Table = OPI_GetTestData.GetParameter("Airtable_Table"); - - Numeric = 10; - StringType = "Hello"; - - RowDescription1 = New Structure("Number,String", Numeric, StringType); - RowDescription2 = New Structure("Number,String", Numeric, StringType); - - ArrayOfDeletions = New Array; - ArrayOfDescriptions = New Array; - ArrayOfDescriptions.Add(RowDescription1); - ArrayOfDescriptions.Add(RowDescription2); - - Result = OPI_Airtable.CreatePosts(Token, Base, Table, ArrayOfDescriptions); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreatePosts"); - - OPI_GetTestData.ExpectsThat(Result["records"]).HasType("Array"); - OPI_GetTestData.ExpectsThat(Result["records"].Quantity()).Equal(2); - - For Each Record Of Result["records"] Loop - ArrayOfDeletions.Add(Record["id"]); - EndOfLoop; - - Result = OPI_Airtable.CreatePosts(Token, Base, Table, RowDescription1); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreatePosts (оdto)"); - - SingleRecord = Result["id"]; - OPI_GetTestData.ExpectsThat(SingleRecord).Filled(); - OPI_GetTestData.ExpectsThat(Result["createdTime"]).Filled(); - OPI_GetTestData.ExpectsThat(Result["fields"]["Number"]).Equal(Numeric); - OPI_GetTestData.ExpectsThat(ShortLP(Result["fields"]["String"])).Equal(StringType); - - Result = OPI_Airtable.GetRecord(Token, Base, Table, SingleRecord); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetRecord"); - - OPI_GetTestData.ExpectsThat(Result["id"]).Equal(SingleRecord); - - Text = "TestComment"; - Result = OPI_Airtable.CreateComment(Token, Base, Table, SingleRecord, Text); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateComment"); - - OPI_GetTestData.ExpectsThat(Result["text"]).Equal(Text); - - Comment = Result["id"]; - Text = "TestComment (fromм.)"; - Result = OPI_Airtable.EditComment(Token, Base, Table, SingleRecord, Comment, Text); - - // !OInt OPI_GetTestData.WriteLog(Result, "EditComment"); - - OPI_GetTestData.ExpectsThat(Result["text"]).Equal(Text); - - Result = OPI_Airtable.GetComments(Token, Base, Table, SingleRecord); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetComments"); - - OPI_GetTestData.ExpectsThat(Result["comments"]).HasType("Array"); - - Result = OPI_Airtable.DeleteComment(Token, Base, Table, SingleRecord, Comment); - - // !OInt OPI_GetTestData.WriteLog(Result, "DeleteComment"); - - OPI_GetTestData.ExpectsThat(Result["deleted"]).Equal(True); - OPI_GetTestData.ExpectsThat(Result["id"]).Equal(Comment); - - Result = OPI_Airtable.GetListOfRecords(Token, Base, Table); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetListOfRecords"); - - OPI_GetTestData.ExpectsThat(Result["records"]).HasType("Array"); - OPI_GetTestData.ExpectsThat(Result["records"]).Filled(); - - Result = OPI_Airtable.DeletePosts(Token, Base, Table, ArrayOfDeletions); - - // !OInt OPI_GetTestData.WriteLog(Result, "DeletePosts"); - - OPI_GetTestData.ExpectsThat(Result["records"]).HasType("Array"); - OPI_GetTestData.ExpectsThat(Result["records"]).Filled(); - - Result = OPI_Airtable.DeletePosts(Token, Base, Table, SingleRecord); - - // !OInt OPI_GetTestData.WriteLog(Result, "DeletePosts (оdto)"); - - OPI_GetTestData.ExpectsThat(Result["records"]).HasType("Array"); - OPI_GetTestData.ExpectsThat(Result["records"]).Filled(); - -EndProcedure - -#EndRegion - -#Region Dropbox - -Procedure Dropbox_GetUpdateToken() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Dropbox_Appkey" , TestParameters); - OPI_GetTestData.ParameterToCollection("Dropbox_Appsecret", TestParameters); - - Dropbox_GetAuthorizationLink(TestParameters); - - OPI_GetTestData.ParameterToCollection("Dropbox_Code", TestParameters); - - Dropbox_GetToken(TestParameters); - - OPI_GetTestData.ParameterToCollection("Dropbox_Refresh", TestParameters); - - Dropbox_UpdateToken(TestParameters); - -EndProcedure - -Procedure Dropbox_UploadFile() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Dropbox_Token", TestParameters); - OPI_GetTestData.ParameterToCollection("Picture", TestParameters); - - Dropbox_UploadFile(TestParameters); - Dropbox_GetObjectInformation(TestParameters); - Dropbox_GetObjectVersionList(TestParameters); - Dropbox_RestoreObjectToVersion(TestParameters); - Dropbox_GetPreview(TestParameters); - Dropbox_DownloadFile(TestParameters); - Dropbox_MoveObject(TestParameters); - Dropbox_CopyObject(TestParameters); - Dropbox_DeleteObject(TestParameters); - -EndProcedure - -Procedure Dropbox_CreateFolder() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Dropbox_Token", TestParameters); - - Dropbox_CreateFolder(TestParameters); - Dropbox_DownloadFolder(TestParameters); - -EndProcedure - -Procedure Dropbox_GetFolderFileList() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Dropbox_Token", TestParameters); - - Dropbox_GetFolderFileList(TestParameters); - -EndProcedure - -Procedure Dropbox_UploadFileByURL() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Dropbox_Token", TestParameters); - OPI_GetTestData.ParameterToCollection("Document", TestParameters); - - Dropbox_UploadFileByURL(TestParameters); - Dropbox_GetUploadStatusByURL(TestParameters); - -EndProcedure - -Procedure Dropbox_CreateDeleteTag() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Dropbox_Token", TestParameters); - - Dropbox_AddTag(TestParameters); - Dropbox_GetTagList(TestParameters); - Dropbox_DeleteTag(TestParameters); - -EndProcedure - -Procedure Dropbox_GetAccount() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Dropbox_Token", TestParameters); - - Dropbox_GetAccountInformation(TestParameters); - Dropbox_GetSpaceUsageData(TestParameters); - -EndProcedure - -Procedure Dropbox_AccessManagement() Export - - TestParameters = New Structure; - OPI_GetTestData.ParameterToCollection("Dropbox_Token" , TestParameters); - OPI_GetTestData.ParameterToCollection("Dropbox_OtherUser", TestParameters); - OPI_GetTestData.ParameterToCollection("Dropbox_FileID" , TestParameters); - - Dropbox_AddUsersToFile(TestParameters); - Dropbox_PublishFolder(TestParameters); - Dropbox_AddUsersToFolder(TestParameters); - Dropbox_CancelFolderPublication(TestParameters); - Dropbox_CancelFilePublication(TestParameters); - -EndProcedure - -#EndRegion - -#EndRegion - -#EndRegion - -#Region ServiceProceduresAndFunctions - -Function GetVKParameters() - - Parameters = New Structure; - GroupNumber = OPI_GetTestData.GetParameter("VK_GroupID"); - - Parameters.Insert("access_token" , OPI_GetTestData.GetParameter("VK_Token")); - Parameters.Insert("owner_id" , "-" + GroupNumber); - Parameters.Insert("app_id" , OPI_GetTestData.GetParameter("VK_AppID")); - Parameters.Insert("group_id" , GroupNumber); - - Return Parameters; - -EndFunction - -Function GetTwitterParameters() - - Parameters = New Match; - - Parameters.Insert("redirect_uri" , OPI_GetTestData.GetParameter("Twitter_Redirect")); - Parameters.Insert("client_id" , OPI_GetTestData.GetParameter("Twitter_ClinetID")); - Parameters.Insert("client_secret" , OPI_GetTestData.GetParameter("Twitter_ClientSecret")); - Parameters.Insert("access_token" , OPI_GetTestData.GetParameter("Twitter_Token")); - Parameters.Insert("refresh_token" , OPI_GetTestData.GetParameter("Twitter_Refresh")); - Parameters.Insert("oauth_token" , OPI_GetTestData.GetParameter("Twitter_OAuthToken")); - Parameters.Insert("oauth_token_secret" , OPI_GetTestData.GetParameter("Twitter_OAuthSecret")); - - Parameters.Insert("oauth_consumer_key" - , OPI_GetTestData.GetParameter("Twitter_OAuthConsumerKey")); - Parameters.Insert("oauth_consumer_secret" - , OPI_GetTestData.GetParameter("Twitter_OAuthConsumerSecret")); - - Return Parameters; - -EndFunction - -#Region Checks - -Procedure Check_Empty(Val Result) - OPI_GetTestData.ExpectsThat(ValueFilled(Result)).Equal(False); -EndProcedure - -Procedure Check_BinaryData(Val Result, Val Size = Undefined) - - MinimumSize = 500000; - - OPI_GetTestData.ExpectsThat(Result).HasType("BinaryData"); - - If Not Size = Undefined Then - OPI_GetTestData.ExpectsThat(Result.Size()).Equal(Size); - Otherwise - OPI_GetTestData.ExpectsThat(Result.Size() > MinimumSize).Equal(True); - EndIf; - -EndProcedure - -Procedure Check_TelegramTrue(Val Result) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); - OPI_GetTestData.ExpectsThat(Result["result"]).Equal(True); - -EndProcedure - -Procedure Check_TelegramBotInformation(Val Result) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); - OPI_GetTestData.ExpectsThat(Result["result"]["username"]).Filled(); - -EndProcedure - -Procedure Check_TelegramArray(Result) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match") .Filled(); - OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); - OPI_GetTestData.ExpectsThat(Result["result"]).HasType("Array"); - -EndProcedure - -Procedure Check_TelegramWebhookSetup(Val Result) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); - OPI_GetTestData.ExpectsThat(Result["result"]).Equal(True); - OPI_GetTestData.ExpectsThat(Result["description"]).Equal("Webhook was set"); - -EndProcedure - -Procedure Check_TelegramWebhookDeletion(Val Result) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); - OPI_GetTestData.ExpectsThat(Result["result"]).Equal(True); - OPI_GetTestData.ExpectsThat(Result["description"]).Filled(); - -EndProcedure - -Procedure Check_TelegramMessage(Val Result, Val Text) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); - OPI_GetTestData.ExpectsThat(Result["result"]["text"]).Equal(Text); - -EndProcedure - -Procedure Check_TelegramImage(Val Result, Val Text) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match") .Filled(); - OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); - OPI_GetTestData.ExpectsThat(Result["result"]["caption"]).Equal(Text); - OPI_GetTestData.ExpectsThat(Result["result"]["photo"]).HasType("Array"); - -EndProcedure - -Procedure Check_TelegramVideo(Val Result, Val Text) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); - OPI_GetTestData.ExpectsThat(Result["result"]["caption"]).Equal(Text); - OPI_GetTestData.ExpectsThat(Result["result"]["video"]["mime_type"]).Equal("video/mp4"); - -EndProcedure - -Procedure Check_TelegramAudio(Val Result, Val Text) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); - OPI_GetTestData.ExpectsThat(Result["result"]["caption"]).Equal(Text); - OPI_GetTestData.ExpectsThat(Result["result"]["audio"]["mime_type"]).Equal("audio/mpeg"); - -EndProcedure - -Procedure Check_TelegramDocument(Val Result, Val Text) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); - OPI_GetTestData.ExpectsThat(Result["result"]["caption"]).Equal(Text); - OPI_GetTestData.ExpectsThat(Result["result"]["document"]).HasType("Match").Filled(); - -EndProcedure - -Procedure Check_TelegramGif(Val Result, Val Text) - - Result = "result"; - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); - OPI_GetTestData.ExpectsThat(Result[Result]["caption"]).Equal(Text); - OPI_GetTestData.ExpectsThat(Result[Result]["document"]).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result[Result]["animation"]["mime_type"]).Equal("video/mp4"); - -EndProcedure - -Procedure Check_TelegramMediaGroup(Val Result) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); - OPI_GetTestData.ExpectsThat(Result["result"]).HasType("Array"); - -EndProcedure - -Procedure Check_TelegramLocation(Val Result) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); - OPI_GetTestData.ExpectsThat(Result["result"]["location"]).HasType("Match").Filled(); - -EndProcedure - -Procedure Check_TelegramContact(Val Result, Val Name) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); - OPI_GetTestData.ExpectsThat(Result["result"]["contact"]).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["result"]["contact"]["first_name"]).Equal(Name); - -EndProcedure - -Procedure Check_TelegramPoll(Val Result, Val Question) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); - OPI_GetTestData.ExpectsThat(Result["result"]["poll"]).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["result"]["poll"]["question"]).Equal(Question); - -EndProcedure - -Procedure Check_TelegramForward(Val Result, Val MessageID) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); - OPI_GetTestData.ExpectsThat(Result["result"]["forward_origin"]["message_id"]).Equal(Number(MessageID)); - -EndProcedure - -Procedure Check_TelegramBan(Val Result) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["description"]).Equal("Bad Request: can't remove chat owner"); - -EndProcedure - -Procedure Check_TelegramInvitation(Val Result, Val Title, Val UnixExpiration) - - Result = "result"; - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); - OPI_GetTestData.ExpectsThat(Result[Result]["member_limit"]).Equal(200); - OPI_GetTestData.ExpectsThat(Result[Result]["name"]).Equal(Title); - OPI_GetTestData.ExpectsThat(Result[Result]["expire_date"]).Equal(Number(UnixExpiration)); - -EndProcedure - -Procedure Check_TelegramNumber(Val Result) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); - OPI_GetTestData.ExpectsThat(Result["result"]).HasType("Number"); - -EndProcedure - -Procedure Check_TelegramCreateTopic(Val Result, Val Name, Icon) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); - OPI_GetTestData.ExpectsThat(Result["result"]["name"]).Equal(Name); - OPI_GetTestData.ExpectsThat(Result["result"]["icon_custom_emoji_id"]).Equal(Icon); - -EndProcedure - -Procedure Check_VKPost(Val Result) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["response"]["post_id"]).HasType("Number").Filled(); - -EndProcedure - -Procedure Check_VKTrue(Val Result) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["response"]).HasType("Number").Equal(1); - -EndProcedure - -Procedure Check_VKAlbum(Val Result, Val Description) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["response"]["description"]).Equal(Description); - -EndProcedure - -Procedure Check_VKAlbumPicture(Val Result, Val ImageDescription, Val AlbumID) - - Response = "response"; - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result[Response][0]["text"]).Equal(ImageDescription); - OPI_GetTestData.ExpectsThat(Result[Response][0]["album_id"]).Equal(AlbumID); - -EndProcedure - -Procedure Check_VKStory(Val Result) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["response"]["count"]).HasType("Number").Equal(1); - OPI_GetTestData.ExpectsThat(Result["response"]["items"]).HasType("Array").Filled(); - -EndProcedure - -Procedure Check_VKDiscussion(Val Result) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["response"]).HasType("Number").Filled(); - -EndProcedure - -Procedure Check_GKObject(Val Result, Val Name, Val Description) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match"); - OPI_GetTestData.ExpectsThat(Result["summary"]).Equal(Name); - OPI_GetTestData.ExpectsThat(Result["description"]).Equal(Description); - OPI_GetTestData.ExpectsThat(Result["id"]).HasType("String").Filled(); - -EndProcedure - -Procedure Check_TwitterText(Val Result, Val Text) - - ReplyText = Result["data"]["text"]; - ReplyText = Left(ReplyText, StrLength(Text)); - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(ReplyText).Equal(Text); - -EndProcedure - -Procedure Check_ViberOk(Val Result) - - OPI_GetTestData.ExpectsThat(Result["status_message"]).Equal("ok"); - OPI_GetTestData.ExpectsThat(Result["status"]).Equal(0); - -EndProcedure - -Procedure Check_NotionObject(Val Result, Val View = "page") - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["object"]).Equal(View); - -EndProcedure - -Procedure Check_SlackOk(Val Result) - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - OPI_GetTestData.ExpectsThat(Result["ok"]).Equal(True); - -EndProcedure - -Procedure Check_DropboxFile(Val Result, Val Path) - - OPI_GetTestData.ExpectsThat(Result["path_display"]).Equal(Path); - -EndProcedure - -Procedure Check_DropboxMetadata(Val Result, Val Path) - - OPI_GetTestData.ExpectsThat(Result["metadata"]["path_display"]).Equal(Path); - -EndProcedure - -Procedure Check_DropboxArray(Val Result, Val Quantity = Undefined) - - OPI_GetTestData.ExpectsThat(Result["entries"]).HasType("Array"); - - If Not Quantity = Undefined Then - OPI_GetTestData.ExpectsThat(Result["entries"].Quantity()).Equal(Quantity); - EndIf; - -EndProcedure - -Procedure Check_DropboxWork(Val Result) - OPI_GetTestData.ExpectsThat(Result["async_job_id"]).Filled(); -EndProcedure - -Procedure Check_DropboxStatus(Val Result) - OPI_GetTestData.ExpectsThat(Result[".tag"]).Equal("complete"); -EndProcedure - -Procedure Check_DropboxTags(Val Result, Val Quantity) - - OPI_GetTestData.ExpectsThat(Result["paths_to_tags"]).HasType("Array"); - OPI_GetTestData.ExpectsThat(Result["paths_to_tags"].Quantity()).Equal(Quantity); - -EndProcedure - -Procedure Check_DropboxAccount(Val Result) - OPI_GetTestData.ExpectsThat(Result["account_id"]).Filled(); -EndProcedure - -Procedure Check_DropboxSpace(Val Result) - OPI_GetTestData.ExpectsThat(Result["used"]).Filled(); -EndProcedure - -Procedure Check_DropboxMember(Val Result, Val Email, Val ViewOnly) - OPI_GetTestData.ExpectsThat(Result[0]["result"][".tag"]).Equal("success"); - OPI_GetTestData.ExpectsThat(Result[0]["member"]["email"]).Equal(Email); - OPI_GetTestData.ExpectsThat( - Result[0]["result"]["success"][".tag"]).Equal(?(ViewOnly, "viewer", "editor")); -EndProcedure - -Procedure Check_DropboxPublicFolder(Val Result) - OPI_GetTestData.ExpectsThat(Result["shared_folder_id"]).Filled(); -EndProcedure - -#EndRegion - -#Region AtomicTests - -#Region Telegram - -Procedure Telegram_GetBotInformation(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - Result = OPI_Telegram.GetBotInformation(Token); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "GetBotInformation", "Telegram"); - - Check_TelegramBotInformation(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_GetUpdates(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - Result = OPI_Telegram.GetUpdates(Token); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "GetUpdates", "Telegram"); - - Check_TelegramArray(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_SetWebhook(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - URL = FunctionParameters["Telegram_URL"]; - - Result = OPI_Telegram.SetWebhook(Token, URL); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "SetWebhook", "Telegram"); - - Check_TelegramWebhookSetup(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_DeleteWebhook(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - Result = OPI_Telegram.DeleteWebhook(Token); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "DeleteWebhook", "Telegram"); - - Check_TelegramWebhookDeletion(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_SendTextMessage(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - ChatID = FunctionParameters["Telegram_ChatID"]; - ChannelID = FunctionParameters["Telegram_ChannelID"]; - Text = FunctionParameters["String"]; - - Result = OPI_Telegram.SendTextMessage(Token, ChatID, Text); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendTextMessage", "Telegram"); - - Check_TelegramMessage(Result, Text); // SKIP - - Result = OPI_Telegram.SendTextMessage(Token, ChannelID, Text); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "SendTextMessage (toаtoл)"); - - Check_TelegramMessage(Result, Text); - - MessageID = OPI_Tools.NumberToString(Result["result"]["message_id"]); - OPI_GetTestData.WriteParameter("Telegram_ChannelMessageID", MessageID); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_SendPicture(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - ChatID = FunctionParameters["Telegram_ChatID"]; - ChannelID = FunctionParameters["Telegram_ChannelID"]; - Text = FunctionParameters["String"]; - Image = FunctionParameters["Picture"]; - - ImagePath = GetTempFileName("png"); - CopyFile(Image, ImagePath); - - ImageDD = New BinaryData(ImagePath); - - Result = OPI_Telegram.SendImage(Token, ChatID, Text, Image); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendImage", "Telegram"); - - Check_TelegramImage(Result, Text); // SKIP - - Result = OPI_Telegram.SendImage(Token, ChannelID, Text, ImagePath); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendImage (Path)"); - - Check_TelegramImage(Result, Text); // SKIP - - Result = OPI_Telegram.SendImage(Token, ChannelID, Text, ImageDD); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "SendImage (BD)"); - - Check_TelegramImage(Result, Text); - - DeleteFiles(ImagePath); - - FileID = Result["result"]["photo"][0]["file_id"]; - OPI_GetTestData.WriteParameter("Telegram_FileID", FileID); - - FunctionParameters.Insert("Telegram_FileID", FileID); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_SendVideo(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - ChatID = FunctionParameters["Telegram_ChatID"]; - ChannelID = FunctionParameters["Telegram_ChannelID"]; - Text = FunctionParameters["String"]; - Video = FunctionParameters["Video"]; - - VideoPath = GetTempFileName("mp4"); - CopyFile(Video, VideoPath); - - VideoDD = New BinaryData(VideoPath); - - Result = OPI_Telegram.SendVideo(Token, ChatID, Text, Video); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendVideo", "Telegram"); - - Check_TelegramVideo(Result, Text); // SKIP - - Result = OPI_Telegram.SendVideo(Token, ChannelID, Text, VideoPath); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendVideo (Path)"); - - Check_TelegramVideo(Result, Text); // SKIP - - Result = OPI_Telegram.SendVideo(Token, ChannelID, Text, VideoDD); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "SendVideo (BD)"); - - Check_TelegramVideo(Result, Text); - - DeleteFiles(VideoPath); - - FileID = Result["result"]["video"]["file_id"]; - OPI_GetTestData.WriteParameter("Telegram_FileID", FileID); - - FunctionParameters.Insert("Telegram_FileID", FileID); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_SendAudio(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - ChatID = FunctionParameters["Telegram_ChatID"]; - ChannelID = FunctionParameters["Telegram_ChannelID"]; - Text = FunctionParameters["String"]; - Audio = FunctionParameters["Audio"]; - - AudioPath = GetTempFileName("mp3"); - CopyFile(Audio, AudioPath); - - AudioDD = New BinaryData(AudioPath); - - Result = OPI_Telegram.SendAudio(Token, ChatID, Text, Audio); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendAudio", "Telegram"); - - Check_TelegramAudio(Result, Text); // SKIP - - Result = OPI_Telegram.SendAudio(Token, ChannelID, Text, AudioPath); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendAudio (Path)"); - - Check_TelegramAudio(Result, Text); // SKIP - - Result = OPI_Telegram.SendAudio(Token, ChannelID, Text, AudioDD); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "SendAudio (BD)"); - - Check_TelegramAudio(Result, Text); - - DeleteFiles(AudioPath); - - FileID = Result["result"]["audio"]["file_id"]; - OPI_GetTestData.WriteParameter("Telegram_FileID", FileID); - - FunctionParameters.Insert("Telegram_FileID", FileID); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_SendDocument(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - ChatID = FunctionParameters["Telegram_ChatID"]; - ChannelID = FunctionParameters["Telegram_ChannelID"]; - Text = FunctionParameters["String"]; - Document = FunctionParameters["Document"]; - - DocumentPath = GetTempFileName("docx"); - CopyFile(Document, DocumentPath); - - DocumentDD = New BinaryData(DocumentPath); - - Result = OPI_Telegram.SendDocument(Token, ChatID, Text, Document); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendDocument", "Telegram"); - - Check_TelegramDocument(Result, Text); // SKIP - - Result = OPI_Telegram.SendDocument(Token, ChannelID, Text, DocumentPath); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendDocument (Path)"); - - Check_TelegramDocument(Result, Text); // SKIP - - Result = OPI_Telegram.SendDocument(Token, ChannelID, Text, DocumentDD); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "SendDocument (BD)"); - - Check_TelegramDocument(Result, Text); - - DeleteFiles(DocumentPath); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_SendGif(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - ChatID = FunctionParameters["Telegram_ChatID"]; - ChannelID = FunctionParameters["Telegram_ChannelID"]; - Text = FunctionParameters["String"]; - GIF = FunctionParameters["GIF"]; - - GifPath = GetTempFileName("gif"); - CopyFile(GIF, GifPath); - - GifDD = New BinaryData(GifPath); - - Result = OPI_Telegram.SendGif(Token, ChatID, Text, GIF); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendGif", "Telegram"); - - Check_TelegramGif(Result, Text); // SKIP - - Result = OPI_Telegram.SendGif(Token, ChannelID, Text, GifPath); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendGif (Path)"); - - Check_TelegramGif(Result, Text); // SKIP - - Result = OPI_Telegram.SendGif(Token, ChannelID, Text, GifDD); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "SendGif (BD)"); - - Check_TelegramGif(Result, Text); - - DeleteFiles(GifPath); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_SendMediaGroup(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - ChatID = FunctionParameters["Telegram_ChatID"]; - Text = FunctionParameters["String"]; - Image = FunctionParameters["Picture"]; - Video = FunctionParameters["Video"]; - - ImagePath = GetTempFileName("png"); - CopyFile(Image, ImagePath); - - VideoPath = GetTempFileName("mp4"); - CopyFile(Video, VideoPath); - - VideoDD = New BinaryData(VideoPath); - - MediaGroup = New Match; - MediaGroup.Insert(ImagePath, "photo"); - MediaGroup.Insert(VideoDD , "video"); - - Result = OPI_Telegram.SendMediaGroup(Token, ChatID, Text, MediaGroup); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "SendMediaGroup", "Telegram"); - - Check_TelegramMediaGroup(Result); - - DeleteFiles(VideoPath); - DeleteFiles(ImagePath); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_SendLocation(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - ChatID = FunctionParameters["Telegram_ChatID"]; - ChannelID = FunctionParameters["Telegram_ChannelID"]; - Width = FunctionParameters["Lat"]; - Longitude = FunctionParameters["Long"]; - - Result = OPI_Telegram.SendLocation(Token, ChatID, Width, Longitude); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendLocation", "Telegram"); - - Check_TelegramLocation(Result); // SKIP - - Result = OPI_Telegram.SendLocation(Token, ChannelID, Width, Longitude); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "SendLocation (toаtoл)"); - - Check_TelegramLocation(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_SendContact(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - ChatID = FunctionParameters["Telegram_ChatID"]; - ChannelID = FunctionParameters["Telegram_ChannelID"]; - Name = FunctionParameters["Name"]; - Last name = FunctionParameters["Surname"]; - Phone = FunctionParameters["Phone"]; - - Result = OPI_Telegram.SendContact(Token, ChatID , Name, Last name, Phone); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendContact", "Telegram"); - - Check_TelegramContact(Result, Name); // SKIP - OPI_Tools.Pause(20); // SKIP - - Result = OPI_Telegram.SendContact(Token, ChannelID, Name, Last name, Phone); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "SendContact (toаtoл)"); - - Check_TelegramContact(Result, Name); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_SendPoll(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - ChatID = FunctionParameters["Telegram_ChatID"]; - ChannelID = FunctionParameters["Telegram_ChannelID"]; - Question = "What's your favorite color?"; - - AnswersArray = New Array; - AnswersArray.Add("Red"); - AnswersArray.Add("Yellow"); - AnswersArray.Add("Green"); - AnswersArray.Add("Blue"); - - Result = OPI_Telegram.SendPoll(Token, ChatID , Question, AnswersArray, False); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendPoll", "Telegram"); - - Check_TelegramPoll(Result, Question); // SKIP - - Result = OPI_Telegram.SendPoll(Token, ChannelID, Question, AnswersArray, True); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendPoll (toаtoл)"); - - Check_TelegramPoll(Result, Question); // SKIP - - // END - - StringArray = "['Red', 'Yellow','Green' ,'Blue']"; - - Result = OPI_Telegram.SendPoll(Token, ChannelID, Question, StringArray, True); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendPoll (withтрочный маwithwithиin)"); - - Check_TelegramPoll(Result, Question); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_DownloadFile(FunctionParameters) - - FileID = FunctionParameters["Telegram_FileID"]; - Token = FunctionParameters["Telegram_Token"]; - - Result = OPI_Telegram.DownloadFile(Token, FileID); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "DownloadFile", "Telegram"); - - OPI_GetTestData.ExpectsThat(Result).HasType("BinaryData"); - -EndProcedure - -Procedure Telegram_ForwardMessage(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - ChatID = FunctionParameters["Telegram_ChatID"]; - ChannelID = FunctionParameters["Telegram_ChannelID"]; - MessageID = FunctionParameters["Telegram_ChannelMessageID"]; - - Result = OPI_Telegram.ForwardMessage(Token, MessageID, ChannelID, ChatID); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "ForwardMessage", "Telegram"); - - Check_TelegramForward(Result, MessageID); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_Ban(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - UserID = FunctionParameters["Telegram_ChatID"]; - ChannelID = FunctionParameters["Telegram_ChannelID"]; - - Result = OPI_Telegram.Ban(Token, ChannelID, UserID); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "Ban", "Telegram"); - - Check_TelegramBan(Result); - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_Unban(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - UserID = FunctionParameters["Telegram_ChatID"]; - ChannelID = FunctionParameters["Telegram_ChannelID"]; - - Result = OPI_Telegram.Unban(Token, ChannelID, UserID); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "Unban", "Telegram"); - - Check_TelegramBan(Result); - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_CreateInviteLink(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - ChannelID = FunctionParameters["Telegram_ChannelID"]; - Day = 86400; - CurrentDate = OPI_Tools.GetCurrentDate(); - - Title = "Link " + String(CurrentDate); - Expiration = CurrentDate + Day; - UnixExpiration = OPI_Tools.UNIXTime(Expiration); - - Result = OPI_Telegram.CreateInvitationLink(Token, ChannelID, Title, Expiration, 200); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateInvitationLink", "Telegram"); - - Check_TelegramInvitation(Result, Title, UnixExpiration); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_PinMessage(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - ChannelID = FunctionParameters["Telegram_ChannelID"]; - MessageID = FunctionParameters["Telegram_ChannelMessageID"]; - - Result = OPI_Telegram.PinMessage(Token, ChannelID, MessageID); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "PinMessage", "Telegram"); - - Check_TelegramTrue(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_UnpinMessage(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - ChannelID = FunctionParameters["Telegram_ChannelID"]; - MessageID = FunctionParameters["Telegram_ChannelMessageID"]; - - Result = OPI_Telegram.UnpinMessage(Token, ChannelID, MessageID); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "UnpinMessage", "Telegram"); - - Check_TelegramTrue(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_GetParticipantCount(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - ChannelID = FunctionParameters["Telegram_ChannelID"]; - - Result = OPI_Telegram.GetParticipantCount(Token, ChannelID); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "GetParticipantCount", "Telegram"); - - Check_TelegramNumber(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_GetForumAvatarList(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - Result = OPI_Telegram.GetAvatarIconList(Token); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "GetAvatarIconList", "Telegram"); - - OPI_GetTestData.ExpectsThat(Result).HasType("Match").Filled(); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_CreateForumTopic(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - Chat = FunctionParameters["Telegram_ForumID"]; - Icon = "5357419403325481346"; - Name = "TestTopic " + String(New UniqueIdentifier); - - Result = OPI_Telegram.CreateForumThread(Token, Chat, Name, Icon); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateForumThread", "Telegram"); - - Topic = Result["result"]["message_thread_id"]; - - FunctionParameters.Insert("Telegram_TopicID", Topic); - OPI_Tools.AddField("Telegram_TopicID", Topic, "String", FunctionParameters); - OPI_GetTestData.WriteParameter("Telegram_TopicID", FunctionParameters["Telegram_TopicID"]); - - Check_TelegramCreateTopic(Result, Name, Icon); - - ChatTopic = Chat + "*" + Topic; - Text = FunctionParameters["String"]; - Result = OPI_Telegram.SendTextMessage(Token, ChatTopic, Text); - - // !OInt OPI_GetTestData.WriteLog(Result, "SendTextMessage (форум)"); - - Check_TelegramMessage(Result, Text); - -EndProcedure - -Procedure Telegram_EditForumTopic(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - Chat = FunctionParameters["Telegram_ForumID"]; - Topic = FunctionParameters["Telegram_TopicID"]; - NewName = "NewTestTitle"; - NewIcon = "5310132165583840589"; - - Result = OPI_Telegram.EditForumTopic(Token, Chat, Topic, NewName, NewIcon); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "EditForumTopic", "Telegram"); - - Check_TelegramTrue(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_CloseForumTopic(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - Chat = FunctionParameters["Telegram_ForumID"]; - Topic = FunctionParameters["Telegram_TopicID"]; - - OPI_Telegram.OpenForumThread(Token, Chat); // SKIP - - Result = OPI_Telegram.CloseForumThread(Token, Chat); // Closes main topic - - // !OInt OPI_GetTestData.WriteLog(Result, "CloseForumThread (глаintoя)"); - - Check_TelegramTrue(Result); // SKIP - - Result = OPI_Telegram.CloseForumThread(Token, Chat, Topic); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "CloseForumThread", "Telegram"); - - Check_TelegramTrue(Result); - - OPI_Tools.Pause(25); - -EndProcedure - -Procedure Telegram_OpenForumTopic(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - Chat = FunctionParameters["Telegram_ForumID"]; - Topic = FunctionParameters["Telegram_TopicID"]; - - Result = OPI_Telegram.OpenForumThread(Token, Chat); // Opens main topic - - // !OInt OPI_GetTestData.WriteLog(Result, "OpenForumThread (глаintoя)"); - - Check_TelegramTrue(Result); // SKIP - - Result = OPI_Telegram.OpenForumThread(Token, Chat, Topic); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "OpenForumThread", "Telegram"); - - Check_TelegramTrue(Result); - - OPI_Tools.Pause(25); - -EndProcedure - -Procedure Telegram_DeleteForumTopic(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - Chat = FunctionParameters["Telegram_ForumID"]; - Topic = FunctionParameters["Telegram_TopicID"]; - - Result = OPI_Telegram.DeleteForumTopic(Token, Chat, Topic); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "DeleteForumTopic", "Telegram"); - - Check_TelegramTrue(Result); - - OPI_Tools.Pause(25); - -EndProcedure - -Procedure Telegram_ClearPinnedMessagesList(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - Chat = FunctionParameters["Telegram_ForumID"]; - Topic = FunctionParameters["Telegram_TopicID"]; - - Result = OPI_Telegram.ClearThreadPinnedMessagesList(Token, Chat); - - // !OInt OPI_GetTestData.WriteLog(Result, "ClearThreadPinnedMessagesList (глаintoя)"); - - Check_TelegramTrue(Result); // SKIP - - Result = OPI_Telegram.ClearThreadPinnedMessagesList(Token, Chat, Topic); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "ClearThreadPinnedMessagesList", "Telegram"); - - Check_TelegramTrue(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_HideMainForumTopic(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - Chat = FunctionParameters["Telegram_ForumID"]; - - Result = OPI_Telegram.HideMainForumTopic(Token, Chat); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "HideMainForumTopic", "Telegram"); - - Check_TelegramTrue(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_ShowMainForumTopic(FunctionParameters) - - Token = FunctionParameters["Telegram_Token"]; - Chat = FunctionParameters["Telegram_ForumID"]; - - Result = OPI_Telegram.ShowMainForumTopic(Token, Chat); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "ShowMainForumTopic", "Telegram"); - - Check_TelegramTrue(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Telegram_ChangeMainTopicName(FunctionParameters) - - Title = "New main thread name " + String(New UniqueIdentifier); - Token = FunctionParameters["Telegram_Token"]; - Chat = FunctionParameters["Telegram_ForumID"]; - - Result = OPI_Telegram.EditMainForumTopicName(Token, Chat, Title); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "EditMainForumTopicName", "Telegram"); - - Check_TelegramTrue(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -#EndRegion - -#Region VK - -Procedure VK_CreateTokenRetrievalLink(FunctionParameters) - - Application = FunctionParameters["VK_AppID"]; - Result = OPI_VK.CreateTokenRetrievalLink(Application); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateTokenRetrievalLink", "VK"); - - OPI_GetTestData.ExpectsThat(Result).HasType("String").Filled(); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure VK_CreatePost(FunctionParameters) - - Parameters = GetVKParameters(); - Text = "Post from autotest"; - URL = "https://github.com/Bayselonarrend/OpenIntegrations"; - - Image = FunctionParameters["Picture"]; // URL, Path or Binary Data - Image2 = FunctionParameters["Picture2"]; // URL, Path or Binary Data - - AndVF = GetTempFileName("png"); - CopyFile(Image2, AndVF); - - ImageArray = New Array; - ImageArray.Add(Image); - ImageArray.Add(AndVF); - - Result = OPI_VK.CreatePost(Text, ImageArray, True, URL, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreatePost", "VK"); - - Check_VKPost(Result); // SKIP - PostID = Result["response"]["post_id"]; // SKIP - Result = OPI_VK.DeletePost(PostID, Parameters); // SKIP - - Result = OPI_VK.CreatePost(Text, Image, False , , Parameters); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "CreatePost (оdto toартинtoа)"); - - Check_VKPost(Result); - - PostID = Result["response"]["post_id"]; - Result = OPI_VK.DeletePost(PostID, Parameters); - - OPI_Tools.Pause(5); - - Result = OPI_VK.CreatePost(Text, AndVF , True, URL, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreatePost (оdин path)"); - - Check_VKPost(Result); - - PostID = Result["response"]["post_id"]; - OPI_Tools.AddField("VK_PostID", PostID, "String", FunctionParameters); - OPI_GetTestData.WriteParameter("VK_PostID", FunctionParameters["VK_PostID"]); - - DeleteFiles(AndVF); - OPI_Tools.Pause(5); - -EndProcedure - -Procedure VK_DeletePost(FunctionParameters) - - Parameters = GetVKParameters(); - PostID = FunctionParameters["VK_PostID"]; - - Result = OPI_VK.DeletePost(PostID, Parameters); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "DeletePost", "VK"); - - Check_VKTrue(Result); - -EndProcedure - -Procedure VK_CreateCompositePost(FunctionParameters) - - Parameters = GetVKParameters(); - Text = "Post from autotest"; - URL = "https://github.com/Bayselonarrend/OpenIntegrations"; - - Image = FunctionParameters["Picture"]; // URL, Path or Binary Data - Video = FunctionParameters["Video"]; // URL, Path or Binary Data - - AndVF = GetTempFileName("png"); - CopyFile(Image, AndVF); - - ImageUpload = OPI_VK.UploadPhotoToServer(AndVF, Parameters)["response"][0]; - VideoUpload = OPI_VK.UploadVideoToServer(Video, "NewVideo", , , Parameters); - - ImageOwner = OPI_Tools.NumberToString(ImageUpload["owner_id"]); - VideoOwner = OPI_Tools.NumberToString(VideoUpload["owner_id"]); - - ImageID = OPI_Tools.NumberToString(ImageUpload["id"]); - VideoID = OPI_Tools.NumberToString(VideoUpload["video_id"]); - - AttachmentsArray = New Array; - AttachmentsArray.Add("photo" + ImageOwner + "_" + ImageID); - AttachmentsArray.Add("video" + VideoOwner + "_" + VideoID); - - Result = OPI_VK.CreateCompositePost(Text, AttachmentsArray, False, URL, Parameters); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateCompositePost", "VK"); - - Check_VKPost(Result); - DeleteFiles(AndVF); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure VK_CreatePoll() - - Parameters = GetVKParameters(); - Question = "What's your favorite color?"; - - OptionArray = New Array; - OptionArray.Add("Red"); - OptionArray.Add("Yellow"); - OptionArray.Add("Green"); - - Result = OPI_VK.CreatePoll(Question, OptionArray, , Parameters); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "CreatePoll", "VK"); - - Check_VKPost(Result); - - PostID = Result["response"]["post_id"]; - OPI_VK.DeletePost(PostID, Parameters); - - OPI_Tools.Pause(10); - -EndProcedure - -Procedure VK_CreateAlbum(FunctionParameters) - - Parameters = GetVKParameters(); - Name = "AlbumFromAutoTest"; - Description = "NewAlbumFromAutoTest"; - - Result = OPI_VK.CreateAlbum(Name, Description, Parameters); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateAlbum", "VK"); - - Check_VKAlbum(Result, Description); - - AlbumID = Result["response"]["id"]; - FunctionParameters.Insert("VK_AlbumID", AlbumID); - OPI_GetTestData.WriteParameter("VK_AlbumID", AlbumID); - -EndProcedure - -Procedure VK_SavePictureToAlbum(FunctionParameters) - - Parameters = GetVKParameters(); - ImageDescription = "AutoTestImage"; - AlbumID = FunctionParameters["VK_AlbumID"]; - - Image = FunctionParameters["Picture"]; // URL, Path to file or Binary Data - AndVF = GetTempFileName("png"); - CopyFile(Image, AndVF); - - Image = New BinaryData(AndVF); - - Result = OPI_VK.SaveImageToAlbum(AlbumID, Image, ImageDescription, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "SaveImageToAlbum", "VK"); - - Check_VKAlbumPicture(Result, ImageDescription, AlbumID); // SKIP - - ImageID = Result["response"][0]["id"]; // SKIP - Result = OPI_VK.DeleteImage(ImageID, Parameters); // SKIP - - Result = OPI_VK.SaveImageToAlbum(AlbumID, AndVF, ImageDescription, Parameters); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "SaveImageToAlbum (path)"); - - Check_VKAlbumPicture(Result, ImageDescription, AlbumID); // SKIP - - ImageID = Result["response"][0]["id"]; - FunctionParameters.Insert("VK_PictureID", ImageID); - OPI_GetTestData.WriteParameter("VK_PictureID", ImageID); - - DeleteFiles(AndVF); - OPI_Tools.Pause(5); - -EndProcedure - -Procedure VK_DeleteImage(FunctionParameters) - - Parameters = GetVKParameters(); - ImageID = FunctionParameters["VK_PictureID"]; - - Result = OPI_VK.DeleteImage(ImageID, Parameters); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "DeleteImage", "VK"); - - Check_VKTrue(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure VK_DeleteAlbum(FunctionParameters) - - Parameters = GetVKParameters(); - AlbumID = FunctionParameters["VK_AlbumID"]; - - Result = OPI_VK.DeleteAlbum(AlbumID, Parameters); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "DeleteAlbum", "VK"); - - Check_VKTrue(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure VK_CreateStory(FunctionParameters) - - Parameters = GetVKParameters(); - URL = "https://github.com/Bayselonarrend/OpenIntegrations"; - - Image = FunctionParameters["Picture"]; // URL, Path to file or Binary Data - AndVF = GetTempFileName("png"); - CopyFile(Image, AndVF); - Image = New BinaryData(AndVF); - - Result = OPI_VK.CreateStory(Image , URL, Parameters); - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateStory", "VK"); - - Check_VKStory(Result); // SKIP - - Result = OPI_VK.CreateStory(AndVF, , Parameters); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateStory (path)"); - - Check_VKStory(Result); - - DeleteFiles(AndVF); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure VK_CreateDiscussion(FunctionParameters) - - Parameters = GetVKParameters(); - Name = "Discussing: Which color is better?"; - Message = "Red, yellow, blue, or some other?"; - - Result = OPI_VK.CreateDiscussion(Name, Message, Parameters); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateDiscussion", "VK"); - - Check_VKDiscussion(Result); - - DiscussionID = Result["response"]; - FunctionParameters.Insert("VK_ConvID", DiscussionID); - OPI_GetTestData.WriteParameter("VK_ConvID", DiscussionID); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure VK_CloseDiscussion(FunctionParameters) - - Parameters = GetVKParameters(); - DiscussionID = FunctionParameters["VK_ConvID"]; - Result = OPI_VK.CloseDiscussion(DiscussionID, False, Parameters); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "CloseDiscussion", "VK"); - - Check_VKTrue(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure VK_OpenDiscussion(FunctionParameters) - - Parameters = GetVKParameters(); - DiscussionID = FunctionParameters["VK_ConvID"]; - Result = OPI_VK.OpenDiscussion(DiscussionID, Parameters); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "OpenDiscussion", "VK"); - - Check_VKTrue(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure VK_PostToDiscussion(FunctionParameters) - - Parameters = GetVKParameters(); - DiscussionID = FunctionParameters["VK_ConvID"]; - Message = "I like yellow more"; - - Result = OPI_VK.WriteInDiscussion(DiscussionID, Message, Parameters); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "WriteInDiscussion", "VK"); - - Check_VKDiscussion(Result); - -EndProcedure - -#EndRegion - -#Region Dropbox - -Procedure Dropbox_GetAuthorizationLink(FunctionParameters) - - AppKey = FunctionParameters["Dropbox_Appkey"]; - Result = OPI_Dropbox.GetAuthorizationLink(AppKey); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "GetAuthorizationLink", "Dropbox"); - - OPI_GetTestData.ExpectsThat(Result).HasType("String"); - -EndProcedure - -Procedure Dropbox_GetToken(FunctionParameters) - - AppKey = FunctionParameters["Dropbox_Appkey"]; - AppSecret = FunctionParameters["Dropbox_Appsecret"]; - Code = FunctionParameters["Dropbox_Code"]; - - Result = OPI_Dropbox.GetToken(AppKey, AppSecret, Code); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "GetToken"); - - Token = Result["access_token"]; - Refresh = Result["refresh_token"]; - - If ValueFilled(Token) Then - OPI_GetTestData.WriteParameter("Dropbox_Token", Token); - EndIf; - - If ValueFilled(Refresh) Then - OPI_GetTestData.WriteParameter("Dropbox_Refresh", Refresh); - EndIf; - -EndProcedure - -Procedure Dropbox_UpdateToken(FunctionParameters) - - AppKey = FunctionParameters["Dropbox_Appkey"]; - AppSecret = FunctionParameters["Dropbox_Appsecret"]; - RefreshToken = FunctionParameters["Dropbox_Refresh"]; - - Result = OPI_Dropbox.RefreshToken(AppKey, AppSecret, RefreshToken); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "RefreshToken"); - - Token = Result["access_token"]; - - OPI_GetTestData.ExpectsThat(Token).Filled(); - - OPI_GetTestData.WriteParameter("Dropbox_Token", Token); - -EndProcedure - -Procedure Dropbox_GetObjectInformation(FunctionParameters) - - Path = "/New/pic.png"; - Token = FunctionParameters["Dropbox_Token"]; - - Result = OPI_Dropbox.GetObjectInformation(Token, Path, True); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "GetObjectInformation", "Dropbox"); - - Check_DropboxFile(Result, Path); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Dropbox_GetPreview(FunctionParameters) - - Token = FunctionParameters["Dropbox_Token"]; - Path = "/New/mydoc.docx"; - - Result = OPI_Dropbox.GetPreview(Token, Path); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "GetPreview", "Dropbox"); - - Check_BinaryData(Result, 190834); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Dropbox_UploadFile(FunctionParameters) - - Path = "/New/pic.png"; - Token = FunctionParameters["Dropbox_Token"]; - Image = FunctionParameters["Picture"]; - - ImagePath = GetTempFileName("png"); - CopyFile(Image, ImagePath); - - Result = OPI_Dropbox.UploadFile(Token, ImagePath, Path, True); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "UploadFile", "Dropbox"); - - Check_DropboxFile(Result, Path); - DeleteFiles(ImagePath); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Dropbox_UploadFileByURL(FunctionParameters) - - Path = "/New/url_doc.docx"; - Token = FunctionParameters["Dropbox_Token"]; - URL = FunctionParameters["Document"]; - - Result = OPI_Dropbox.UploadFileByURL(Token, URL, Path); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "UploadFileByURL", "Dropbox"); - - Check_DropboxWork(Result); - - Work = Result["async_job_id"]; - - FunctionParameters.Insert("Dropbox_Job", Work); - OPI_GetTestData.WriteParameter("Dropbox_Job", Work); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Dropbox_GetUploadStatusByURL(FunctionParameters) - - Token = FunctionParameters["Dropbox_Token"]; - WorkID = FunctionParameters["Dropbox_Job"]; - Status = "in_progress"; - - While Status = "in_progress" Loop - - Result = OPI_Dropbox.GetUploadStatusByURL(Token, WorkID); - Status = Result[".tag"]; - - OPI_Tools.Pause(5); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetUploadStatusByURL", "Dropbox"); - - EndOfLoop; - - // END - - Check_DropboxStatus(Result); - - Path = "/New/url_doc.docx"; - Result = OPI_Dropbox.DeleteObject(Token, Path); - - Check_DropboxMetadata(Result, Path); - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Dropbox_DeleteObject(FunctionParameters) - - Path = "/New/pic.png"; - Token = FunctionParameters["Dropbox_Token"]; - - Result = OPI_Dropbox.DeleteObject(Token, Path); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "DeleteObject", "Dropbox"); - - Check_DropboxMetadata(Result, Path); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Dropbox_CopyObject(FunctionParameters) - - Original = "/New/pic.png"; - Copy = "/New/pic_copy.png"; - Token = FunctionParameters["Dropbox_Token"]; - - Result = OPI_Dropbox.CopyObject(Token, Original, Copy); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "CopyObject", "Dropbox"); - - Check_DropboxMetadata(Result, Copy); - - Result = OPI_Dropbox.DeleteObject(Token, Copy); - Check_DropboxMetadata(Result, Copy); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Dropbox_MoveObject(FunctionParameters) - - OriginalPath = "/New/pic.png"; - TargetPath = "/pic.png"; - Token = FunctionParameters["Dropbox_Token"]; - - Result = OPI_Dropbox.MoveObject(Token, OriginalPath, TargetPath); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "Dropbox_MoveObject", "Dropbox"); - - Check_DropboxMetadata(Result, TargetPath); - - Result = OPI_Dropbox.MoveObject(Token, TargetPath, OriginalPath); - Check_DropboxMetadata(Result, OriginalPath); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Dropbox_CreateFolder(FunctionParameters) - - Token = FunctionParameters["Dropbox_Token"]; - Path = "/New toаталог"; - - Result = OPI_Dropbox.CreateFolder(Token, Path); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "CreateFolder", "Dropbox"); - - Check_DropboxMetadata(Result, Path); - - Result = OPI_Dropbox.DeleteObject(Token, Path); - Check_DropboxMetadata(Result, Path); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Dropbox_DownloadFile(FunctionParameters) - - Token = FunctionParameters["Dropbox_Token"]; - Path = "/New/pic.png"; - - Result = OPI_Dropbox.DownloadFile(Token, Path); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "DownloadFile", "Dropbox"); - - Check_BinaryData(Result, 2114023); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Dropbox_DownloadFolder(FunctionParameters) - - Token = FunctionParameters["Dropbox_Token"]; - Path = "/New"; - - Result = OPI_Dropbox.DownloadFolder(Token, Path); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "DownloadFolder", "Dropbox"); - - Check_BinaryData(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Dropbox_GetFolderFileList(FunctionParameters) - - Path = "/New"; - Token = FunctionParameters["Dropbox_Token"]; - - Result = OPI_Dropbox.GetListOfFolderFiles(Token, Path, True); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "GetListOfFolderFiles", "Dropbox"); - - Check_DropboxArray(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Dropbox_GetObjectVersionList(FunctionParameters) - - Token = FunctionParameters["Dropbox_Token"]; - Path = "/New/pic.png"; - - Result = OPI_Dropbox.GetObjectVersionList(Token, Path, 1); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "GetObjectVersionList", "Dropbox"); - - Check_DropboxArray(Result, 1); - - Revision = Result["entries"][0]["rev"]; - - FunctionParameters.Insert("Dropbox_FileRevision", Revision); - OPI_GetTestData.WriteParameter("Dropbox_FileRevision", Revision); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Dropbox_RestoreObjectToVersion(FunctionParameters) - - Version = FunctionParameters["Dropbox_FileRevision"]; - Token = FunctionParameters["Dropbox_Token"]; - Path = "/New/pic.png"; - - Result = OPI_Dropbox.RestoreObjectToVersion(Token, Path, Version); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "RestoreObjectToVersion", "Dropbox"); - - Check_DropboxFile(Result, Path); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Dropbox_GetTagList(FunctionParameters) - - Token = FunctionParameters["Dropbox_Token"]; - - PathsArray = New Array; - PathsArray.Add("/New/Dogs.mp3"); - PathsArray.Add("/New/mydoc.docx"); - - Result = OPI_Dropbox.GetTagList(Token, PathsArray); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "GetTagList", "Dropbox"); - - Check_DropboxTags(Result, PathsArray.Quantity()); - - Result = OPI_Dropbox.GetTagList(Token, "/New/mydoc.docx"); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetTagList (оdиночный)"); - - Check_DropboxTags(Result, 1); - - HasTag = False; - - For Each Tag Of Result["paths_to_tags"][0]["tags"] Loop - If Tag["tag_text"] = "important" Then - HasTag = True; - EndIf; - EndOfLoop; - - OPI_GetTestData.ExpectsThat(HasTag).Equal(True); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Dropbox_AddTag(FunctionParameters) - - Tag = "Important"; - Token = FunctionParameters["Dropbox_Token"]; - Path = "/New/mydoc.docx"; - - Result = OPI_Dropbox.AddTag(Token, Path, Tag); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "AddTag", "Dropbox"); - - Check_Empty(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Dropbox_DeleteTag(FunctionParameters) - - Tag = "Important"; - Token = FunctionParameters["Dropbox_Token"]; - Path = "/New/mydoc.docx"; - - Result = OPI_Dropbox.DeleteTag(Token, Path, Tag); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "DeleteTag", "Dropbox"); - - Check_Empty(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Dropbox_GetAccountInformation(FunctionParameters) - - Token = FunctionParameters["Dropbox_Token"]; - - Result = OPI_Dropbox.GetAccountInformation(Token); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "GetAccountInformation", "Dropbox"); - - Check_DropboxAccount(Result); - - Result = OPI_Dropbox.GetAccountInformation(Token, Result["account_id"]); - - // !OInt OPI_GetTestData.WriteLog(Result, "GetAccountInformation (withторонний)"); - - Check_DropboxAccount(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Dropbox_GetSpaceUsageData(FunctionParameters) - - Token = FunctionParameters["Dropbox_Token"]; - - Result = OPI_Dropbox.GetSpaceUsageData(Token); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "GetSpaceUsageData", "Dropbox"); - - Check_DropboxSpace(Result); - -EndProcedure - -Procedure Dropbox_AddUsersToFile(FunctionParameters) - - Token = FunctionParameters["Dropbox_Token"]; - Email = FunctionParameters["Dropbox_OtherUser"]; - File = FunctionParameters["Dropbox_FileID"]; - - Result = OPI_Dropbox.AddUsersToFile(Token, File, Email, False); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "AddUserToFile", "Dropbox"); - - Check_DropboxMember(Result, Email, False); - - Mails = New Array; - Mails.Add(Email); - - Result = OPI_Dropbox.AddUsersToFile(Token, File, Mails, True); - - Check_DropboxMember(Result, Email, True); - -EndProcedure - -Procedure Dropbox_PublishFolder(FunctionParameters) - - Token = FunctionParameters["Dropbox_Token"]; - Path = "/New"; - - Result = OPI_Dropbox.PublishFolder(Token, Path); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "PublishFolder", "Dropbox"); - - Check_DropboxPublicFolder(Result); - - FolderID = Result["shared_folder_id"]; - - FunctionParameters.Insert("Dropbox_SharedFolder", FolderID); - OPI_GetTestData.WriteParameter("Dropbox_SharedFolder", FolderID); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Dropbox_CancelFolderPublication(FunctionParameters) - - Token = FunctionParameters["Dropbox_Token"]; - Folder = FunctionParameters["Dropbox_SharedFolder"]; - - Result = OPI_Dropbox.CancelFolderPublication(Token, Folder); - CurrentStatus = "in_progress"; - JobID = Result["async_job_id"]; - - While CurrentStatus = "in_progress" Loop - Result = OPI_Dropbox.GetAsynchronousChangeStatus(Token, JobID); - CurrentStatus = Result[".tag"]; - OPI_Tools.Pause(3); - EndOfLoop; - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "CancelFolderPublication", "Dropbox"); - - Check_DropboxStatus(Result); - - OPI_Tools.Pause(5); - -EndProcedure - -Procedure Dropbox_AddUsersToFolder(FunctionParameters) - - Token = FunctionParameters["Dropbox_Token"]; - Email = FunctionParameters["Dropbox_OtherUser"]; - Folder = FunctionParameters["Dropbox_SharedFolder"]; // shared_folder_id - - Result = OPI_Dropbox.AddUsersToFolder(Token, Folder, Email, False); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "AddUserToFile", "Dropbox"); - - Check_Empty(Result); - - Mails = New Array; - Mails.Add(Email); - - Result = OPI_Dropbox.AddUsersToFolder(Token, Folder, Mails, True); - - Check_Empty(Result); - -EndProcedure - -Procedure Dropbox_CancelFilePublication(FunctionParameters) - - Token = FunctionParameters["Dropbox_Token"]; - File = FunctionParameters["Dropbox_FileID"]; - - Result = OPI_Dropbox.CancelFilePublication(Token, File); - - // END - - // !OInt OPI_GetTestData.WriteLog(Result, "CancelFilePublication", "Dropbox"); - - Check_Empty(Result); - -EndProcedure - -#EndRegion - -#EndRegion - -#EndRegion diff --git a/src/en/OPI/src/CommonModules/OPI_Тесты/OPI_Тесты.mdo b/src/en/OPI/src/CommonModules/OPI_Тесты/OPI_Тесты.mdo deleted file mode 100644 index 6106c21e79..0000000000 --- a/src/en/OPI/src/CommonModules/OPI_Тесты/OPI_Тесты.mdo +++ /dev/null @@ -1,15 +0,0 @@ - - - OPI_Тесты - - - OPI тесты - - - ru - Тесты для YaxUnit (ОПИ) - - true - true - true - diff --git a/src/en/OPI/src/Configuration/Configuration.mdo b/src/en/OPI/src/Configuration/Configuration.mdo index 0c5da04703..3b72a6160b 100644 --- a/src/en/OPI/src/Configuration/Configuration.mdo +++ b/src/en/OPI/src/Configuration/Configuration.mdo @@ -1,70 +1,70 @@ - + - OpenIntegrations - - ru - Открытый пакет интеграций - - Adopted - - Checked - Checked - Checked - - - - - - - - - true - OPI_ - 8.3.9 - Customization - ManagedApplication - PersonalComputer - Russian - Bayselonarrend - 1.9.0 - - ru - Открытый пакет интеграций - набор библиотек для интеграции с некоторыми популярными API для 1C:Enterprise. Он состоит из общих модулей, каждый из которых отвечает за свой API, а также нескольких модулей-инструментов, общих для всех. - - - ru - https://github.com/Bayselonarrend - - - ru - https://github.com/Bayselonarrend/OpenIntegrations - - - Русский - Adopted - - Checked - - ru - - Subsystem.OPI_Интеграция - CommonModule.OPI_Инструменты - CommonModule.OPI_Криптография - CommonModule.OPI_ПреобразованиеТипов - CommonModule.OPI_Telegram - CommonModule.OPI_VK - CommonModule.OPI_Viber - CommonModule.OPI_Twitter - CommonModule.OPI_Notion - CommonModule.OPI_YandexID - CommonModule.OPI_YandexDisk - CommonModule.OPI_GoogleWorkspace - CommonModule.OPI_GoogleCalendar - CommonModule.OPI_GoogleDrive - CommonModule.OPI_GoogleSheets - CommonModule.OPI_Slack - CommonModule.OPI_Airtable - CommonModule.OPI_Dropbox - CommonModule.OPI_Тесты - CommonModule.OPI_ПолучениеДанныхТестов +OpenIntegrations + +ru +Open integrations package + +Adopted + +Checked +Checked +Checked + + + + + + + + +true +OPI_ +8.3.9 +Customization +ManagedApplication +PersonalComputer +Russian +Bayselonarrend +1.9.0 + +ru +Open integrations package - toбор библиотеto for интеграции with неtoоторыми популярными API for 1C:Enterprise. He consists of general modules, each responsible for its own API, as well as several tool modules common for all. + + +ru +https://github.com/Bayselonarrend + + +ru +https://github.com/Bayselonarrend/OpenIntegrations + + +Russian +Adopted + +Checked + +ru + +Subsystem.OPI_Integrations +CommonModule.OPI_Tools +CommonModule.OPI_Cryptography +CommonModule.OPI_TypeConversion +CommonModule.OPI_Telegram +CommonModule.OPI_VK +CommonModule.OPI_Viber +CommonModule.OPI_Twitter +CommonModule.OPI_Notion +CommonModule.OPI_YandexID +CommonModule.OPI_YandexDisk +CommonModule.OPI_GoogleWorkspace +CommonModule.OPI_GoogleCalendar +CommonModule.OPI_GoogleDrive +CommonModule.OPI_GoogleSheets +CommonModule.OPI_Slack +CommonModule.OPI_Airtable +CommonModule.OPI_Dropbox +CommonModule.OPI_Tests +CommonModule.OPI_TestDataRetrieval diff --git a/service/interim/en/OPI/src/Subsystems/OPI_Интеграция/CommandInterface.cmi b/src/en/OPI/src/Subsystems/OPI_Integrations/CommandInterface.cmi similarity index 100% rename from service/interim/en/OPI/src/Subsystems/OPI_Интеграция/CommandInterface.cmi rename to src/en/OPI/src/Subsystems/OPI_Integrations/CommandInterface.cmi diff --git a/src/en/OPI/src/Subsystems/OPI_Integrations/OPI_Integrations.mdo b/src/en/OPI/src/Subsystems/OPI_Integrations/OPI_Integrations.mdo new file mode 100644 index 0000000000..8d6a631a97 --- /dev/null +++ b/src/en/OPI/src/Subsystems/OPI_Integrations/OPI_Integrations.mdo @@ -0,0 +1,28 @@ + + +OPI_Integrations + +ru +Integrations + +true +true +CommonModule.OPI_Tools +CommonModule.OPI_Cryptography +CommonModule.OPI_TypeConversion +CommonModule.OPI_VK +CommonModule.OPI_Telegram +CommonModule.OPI_Viber +CommonModule.OPI_Twitter +CommonModule.OPI_Notion +CommonModule.OPI_YandexID +CommonModule.OPI_YandexDisk +CommonModule.OPI_GoogleWorkspace +CommonModule.OPI_GoogleCalendar +CommonModule.OPI_GoogleDrive +CommonModule.OPI_GoogleSheets +CommonModule.OPI_Slack +CommonModule.OPI_Airtable +CommonModule.OPI_Tests +CommonModule.OPI_TestDataRetrieval + diff --git a/src/en/OPI/src/Subsystems/OPI_Интеграция/CommandInterface.cmi b/src/en/OPI/src/Subsystems/OPI_Интеграция/CommandInterface.cmi deleted file mode 100644 index 0cf6de8a40..0000000000 --- a/src/en/OPI/src/Subsystems/OPI_Интеграция/CommandInterface.cmi +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/src/en/OPI/src/Subsystems/OPI_Интеграция/OPI_Интеграция.mdo b/src/en/OPI/src/Subsystems/OPI_Интеграция/OPI_Интеграция.mdo deleted file mode 100644 index 64613d82e4..0000000000 --- a/src/en/OPI/src/Subsystems/OPI_Интеграция/OPI_Интеграция.mdo +++ /dev/null @@ -1,28 +0,0 @@ - - - OPI_Интеграция - - ru - Интеграция - - true - true - CommonModule.OPI_Инструменты - CommonModule.OPI_Криптография - CommonModule.OPI_ПреобразованиеТипов - CommonModule.OPI_VK - CommonModule.OPI_Telegram - CommonModule.OPI_Viber - CommonModule.OPI_Twitter - CommonModule.OPI_Notion - CommonModule.OPI_YandexID - CommonModule.OPI_YandexDisk - CommonModule.OPI_GoogleWorkspace - CommonModule.OPI_GoogleCalendar - CommonModule.OPI_GoogleDrive - CommonModule.OPI_GoogleSheets - CommonModule.OPI_Slack - CommonModule.OPI_Airtable - CommonModule.OPI_Тесты - CommonModule.OPI_ПолучениеДанныхТестов -