You've already forked OpenIntegrations
mirror of
https://github.com/Bayselonarrend/OpenIntegrations.git
synced 2025-08-13 20:05:19 +02:00
Скрипт автоформатирования модулей
This commit is contained in:
3
.github/workflows/oint_convert.yml
vendored
3
.github/workflows/oint_convert.yml
vendored
@@ -47,6 +47,9 @@ jobs:
|
||||
- name: Обновить Workflow тестирования OInt (EN)
|
||||
run: oscript ./.github/workflows/os/oint_testmaker_en.os
|
||||
|
||||
- name: Скрипт форматирования модулей
|
||||
run: oscript ./.github/workflows/os/format.os
|
||||
|
||||
|
||||
- uses: stefanzweifel/git-auto-commit-action@v5
|
||||
with:
|
||||
|
206
.github/workflows/os/format.os
vendored
Normal file
206
.github/workflows/os/format.os
vendored
Normal file
@@ -0,0 +1,206 @@
|
||||
Процедура ОтформатироватьМодуль(Знач ПутьКМодулю) Экспорт
|
||||
|
||||
ТекстовыйДокумент = Новый ТекстовыйДокумент();
|
||||
ТекстовыйДокумент.Прочитать(ПутьКМодулю, "UTF-8");
|
||||
|
||||
БлокиКода = РазобратьМодульНаБлоки(ТекстовыйДокумент);
|
||||
|
||||
Для Н = 0 По БлокиКода.ВГраница() Цикл
|
||||
|
||||
МассивСтрокБлока = СтрРазделить(БлокиКода[Н], Символы.ПС);
|
||||
|
||||
Если МассивСтрокБлока.Количество() < 2 Тогда
|
||||
Продолжить;
|
||||
ИначеЕсли СтрНачинаетсяС(СокрЛП(МассивСтрокБлока[1]), "//") Тогда
|
||||
Продолжить;
|
||||
Иначе
|
||||
ВыровнятьЗнакиРавно(МассивСтрокБлока);
|
||||
ВыровнятьЗапятые(МассивСтрокБлока);
|
||||
КонецЕсли;
|
||||
|
||||
БлокиКода[Н] = СтрСоединить(МассивСтрокБлока, Символы.ПС);
|
||||
|
||||
КонецЦикла;
|
||||
|
||||
ТекстФайла = СтрСоединить(БлокиКода, "");
|
||||
|
||||
ТекстовыйДокумент.УстановитьТекст(ТекстФайла);
|
||||
ТекстовыйДокумент.Записать(ПутьКМодулю);
|
||||
|
||||
КонецПроцедуры
|
||||
|
||||
Функция РазобратьМодульНаБлоки(Знач ТекстовыйДокумент)
|
||||
|
||||
Для Н = 1 По ТекстовыйДокумент.КоличествоСтрок() Цикл
|
||||
|
||||
ТекущаяСтрока = ТекстовыйДокумент.ПолучитьСтроку(Н);
|
||||
|
||||
Если Не ЗначениеЗаполнено(СокрЛП(ТекущаяСтрока)) Тогда
|
||||
ТекстовыйДокумент.ЗаменитьСтроку(Н, "⣿");
|
||||
Иначе
|
||||
ТекстовыйДокумент.ЗаменитьСтроку(Н, СокрП(ТекущаяСтрока));
|
||||
КонецЕсли;
|
||||
|
||||
КонецЦикла;
|
||||
|
||||
ТекстФайла = ТекстовыйДокумент.ПолучитьТекст();
|
||||
БлокиФайла = СтрРазделить(ТекстФайла, "⣿");
|
||||
|
||||
Возврат БлокиФайла;
|
||||
|
||||
КонецФункции
|
||||
|
||||
Процедура ВыровнятьЗнакиРавно(МассивСтрокБлока)
|
||||
|
||||
СоответствиеРасположений = Новый Соответствие();
|
||||
МаксимальноеРасположение = 0;
|
||||
ЧислоЗнаковРавно = 0;
|
||||
|
||||
Для Н = 0 По МассивСтрокБлока.ВГраница() Цикл
|
||||
|
||||
РасположениеРавно = СтрНайти(МассивСтрокБлока[Н], "=");
|
||||
СоответствиеРасположений.Вставить(Н, РасположениеРавно);
|
||||
МаксимальноеРасположение = ?(РасположениеРавно > МаксимальноеРасположение, РасположениеРавно, МаксимальноеРасположение);
|
||||
|
||||
Если Не РасположениеРавно = 0 Тогда
|
||||
ЧислоЗнаковРавно = ЧислоЗнаковРавно + 1;
|
||||
КонецЕсли;
|
||||
|
||||
КонецЦикла;
|
||||
|
||||
Если МаксимальноеРасположение = 0 Или ЧислоЗнаковРавно < 2 Тогда
|
||||
Возврат;
|
||||
КонецЕсли;
|
||||
|
||||
Для Каждого СтрокаБлока Из СоответствиеРасположений Цикл
|
||||
|
||||
РасположениеРавно = СтрокаБлока.Значение;
|
||||
Индекс = СтрокаБлока.Ключ;
|
||||
|
||||
Если РасположениеРавно = 0 Или МаксимальноеРасположение - РасположениеРавно > 12 Тогда
|
||||
Продолжить;
|
||||
КонецЕсли;
|
||||
|
||||
Для Н = РасположениеРавно По МаксимальноеРасположение - 1 Цикл
|
||||
МассивСтрокБлока[Индекс] = СтрЗаменить(МассивСтрокБлока[Индекс], "=", " =");
|
||||
КонецЦикла;
|
||||
|
||||
КонецЦикла;
|
||||
|
||||
КонецПроцедуры
|
||||
|
||||
Процедура ВыровнятьЗапятые(МассивСтрокБлока, СоответствиеМаксимумов = "")
|
||||
|
||||
ПолноеСоответствиеРасположений = Новый Соответствие();
|
||||
СтрокаСЗапятыми = 0;
|
||||
НачалоСтроки = "";
|
||||
|
||||
Для Н = 0 По МассивСтрокБлока.ВГраница() Цикл
|
||||
|
||||
МассивУчастков = СтрРазделить(МассивСтрокБлока[Н], ",");
|
||||
МассивУчастков_ = Новый Массив;
|
||||
Соединение = Ложь;
|
||||
СтрокаСоединения = "";
|
||||
|
||||
Для Каждого Участок Из МассивУчастков Цикл
|
||||
|
||||
ЧислоКавычек = СтрЧислоВхождений(Участок, """");
|
||||
|
||||
Если (ЧислоКавычек = 0 Или ЧислоКавычек % 2 = 0 ) И Не Соединение Тогда
|
||||
|
||||
МассивУчастков_.Добавить(Участок);
|
||||
|
||||
ИначеЕсли Соединение И ЧислоКавычек % 2 <> 0 Тогда
|
||||
МассивУчастков_.Добавить(СтрокаСоединения + "," + Участок);
|
||||
СтрокаСоединения = "";
|
||||
Соединение = Ложь;
|
||||
|
||||
Иначе
|
||||
СтрокаСоединения = ?(ЗначениеЗаполнено(СтрокаСоединения), СтрокаСоединения + "," + Участок, Участок);
|
||||
Соединение = Истина;
|
||||
КонецЕсли;
|
||||
|
||||
КонецЦикла;
|
||||
|
||||
МассивУчастков = МассивУчастков_;
|
||||
|
||||
Если МассивУчастков.Количество() < 2 Тогда
|
||||
Продолжить;
|
||||
Иначе
|
||||
СтрокаСЗапятыми = СтрокаСЗапятыми + 1;
|
||||
КонецЕсли;
|
||||
|
||||
МассивНачалаСтроки = СтрРазделить(МассивУчастков[0], "(");
|
||||
|
||||
Если МассивНачалаСтроки.Количество() < 2 Тогда
|
||||
Продолжить;
|
||||
КонецЕсли;
|
||||
|
||||
НачалоСтроки = МассивНачалаСтроки[0];
|
||||
СоответствиеРасположений = ПолноеСоответствиеРасположений[НачалоСтроки];
|
||||
|
||||
Если Не ЗначениеЗаполнено(СоответствиеРасположений) Тогда
|
||||
СоответствиеРасположений = Новый Соответствие;
|
||||
КонецЕсли;
|
||||
|
||||
Для Р = 0 По МассивУчастков.ВГраница() - 1 Цикл
|
||||
|
||||
Если Не ЗначениеЗаполнено(СоответствиеМаксимумов) Тогда
|
||||
|
||||
ДлинаУчастка = СтрДлина(МассивУчастков[Р]);
|
||||
|
||||
ТекущийМаксимум = СоответствиеРасположений.Получить(Р);
|
||||
ТекущийМаксимум = ?(ЗначениеЗаполнено(ТекущийМаксимум), ТекущийМаксимум, 0);
|
||||
ТекущийМаксимум = ?(ДлинаУчастка > ТекущийМаксимум , ДлинаУчастка , ТекущийМаксимум);
|
||||
|
||||
СоответствиеРасположений.Вставить(Р, ТекущийМаксимум);
|
||||
|
||||
Иначе
|
||||
|
||||
ТекущееСоответствиеМаксимумов = СоответствиеМаксимумов[НачалоСтроки];
|
||||
|
||||
Если Не ЗначениеЗаполнено(ТекущееСоответствиеМаксимумов) Тогда
|
||||
Прервать;
|
||||
КонецЕсли;
|
||||
|
||||
НеобходимаяДлина = ТекущееСоответствиеМаксимумов[Р];
|
||||
|
||||
Если НеобходимаяДлина = Неопределено Тогда
|
||||
Продолжить;
|
||||
КонецЕсли;
|
||||
|
||||
Пока СтрДлина(МассивУчастков[Р]) < НеобходимаяДлина Цикл
|
||||
МассивУчастков[Р] = МассивУчастков[Р] + " ";
|
||||
КонецЦикла;
|
||||
|
||||
КонецЕсли;
|
||||
|
||||
КонецЦикла;
|
||||
|
||||
ПолноеСоответствиеРасположений.Вставить(НачалоСтроки, СоответствиеРасположений);
|
||||
|
||||
МассивСтрокБлока[Н] = СтрСоединить(МассивУчастков, ",");
|
||||
|
||||
КонецЦикла;
|
||||
|
||||
Если Не ЗначениеЗаполнено(СоответствиеМаксимумов)
|
||||
И ЗначениеЗаполнено(ПолноеСоответствиеРасположений)
|
||||
И СтрокаСЗапятыми > 1 Тогда
|
||||
ВыровнятьЗапятые(МассивСтрокБлока, ПолноеСоответствиеРасположений);
|
||||
КонецЕсли;
|
||||
|
||||
КонецПроцедуры
|
||||
|
||||
Для Каждого Файл Из НайтиФайлы("./src", "*.os", Истина) Цикл
|
||||
Если СтрНайти(Файл.ПолноеИмя, "\cli\") = 0
|
||||
И СтрНайти(Файл.ПолноеИмя, "/cli/") = 0 Тогда
|
||||
ОтформатироватьМодуль(Файл.ПолноеИмя);
|
||||
КонецЕсли;
|
||||
КонецЦикла;
|
||||
|
||||
Для Каждого Файл Из НайтиФайлы("./src", "*.bsl", Истина) Цикл
|
||||
Если СтрНайти(Файл.ПолноеИмя, "\cli\") = 0
|
||||
И СтрНайти(Файл.ПолноеИмя, "/cli/") = 0 Тогда
|
||||
ОтформатироватьМодуль(Файл.ПолноеИмя);
|
||||
КонецЕсли;
|
||||
КонецЦикла;
|
@@ -53,8 +53,8 @@ Function GetListOfBases(Val Token, Val Indent = "") Export
|
||||
|
||||
OPI_TypeConversion.GetLine(Indent);
|
||||
|
||||
URL = "https://api.airtable.com/v0/meta/bases";
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
URL = "https://api.airtable.com/v0/meta/bases";
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
Parameters = New Structure;
|
||||
|
||||
OPI_Tools.AddField("offset", Indent, "String", Parameters);
|
||||
@@ -78,7 +78,7 @@ Function GetDatabaseTables(Val Token, Val Base) Export
|
||||
|
||||
OPI_TypeConversion.GetLine(Base);
|
||||
|
||||
URL = "https://api.airtable.com/v0/meta/bases/" + Base + "/tables";
|
||||
URL = "https://api.airtable.com/v0/meta/bases/" + Base + "/tables";
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
|
||||
Response = OPI_Tools.Get(URL, , Headers);
|
||||
@@ -102,15 +102,15 @@ Function CreateDatabase(Val Token, Val Workspace, Val Name, Val TableCollection)
|
||||
|
||||
OPI_TypeConversion.GetCollection(TableCollection);
|
||||
|
||||
If Not TypeOf(TableCollection) = Type("Structure")
|
||||
If Not TypeOf(TableCollection) = Type("Structure")
|
||||
And Not TypeOf(TableCollection) = Type("Map") Then
|
||||
|
||||
Raise "Error in table collection data";
|
||||
|
||||
EndIf;
|
||||
|
||||
URL = "https://api.airtable.com/v0/meta/bases";
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
URL = "https://api.airtable.com/v0/meta/bases";
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
TableArray = New Array;
|
||||
|
||||
For Each Table In TableCollection Do
|
||||
@@ -121,9 +121,9 @@ Function CreateDatabase(Val Token, Val Workspace, Val Name, Val TableCollection)
|
||||
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);
|
||||
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);
|
||||
|
||||
@@ -151,8 +151,8 @@ Function CreateTable(Val Token, Val Base, Val Name, Val FieldArray, Val Descript
|
||||
|
||||
OPI_TypeConversion.GetLine(Base);
|
||||
|
||||
URL = "https://api.airtable.com/v0/meta/bases/" + Base + "/tables";
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
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);
|
||||
@@ -178,11 +178,11 @@ Function ModifyTable(Val Token, Val Base, Val Table, Val Name = "", Val Descript
|
||||
OPI_TypeConversion.GetLine(Base);
|
||||
OPI_TypeConversion.GetLine(Table);
|
||||
|
||||
URL = "https://api.airtable.com/v0/meta/bases/" + Base + "/tables/" + Table;
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
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("name" , Name , "String", Parameters);
|
||||
OPI_Tools.AddField("description", Description , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Patch(URL, Parameters, Headers);
|
||||
@@ -212,14 +212,14 @@ Function CreateField(Val Token, Val Base, Val Table, Val FieldStructure) Export
|
||||
OPI_TypeConversion.GetLine(Table);
|
||||
OPI_TypeConversion.GetCollection(FieldStructure);
|
||||
|
||||
If Not TypeOf(FieldStructure) = Type("Structure")
|
||||
If Not TypeOf(FieldStructure) = Type("Structure")
|
||||
And Not TypeOf(FieldStructure) = Type("Map") Then
|
||||
|
||||
Raise "Error in field description data";
|
||||
|
||||
EndIf;
|
||||
|
||||
URL = "https://api.airtable.com/v0/meta/bases/" + Base + "/tables/" + Table + "/fields";
|
||||
URL = "https://api.airtable.com/v0/meta/bases/" + Base + "/tables/" + Table + "/fields";
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
|
||||
Response = OPI_Tools.Post(URL, FieldStructure, Headers);
|
||||
@@ -257,7 +257,7 @@ Function ModifyField(Val Token, Val Base, Val Table, Val Field, Val Name = "", V
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
|
||||
Parameters = New Structure();
|
||||
OPI_Tools.AddField("name" , Name, "String", Parameters);
|
||||
OPI_Tools.AddField("name" , Name , "String", Parameters);
|
||||
OPI_Tools.AddField("description", Description , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Patch(URL, Parameters, Headers);
|
||||
@@ -337,7 +337,7 @@ EndFunction
|
||||
// Structure - Field description
|
||||
Function GetDateField(Val Name) Export
|
||||
|
||||
FormatStructure = New Structure("format,name", "YYYY-MM-DD", "iso");
|
||||
FormatStructure = New Structure("format,name", "YYYY-MM-DD", "iso");
|
||||
OptionsStructure = New Structure("dateFormat", FormatStructure);
|
||||
|
||||
Return PrimitiveFieldDescription(Name, "date", OptionsStructure);
|
||||
@@ -406,7 +406,7 @@ Function GetListOfRecords(Val Token, Val Base, Val Table, Val Indent = "") Expor
|
||||
OPI_TypeConversion.GetLine(Base);
|
||||
OPI_TypeConversion.GetLine(Table);
|
||||
|
||||
URL = "https://api.airtable.com/v0/" + Base + "/" + Table;
|
||||
URL = "https://api.airtable.com/v0/" + Base + "/" + Table;
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
|
||||
Parameters = New Structure();
|
||||
@@ -435,7 +435,7 @@ Function GetRecord(Val Token, Val Base, Val Table, Val Record) Export
|
||||
OPI_TypeConversion.GetLine(Table);
|
||||
OPI_TypeConversion.GetLine(Record);
|
||||
|
||||
URL = "https://api.airtable.com/v0/" + Base + "/" + Table + "/" + Record;
|
||||
URL = "https://api.airtable.com/v0/" + Base + "/" + Table + "/" + Record;
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
|
||||
Response = OPI_Tools.Get(URL, , Headers);
|
||||
@@ -464,7 +464,7 @@ Function CreatePosts(Val Token, Val Base, Val Table, Val Data) Export
|
||||
Parameters = New Structure();
|
||||
AddDataDescription(Data, Parameters);
|
||||
|
||||
URL = "https://api.airtable.com/v0/" + Base + "/" + Table;
|
||||
URL = "https://api.airtable.com/v0/" + Base + "/" + Table;
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
@@ -493,13 +493,13 @@ Function DeletePosts(Val Token, Val Base, Val Table, Val Records) Export
|
||||
RecordString = "";
|
||||
|
||||
For Each Record In Records Do
|
||||
RecordString = RecordString
|
||||
RecordString = RecordString
|
||||
+ ?(ValueIsFilled(RecordString), "&", "?")
|
||||
+ "records[]="
|
||||
+ OPI_Tools.NumberToString(Record);
|
||||
EndDo;
|
||||
|
||||
URL = "https://api.airtable.com/v0/" + Base + "/" + Table + RecordString;
|
||||
URL = "https://api.airtable.com/v0/" + Base + "/" + Table + RecordString;
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
|
||||
Response = OPI_Tools.Delete(URL, , Headers);
|
||||
@@ -530,7 +530,7 @@ Function GetComments(Val Token, Val Base, Val Table, Val Record, Val Indent = ""
|
||||
OPI_TypeConversion.GetLine(Table);
|
||||
OPI_TypeConversion.GetLine(Record);
|
||||
|
||||
URL = "https://api.airtable.com/v0/" + Base + "/" + Table + "/" + Record + "/comments";
|
||||
URL = "https://api.airtable.com/v0/" + Base + "/" + Table + "/" + Record + "/comments";
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
|
||||
Parameters = New Structure();
|
||||
@@ -560,7 +560,7 @@ Function CreateComment(Val Token, Val Base, Val Table, Val Record, Val Text) Exp
|
||||
OPI_TypeConversion.GetLine(Table);
|
||||
OPI_TypeConversion.GetLine(Record);
|
||||
|
||||
URL = "https://api.airtable.com/v0/" + Base + "/" + Table + "/" + Record + "/comments";
|
||||
URL = "https://api.airtable.com/v0/" + Base + "/" + Table + "/" + Record + "/comments";
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
|
||||
Parameters = New Structure();
|
||||
@@ -592,7 +592,7 @@ Function EditComment(Val Token, Val Base, Val Table, Val Record, Val Comment, Va
|
||||
OPI_TypeConversion.GetLine(Record);
|
||||
OPI_TypeConversion.GetLine(Comment);
|
||||
|
||||
URL = "https://api.airtable.com/v0/" + Base + "/" + Table + "/" + Record + "/comments/" + Comment;
|
||||
URL = "https://api.airtable.com/v0/" + Base + "/" + Table + "/" + Record + "/comments/" + Comment;
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
|
||||
Parameters = New Structure();
|
||||
@@ -623,7 +623,7 @@ Function DeleteComment(Val Token, Val Base, Val Table, Val Record, Val Comment)
|
||||
OPI_TypeConversion.GetLine(Record);
|
||||
OPI_TypeConversion.GetLine(Comment);
|
||||
|
||||
URL = "https://api.airtable.com/v0/" + Base + "/" + Table + "/" + Record + "/comments/" + Comment;
|
||||
URL = "https://api.airtable.com/v0/" + Base + "/" + Table + "/" + Record + "/comments/" + Comment;
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
|
||||
Response = OPI_Tools.Delete(URL, , Headers);
|
||||
@@ -665,8 +665,8 @@ 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("name" , Name , "String" , FieldStructure);
|
||||
OPI_Tools.AddField("type" , Type , "String" , FieldStructure);
|
||||
OPI_Tools.AddField("options", Options , "Collection", FieldStructure);
|
||||
|
||||
Return FieldStructure;
|
||||
|
@@ -85,14 +85,14 @@ EndFunction
|
||||
// Map Of KeyAndValue - serialized JSON of answer from Bitrix24 API
|
||||
Function GetToken(Val ClientID, Val ClientSecret, Val Code) Export
|
||||
|
||||
URL = "https://oauth.bitrix.info/oauth/token/";
|
||||
URL = "https://oauth.bitrix.info/oauth/token/";
|
||||
String_ = "String";
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("grant_type" , "authorization_code", String_, Parameters);
|
||||
OPI_Tools.AddField("client_id" , ClientID , String_, Parameters);
|
||||
OPI_Tools.AddField("client_secret", ClientSecret , String_, Parameters);
|
||||
OPI_Tools.AddField("code" , Code , String_, Parameters);
|
||||
OPI_Tools.AddField("grant_type" , "authorization_code", String_, Parameters);
|
||||
OPI_Tools.AddField("client_id" , ClientID , String_, Parameters);
|
||||
OPI_Tools.AddField("client_secret", ClientSecret , String_, Parameters);
|
||||
OPI_Tools.AddField("code" , Code , String_, Parameters);
|
||||
|
||||
Response = OPI_Tools.Get(URL, Parameters);
|
||||
|
||||
@@ -112,14 +112,14 @@ EndFunction
|
||||
// Map Of KeyAndValue - serialized JSON of answer from Bitrix24 API
|
||||
Function RefreshToken(Val ClientID, Val ClientSecret, Val Refresh) Export
|
||||
|
||||
URL = "https://oauth.bitrix.info/oauth/token/";
|
||||
URL = "https://oauth.bitrix.info/oauth/token/";
|
||||
String_ = "String";
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("grant_type" , "refresh_token" , String_, Parameters);
|
||||
OPI_Tools.AddField("client_id" , ClientID , String_, Parameters);
|
||||
OPI_Tools.AddField("client_secret", ClientSecret , String_, Parameters);
|
||||
OPI_Tools.AddField("refresh_token", Refresh , String_, Parameters);
|
||||
OPI_Tools.AddField("grant_type" , "refresh_token" , String_, Parameters);
|
||||
OPI_Tools.AddField("client_id" , ClientID , String_, Parameters);
|
||||
OPI_Tools.AddField("client_secret", ClientSecret , String_, Parameters);
|
||||
OPI_Tools.AddField("refresh_token", Refresh , String_, Parameters);
|
||||
|
||||
Response = OPI_Tools.Get(URL, Parameters);
|
||||
|
||||
@@ -142,7 +142,7 @@ EndFunction
|
||||
Function ServerTime(Val URL, Val Token = "") Export
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "server.time");
|
||||
Response = OPI_Tools.Get(URL, Parameters);
|
||||
Response = OPI_Tools.Get(URL, Parameters);
|
||||
|
||||
Return Response;
|
||||
|
||||
@@ -182,10 +182,10 @@ Function CreatePost(Val URL
|
||||
String_ = "String";
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "log.blogpost.add");
|
||||
OPI_Tools.AddField("POST_MESSAGE", Text , String_, Parameters);
|
||||
OPI_Tools.AddField("POST_TITLE" , Title , String_, Parameters);
|
||||
OPI_Tools.AddField("DEST" , Visibility , "Array", Parameters);
|
||||
OPI_Tools.AddField("IMPORTANT" , Important , String_, Parameters);
|
||||
OPI_Tools.AddField("POST_MESSAGE", Text , String_, Parameters);
|
||||
OPI_Tools.AddField("POST_TITLE" , Title , String_, Parameters);
|
||||
OPI_Tools.AddField("DEST" , Visibility , "Array", Parameters);
|
||||
OPI_Tools.AddField("IMPORTANT" , Important , String_, Parameters);
|
||||
|
||||
If ValueIsFilled(Files) Then
|
||||
|
||||
@@ -233,10 +233,10 @@ Function UpdatePost(Val URL
|
||||
String_ = "String";
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "log.blogpost.update");
|
||||
OPI_Tools.AddField("POST_MESSAGE", Text , String_, Parameters);
|
||||
OPI_Tools.AddField("POST_TITLE" , Title , String_, Parameters);
|
||||
OPI_Tools.AddField("DEST" , Visibility , "Array", Parameters);
|
||||
OPI_Tools.AddField("POST_ID" , PostID , String_, Parameters);
|
||||
OPI_Tools.AddField("POST_MESSAGE", Text , String_, Parameters);
|
||||
OPI_Tools.AddField("POST_TITLE" , Title , String_, Parameters);
|
||||
OPI_Tools.AddField("DEST" , Visibility , "Array", Parameters);
|
||||
OPI_Tools.AddField("POST_ID" , PostID , String_, Parameters);
|
||||
|
||||
If ValueIsFilled(Files) Then
|
||||
|
||||
@@ -322,7 +322,7 @@ Function GetPosts(Val URL, Val PostID = "", Val Filter = "UA", Val Token = "") E
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "log.blogpost.get");
|
||||
|
||||
OPI_Tools.AddField("POST_ID" , PostID, "String", Parameters);
|
||||
OPI_Tools.AddField("POST_ID" , PostID , "String", Parameters);
|
||||
OPI_Tools.AddField("LOG_RIGHTS", Filter , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
@@ -350,7 +350,7 @@ Function AddPostComment(Val URL, Val PostID, Val Text, Val Token = "") Export
|
||||
Parameters = NormalizeAuth(URL, Token, "log.blogcomment.add");
|
||||
|
||||
OPI_Tools.AddField("POST_ID" , PostID, "String", Parameters);
|
||||
OPI_Tools.AddField("TEXT" , Text , "String", Parameters);
|
||||
OPI_Tools.AddField("TEXT" , Text , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -376,8 +376,8 @@ Function AddPostRecipients(Val URL, Val PostID, Val Visibility, Val Token = "")
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "log.blogpost.share");
|
||||
|
||||
OPI_Tools.AddField("POST_ID" , PostID, "String", Parameters);
|
||||
OPI_Tools.AddField("DEST" , Visibility, "String", Parameters);
|
||||
OPI_Tools.AddField("POST_ID" , PostID , "String", Parameters);
|
||||
OPI_Tools.AddField("DEST" , Visibility, "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -427,7 +427,7 @@ Function GetTasksList(Val URL, Val Filter = "", Val Indent = 0, Val Token = "")
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "tasks.task.list");
|
||||
OPI_Tools.AddField("filter", Filter, "Collection", Parameters);
|
||||
OPI_Tools.AddField("start" , Indent, "String" , Parameters);
|
||||
OPI_Tools.AddField("start" , Indent, "String" , Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -477,7 +477,7 @@ Function UpdateTask(Val URL, Val TaskID, Val FieldsStructure, Val Token = "") Ex
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "tasks.task.update");
|
||||
OPI_Tools.AddField("fields", FieldsStructure, "Collection", Parameters);
|
||||
OPI_Tools.AddField("taskId", TaskID , "String" , Parameters);
|
||||
OPI_Tools.AddField("taskId", TaskID , "String" , Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -523,7 +523,7 @@ Function AttachFileToTopic(Val URL, Val TaskID, Val FileID, Val Token = "") Expo
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "tasks.task.files.attach");
|
||||
OPI_Tools.AddField("fileId", FileID , "String", Parameters);
|
||||
OPI_Tools.AddField("taskId", TaskID, "String", Parameters);
|
||||
OPI_Tools.AddField("taskId", TaskID , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -729,7 +729,7 @@ Function DelegateTask(Val URL, Val TaskID, Val UserID, Val Token = "") Export
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "tasks.task.delegate");
|
||||
OPI_Tools.AddField("taskId", TaskID , "String", Parameters);
|
||||
OPI_Tools.AddField("userId", UserID, "String", Parameters);
|
||||
OPI_Tools.AddField("userId", UserID , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -815,7 +815,7 @@ Function CheckTaskAccesses(Val URL, Val TaskID, Val Users = "", Val Token = "")
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "tasks.task.getaccess");
|
||||
OPI_Tools.AddField("taskId", TaskID , "String" , Parameters);
|
||||
OPI_Tools.AddField("users" , Users, "Array", Parameters);
|
||||
OPI_Tools.AddField("users" , Users , "Array" , Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -885,9 +885,9 @@ Function CreateTasksDependencies(Val URL, Val FromID, Val DestinationID, Val Lin
|
||||
OPI_TypeConversion.GetLine(LinkType);
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "task.dependence.add");
|
||||
OPI_Tools.AddField("taskIdFrom", FromID, String_, Parameters);
|
||||
OPI_Tools.AddField("taskIdTo" , DestinationID, String_, Parameters);
|
||||
OPI_Tools.AddField("linkType" , LinkType , String_, Parameters);
|
||||
OPI_Tools.AddField("taskIdFrom", FromID , String_, Parameters);
|
||||
OPI_Tools.AddField("taskIdTo" , DestinationID, String_, Parameters);
|
||||
OPI_Tools.AddField("linkType" , LinkType , String_, Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -917,9 +917,9 @@ Function DeleteTasksDependencies(Val URL, Val FromID, Val DestinationID, Val Lin
|
||||
OPI_TypeConversion.GetLine(LinkType);
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "task.dependence.delete");
|
||||
OPI_Tools.AddField("taskIdFrom", FromID, String_, Parameters);
|
||||
OPI_Tools.AddField("taskIdTo" , DestinationID, String_, Parameters);
|
||||
OPI_Tools.AddField("linkType" , LinkType , String_, Parameters);
|
||||
OPI_Tools.AddField("taskIdFrom", FromID , String_, Parameters);
|
||||
OPI_Tools.AddField("taskIdTo" , DestinationID, String_, Parameters);
|
||||
OPI_Tools.AddField("linkType" , LinkType , String_, Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -964,7 +964,7 @@ EndFunction
|
||||
Function GetTaskFieldsStructure(Val URL, Val Token = "") Export
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "tasks.task.getFields");
|
||||
Response = OPI_Tools.Get(URL, Parameters);
|
||||
Response = OPI_Tools.Get(URL, Parameters);
|
||||
|
||||
Return Response;
|
||||
|
||||
@@ -986,31 +986,31 @@ Function GetTasksFilterStructure(Val Clear = False) Export
|
||||
OPI_TypeConversion.GetBoolean(Clear);
|
||||
|
||||
FilterStructure = New Structure;
|
||||
FilterStructure.Insert("ID" , "<task identifier>");
|
||||
FilterStructure.Insert("PARENT_ID" , "<parent task identifier>");
|
||||
FilterStructure.Insert("GROUP_ID" , "<workgroup identifier>");
|
||||
FilterStructure.Insert("CREATED_BY" , "<producer>");
|
||||
FilterStructure.Insert("ID" , "<task identifier>");
|
||||
FilterStructure.Insert("PARENT_ID" , "<parent task identifier>");
|
||||
FilterStructure.Insert("GROUP_ID" , "<workgroup identifier>");
|
||||
FilterStructure.Insert("CREATED_BY" , "<producer>");
|
||||
FilterStructure.Insert("STATUS_CHANGED_BY", "<the user who last changed the task status>");
|
||||
FilterStructure.Insert("PRIORITY" , "<priority>");
|
||||
FilterStructure.Insert("FORUM_TOPIC_ID" , "<forum topic identifier>");
|
||||
FilterStructure.Insert("RESPONSIBLE_ID" , "<performer>");
|
||||
FilterStructure.Insert("TITLE" , "<task name (can be searched using the template [%_])>");
|
||||
FilterStructure.Insert("TAG" , "<tag>");
|
||||
FilterStructure.Insert("REAL_STATUS" , "<task status>");
|
||||
FilterStructure.Insert("MARK" , "<mark>");
|
||||
FilterStructure.Insert("SITE_ID" , "<site identifier>");
|
||||
FilterStructure.Insert("ADD_IN_REPORT" , "<task in the report (Y|N)>");
|
||||
FilterStructure.Insert("DATE_START" , "<start date>");
|
||||
FilterStructure.Insert("DEADLINE" , "<deadline>");
|
||||
FilterStructure.Insert("CREATED_DATE" , "<date of creation>");
|
||||
FilterStructure.Insert("CLOSED_DATE" , "<completion date>");
|
||||
FilterStructure.Insert("CHANGED_DATE" , "<date of last modification>");
|
||||
FilterStructure.Insert("ACCOMPLICE" , "<co-executor identifier>");
|
||||
FilterStructure.Insert("AUDITOR" , "<auditor identifier>");
|
||||
FilterStructure.Insert("DEPENDS_ON" , "<previous task identifier>");
|
||||
FilterStructure.Insert("ONLY_ROOT_TASKS" , "<only tasks that are not subtasks (Y|N)>");
|
||||
FilterStructure.Insert("STAGE_ID" , "<stage>");
|
||||
FilterStructure.Insert("UF_CRM_TASK" , "<CRM elements>");
|
||||
FilterStructure.Insert("PRIORITY" , "<priority>");
|
||||
FilterStructure.Insert("FORUM_TOPIC_ID" , "<forum topic identifier>");
|
||||
FilterStructure.Insert("RESPONSIBLE_ID" , "<performer>");
|
||||
FilterStructure.Insert("TITLE" , "<task name (can be searched using the template [%_])>");
|
||||
FilterStructure.Insert("TAG" , "<tag>");
|
||||
FilterStructure.Insert("REAL_STATUS" , "<task status>");
|
||||
FilterStructure.Insert("MARK" , "<mark>");
|
||||
FilterStructure.Insert("SITE_ID" , "<site identifier>");
|
||||
FilterStructure.Insert("ADD_IN_REPORT" , "<task in the report (Y|N)>");
|
||||
FilterStructure.Insert("DATE_START" , "<start date>");
|
||||
FilterStructure.Insert("DEADLINE" , "<deadline>");
|
||||
FilterStructure.Insert("CREATED_DATE" , "<date of creation>");
|
||||
FilterStructure.Insert("CLOSED_DATE" , "<completion date>");
|
||||
FilterStructure.Insert("CHANGED_DATE" , "<date of last modification>");
|
||||
FilterStructure.Insert("ACCOMPLICE" , "<co-executor identifier>");
|
||||
FilterStructure.Insert("AUDITOR" , "<auditor identifier>");
|
||||
FilterStructure.Insert("DEPENDS_ON" , "<previous task identifier>");
|
||||
FilterStructure.Insert("ONLY_ROOT_TASKS" , "<only tasks that are not subtasks (Y|N)>");
|
||||
FilterStructure.Insert("STAGE_ID" , "<stage>");
|
||||
FilterStructure.Insert("UF_CRM_TASK" , "<CRM elements>");
|
||||
FilterStructure.Insert("STATUS"
|
||||
, "<status for sorting. Similar to REAL_STATUS, but has three additional meta-statuses>");
|
||||
|
||||
@@ -1049,14 +1049,14 @@ Function AddTasksChecklistElement(Val URL, Val TaskID, Val Text, Val Completed =
|
||||
String_ = "String";
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "task.checklistitem.add");
|
||||
Fields = New Structure;
|
||||
Fields = New Structure;
|
||||
|
||||
MakeBoolean(Completed);
|
||||
|
||||
OPI_Tools.AddField("TITLE" , Text , String_, Fields);
|
||||
OPI_Tools.AddField("TITLE" , Text , String_, Fields);
|
||||
OPI_Tools.AddField("IS_COMPLETE", Completed, String_, Fields);
|
||||
|
||||
OPI_Tools.AddField("TASKID", TaskID, String_ , Parameters);
|
||||
OPI_Tools.AddField("TASKID", TaskID , String_ , Parameters);
|
||||
OPI_Tools.AddField("FIELDS", Fields , "Collection", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
@@ -1085,13 +1085,13 @@ Function UpdateTasksChecklistElement(Val URL, Val TaskID, Val ElementID, Val Tex
|
||||
String_ = "String";
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "task.checklistitem.update");
|
||||
Fields = New Structure;
|
||||
Fields = New Structure;
|
||||
|
||||
OPI_Tools.AddField("TITLE", Text, String_, Fields);
|
||||
|
||||
OPI_Tools.AddField("TASKID", TaskID , String_ , Parameters);
|
||||
OPI_Tools.AddField("ITEMID", ElementID, String_ , Parameters);
|
||||
OPI_Tools.AddField("FIELDS", Fields , "Collection", Parameters);
|
||||
OPI_Tools.AddField("TASKID", TaskID , String_ , Parameters);
|
||||
OPI_Tools.AddField("ITEMID", ElementID, String_ , Parameters);
|
||||
OPI_Tools.AddField("FIELDS", Fields , "Collection", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -1253,7 +1253,7 @@ EndFunction
|
||||
Function GetTaskComment(Val URL, Val TaskID, Val CommentID, Val Token = "") Export
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "task.commentitem.get");
|
||||
OPI_Tools.AddField("TASKID", TaskID , "String", Parameters);
|
||||
OPI_Tools.AddField("TASKID", TaskID , "String", Parameters);
|
||||
OPI_Tools.AddField("ITEMID", CommentID, "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
@@ -1283,7 +1283,7 @@ Function AddTaskComment(Val URL, Val TaskID, Val Text, Val Token = "") Export
|
||||
Comment = New Structure;
|
||||
OPI_Tools.AddField("POST_MESSAGE", Text, "String", Comment);
|
||||
|
||||
OPI_Tools.AddField("TASKID", TaskID , "String" , Parameters);
|
||||
OPI_Tools.AddField("TASKID", TaskID , "String" , Parameters);
|
||||
OPI_Tools.AddField("FIELDS", Comment, "Collection", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
@@ -1316,9 +1316,9 @@ Function UpdateTaskComment(Val URL, Val TaskID, Val CommentID, Val Text, Val Tok
|
||||
Comment = New Structure;
|
||||
OPI_Tools.AddField("POST_MESSAGE", Text, "String", Comment);
|
||||
|
||||
OPI_Tools.AddField("TASKID", TaskID , String_ , Parameters);
|
||||
OPI_Tools.AddField("ITEMID", CommentID, String_ , Parameters);
|
||||
OPI_Tools.AddField("FIELDS", Comment , "Collection", Parameters);
|
||||
OPI_Tools.AddField("TASKID", TaskID , String_ , Parameters);
|
||||
OPI_Tools.AddField("ITEMID", CommentID, String_ , Parameters);
|
||||
OPI_Tools.AddField("FIELDS", Comment , "Collection", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -1343,7 +1343,7 @@ EndFunction
|
||||
Function DeleteTaskComment(Val URL, Val TaskID, Val CommentID, Val Token = "") Export
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "task.commentitem.delete");
|
||||
OPI_Tools.AddField("TASKID", TaskID , "String", Parameters);
|
||||
OPI_Tools.AddField("TASKID", TaskID , "String", Parameters);
|
||||
OPI_Tools.AddField("ITEMID", CommentID, "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
@@ -1436,11 +1436,11 @@ Function GetCommentStructure(Val Clear = False) Export
|
||||
OPI_TypeConversion.GetBoolean(Clear);
|
||||
|
||||
FieldsStructure = New Structure;
|
||||
FieldsStructure.Insert("AUTHOR_ID" , "<comment author identifier>");
|
||||
FieldsStructure.Insert("AUTHOR_NAME" , "<Name of user (optional)>");
|
||||
FieldsStructure.Insert("AUTHOR_EMAIL" , "<E-mail of user (optional)>");
|
||||
FieldsStructure.Insert("USE_SMILES" , "<(Y|N) - parse comments for emoticons or not>");
|
||||
FieldsStructure.Insert("POST_MESSAGE" , "<Message text>");
|
||||
FieldsStructure.Insert("AUTHOR_ID" , "<comment author identifier>");
|
||||
FieldsStructure.Insert("AUTHOR_NAME" , "<Name of user (optional)>");
|
||||
FieldsStructure.Insert("AUTHOR_EMAIL" , "<E-mail of user (optional)>");
|
||||
FieldsStructure.Insert("USE_SMILES" , "<(Y|N) - parse comments for emoticons or not>");
|
||||
FieldsStructure.Insert("POST_MESSAGE" , "<Message text>");
|
||||
FieldsStructure.Insert("UF_FORUM_MESSAGE_DOC" , "<Files array with of drive for of attachments>");
|
||||
|
||||
If Clear Then
|
||||
@@ -1486,15 +1486,15 @@ Function AddKanbanStage(Val URL
|
||||
String_ = "String";
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "task.stages.add");
|
||||
Fields = New Structure;
|
||||
Fields = New Structure;
|
||||
|
||||
MakeBoolean(AsAdmin);
|
||||
|
||||
OPI_Tools.AddField("TITLE" , Name , String_, Fields);
|
||||
OPI_Tools.AddField("COLOR" , Color , String_, Fields);
|
||||
OPI_Tools.AddField("TITLE" , Name , String_, Fields);
|
||||
OPI_Tools.AddField("COLOR" , Color , String_, Fields);
|
||||
OPI_Tools.AddField("AFTER_ID" , PrevStageID , String_, Fields);
|
||||
OPI_Tools.AddField("ENTITY_ID", EntityID , String_, Fields);
|
||||
OPI_Tools.AddField("isAdmin" , AsAdmin, String_, Fields);
|
||||
OPI_Tools.AddField("ENTITY_ID", EntityID , String_, Fields);
|
||||
OPI_Tools.AddField("isAdmin" , AsAdmin , String_, Fields);
|
||||
|
||||
Parameters.Insert("fields", Fields);
|
||||
|
||||
@@ -1532,14 +1532,14 @@ Function UpdateKanbansStage(Val URL
|
||||
String_ = "String";
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "task.stages.update");
|
||||
Fields = New Structure;
|
||||
Fields = New Structure;
|
||||
|
||||
OPI_Tools.AddField("TITLE" , Name , String_, Fields);
|
||||
OPI_Tools.AddField("COLOR" , Color , String_, Fields);
|
||||
OPI_Tools.AddField("AFTER_ID" , PrevStageID , String_, Fields);
|
||||
OPI_Tools.AddField("isAdmin" , AsAdmin, "Boolean", Fields);
|
||||
OPI_Tools.AddField("TITLE" , Name , String_ , Fields);
|
||||
OPI_Tools.AddField("COLOR" , Color , String_ , Fields);
|
||||
OPI_Tools.AddField("AFTER_ID" , PrevStageID , String_ , Fields);
|
||||
OPI_Tools.AddField("isAdmin" , AsAdmin , "Boolean", Fields);
|
||||
|
||||
OPI_Tools.AddField("id" , StageID, String_ , Parameters);
|
||||
OPI_Tools.AddField("id" , StageID, String_ , Parameters);
|
||||
OPI_Tools.AddField("fields", Fields , "Collection", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
@@ -1568,8 +1568,8 @@ Function DeleteKanbanStage(Val URL, Val StageID, Val AsAdmin = False, Val Token
|
||||
|
||||
MakeBoolean(AsAdmin);
|
||||
|
||||
OPI_Tools.AddField("id" , StageID , "String", Parameters);
|
||||
OPI_Tools.AddField("isAdmin", AsAdmin, "String", Parameters);
|
||||
OPI_Tools.AddField("id" , StageID , "String", Parameters);
|
||||
OPI_Tools.AddField("isAdmin", AsAdmin , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -1593,13 +1593,13 @@ EndFunction
|
||||
// Map Of KeyAndValue - serialized JSON of answer from Bitrix24 API
|
||||
Function GetKanbanStages(Val URL, Val EntityID = 0, Val AsAdmin = False, Val Token = "") Export
|
||||
|
||||
EntityID = OPI_Tools.NumberToString(EntityID);
|
||||
EntityID = OPI_Tools.NumberToString(EntityID);
|
||||
Parameters = NormalizeAuth(URL, Token, "task.stages.get");
|
||||
|
||||
MakeBoolean(AsAdmin);
|
||||
|
||||
OPI_Tools.AddField("entityId", EntityID , "String", Parameters);
|
||||
OPI_Tools.AddField("isAdmin" , AsAdmin, "String", Parameters);
|
||||
OPI_Tools.AddField("isAdmin" , AsAdmin , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -1634,7 +1634,7 @@ Function MoveTaskToKanbanStage(Val URL
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "task.stages.movetask");
|
||||
|
||||
OPI_Tools.AddField("id" , TaskID, String_, Parameters);
|
||||
OPI_Tools.AddField("id" , TaskID , String_, Parameters);
|
||||
OPI_Tools.AddField("stageId", StageID, String_, Parameters);
|
||||
|
||||
If ValueIsFilled(Prev) Then
|
||||
@@ -1686,14 +1686,14 @@ Function AddTaskTimeAccounting(Val URL
|
||||
String_ = "String";
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "task.elapseditem.add");
|
||||
Fields = New Structure;
|
||||
Fields = New Structure;
|
||||
|
||||
OPI_Tools.AddField("SECONDS" , Time , String_ , Fields);
|
||||
OPI_Tools.AddField("COMMENT_TEXT", Text , String_ , Fields);
|
||||
OPI_Tools.AddField("USER_ID" , UserID, String_ , Fields);
|
||||
OPI_Tools.AddField("SECONDS" , Time , String_ , Fields);
|
||||
OPI_Tools.AddField("COMMENT_TEXT", Text , String_ , Fields);
|
||||
OPI_Tools.AddField("USER_ID" , UserID , String_ , Fields);
|
||||
OPI_Tools.AddField("CREATED_DATE", SetupDate , "DateISO", Fields);
|
||||
|
||||
OPI_Tools.AddField("TASKID" , TaskID, String_ , Parameters);
|
||||
OPI_Tools.AddField("TASKID" , TaskID , String_ , Parameters);
|
||||
OPI_Tools.AddField("ARFIELDS", Fields , "Collection", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
@@ -1720,7 +1720,7 @@ Function DeleteTaskTimeAccounting(Val URL, Val TaskID, Val RecordID, Val Token =
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "task.elapseditem.delete");
|
||||
|
||||
OPI_Tools.AddField("TASKID", TaskID, "String", Parameters);
|
||||
OPI_Tools.AddField("TASKID", TaskID , "String", Parameters);
|
||||
OPI_Tools.AddField("ITEMID", RecordID, "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
@@ -1772,7 +1772,7 @@ Function GetTaskTimeAccounting(Val URL, Val TaskID, Val RecordID, Val Token = ""
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "task.elapseditem.get");
|
||||
|
||||
OPI_Tools.AddField("TASKID", TaskID, "String", Parameters);
|
||||
OPI_Tools.AddField("TASKID", TaskID , "String", Parameters);
|
||||
OPI_Tools.AddField("ITEMID", RecordID, "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
@@ -1809,15 +1809,15 @@ Function UpdateTaskTimeAccounting(Val URL
|
||||
String_ = "String";
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "task.elapseditem.update");
|
||||
Fields = New Structure;
|
||||
Fields = New Structure;
|
||||
|
||||
OPI_Tools.AddField("SECONDS" , Time , String_ , Fields);
|
||||
OPI_Tools.AddField("COMMENT_TEXT", Text , String_ , Fields);
|
||||
OPI_Tools.AddField("SECONDS" , Time , String_ , Fields);
|
||||
OPI_Tools.AddField("COMMENT_TEXT", Text , String_ , Fields);
|
||||
OPI_Tools.AddField("CREATED_DATE", SetupDate , "DateISO", Fields);
|
||||
|
||||
OPI_Tools.AddField("TASKID" , TaskID, String_ , Parameters);
|
||||
OPI_Tools.AddField("ITEMID" , RecordID, String_ , Parameters);
|
||||
OPI_Tools.AddField("ARFIELDS", Fields , "Collection", Parameters);
|
||||
OPI_Tools.AddField("TASKID" , TaskID , String_ , Parameters);
|
||||
OPI_Tools.AddField("ITEMID" , RecordID, String_ , Parameters);
|
||||
OPI_Tools.AddField("ARFIELDS", Fields , "Collection", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -1844,7 +1844,7 @@ EndFunction
|
||||
Function GetStoragesList(Val URL, Val Token = "") Export
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "disk.storage.getlist");
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
Return Response;
|
||||
|
||||
@@ -1864,7 +1864,7 @@ EndFunction
|
||||
// Map Of KeyAndValue - serialized JSON of answer from Bitrix24 API
|
||||
Function GetAppSotrage(Val URL, Val Token = "") Export
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "disk.storage.getforapp");
|
||||
Parameters = NormalizeAuth(URL, Token, "disk.storage.getforapp");
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
Return Response;
|
||||
@@ -1909,8 +1909,8 @@ Function RenameStorage(Val URL, Val StorageID, Val Name, Val Token = "") Export
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "disk.storage.rename");
|
||||
|
||||
OPI_Tools.AddField("id" , StorageID , "String", Parameters);
|
||||
OPI_Tools.AddField("newName", Name, "String", Parameters);
|
||||
OPI_Tools.AddField("id" , StorageID , "String", Parameters);
|
||||
OPI_Tools.AddField("newName", Name , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -1960,7 +1960,7 @@ Function CreateStorageFolder(Val URL, Val StorageID, Val Name, Val Token = "") E
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "disk.storage.addfolder");
|
||||
|
||||
OPI_Tools.AddField("id" , StorageID , "String" , Parameters);
|
||||
OPI_Tools.AddField("id" , StorageID , "String" , Parameters);
|
||||
OPI_Tools.AddField("data", FolderStructure, "Collection", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
@@ -2015,7 +2015,7 @@ Function CreateSubfolder(Val URL, Val FolderID, Val Name, Val Token = "") Export
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "disk.folder.addsubfolder");
|
||||
|
||||
OPI_Tools.AddField("id" , FolderID , "String" , Parameters);
|
||||
OPI_Tools.AddField("id" , FolderID , "String" , Parameters);
|
||||
OPI_Tools.AddField("data", FolderStructure, "Collection", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
@@ -2042,7 +2042,7 @@ Function MakeFolderCopy(Val URL, Val FolderID, Val DestinationID, Val Token = ""
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "disk.folder.copyto");
|
||||
|
||||
OPI_Tools.AddField("id" , FolderID , "String", Parameters);
|
||||
OPI_Tools.AddField("id" , FolderID , "String", Parameters);
|
||||
OPI_Tools.AddField("targetFolderId", DestinationID, "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
@@ -2069,7 +2069,7 @@ Function MoveFolder(Val URL, Val FolderID, Val DestinationID, Val Token = "") Ex
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "disk.folder.moveto");
|
||||
|
||||
OPI_Tools.AddField("id" , FolderID , "String", Parameters);
|
||||
OPI_Tools.AddField("id" , FolderID , "String", Parameters);
|
||||
OPI_Tools.AddField("targetFolderId", DestinationID, "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
@@ -2135,8 +2135,8 @@ EndFunction
|
||||
Function GetFolderItems(Val URL, Val FolderID, Val Filter = "", Val Token = "") Export
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "disk.folder.getchildren");
|
||||
OPI_Tools.AddField("id" , FolderID, "String" , Parameters);
|
||||
OPI_Tools.AddField("filter", Filter , "Collection", Parameters);
|
||||
OPI_Tools.AddField("id" , FolderID, "String" , Parameters);
|
||||
OPI_Tools.AddField("filter", Filter , "Collection", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -2202,8 +2202,8 @@ Function RenameFolder(Val URL, Val FolderID, Val Name, Val Token = "") Export
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "disk.folder.rename");
|
||||
|
||||
OPI_Tools.AddField("id" , FolderID , "String", Parameters);
|
||||
OPI_Tools.AddField("newName", Name, "String", Parameters);
|
||||
OPI_Tools.AddField("id" , FolderID , "String", Parameters);
|
||||
OPI_Tools.AddField("newName", Name , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -2227,14 +2227,14 @@ EndFunction
|
||||
Function GetFolderFilterStructure(Val URL, Val Clear = False, Val Token = "") Export
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "disk.folder.getfields");
|
||||
Filter = New Structure;
|
||||
Filter = New Structure;
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
Fields = Response["result"];
|
||||
Fields = Response["result"];
|
||||
|
||||
For Each Field In Fields Do
|
||||
|
||||
Name = Field.Key;
|
||||
Name = Field.Key;
|
||||
Description = Field.Value;
|
||||
|
||||
If Description["USE_IN_FILTER"] Then
|
||||
@@ -2282,14 +2282,14 @@ Function UploadFileToStorage(Val URL
|
||||
|
||||
Method = "disk.storage.uploadfile";
|
||||
|
||||
FileData = New Structure("NAME", Name);
|
||||
FileData = New Structure("NAME", Name);
|
||||
FileContent = New Map();
|
||||
FileContent.Insert(Name, File);
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, Method);
|
||||
OPI_Tools.AddField("data" , FileData, "Collection", Parameters);
|
||||
OPI_Tools.AddField("rights", Rights , "Array" , Parameters);
|
||||
OPI_Tools.AddField("id" , StorageID, "String" , Parameters);
|
||||
OPI_Tools.AddField("data" , FileData , "Collection", Parameters);
|
||||
OPI_Tools.AddField("rights", Rights , "Array" , Parameters);
|
||||
OPI_Tools.AddField("id" , StorageID, "String" , Parameters);
|
||||
|
||||
FileArray = NormalizeFiles(FileContent);
|
||||
|
||||
@@ -2327,7 +2327,7 @@ Function UploadFileToFolder(Val URL, Val Name, Val File, Val FolderID, Val Token
|
||||
OPI_Tools.AddField("id", FolderID, "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Get(URL, Parameters);
|
||||
Result = Response["result"];
|
||||
Result = Response["result"];
|
||||
|
||||
If ValueIsFilled(Result) Then
|
||||
|
||||
@@ -2338,7 +2338,7 @@ Function UploadFileToFolder(Val URL, Val Name, Val File, Val FolderID, Val Token
|
||||
|
||||
FieldName = TrimAll(FieldName);
|
||||
UploadURL = TrimAll(UploadURL);
|
||||
FileName = FieldName + "|" + Name;
|
||||
FileName = FieldName + "|" + Name;
|
||||
|
||||
FileMapping = New Map;
|
||||
FileMapping.Insert(FileName, File);
|
||||
@@ -2471,7 +2471,7 @@ Function MakeCopyFile(Val URL, Val FileID, Val FolderID, Val Token = "") Export
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "disk.file.copyto");
|
||||
|
||||
OPI_Tools.AddField("id" , FileID , "String", Parameters);
|
||||
OPI_Tools.AddField("id" , FileID , "String", Parameters);
|
||||
OPI_Tools.AddField("targetFolderId", FolderID, "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
@@ -2498,7 +2498,7 @@ Function MoveFileToFolder(Val URL, Val FileID, Val FolderID, Val Token = "") Exp
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "disk.file.moveto");
|
||||
|
||||
OPI_Tools.AddField("id" , FileID , "String", Parameters);
|
||||
OPI_Tools.AddField("id" , FileID , "String", Parameters);
|
||||
OPI_Tools.AddField("targetFolderId", FolderID, "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
@@ -2525,8 +2525,8 @@ Function RenameFile(Val URL, Val FileID, Val Name, Val Token = "") Export
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "disk.file.rename");
|
||||
|
||||
OPI_Tools.AddField("id" , FileID , "String", Parameters);
|
||||
OPI_Tools.AddField("newName", Name, "String", Parameters);
|
||||
OPI_Tools.AddField("id" , FileID , "String", Parameters);
|
||||
OPI_Tools.AddField("newName", Name , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -2655,9 +2655,9 @@ Function AddUsersToChat(Val URL
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "im.chat.user.add");
|
||||
|
||||
OPI_Tools.AddField("CHAT_ID" , ChatID , "String" , Parameters);
|
||||
OPI_Tools.AddField("USERS" , UserIDs, "Collection", Parameters);
|
||||
OPI_Tools.AddField("HIDE_HISTORY", HideHistory , "String" , Parameters);
|
||||
OPI_Tools.AddField("CHAT_ID" , ChatID , "String" , Parameters);
|
||||
OPI_Tools.AddField("USERS" , UserIDs , "Collection", Parameters);
|
||||
OPI_Tools.AddField("HIDE_HISTORY", HideHistory , "String" , Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -2684,7 +2684,7 @@ Function DeleteUserFromChat(Val URL, Val ChatID, Val UserID, Val Token = "") Exp
|
||||
Parameters = NormalizeAuth(URL, Token, "im.chat.user.delete");
|
||||
|
||||
OPI_Tools.AddField("CHAT_ID", ChatID , "String", Parameters);
|
||||
OPI_Tools.AddField("USER_ID", UserID, "String", Parameters);
|
||||
OPI_Tools.AddField("USER_ID", UserID , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -2711,7 +2711,7 @@ Function ChangeChatTitle(Val URL, Val ChatID, Val Title, Val Token = "") Export
|
||||
Parameters = NormalizeAuth(URL, Token, "im.chat.updateTitle");
|
||||
|
||||
OPI_Tools.AddField("CHAT_ID", ChatID , "String", Parameters);
|
||||
OPI_Tools.AddField("TITLE" , Title, "String", Parameters);
|
||||
OPI_Tools.AddField("TITLE" , Title , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -2739,7 +2739,7 @@ Function ChangeChatColor(Val URL, Val ChatID, Val Color, Val Token = "") Export
|
||||
Parameters = NormalizeAuth(URL, Token, "im.chat.updateColor");
|
||||
|
||||
OPI_Tools.AddField("CHAT_ID", ChatID, "String", Parameters);
|
||||
OPI_Tools.AddField("COLOR" , Color , "String", Parameters);
|
||||
OPI_Tools.AddField("COLOR" , Color , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -2765,11 +2765,11 @@ Function ChangeChatPicture(Val URL, Val ChatID, Val Image, Val Token = "") Expor
|
||||
|
||||
OPI_TypeConversion.GetBinaryData(Image);
|
||||
|
||||
Image = Base64String(Image);
|
||||
Image = Base64String(Image);
|
||||
Parameters = NormalizeAuth(URL, Token, "im.chat.updateAvatar");
|
||||
|
||||
OPI_Tools.AddField("CHAT_ID", ChatID , "String", Parameters);
|
||||
OPI_Tools.AddField("AVATAR" , Image, "String", Parameters);
|
||||
OPI_Tools.AddField("AVATAR" , Image , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -2796,7 +2796,7 @@ Function ChangeChatOwner(Val URL, Val ChatID, Val UserID, Val Token = "") Export
|
||||
Parameters = NormalizeAuth(URL, Token, "im.chat.setOwner");
|
||||
|
||||
OPI_Tools.AddField("CHAT_ID", ChatID , "String", Parameters);
|
||||
OPI_Tools.AddField("USER_ID", UserID, "String", Parameters);
|
||||
OPI_Tools.AddField("USER_ID", UserID , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -2872,8 +2872,8 @@ Function GetChatMessagesList(Val URL
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "im.dialog.messages.get");
|
||||
|
||||
OPI_Tools.AddField("DIALOG_ID", ChatID , String_, Parameters);
|
||||
OPI_Tools.AddField("LAST_ID" , LastID, String_, Parameters);
|
||||
OPI_Tools.AddField("DIALOG_ID", ChatID , String_, Parameters);
|
||||
OPI_Tools.AddField("LAST_ID" , LastID , String_, Parameters);
|
||||
OPI_Tools.AddField("FIRST_ID" , FirstID , String_, Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
@@ -3019,7 +3019,7 @@ EndFunction
|
||||
Function ReadAll(Val URL, Val Token = "") Export
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "im.dialog.read.all");
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
Return Response;
|
||||
|
||||
@@ -3058,14 +3058,14 @@ Function GetChatStructure(Val Clear = False) Export
|
||||
OPI_TypeConversion.GetBoolean(Clear);
|
||||
|
||||
ChatStructure = New Structure;
|
||||
ChatStructure.Insert("TYPE" , "<Chat type OPEN (Public) | CHAT (Private)>");
|
||||
ChatStructure.Insert("TITLE" , "<Chat title>");
|
||||
ChatStructure.Insert("TYPE" , "<Chat type OPEN (Public) | CHAT (Private)>");
|
||||
ChatStructure.Insert("TITLE" , "<Chat title>");
|
||||
ChatStructure.Insert("DESCRIPTION", "<Chat description>");
|
||||
ChatStructure.Insert("COLOR" , "<Chat color: RED, GREEN, MINT, LIGHT_BLUE, DARK_BLUE, PURPLE, AQUA, ...>");
|
||||
ChatStructure.Insert("MESSAGE" , "<First chat message>");
|
||||
ChatStructure.Insert("USERS" , "<Chat members array>");
|
||||
ChatStructure.Insert("AVATAR" , "<Base64 chat picture>");
|
||||
ChatStructure.Insert("OWNER_ID" , "<ID of chat owner. Current user by default>");
|
||||
ChatStructure.Insert("COLOR" , "<Chat color: RED, GREEN, MINT, LIGHT_BLUE, DARK_BLUE, PURPLE, AQUA, ...>");
|
||||
ChatStructure.Insert("MESSAGE" , "<First chat message>");
|
||||
ChatStructure.Insert("USERS" , "<Chat members array>");
|
||||
ChatStructure.Insert("AVATAR" , "<Base64 chat picture>");
|
||||
ChatStructure.Insert("OWNER_ID" , "<ID of chat owner. Current user by default>");
|
||||
|
||||
If Clear Then
|
||||
For Each Element In ChatStructure Do
|
||||
@@ -3101,9 +3101,9 @@ Function SendMessage(Val URL, Val ChatID, Val Text, Val Attachments = "", Val To
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "im.message.add");
|
||||
|
||||
OPI_Tools.AddField("DIALOG_ID", ChatID , "String", Parameters);
|
||||
OPI_Tools.AddField("MESSAGE" , Text , "String", Parameters);
|
||||
OPI_Tools.AddField("ATTACH" , Attachments, "Array", Parameters);
|
||||
OPI_Tools.AddField("DIALOG_ID", ChatID , "String", Parameters);
|
||||
OPI_Tools.AddField("MESSAGE" , Text , "String", Parameters);
|
||||
OPI_Tools.AddField("ATTACH" , Attachments, "Array" , Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -3130,9 +3130,9 @@ Function EditMessage(Val URL, Val MessageID, Val Text = "", Val Attachments = ""
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "im.message.update");
|
||||
|
||||
OPI_Tools.AddField("MESSAGE_ID", MessageID, "String", Parameters);
|
||||
OPI_Tools.AddField("MESSAGE" , Text , "String", Parameters);
|
||||
OPI_Tools.AddField("ATTACH" , Attachments , "Array", Parameters);
|
||||
OPI_Tools.AddField("MESSAGE_ID", MessageID , "String", Parameters);
|
||||
OPI_Tools.AddField("MESSAGE" , Text , "String", Parameters);
|
||||
OPI_Tools.AddField("ATTACH" , Attachments , "Array" , Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -3211,9 +3211,9 @@ Function SendFile(Val URL, Val ChatID, Val FileID, Val Description = "", Val Tok
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "im.disk.file.commit");
|
||||
|
||||
OPI_Tools.AddField("CHAT_ID" , ChatID , String_, Parameters);
|
||||
OPI_Tools.AddField("UPLOAD_ID", FileID , String_, Parameters);
|
||||
OPI_Tools.AddField("MESSAGE" , Description, String_, Parameters);
|
||||
OPI_Tools.AddField("CHAT_ID" , ChatID , String_, Parameters);
|
||||
OPI_Tools.AddField("UPLOAD_ID", FileID , String_, Parameters);
|
||||
OPI_Tools.AddField("MESSAGE" , Description, String_, Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -3239,7 +3239,7 @@ Function MarkMessageAsReaded(Val URL, Val ChatID, Val MessageID, Val Token = "")
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "im.dialog.read");
|
||||
|
||||
OPI_Tools.AddField("DIALOG_ID" , ChatID , "String", Parameters);
|
||||
OPI_Tools.AddField("DIALOG_ID" , ChatID , "String", Parameters);
|
||||
OPI_Tools.AddField("MESSAGE_ID", MessageID, "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
@@ -3266,7 +3266,7 @@ Function MarkMessageAsUnreaded(Val URL, Val ChatID, Val MessageID, Val Token = "
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "im.dialog.unread");
|
||||
|
||||
OPI_Tools.AddField("DIALOG_ID" , ChatID , "String", Parameters);
|
||||
OPI_Tools.AddField("DIALOG_ID" , ChatID , "String", Parameters);
|
||||
OPI_Tools.AddField("MESSAGE_ID", MessageID, "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
@@ -3350,10 +3350,10 @@ Function CreatePersonalNotification(Val URL
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "im.notify.personal.add");
|
||||
|
||||
OPI_Tools.AddField("USER_ID", UserID, "String", Parameters);
|
||||
OPI_Tools.AddField("MESSAGE", Text , "String", Parameters);
|
||||
OPI_Tools.AddField("TAG" , Tag , "String", Parameters);
|
||||
OPI_Tools.AddField("ATTACH" , Attachments , "Array", Parameters);
|
||||
OPI_Tools.AddField("USER_ID", UserID , "String", Parameters);
|
||||
OPI_Tools.AddField("MESSAGE", Text , "String", Parameters);
|
||||
OPI_Tools.AddField("TAG" , Tag , "String", Parameters);
|
||||
OPI_Tools.AddField("ATTACH" , Attachments , "Array" , Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -3386,10 +3386,10 @@ Function CreateSystemNotification(Val URL
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "im.notify.system.add");
|
||||
|
||||
OPI_Tools.AddField("USER_ID", UserID, "String", Parameters);
|
||||
OPI_Tools.AddField("MESSAGE", Text , "String", Parameters);
|
||||
OPI_Tools.AddField("TAG" , Tag , "String", Parameters);
|
||||
OPI_Tools.AddField("ATTACH" , Attachments , "Array", Parameters);
|
||||
OPI_Tools.AddField("USER_ID", UserID , "String", Parameters);
|
||||
OPI_Tools.AddField("MESSAGE", Text , "String", Parameters);
|
||||
OPI_Tools.AddField("TAG" , Tag , "String", Parameters);
|
||||
OPI_Tools.AddField("ATTACH" , Attachments , "Array" , Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -3440,7 +3440,7 @@ Function NormalizeAuth(URL, Val Token, Val Method = "")
|
||||
OPI_TypeConversion.GetLine(URL);
|
||||
OPI_TypeConversion.GetLine(Token);
|
||||
|
||||
Parameters = New Structure;
|
||||
Parameters = New Structure;
|
||||
IsTokenAuth = ValueIsFilled(Token);
|
||||
|
||||
UncorrectItems = New Array;
|
||||
@@ -3485,8 +3485,8 @@ Function NormalizeFiles(Val Files)
|
||||
For Each File In Files Do
|
||||
|
||||
CurrentArray = New Array;
|
||||
CurrentFile = File.Value;
|
||||
CurrentName = File.Key;
|
||||
CurrentFile = File.Value;
|
||||
CurrentName = File.Key;
|
||||
|
||||
OPI_TypeConversion.GetBinaryData(CurrentFile);
|
||||
OPI_TypeConversion.GetLine(CurrentName);
|
||||
@@ -3530,7 +3530,7 @@ Function ChecklistElementManagment(Val URL, Val TaskID, Val ElementID, Val Metho
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, Method);
|
||||
|
||||
OPI_Tools.AddField("TASKID", TaskID , "String", Parameters);
|
||||
OPI_Tools.AddField("TASKID", TaskID , "String", Parameters);
|
||||
OPI_Tools.AddField("ITEMID", ElementID, "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
@@ -3557,7 +3557,7 @@ Function ChatNotificationsSwitch(Val URL, Val ChatID, Val Off, Val Token = "")
|
||||
Parameters = NormalizeAuth(URL, Token, "im.chat.mute");
|
||||
|
||||
OPI_Tools.AddField("CHAT_ID", ChatID , "String", Parameters);
|
||||
OPI_Tools.AddField("MUTE" , Off, "String", Parameters);
|
||||
OPI_Tools.AddField("MUTE" , Off , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
|
@@ -69,22 +69,22 @@ EndFunction
|
||||
// Map Of KeyAndValue - serialized JSON response from Dropbox
|
||||
Function GetToken(Val AppKey, Val AppSecret, Val Code) Export
|
||||
|
||||
URL = "https://api.dropbox.com/oauth2/token";
|
||||
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("code" , Code , "String", Parameters);
|
||||
OPI_Tools.AddField("grant_type", "authorization_code", "String", Parameters);
|
||||
|
||||
URLStructure = OPI_Tools.SplitURL(URL);
|
||||
Server = URLStructure["Server"];
|
||||
Address = URLStructure["Address"];
|
||||
Server = URLStructure["Server"];
|
||||
Address = URLStructure["Address"];
|
||||
|
||||
Request = OPI_Tools.CreateRequest(Address, , DataType);
|
||||
Request = OPI_Tools.CreateRequest(Address, , DataType);
|
||||
Connection = OPI_Tools.CreateConnection(Server, AppKey, AppSecret);
|
||||
|
||||
ParameterString = OPI_Tools.RequestParametersToString(Parameters);
|
||||
Data = Right(ParameterString, StrLen(ParameterString) - 1);
|
||||
Data = Right(ParameterString, StrLen(ParameterString) - 1);
|
||||
|
||||
Request.SetBodyFromString(Data);
|
||||
|
||||
@@ -108,13 +108,13 @@ EndFunction
|
||||
Function RefreshToken(Val AppKey, Val AppSecret, Val RefreshToken) Export
|
||||
|
||||
String_ = "String";
|
||||
URL = "https://api.dropbox.com/oauth2/token";
|
||||
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);
|
||||
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);
|
||||
|
||||
@@ -153,7 +153,7 @@ EndFunction
|
||||
// Map Of KeyAndValue - serialized JSON response from Dropbox
|
||||
Function GetSpaceUsageData(Val Token) Export
|
||||
|
||||
URL = "https://api.dropboxapi.com/2/users/get_space_usage";
|
||||
URL = "https://api.dropboxapi.com/2/users/get_space_usage";
|
||||
Headers = GetRequestHeaders(Token);
|
||||
|
||||
Response = OPI_Tools.PostBinary(URL
|
||||
@@ -185,10 +185,10 @@ 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("path" , Path , "String" , Parameters);
|
||||
OPI_Tools.AddField("include_media_info", Detailed, "Boolean", Parameters);
|
||||
|
||||
Headers = GetRequestHeaders(Token);
|
||||
Headers = GetRequestHeaders(Token);
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
|
||||
Return Response;
|
||||
@@ -213,7 +213,7 @@ Function GetListOfFolderFiles(Val Token, Val Path = "", Val Detailed = False, Va
|
||||
URL = "https://api.dropboxapi.com/2/files/list_folder";
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("path" , Path , "String", Parameters);
|
||||
OPI_Tools.AddField("path" , Path , "String" , Parameters);
|
||||
OPI_Tools.AddField("include_media_info", Detailed , "Boolean", Parameters);
|
||||
|
||||
Else
|
||||
@@ -244,7 +244,7 @@ EndFunction
|
||||
// BinaryData - document preview
|
||||
Function GetPreview(Val Token, Val Path) Export
|
||||
|
||||
URL = "https://content.dropboxapi.com/2/files/get_preview";
|
||||
URL = "https://content.dropboxapi.com/2/files/get_preview";
|
||||
Response = ProcessObject(Token, URL, Path, True);
|
||||
|
||||
Return Response;
|
||||
@@ -268,8 +268,8 @@ Function UploadFile(Val Token, Val File, Val Path, Val Overwrite = False) Export
|
||||
OPI_TypeConversion.GetBoolean(Overwrite);
|
||||
OPI_TypeConversion.GetLine(Path);
|
||||
|
||||
Mode = ?(Overwrite, "overwrite", "add");
|
||||
Size = File.Size();
|
||||
Mode = ?(Overwrite, "overwrite", "add");
|
||||
Size = File.Size();
|
||||
Border = 100000000;
|
||||
|
||||
If Size > Border Then
|
||||
@@ -297,10 +297,10 @@ 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("path", Path , "String", Parameters);
|
||||
OPI_Tools.AddField("url" , FileURL , "String", Parameters);
|
||||
|
||||
Headers = GetRequestHeaders(Token);
|
||||
Headers = GetRequestHeaders(Token);
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
|
||||
Return Response;
|
||||
@@ -323,7 +323,7 @@ Function GetUploadStatusByURL(Val Token, Val JobID) Export
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("async_job_id", JobID, "String", Parameters);
|
||||
|
||||
Headers = GetRequestHeaders(Token);
|
||||
Headers = GetRequestHeaders(Token);
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
|
||||
Return Response;
|
||||
@@ -371,8 +371,8 @@ Function CopyObject(Val Token, Val From, Val Target) 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" , Target , "String", Parameters);
|
||||
OPI_Tools.AddField("from_path", From , "String", Parameters);
|
||||
OPI_Tools.AddField("to_path" , Target , "String", Parameters);
|
||||
|
||||
Headers = GetRequestHeaders(Token);
|
||||
|
||||
@@ -397,8 +397,8 @@ Function MoveObject(Val Token, Val From, Val Target) 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" , Target , "String", Parameters);
|
||||
OPI_Tools.AddField("from_path", From , "String", Parameters);
|
||||
OPI_Tools.AddField("to_path" , Target , "String", Parameters);
|
||||
|
||||
Headers = GetRequestHeaders(Token);
|
||||
|
||||
@@ -419,7 +419,7 @@ EndFunction
|
||||
// Map Of KeyAndValue - serialized JSON response from Dropbox
|
||||
Function CreateFolder(Val Token, Val Path) Export
|
||||
|
||||
URL = "https://api.dropboxapi.com/2/files/create_folder_v2";
|
||||
URL = "https://api.dropboxapi.com/2/files/create_folder_v2";
|
||||
Response = ProcessObject(Token, URL, Path);
|
||||
|
||||
Return Response;
|
||||
@@ -437,7 +437,7 @@ EndFunction
|
||||
// BinaryData - binary data of the file
|
||||
Function DownloadFile(Val Token, Val Path) Export
|
||||
|
||||
URL = "https://content.dropboxapi.com/2/files/download";
|
||||
URL = "https://content.dropboxapi.com/2/files/download";
|
||||
Response = ProcessObject(Token, URL, Path, True);
|
||||
|
||||
Return Response;
|
||||
@@ -455,7 +455,7 @@ EndFunction
|
||||
// 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";
|
||||
URL = "https://content.dropboxapi.com/2/files/download_zip";
|
||||
Response = ProcessObject(Token, URL, Path, True);
|
||||
|
||||
Return Response;
|
||||
@@ -477,10 +477,10 @@ Function GetObjectVersionList(Val Token, Val Path, Val Count = 10) Export
|
||||
URL = "https://api.dropboxapi.com/2/files/list_revisions";
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("path" , Path , "String", Parameters);
|
||||
OPI_Tools.AddField("path" , Path , "String" , Parameters);
|
||||
OPI_Tools.AddField("limit", Count, "Number" , Parameters);
|
||||
|
||||
Headers = GetRequestHeaders(Token);
|
||||
Headers = GetRequestHeaders(Token);
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
|
||||
Return Response;
|
||||
@@ -502,10 +502,10 @@ 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("path", Path , "String", Parameters);
|
||||
OPI_Tools.AddField("rev" , Version, "String", Parameters);
|
||||
|
||||
Headers = GetRequestHeaders(Token);
|
||||
Headers = GetRequestHeaders(Token);
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
|
||||
Return Response;
|
||||
@@ -587,7 +587,7 @@ EndFunction
|
||||
// Map Of KeyAndValue - serialized JSON response from Dropbox
|
||||
Function PublishFolder(Val Token, Val Path) Export
|
||||
|
||||
URL = "https://api.dropboxapi.com/2/sharing/share_folder";
|
||||
URL = "https://api.dropboxapi.com/2/sharing/share_folder";
|
||||
Response = ProcessObject(Token, URL, Path);
|
||||
|
||||
Return Response;
|
||||
@@ -610,7 +610,7 @@ Function CancelFolderPublication(Val Token, Val FolderID) Export
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("shared_folder_id", FolderID, "String", Parameters);
|
||||
|
||||
Headers = GetRequestHeaders(Token);
|
||||
Headers = GetRequestHeaders(Token);
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
|
||||
Return Response;
|
||||
@@ -647,7 +647,7 @@ Function AddUsersToFile(Val Token, Val FileID, Val EmailAddresses, Val ViewOnly
|
||||
For Each Address In EmailAddresses Do
|
||||
|
||||
UserData = New Map;
|
||||
OPI_Tools.AddField(".tag" , "email", String_, UserData);
|
||||
OPI_Tools.AddField(".tag" , "email" , String_, UserData);
|
||||
OPI_Tools.AddField("email", Address , String_, UserData);
|
||||
|
||||
ArrayOfUsers.Add(UserData);
|
||||
@@ -655,7 +655,7 @@ Function AddUsersToFile(Val Token, Val FileID, Val EmailAddresses, Val ViewOnly
|
||||
EndDo;
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("file" , FileID , String_, Parameters);
|
||||
OPI_Tools.AddField("file" , FileID , String_, Parameters);
|
||||
OPI_Tools.AddField("members", ArrayOfUsers , "Array", Parameters);
|
||||
|
||||
Mode = ?(ViewOnly, "viewer", "editor");
|
||||
@@ -696,7 +696,7 @@ Function AddUsersToFolder(Val Token, Val FolderID, Val EmailAddresses, Val ViewO
|
||||
For Each Address In EmailAddresses Do
|
||||
|
||||
UserData = New Map;
|
||||
OPI_Tools.AddField(".tag" , "email", String_, UserData);
|
||||
OPI_Tools.AddField(".tag" , "email" , String_, UserData);
|
||||
OPI_Tools.AddField("email", Address , String_, UserData);
|
||||
|
||||
UserStructure = New Structure("member,access_level", UserData, Mode);
|
||||
@@ -706,8 +706,8 @@ Function AddUsersToFolder(Val Token, Val FolderID, Val EmailAddresses, Val ViewO
|
||||
EndDo;
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("shared_folder_id", FolderID , String_, Parameters);
|
||||
OPI_Tools.AddField("members" , ArrayOfUsers , "Array", Parameters);
|
||||
OPI_Tools.AddField("shared_folder_id", FolderID , String_, Parameters);
|
||||
OPI_Tools.AddField("members" , ArrayOfUsers , "Array", Parameters);
|
||||
|
||||
Headers = GetRequestHeaders(Token);
|
||||
|
||||
@@ -733,7 +733,7 @@ Function GetAsynchronousChangeStatus(Val Token, Val JobID) Export
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("async_job_id", JobID, "String", Parameters);
|
||||
|
||||
Headers = GetRequestHeaders(Token);
|
||||
Headers = GetRequestHeaders(Token);
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
|
||||
Return Response;
|
||||
@@ -762,7 +762,7 @@ Function CancelFilePublication(Val Token, Val FileID) Export
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("file", FileID, "String", Parameters);
|
||||
|
||||
Headers = GetRequestHeaders(Token);
|
||||
Headers = GetRequestHeaders(Token);
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
|
||||
Return Response;
|
||||
@@ -781,10 +781,10 @@ Function ProcessObject(Val Token, Val URL, Val Path, Val InHeaders = False)
|
||||
OPI_Tools.AddField("path", Path, "String", Parameters);
|
||||
|
||||
If InHeaders Then
|
||||
Headers = GetRequestHeaders(Token, Parameters);
|
||||
Headers = GetRequestHeaders(Token, Parameters);
|
||||
Response = OPI_Tools.PostBinary(URL, GetBinaryDataFromString(""), Headers);
|
||||
Else
|
||||
Headers = GetRequestHeaders(Token);
|
||||
Headers = GetRequestHeaders(Token);
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
EndIf;
|
||||
|
||||
@@ -801,7 +801,7 @@ Function ProcessTag(Val Token, Val Path, Val Tag, Val ThisIsDeletion = False)
|
||||
EndIf;
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("path" , Path, "String", Parameters);
|
||||
OPI_Tools.AddField("path" , Path, "String", Parameters);
|
||||
OPI_Tools.AddField("tag_text" , Tag , "String", Parameters);
|
||||
|
||||
Headers = GetRequestHeaders(Token);
|
||||
@@ -836,11 +836,11 @@ Function UploadLargeFile(Val Token, Val File, Val Path, Val Mode)
|
||||
|
||||
URL = "https://content.dropboxapi.com/2/files/upload_session/append_v2";
|
||||
|
||||
ChunkSize = 100000000;
|
||||
ChunkSize = 100000000;
|
||||
CurrentPosition = 0;
|
||||
BytesRead = 0;
|
||||
TotalSize = File.Size();
|
||||
Session = OpenSession(Token);
|
||||
BytesRead = 0;
|
||||
TotalSize = File.Size();
|
||||
Session = OpenSession(Token);
|
||||
|
||||
WHile BytesRead < TotalSize Do
|
||||
|
||||
@@ -848,13 +848,13 @@ Function UploadLargeFile(Val Token, Val File, Val Path, Val Mode)
|
||||
Cursor = New Structure("offset,session_id", Indent, Session);
|
||||
|
||||
Parameters = New Structure("cursor", Cursor);
|
||||
Headers = GetRequestHeaders(Token, Parameters);
|
||||
Headers = GetRequestHeaders(Token, Parameters);
|
||||
|
||||
DataReader = New DataReader(File);
|
||||
BytesRead = DataReader.Skip(CurrentPosition);
|
||||
Result = DataReader.Read(ChunkSize);
|
||||
CurrentData = Result.GetBinaryData();
|
||||
CurrentSize = CurrentData.Size();
|
||||
DataReader = New DataReader(File);
|
||||
BytesRead = DataReader.Skip(CurrentPosition);
|
||||
Result = DataReader.Read(ChunkSize);
|
||||
CurrentData = Result.GetBinaryData();
|
||||
CurrentSize = CurrentData.Size();
|
||||
NextPosition = CurrentPosition + CurrentSize;
|
||||
|
||||
If Not ValueIsFilled(CurrentData) Then
|
||||
@@ -866,7 +866,7 @@ Function UploadLargeFile(Val Token, Val File, Val Path, Val Mode)
|
||||
CurrentPosition = NextPosition;
|
||||
|
||||
KBytes = 1024;
|
||||
MByte = KBytes * KBytes;
|
||||
MByte = KBytes * KBytes;
|
||||
Message(OPI_Tools.ProgressInformation(CurrentPosition, TotalSize, "MB", MByte));
|
||||
|
||||
RunGarbageCollection();
|
||||
@@ -883,15 +883,15 @@ EndFunction
|
||||
Function UploadSmallFile(Val Token, Val File, Val Path, Val Mode)
|
||||
|
||||
Boolean_ = "Boolean";
|
||||
String_ = "String";
|
||||
URL = "https://content.dropboxapi.com/2/files/upload";
|
||||
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("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);
|
||||
@@ -905,8 +905,8 @@ EndFunction
|
||||
Function OpenSession(Val Token)
|
||||
|
||||
SessionId = "session_id";
|
||||
URL = "https://content.dropboxapi.com/2/files/upload_session/start";
|
||||
Headers = GetRequestHeaders(Token);
|
||||
URL = "https://content.dropboxapi.com/2/files/upload_session/start";
|
||||
Headers = GetRequestHeaders(Token);
|
||||
|
||||
Response = OPI_Tools.PostBinary(URL, GetBinaryDataFromString(""), Headers);
|
||||
|
||||
@@ -925,7 +925,7 @@ Function CloseSession(Val Token, Val Path, Val Mode, Val TotalSize, Val Session)
|
||||
Cursor = New Structure("offset,session_id", TotalSize, Session);
|
||||
|
||||
Parameters = New Structure("commit,cursor", Commit, Cursor);
|
||||
Headers = GetRequestHeaders(Token, Parameters);
|
||||
Headers = GetRequestHeaders(Token, Parameters);
|
||||
|
||||
Response = OPI_Tools.PostBinary(URL, GetBinaryDataFromString(""), Headers);
|
||||
|
||||
@@ -950,7 +950,7 @@ EndFunction
|
||||
|
||||
Function GetOwnAccount(Val Token)
|
||||
|
||||
URL = "https://api.dropboxapi.com/2/users/get_current_account";
|
||||
URL = "https://api.dropboxapi.com/2/users/get_current_account";
|
||||
Headers = GetRequestHeaders(Token);
|
||||
|
||||
Response = OPI_Tools.PostBinary(URL
|
||||
|
@@ -56,7 +56,7 @@ Function CreateCalendar(Val Token, Val Name) Export
|
||||
OPI_TypeConversion.GetLine(Name);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://www.googleapis.com/calendar/v3/calendars";
|
||||
URL = "https://www.googleapis.com/calendar/v3/calendars";
|
||||
|
||||
Parameters = New Structure;
|
||||
Parameters.Insert("summary" , Name);
|
||||
@@ -82,8 +82,8 @@ 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;
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://www.googleapis.com/calendar/v3/calendars/" + Calendar;
|
||||
Response = OPI_Tools.Get(URL, , Headers);
|
||||
|
||||
Return Response;
|
||||
@@ -112,7 +112,7 @@ Function EditCalendarMetadata(Val Token
|
||||
OPI_TypeConversion.GetLine(Description);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://www.googleapis.com/calendar/v3/calendars/" + Calendar;
|
||||
URL = "https://www.googleapis.com/calendar/v3/calendars/" + Calendar;
|
||||
|
||||
Parameters = New Structure;
|
||||
|
||||
@@ -142,8 +142,8 @@ Function ClearMainCalendar(Val Token) Export
|
||||
|
||||
OPI_TypeConversion.GetLine(Token);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://www.googleapis.com/calendar/v3/calendars/primary/clear";
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://www.googleapis.com/calendar/v3/calendars/primary/clear";
|
||||
Response = OPI_Tools.Post(URL, , Headers, False);
|
||||
|
||||
Return Response;
|
||||
@@ -164,8 +164,8 @@ 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;
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://www.googleapis.com/calendar/v3/calendars/" + Calendar;
|
||||
Response = OPI_Tools.Delete(URL, , Headers);
|
||||
|
||||
Return Response;
|
||||
@@ -188,7 +188,7 @@ Function GetCalendarList(Val Token) Export
|
||||
|
||||
OPI_TypeConversion.GetLine(Token);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
ArrayOfCalendars = New Array;
|
||||
|
||||
GetCalendarsListRecursively(Headers, ArrayOfCalendars);
|
||||
@@ -212,7 +212,7 @@ Function AddCalendarToList(Val Token, Val Calendar) Export
|
||||
OPI_TypeConversion.GetLine(Calendar);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://www.googleapis.com/calendar/v3/users/me/calendarList";
|
||||
URL = "https://www.googleapis.com/calendar/v3/users/me/calendarList";
|
||||
|
||||
Parameters = New Structure;
|
||||
Parameters.Insert("id", Calendar);
|
||||
@@ -237,8 +237,8 @@ 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;
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://www.googleapis.com/calendar/v3/users/me/calendarList/" + Calendar;
|
||||
Response = OPI_Tools.Get(URL, , Headers);
|
||||
|
||||
Return Response;
|
||||
@@ -259,8 +259,8 @@ 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;
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://www.googleapis.com/calendar/v3/users/me/calendarList/" + Calendar;
|
||||
Response = OPI_Tools.Delete(URL, , Headers);
|
||||
|
||||
Return Response;
|
||||
@@ -292,10 +292,10 @@ Function EditListCalendar(Val Token
|
||||
OPI_TypeConversion.GetBoolean(Hidden);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://www.googleapis.com/calendar/v3/users/me/calendarList/" + Calendar + "?colorRgbFormat=true";
|
||||
URL = "https://www.googleapis.com/calendar/v3/users/me/calendarList/" + Calendar + "?colorRgbFormat =true";
|
||||
|
||||
Parameters = New Map;
|
||||
Parameters.Insert("hidden" , Hidden);
|
||||
Parameters.Insert("hidden" , Hidden);
|
||||
Parameters.Insert("foregroundColor", PrimaryColor);
|
||||
Parameters.Insert("backgroundColor", SecondaryColor);
|
||||
|
||||
@@ -316,16 +316,16 @@ EndFunction
|
||||
Function GetEventDescription() Export
|
||||
|
||||
CurrentDate = OPI_Tools.GetCurrentDate();
|
||||
Hour = 3600;
|
||||
Event = New Map;
|
||||
Hour = 3600;
|
||||
Event = New Map;
|
||||
|
||||
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("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 Map); // Key - name, Value - URL to file
|
||||
Event.Insert("SendNotifications" , True); // Indication of sending notifications to participants
|
||||
Event.Insert("SendNotifications" , True); // Indication of sending notifications to participants
|
||||
|
||||
Return Event;
|
||||
|
||||
@@ -345,7 +345,7 @@ Function GetEventList(Val Token, Val Calendar) Export
|
||||
OPI_TypeConversion.GetLine(Token);
|
||||
OPI_TypeConversion.GetLine(Calendar);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
ArrayOfEvents = New Array;
|
||||
|
||||
GetEventsListRecursively(Headers, Calendar, ArrayOfEvents);
|
||||
@@ -371,7 +371,7 @@ Function GetEvent(Val Token, Val Calendar, Val Event) Export
|
||||
OPI_TypeConversion.GetLine(Event);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://www.googleapis.com/calendar/v3/calendars/"
|
||||
URL = "https://www.googleapis.com/calendar/v3/calendars/"
|
||||
+ Calendar
|
||||
+ "/events/"
|
||||
+ Event;
|
||||
@@ -464,7 +464,7 @@ Function DeleteEvent(Val Token, Val Calendar, Val Event) Export
|
||||
OPI_TypeConversion.GetLine(Event);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://www.googleapis.com/calendar/v3/calendars/"
|
||||
URL = "https://www.googleapis.com/calendar/v3/calendars/"
|
||||
+ Calendar
|
||||
+ "/events/"
|
||||
+ Event;
|
||||
@@ -491,16 +491,16 @@ Function ConvertDate(Val Date)
|
||||
Return Undefined;
|
||||
EndIf;
|
||||
|
||||
If Date = BegOfDay(Date) Then
|
||||
If Date = BegOfDay(Date) Then
|
||||
DateFormat = "DF=yyyy-MM-dd";
|
||||
Field = "date";
|
||||
Field = "date";
|
||||
Else
|
||||
DateFormat = "DF=yyyy-MM-ddTHH:mm:ssZ";
|
||||
Field = "dateTime";
|
||||
Field = "dateTime";
|
||||
EndIf;
|
||||
|
||||
Date = Format(Date, DateFormat);
|
||||
DateStructure.Insert(Field , Date);
|
||||
DateStructure.Insert(Field , Date);
|
||||
DateStructure.Insert("timeZone", "Europe/Moscow");
|
||||
|
||||
Return DateStructure;
|
||||
@@ -518,7 +518,7 @@ Function ConvertAttachments(Val Attachments)
|
||||
For Each Attachment In Attachments Do
|
||||
|
||||
CurrentAttachment = New Structure;
|
||||
CurrentAttachment.Insert("title" , Attachment.Key);
|
||||
CurrentAttachment.Insert("title" , Attachment.Key);
|
||||
CurrentAttachment.Insert("fileUrl", Attachment.Value);
|
||||
|
||||
AttachmentsArray.Add(CurrentAttachment);
|
||||
@@ -542,31 +542,31 @@ Function EventManagement(Val Token, Val Calendar, Val EventDescription, Val Even
|
||||
OPI_TypeConversion.GetLine(Event);
|
||||
OPI_TypeConversion.GetCollection(EventDescription);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
Existing = ValueIsFilled(Event);
|
||||
URL = "https://www.googleapis.com/calendar/v3/calendars/"
|
||||
URL = "https://www.googleapis.com/calendar/v3/calendars/"
|
||||
+ Calendar
|
||||
+ "/events"
|
||||
+ ?(Existing, "/" + Event, "");
|
||||
|
||||
Date0 = EventDescription["StartDate"];
|
||||
Date1 = EventDescription["EndDate"];
|
||||
Attachments = EventDescription["ArrayOfAttachmentURLs"];
|
||||
Attachments = ConvertAttachments(Attachments);
|
||||
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("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("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("sendUpdates" , ?(Notifications , "all" , "none"));
|
||||
URLParameters.Insert("supportsAttachments" , ?(ValueIsFilled(Attachments), "true", "false"));
|
||||
|
||||
URL = URL + OPI_Tools.RequestParametersToString(URLParameters);
|
||||
@@ -585,8 +585,8 @@ EndFunction
|
||||
|
||||
Procedure GetCalendarsListRecursively(Val Headers, ArrayOfCalendars, Page = "")
|
||||
|
||||
Items = "items";
|
||||
NPT = "nextPageToken";
|
||||
Items = "items";
|
||||
NPT = "nextPageToken";
|
||||
Parameters = New Structure;
|
||||
|
||||
If ValueIsFilled(Page) Then
|
||||
@@ -598,7 +598,7 @@ Procedure GetCalendarsListRecursively(Val Headers, ArrayOfCalendars, Page = "")
|
||||
, Headers);
|
||||
|
||||
Calendars = Result[Items];
|
||||
Page = Result[NPT];
|
||||
Page = Result[NPT];
|
||||
|
||||
For Each Calendar In Calendars Do
|
||||
ArrayOfCalendars.Add(Calendar);
|
||||
@@ -612,8 +612,8 @@ EndProcedure
|
||||
|
||||
Procedure GetEventsListRecursively(Val Headers, Val Calendar, ArrayOfEvents, Page = "")
|
||||
|
||||
Items = "items";
|
||||
NPT = "nextPageToken";
|
||||
Items = "items";
|
||||
NPT = "nextPageToken";
|
||||
Parameters = New Structure;
|
||||
|
||||
If ValueIsFilled(Page) Then
|
||||
@@ -625,7 +625,7 @@ Procedure GetEventsListRecursively(Val Headers, Val Calendar, ArrayOfEvents, Pag
|
||||
, Headers);
|
||||
|
||||
Events = Result[Items];
|
||||
Page = Result[NPT];
|
||||
Page = Result[NPT];
|
||||
|
||||
For Each Event In Events Do
|
||||
ArrayOfEvents.Add(Event);
|
||||
|
@@ -56,7 +56,7 @@ Function GetObjectInformation(Val Token, Val Identifier) Export
|
||||
OPI_TypeConversion.GetLine(Identifier);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://www.googleapis.com/drive/v3/files/" + Identifier;
|
||||
URL = "https://www.googleapis.com/drive/v3/files/" + Identifier;
|
||||
|
||||
Parameters = New Structure;
|
||||
Parameters.Insert("fields", "*");
|
||||
@@ -83,9 +83,9 @@ Function GetDirectoriesList(Val Token, Val NameContains = "", Val Detailed = Fal
|
||||
OPI_TypeConversion.GetLine(NameContains);
|
||||
OPI_TypeConversion.GetBoolean(Detailed);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
ArrayOfObjects = New Array;
|
||||
Filter = New Array;
|
||||
Filter = New Array;
|
||||
|
||||
Filter.Add("mimeType = 'application/vnd.google-apps.folder'");
|
||||
|
||||
@@ -119,9 +119,9 @@ Function GetFilesList(Val Token, Val NameContains = "", Val Directory = "") Expo
|
||||
OPI_TypeConversion.GetLine(NameContains);
|
||||
OPI_TypeConversion.GetLine(Directory);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
ArrayOfObjects = New Array;
|
||||
Filter = New Array;
|
||||
Filter = New Array;
|
||||
|
||||
Filter.Add("mimeType != 'application/vnd.google-apps.folder'");
|
||||
|
||||
@@ -172,10 +172,10 @@ Function CreateFolder(Val Token, Val Name, Val Parent = "") Export
|
||||
OPI_TypeConversion.GetLine(Parent);
|
||||
|
||||
Description = New Map;
|
||||
Description.Insert("MIME" , "application/vnd.google-apps.folder");
|
||||
Description.Insert("Name" , Name);
|
||||
Description.Insert("MIME" , "application/vnd.google-apps.folder");
|
||||
Description.Insert("Name" , Name);
|
||||
Description.Insert("Description", "");
|
||||
Description.Insert("Parent", ?(ValueIsFilled(Parent), Parent, "root"));
|
||||
Description.Insert("Parent" , ?(ValueIsFilled(Parent), Parent, "root"));
|
||||
|
||||
Return FileManagement(Token, , Description);
|
||||
|
||||
@@ -197,7 +197,7 @@ Function DownloadFile(Val Token, Val Identifier, Val SavePath = "") Export
|
||||
OPI_TypeConversion.GetLine(Identifier);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://www.googleapis.com/drive/v3/files/" + Identifier;
|
||||
URL = "https://www.googleapis.com/drive/v3/files/" + Identifier;
|
||||
|
||||
Parameters = New Map;
|
||||
Parameters.Insert("alt", "media");
|
||||
@@ -227,7 +227,7 @@ Function CopyObject(Val Token, Val Identifier, Val NewName = "", Val NewParent =
|
||||
OPI_TypeConversion.GetLine(NewParent);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://www.googleapis.com/drive/v3/files/" + Identifier + "/copy";
|
||||
URL = "https://www.googleapis.com/drive/v3/files/" + Identifier + "/copy";
|
||||
|
||||
Parameters = New Structure;
|
||||
|
||||
@@ -292,8 +292,8 @@ 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;
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://www.googleapis.com/drive/v3/files/" + Identifier;
|
||||
Response = OPI_Tools.Delete(URL, , Headers);
|
||||
|
||||
Return Response;
|
||||
@@ -307,10 +307,10 @@ EndFunction
|
||||
Function GetFileDescription() Export
|
||||
|
||||
Description = New Map;
|
||||
Description.Insert("MIME" , "image/jpeg"); // MIME-type uploading file
|
||||
Description.Insert("Name" , "New file.jpg"); // File name with extension
|
||||
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
|
||||
Description.Insert("Parent" , "root"); // ID directory upload or "root" for upload in root
|
||||
|
||||
Return Description;
|
||||
|
||||
@@ -337,7 +337,7 @@ Function CreateComment(Val Token, Val Identifier, Val Comment) Export
|
||||
OPI_TypeConversion.GetLine(Comment);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://www.googleapis.com/drive/v3/files/" + Identifier + "/comments?fields=*";
|
||||
URL = "https://www.googleapis.com/drive/v3/files/" + Identifier + "/comments?fields =*";
|
||||
|
||||
Parameters = New Structure;
|
||||
Parameters.Insert("content", Comment);
|
||||
@@ -365,7 +365,7 @@ Function GetComment(Val Token, Val ObjectID, Val CommentID) Export
|
||||
OPI_TypeConversion.GetLine(CommentID);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://www.googleapis.com/drive/v3/files/" + ObjectID + "/comments/" + CommentID;
|
||||
URL = "https://www.googleapis.com/drive/v3/files/" + ObjectID + "/comments/" + CommentID;
|
||||
|
||||
Parameters = New Structure;
|
||||
Parameters.Insert("fields", "*");
|
||||
@@ -391,7 +391,7 @@ Function GetCommentList(Val Token, Val ObjectID) Export
|
||||
OPI_TypeConversion.GetLine(ObjectID);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://www.googleapis.com/drive/v3/files/" + ObjectID + "/comments";
|
||||
URL = "https://www.googleapis.com/drive/v3/files/" + ObjectID + "/comments";
|
||||
|
||||
Parameters = New Structure;
|
||||
Parameters.Insert("fields", "*");
|
||||
@@ -419,7 +419,7 @@ Function DeleteComment(Val Token, Val ObjectID, Val CommentID) Export
|
||||
OPI_TypeConversion.GetLine(CommentID);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://www.googleapis.com/drive/v3/files/" + ObjectID + "/comments/" + CommentID;
|
||||
URL = "https://www.googleapis.com/drive/v3/files/" + ObjectID + "/comments/" + CommentID;
|
||||
|
||||
Response = OPI_Tools.Delete(URL, , Headers);
|
||||
|
||||
@@ -435,9 +435,9 @@ EndFunction
|
||||
|
||||
Procedure GetObjectsListRecursively(Val Headers, ArrayOfObjects, Detailed = False, Filter = "", Page = "")
|
||||
|
||||
URL = "https://www.googleapis.com/drive/v3/files";
|
||||
Files = "files";
|
||||
NPT = "nextPageToken";
|
||||
URL = "https://www.googleapis.com/drive/v3/files";
|
||||
Files = "files";
|
||||
NPT = "nextPageToken";
|
||||
Parameters = New Structure;
|
||||
Parameters.Insert("fields", "*");
|
||||
|
||||
@@ -453,7 +453,7 @@ Procedure GetObjectsListRecursively(Val Headers, ArrayOfObjects, Detailed = Fals
|
||||
Result = OPI_Tools.Get(URL, Parameters, Headers);
|
||||
|
||||
Objects = Result[Files];
|
||||
Page = Result[NPT];
|
||||
Page = Result[NPT];
|
||||
|
||||
For Each CurrentObject In Objects Do
|
||||
ArrayOfObjects.Add(CurrentObject);
|
||||
@@ -470,7 +470,7 @@ Procedure BreakDownObjectsInDetail(Val Token, ArrayOfObjects)
|
||||
For Each CurrentObject In ArrayOfObjects Do
|
||||
|
||||
ArrayOfFiles = New Array;
|
||||
CurrentID = CurrentObject["id"];
|
||||
CurrentID = CurrentObject["id"];
|
||||
|
||||
Result = GetFilesList(Token, , CurrentID);
|
||||
|
||||
@@ -490,11 +490,11 @@ Procedure FormFileUploadParameters(Description)
|
||||
OPI_Tools.RemoveEmptyCollectionFields(Description);
|
||||
|
||||
FieldMapping = New Map;
|
||||
FieldMapping.Insert("MIME" , "mimeType");
|
||||
FieldMapping.Insert("Name" , "name");
|
||||
FieldMapping.Insert("MIME" , "mimeType");
|
||||
FieldMapping.Insert("Name" , "name");
|
||||
FieldMapping.Insert("Description" , "description");
|
||||
FieldMapping.Insert("Parent" , "parents");
|
||||
FieldMapping.Insert("Extension", "fileExtension");
|
||||
FieldMapping.Insert("Parent" , "parents");
|
||||
FieldMapping.Insert("Extension" , "fileExtension");
|
||||
|
||||
For Each Element In Description Do
|
||||
|
||||
@@ -539,7 +539,7 @@ Function FileManagement(Val Token, Val File = "", Val Description = "", Val Iden
|
||||
Description = New Map;
|
||||
EndIf;
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
FormFileUploadParameters(Description);
|
||||
JSONDescription = OPI_Tools.JSONString(Description);
|
||||
|
||||
@@ -548,7 +548,7 @@ Function FileManagement(Val Token, Val File = "", Val Description = "", Val Iden
|
||||
If ValueIsFilled(File) Then
|
||||
|
||||
ChunkSize = 268435457;
|
||||
Size = OPI_Tools.ConvertDataWithSizeRetrieval(File, ChunkSize);
|
||||
Size = OPI_Tools.ConvertDataWithSizeRetrieval(File, ChunkSize);
|
||||
|
||||
FileMapping.Insert(File, MIME);
|
||||
|
||||
@@ -571,7 +571,7 @@ Function UploadSmallFile(Val Description, Val FileMapping, Val Headers, Val Iden
|
||||
URL = "https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart";
|
||||
|
||||
If ValueIsFilled(Identifier) Then
|
||||
URL = StrReplace(URL, "/files", "/files/" + Identifier);
|
||||
URL = StrReplace(URL, "/files", "/files/" + Identifier);
|
||||
Response = OPI_Tools.PatchMultipartRelated(URL, Description, FileMapping, Headers);
|
||||
Else
|
||||
Response = OPI_Tools.PostMultipartRelated(URL, Description, FileMapping, Headers);
|
||||
@@ -591,7 +591,7 @@ Function UploadLargeFile(Val Description, Val FileMapping, Val Headers, Val Iden
|
||||
URL = "https://www.googleapis.com/upload/drive/v3/files?uploadType=resumable";
|
||||
|
||||
If ValueIsFilled(Identifier) Then
|
||||
URL = StrReplace(URL, "/files", "/files/" + Identifier);
|
||||
URL = StrReplace(URL, "/files", "/files/" + Identifier);
|
||||
Response = OPI_Tools.Patch(URL, Description, Headers, True, True);
|
||||
Else
|
||||
Response = OPI_Tools.Post(URL, Description, Headers, True, True);
|
||||
@@ -605,7 +605,7 @@ Function UploadLargeFile(Val Description, Val FileMapping, Val Headers, Val Iden
|
||||
EndIf;
|
||||
|
||||
UploadResponse = UploadFileInParts(Binary, UploadURL);
|
||||
Response = ?(ValueIsFilled(UploadResponse), UploadResponse, Response);
|
||||
Response = ?(ValueIsFilled(UploadResponse), UploadResponse, Response);
|
||||
|
||||
OPI_Tools.ProcessResponse(Response);
|
||||
Return Response;
|
||||
@@ -614,21 +614,21 @@ EndFunction
|
||||
|
||||
Function UploadFileInParts(Val Binary, Val UploadURL)
|
||||
|
||||
Response = "";
|
||||
ChunkSize = 268435456;
|
||||
BytesRead = 0;
|
||||
Response = "";
|
||||
ChunkSize = 268435456;
|
||||
BytesRead = 0;
|
||||
CurrentPosition = 0;
|
||||
TotalSize = Binary.Size();
|
||||
StrTotalSize = OPI_Tools.NumberToString(TotalSize);
|
||||
DataReader = New DataReader(Binary);
|
||||
SourceStream = DataReader.SourceStream();
|
||||
TotalSize = Binary.Size();
|
||||
StrTotalSize = OPI_Tools.NumberToString(TotalSize);
|
||||
DataReader = New DataReader(Binary);
|
||||
SourceStream = DataReader.SourceStream();
|
||||
|
||||
WHile BytesRead < TotalSize Do
|
||||
|
||||
BytesRead = SourceStream.CurrentPosition();
|
||||
Result = DataReader.Read(ChunkSize);
|
||||
CurrentData = Result.GetBinaryData();
|
||||
CurrentSize = CurrentData.Size();
|
||||
BytesRead = SourceStream.CurrentPosition();
|
||||
Result = DataReader.Read(ChunkSize);
|
||||
CurrentData = Result.GetBinaryData();
|
||||
CurrentSize = CurrentData.Size();
|
||||
NextPosition = CurrentPosition + CurrentSize - 1;
|
||||
|
||||
If Not ValueIsFilled(CurrentData) Then
|
||||
@@ -645,7 +645,7 @@ Function UploadFileInParts(Val Binary, Val UploadURL)
|
||||
AdditionalHeaders = New Map;
|
||||
AdditionalHeaders.Insert("Content-Length", OPI_Tools.NumberToString(CurrentSize));
|
||||
AdditionalHeaders.Insert("Content-Range" , StreamHeader);
|
||||
AdditionalHeaders.Insert("Content-Type" , "application/octet-stream");
|
||||
AdditionalHeaders.Insert("Content-Type" , "application/octet-stream");
|
||||
|
||||
Response = OPI_Tools.Put(UploadURL, CurrentData, AdditionalHeaders, False, True);
|
||||
|
||||
@@ -656,7 +656,7 @@ Function UploadFileInParts(Val Binary, Val UploadURL)
|
||||
EndIf;
|
||||
|
||||
KBytes = 1024;
|
||||
MByte = KBytes * KBytes;
|
||||
MByte = KBytes * KBytes;
|
||||
Message(OPI_Tools.ProgressInformation(CurrentPosition, TotalSize, "MB", MByte));
|
||||
|
||||
RunGarbageCollection();
|
||||
@@ -670,11 +670,11 @@ EndFunction
|
||||
|
||||
Function CheckPartUpload(Response, StrTotalSize, AdditionalHeaders, UploadURL, CurrentPosition)
|
||||
|
||||
StartOfErrorCodes = 400;
|
||||
EndOfFailureCodes = 600;
|
||||
StartOfErrorCodes = 400;
|
||||
EndOfFailureCodes = 600;
|
||||
StartOfSuccessCodes = 200;
|
||||
EndOfSuccessCodes = 300;
|
||||
Redirection = 308;
|
||||
EndOfSuccessCodes = 300;
|
||||
Redirection = 308;
|
||||
|
||||
If Response.StatusCode >= StartOfErrorCodes And Response.StatusCode < EndOfFailureCodes Then
|
||||
|
||||
@@ -708,9 +708,9 @@ Function CheckPartUpload(Response, StrTotalSize, AdditionalHeaders, UploadURL, C
|
||||
Return Response;
|
||||
EndIf;
|
||||
|
||||
UploadedData = StrReplace(UploadedData, "bytes=", "");
|
||||
UploadedData = StrReplace(UploadedData, "bytes =", "");
|
||||
ArrayOfInformation = StrSplit(UploadedData, "-", False);
|
||||
PartsRequired = 2;
|
||||
PartsRequired = 2;
|
||||
|
||||
If Not ArrayOfInformation.Count() = PartsRequired Then
|
||||
OPI_Tools.ProcessResponse(Response);
|
||||
|
@@ -57,16 +57,16 @@ Function CreateSpreadsheet(Val Token, Val Name, Val ArrayOfSheetNames) Export
|
||||
OPI_TypeConversion.GetCollection(ArrayOfSheetNames);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://sheets.googleapis.com/v4/spreadsheets";
|
||||
URL = "https://sheets.googleapis.com/v4/spreadsheets";
|
||||
|
||||
Properties = New Structure("title" , Name);
|
||||
Sheets = New Array;
|
||||
Sheets = New Array;
|
||||
|
||||
FillSheetArray(ArrayOfSheetNames, Sheets);
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("properties", Properties, "Collection", Parameters);
|
||||
OPI_Tools.AddField("sheets" , Sheets , "Collection", Parameters);
|
||||
OPI_Tools.AddField("sheets" , Sheets , "Collection", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
|
||||
@@ -88,7 +88,7 @@ Function GetSpreadsheet(Val Token, Val Identifier) Export
|
||||
OPI_TypeConversion.GetLine(Identifier);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://sheets.googleapis.com/v4/spreadsheets/" + Identifier;
|
||||
URL = "https://sheets.googleapis.com/v4/spreadsheets/" + Identifier;
|
||||
|
||||
Response = OPI_Tools.Get(URL, , Headers);
|
||||
|
||||
@@ -112,11 +112,11 @@ Function EditSpreadsheetTitle(Val Token, Val Spreadsheet, Val Name) Export
|
||||
OPI_TypeConversion.GetLine(Name);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://sheets.googleapis.com/v4/spreadsheets/" + Spreadsheet + ":batchUpdate";
|
||||
URL = "https://sheets.googleapis.com/v4/spreadsheets/" + Spreadsheet + ":batchUpdate";
|
||||
|
||||
Change = New Structure("title", Name);
|
||||
Change = New Structure("title", Name);
|
||||
ChangeRequest = New Structure("properties,fields", Change, "title");
|
||||
Request = New Structure("updateSpreadsheetProperties", ChangeRequest);
|
||||
Request = New Structure("updateSpreadsheetProperties", ChangeRequest);
|
||||
|
||||
ArrayOfRequests = New Array;
|
||||
ArrayOfRequests.Add(Request);
|
||||
@@ -149,11 +149,11 @@ Function AddSheet(Val Token, Val Spreadsheet, Val Name) Export
|
||||
OPI_TypeConversion.GetLine(Spreadsheet);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://sheets.googleapis.com/v4/spreadsheets/" + Spreadsheet + ":batchUpdate";
|
||||
Sheet = CreateSheet(Name);
|
||||
URL = "https://sheets.googleapis.com/v4/spreadsheets/" + Spreadsheet + ":batchUpdate";
|
||||
Sheet = CreateSheet(Name);
|
||||
|
||||
Requests = New Array;
|
||||
Change = New Structure("addSheet", Sheet);
|
||||
Change = New Structure("addSheet", Sheet);
|
||||
Requests.Add(Change);
|
||||
|
||||
Parameters = New Structure("requests", Requests);
|
||||
@@ -180,11 +180,11 @@ Function DeleteSheet(Val Token, Val Spreadsheet, Val Sheet) Export
|
||||
OPI_TypeConversion.GetLine(Sheet);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://sheets.googleapis.com/v4/spreadsheets/" + Spreadsheet + ":batchUpdate";
|
||||
URL = "https://sheets.googleapis.com/v4/spreadsheets/" + Spreadsheet + ":batchUpdate";
|
||||
|
||||
Requests = New Array;
|
||||
Sheet = New Structure("sheetId" , Sheet);
|
||||
Change = New Structure("deleteSheet", Sheet);
|
||||
Sheet = New Structure("sheetId" , Sheet);
|
||||
Change = New Structure("deleteSheet", Sheet);
|
||||
Requests.Add(Change);
|
||||
|
||||
Parameters = New Structure("requests", Requests);
|
||||
@@ -213,14 +213,14 @@ Function CopySheet(Val Token, Val From, Val Target, Val Sheet) Export
|
||||
OPI_TypeConversion.GetLine(Sheet);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://sheets.googleapis.com/v4/spreadsheets/"
|
||||
URL = "https://sheets.googleapis.com/v4/spreadsheets/"
|
||||
+ From
|
||||
+ "/sheets/"
|
||||
+ Sheet
|
||||
+ ":copyTo";
|
||||
|
||||
Parameters = New Structure("destinationSpreadsheetId", Target);
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
|
||||
Return Response;
|
||||
|
||||
@@ -251,17 +251,17 @@ Function SetCellValues(Val Token
|
||||
OPI_TypeConversion.GetLine(Spreadsheet);
|
||||
OPI_TypeConversion.GetCollection(ValueMapping);
|
||||
|
||||
If Not TypeOf(ValueMapping) = Type("Structure")
|
||||
If Not TypeOf(ValueMapping) = Type("Structure")
|
||||
And Not TypeOf(ValueMapping) = Type("Map") 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/" + Spreadsheet + "/values:batchUpdate";
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://sheets.googleapis.com/v4/spreadsheets/" + Spreadsheet + "/values:batchUpdate";
|
||||
DataArray = FormCellDataArray(ValueMapping, MajorDimension, Sheet);
|
||||
|
||||
Parameters = New Structure("data,valueInputOption", DataArray, "USER_ENTERED");
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
|
||||
Return Response;
|
||||
|
||||
@@ -284,12 +284,12 @@ Function ClearCells(Val Token, Val Spreadsheet, Val CellsArray, Val Sheet = "")
|
||||
OPI_TypeConversion.GetCollection(CellsArray);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://sheets.googleapis.com/v4/spreadsheets/" + Spreadsheet + "/values:batchClear";
|
||||
URL = "https://sheets.googleapis.com/v4/spreadsheets/" + Spreadsheet + "/values:batchClear";
|
||||
|
||||
FormCellNameArray(CellsArray, Sheet);
|
||||
|
||||
Parameters = New Structure("ranges", CellsArray);
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
|
||||
Return Response;
|
||||
|
||||
@@ -311,20 +311,20 @@ Function GetCellValues(Val Token, Val Spreadsheet, Val CellsArray = "", Val Shee
|
||||
OPI_TypeConversion.GetLine(Spreadsheet);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://sheets.googleapis.com/v4/spreadsheets/" + Spreadsheet + "/values:batchGet";
|
||||
URL = "https://sheets.googleapis.com/v4/spreadsheets/" + Spreadsheet + "/values:batchGet";
|
||||
|
||||
If ValueIsFilled(CellsArray) Then
|
||||
OPI_TypeConversion.GetCollection(CellsArray);
|
||||
FormCellNameArray(CellsArray, Sheet);
|
||||
|
||||
First = True;
|
||||
First = True;
|
||||
For Each Cell In CellsArray Do
|
||||
Delimiter = ?(First, "?", "&");
|
||||
URL = URL + Delimiter + "ranges=" + Cell;
|
||||
First = False;
|
||||
URL = URL + Delimiter + "ranges =" + Cell;
|
||||
First = False;
|
||||
EndDo;
|
||||
Else
|
||||
URL = URL + "?ranges='" + Sheet + "'";
|
||||
URL = URL + "?ranges ='" + Sheet + "'";
|
||||
EndIf;
|
||||
|
||||
Response = OPI_Tools.Get(URL, , Headers);
|
||||
@@ -363,7 +363,7 @@ Function CreateSheet(Val Name)
|
||||
OPI_TypeConversion.GetLine(Name);
|
||||
|
||||
SheetProperties = New Structure("title" , Name);
|
||||
Sheet = New Structure("properties", SheetProperties);
|
||||
Sheet = New Structure("properties", SheetProperties);
|
||||
|
||||
Return Sheet;
|
||||
|
||||
@@ -378,19 +378,19 @@ Function FormCellDataArray(Val ValueStructure, Val MajorDimension, Val Sheet)
|
||||
For Each CellData In ValueStructure Do
|
||||
|
||||
CurrentValue = CellData.Value;
|
||||
CurrentKey = CellData.Key;
|
||||
CurrentKey = CellData.Key;
|
||||
|
||||
AddSheetName(CurrentKey, Sheet);
|
||||
|
||||
OPI_TypeConversion.GetArray(CurrentValue);
|
||||
|
||||
CurrentData = New Map;
|
||||
CurrentData = New Map;
|
||||
CurrentArray = New Array;
|
||||
|
||||
CurrentArray.Add(CurrentValue);
|
||||
|
||||
OPI_Tools.AddField("range" , CurrentKey , "String", CurrentData);
|
||||
OPI_Tools.AddField("values" , CurrentArray , "Array", CurrentData);
|
||||
OPI_Tools.AddField("range" , CurrentKey , "String", CurrentData);
|
||||
OPI_Tools.AddField("values" , CurrentArray , "Array" , CurrentData);
|
||||
OPI_Tools.AddField("majorDimension", MajorDimension, "String", CurrentData);
|
||||
|
||||
DataArray.Add(CurrentData);
|
||||
|
@@ -64,10 +64,10 @@ Function FormCodeRetrievalLink(Val ClientID
|
||||
|
||||
URLParameters = New Structure;
|
||||
URLParameters.Insert("response_type", "code");
|
||||
URLParameters.Insert("client_id" , ClientID);
|
||||
URLParameters.Insert("client_id" , ClientID);
|
||||
URLParameters.Insert("redirect_uri" , "http://localhost");
|
||||
URLParameters.Insert("access_type" , "offline");
|
||||
URLParameters.Insert("scope" , GetPermissionsList(Calendar, Drive, Sheets));
|
||||
URLParameters.Insert("access_type" , "offline");
|
||||
URLParameters.Insert("scope" , GetPermissionsList(Calendar, Drive, Sheets));
|
||||
|
||||
URL = URL + OPI_Tools.RequestParametersToString(URLParameters);
|
||||
|
||||
@@ -94,11 +94,11 @@ Function GetTokenByCode(Val ClientID, Val ClientSecret, Val Code) Export
|
||||
URL = "https://accounts.google.com/o/oauth2/token";
|
||||
|
||||
URLParameters = New Structure;
|
||||
URLParameters.Insert("grant_type" , "authorization_code");
|
||||
URLParameters.Insert("client_id" , ClientID);
|
||||
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);
|
||||
URLParameters.Insert("code" , Code);
|
||||
|
||||
Response = OPI_Tools.Post(URL, URLParameters, , False);
|
||||
|
||||
@@ -125,8 +125,8 @@ Function RefreshToken(Val ClientID, Val ClientSecret, Val RefreshToken) Export
|
||||
URL = "https://accounts.google.com/o/oauth2/token";
|
||||
|
||||
URLParameters = New Structure;
|
||||
URLParameters.Insert("grant_type" , "refresh_token");
|
||||
URLParameters.Insert("client_id" , ClientID);
|
||||
URLParameters.Insert("grant_type" , "refresh_token");
|
||||
URLParameters.Insert("client_id" , ClientID);
|
||||
URLParameters.Insert("client_secret", ClientSecret);
|
||||
URLParameters.Insert("refresh_token", RefreshToken);
|
||||
|
||||
|
@@ -59,7 +59,7 @@ Function CreatePage(Val Token, Val Parent, Val Title) Export
|
||||
OPI_TypeConversion.GetLine(Parent);
|
||||
OPI_TypeConversion.GetLine(Title);
|
||||
|
||||
Headers = CreateRequestHeaders(Token);
|
||||
Headers = CreateRequestHeaders(Token);
|
||||
Properties = New Structure;
|
||||
Parameters = New Structure;
|
||||
|
||||
@@ -90,7 +90,7 @@ Function CreatePageInDatabase(Val Token, Val Parent, Val Data) Export
|
||||
OPI_TypeConversion.GetLine(Parent);
|
||||
OPI_TypeConversion.GetCollection(Data);
|
||||
|
||||
Headers = CreateRequestHeaders(Token);
|
||||
Headers = CreateRequestHeaders(Token);
|
||||
Parameters = New Structure;
|
||||
|
||||
AddPageParent(Parent, True, Parameters);
|
||||
@@ -154,15 +154,15 @@ Function EditPageProperties(Val Token
|
||||
OPI_TypeConversion.GetBoolean(Archived);
|
||||
OPI_TypeConversion.GetCollection(Data);
|
||||
|
||||
Headers = CreateRequestHeaders(Token);
|
||||
Headers = CreateRequestHeaders(Token);
|
||||
Parameters = New Structure;
|
||||
Files = "files";
|
||||
Files = "files";
|
||||
|
||||
If ValueIsFilled(Data)
|
||||
And (TypeOf(Data) = Type("Map") Or TypeOf(Data) = Type("Structure")) Then
|
||||
Properties = FillDataBySchema(Page, Data, Token, False);
|
||||
Properties = FillDataBySchema(Page, Data, Token, False);
|
||||
Else
|
||||
Properties = New Map;
|
||||
Properties = New Map;
|
||||
EndIf;
|
||||
|
||||
If ValueIsFilled(Icon) Then
|
||||
@@ -188,7 +188,7 @@ Function EditPageProperties(Val Token
|
||||
EndIf;
|
||||
|
||||
Parameters.Insert("properties", Properties);
|
||||
Parameters.Insert("archived" , Archived);
|
||||
Parameters.Insert("archived" , Archived);
|
||||
|
||||
ConvertID(Page);
|
||||
|
||||
@@ -235,10 +235,10 @@ Function CreateDatabase(Val Token, Val Parent, Val Title, Val Properties = "") E
|
||||
// All pages created as children must have parent base properties
|
||||
|
||||
If Not TypeOf(Properties) = Type("Structure") And Not TypeOf(Properties) = Type("Map") Then
|
||||
Properties = New Structure("Name", "title");
|
||||
Properties = New Structure("Name", "title");
|
||||
EndIf;
|
||||
|
||||
Headers = CreateRequestHeaders(Token);
|
||||
Headers = CreateRequestHeaders(Token);
|
||||
Parameters = New Structure;
|
||||
|
||||
AddDatabaseParent(Parent, False, Parameters);
|
||||
@@ -295,7 +295,7 @@ Function EditDatabaseProperties(Val Token, Val Base, Val Properties = "", Val Ti
|
||||
OPI_TypeConversion.GetCollection(Properties);
|
||||
|
||||
Parameters = New Structure;
|
||||
Headers = CreateRequestHeaders(Token);
|
||||
Headers = CreateRequestHeaders(Token);
|
||||
ConvertID(Base);
|
||||
|
||||
If ValueIsFilled(Title) Then
|
||||
@@ -339,7 +339,7 @@ Function CreateBlock(Val Token, Val Parent, Val Block, Val InsertAfter = "") Exp
|
||||
OPI_TypeConversion.GetCollection(Block);
|
||||
|
||||
If TypeOf(Block) = Type("Array") Then
|
||||
Block = Block[0];
|
||||
Block = Block[0];
|
||||
EndIf;
|
||||
|
||||
Headers = CreateRequestHeaders(Token);
|
||||
@@ -347,7 +347,7 @@ Function CreateBlock(Val Token, Val Parent, Val Block, Val InsertAfter = "") Exp
|
||||
|
||||
If TypeOf(Block) = Type("String") Then
|
||||
ConvertID(Block);
|
||||
Block = ReturnBlock(Token, Block);
|
||||
Block = ReturnBlock(Token, Block);
|
||||
EndIf;
|
||||
|
||||
BlockArray = New Array;
|
||||
@@ -360,7 +360,7 @@ Function CreateBlock(Val Token, Val Parent, Val Block, Val InsertAfter = "") Exp
|
||||
Parameters.Insert("after", InsertAfter);
|
||||
EndIf;
|
||||
|
||||
URL = "https://api.notion.com/v1/blocks/" + Parent + "/children";
|
||||
URL = "https://api.notion.com/v1/blocks/" + Parent + "/children";
|
||||
Response = OPI_Tools.Patch(URL, Parameters, Headers);
|
||||
|
||||
Return Response;
|
||||
@@ -385,7 +385,7 @@ Function ReturnBlock(Val Token, Val BlockID, Val OnlyBase = True) Export
|
||||
|
||||
ConvertID(BlockID);
|
||||
|
||||
Headers = CreateRequestHeaders(Token);
|
||||
Headers = CreateRequestHeaders(Token);
|
||||
Response = OPI_Tools.Get("https://api.notion.com/v1/blocks/" + BlockID, , Headers);
|
||||
|
||||
If OnlyBase Then
|
||||
@@ -412,7 +412,7 @@ Function ReturnChildBlocks(Val Token, Val BlockID) Export
|
||||
|
||||
ConvertID(BlockID);
|
||||
|
||||
Headers = CreateRequestHeaders(Token);
|
||||
Headers = CreateRequestHeaders(Token);
|
||||
Response = OPI_Tools.Get("https://api.notion.com/v1/blocks/" + BlockID + "/children", , Headers);
|
||||
|
||||
Return Response;
|
||||
@@ -435,7 +435,7 @@ Function DeleteBlock(Val Token, Val BlockID) Export
|
||||
|
||||
ConvertID(BlockID);
|
||||
|
||||
Headers = CreateRequestHeaders(Token);
|
||||
Headers = CreateRequestHeaders(Token);
|
||||
Response = OPI_Tools.Delete("https://api.notion.com/v1/blocks/" + BlockID, , Headers);
|
||||
|
||||
Return Response;
|
||||
@@ -458,7 +458,7 @@ Function UserList(Val Token) Export
|
||||
|
||||
OPI_TypeConversion.GetLine(Token);
|
||||
|
||||
Headers = CreateRequestHeaders(Token);
|
||||
Headers = CreateRequestHeaders(Token);
|
||||
Response = OPI_Tools.Get("https://api.notion.com/v1/users", , Headers);
|
||||
|
||||
Return Response;
|
||||
@@ -481,7 +481,7 @@ Function GetUserData(Val Token, Val UserID) Export
|
||||
|
||||
ConvertID(UserID);
|
||||
|
||||
Headers = CreateRequestHeaders(Token);
|
||||
Headers = CreateRequestHeaders(Token);
|
||||
Response = OPI_Tools.Get("https://api.notion.com/v1/users/" + UserID, , Headers);
|
||||
|
||||
Return Response;
|
||||
@@ -536,7 +536,7 @@ Procedure AddDatabaseParent(Val Parent, Val ParentBase, MainStructure)
|
||||
IdentifierField = ?(ParentBase, "database_id", "page_id");
|
||||
|
||||
ParentStructure = New Structure();
|
||||
ParentStructure.Insert("type" , IdentifierField);
|
||||
ParentStructure.Insert("type" , IdentifierField);
|
||||
ParentStructure.Insert(IdentifierField, Parent);
|
||||
|
||||
MainStructure.Insert("parent", ParentStructure);
|
||||
@@ -548,22 +548,22 @@ Procedure AddPageHeader(Val Title, MainStructure)
|
||||
OPI_TypeConversion.GetLine(Title);
|
||||
|
||||
SubordinateStructure = New Structure;
|
||||
DataStructure = New Structure;
|
||||
TextStructure = New Structure;
|
||||
DataArray = New Array;
|
||||
DataStructure = New Structure;
|
||||
TextStructure = New Structure;
|
||||
DataArray = New Array;
|
||||
Title = "title";
|
||||
|
||||
TextStructure.Insert("content", Title);
|
||||
TextStructure.Insert("link" , Undefined);
|
||||
TextStructure.Insert("link" , Undefined);
|
||||
|
||||
DataStructure.Insert("text", TextStructure);
|
||||
DataStructure.Insert("type", "text");
|
||||
|
||||
DataArray.Add(DataStructure);
|
||||
|
||||
SubordinateStructure.Insert("id" , Title);
|
||||
SubordinateStructure.Insert("id" , Title);
|
||||
SubordinateStructure.Insert("type" , Title);
|
||||
SubordinateStructure.Insert(Title , DataArray);
|
||||
SubordinateStructure.Insert(Title , DataArray);
|
||||
|
||||
MainStructure.Insert(Title, SubordinateStructure);
|
||||
|
||||
@@ -602,7 +602,7 @@ Procedure AddDatabaseProperties(Val Properties, MainStructure)
|
||||
|
||||
ParameterMap.Insert(Property.Key, New Structure(Property.Value, New Structure));
|
||||
|
||||
ElsIf TypeOf(Property.Value) = Type("Structure")
|
||||
ElsIf TypeOf(Property.Value) = Type("Structure")
|
||||
Or TypeOf(Property.Value) = Type("Map") Then
|
||||
|
||||
ValueSelection = FormSelectionValues(Property.Value);
|
||||
@@ -705,7 +705,7 @@ EndProcedure
|
||||
|
||||
Function ConvertValueByType(Val Type, Val Value)
|
||||
|
||||
If Type = "title" Then
|
||||
If Type = "title" Then
|
||||
Return ConvertHeader(Value);
|
||||
ElsIf Type = "rich_text" Then
|
||||
Return ConvertText(Value);
|
||||
@@ -743,10 +743,10 @@ Function ConvertHeader(Val Title)
|
||||
|
||||
DataStructure = New Structure;
|
||||
TextStructure = New Structure;
|
||||
DataArray = New Array;
|
||||
DataArray = New Array;
|
||||
|
||||
TextStructure.Insert("content", Title);
|
||||
TextStructure.Insert("link" , Undefined);
|
||||
TextStructure.Insert("link" , Undefined);
|
||||
|
||||
DataStructure.Insert("type", "text");
|
||||
DataStructure.Insert("text", TextStructure);
|
||||
@@ -759,7 +759,7 @@ EndFunction
|
||||
|
||||
Function ConvertText(Val Text)
|
||||
|
||||
TextArray = New Array;
|
||||
TextArray = New Array;
|
||||
TextStructure = New Structure;
|
||||
|
||||
TextStructure.Insert("type", "text");
|
||||
@@ -809,7 +809,7 @@ Function ConvertDate(Val Date)
|
||||
|
||||
DateStructure = New Structure;
|
||||
|
||||
If Date = BegOfDay(Date) Then
|
||||
If Date = BegOfDay(Date) Then
|
||||
DateFormat = "DF=yyyy-MM-dd";
|
||||
Else
|
||||
DateFormat = "ISO8601Datetime";
|
||||
@@ -834,9 +834,9 @@ EndFunction
|
||||
Function ConvertUsers(Val IDArray)
|
||||
|
||||
If Not TypeOf(IDArray) = Type("Array") Then
|
||||
ArrayID_ = New Array;
|
||||
ArrayID_ = New Array;
|
||||
ArrayID_.Add(IDArray);
|
||||
IDArray = ArrayID_;
|
||||
IDArray = ArrayID_;
|
||||
EndIf;
|
||||
|
||||
ArrayOfUsers = New Array;
|
||||
@@ -845,7 +845,7 @@ Function ConvertUsers(Val IDArray)
|
||||
|
||||
UserStructure = New Structure;
|
||||
UserStructure.Insert("object", "user");
|
||||
UserStructure.Insert("id" , Identifier);
|
||||
UserStructure.Insert("id" , Identifier);
|
||||
ArrayOfUsers.Add(UserStructure);
|
||||
|
||||
EndDo;
|
||||
@@ -861,8 +861,8 @@ Function ConvertFiles(Val FileMapping)
|
||||
For Each File In FileMapping Do
|
||||
|
||||
FileStructure = New Structure;
|
||||
FileStructure.Insert("type" , "external");
|
||||
FileStructure.Insert("name" , File.Key);
|
||||
FileStructure.Insert("type" , "external");
|
||||
FileStructure.Insert("name" , File.Key);
|
||||
FileStructure.Insert("external", New Structure("url", File.Value));
|
||||
|
||||
ArrayOfFiles.Add(FileStructure);
|
||||
|
@@ -51,7 +51,7 @@
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function GetBotInformation(Val Token) Export
|
||||
|
||||
URL = "https://slack.com/api/auth.test";
|
||||
URL = "https://slack.com/api/auth.test";
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
|
||||
Response = OPI_Tools.Get(URL, , Headers);
|
||||
@@ -71,7 +71,7 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function GetWorkspaceList(Val Token, Val Cursor = "") Export
|
||||
|
||||
URL = "https://slack.com/api/auth.teams.list";
|
||||
URL = "https://slack.com/api/auth.teams.list";
|
||||
Response = GeneralDataRetrieval(Token, URL, Cursor);
|
||||
|
||||
Return Response;
|
||||
@@ -89,7 +89,7 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function GetUserList(Val Token, Val Cursor = "") Export
|
||||
|
||||
URL = "https://slack.com/api/users.list";
|
||||
URL = "https://slack.com/api/users.list";
|
||||
Response = GeneralDataRetrieval(Token, URL, Cursor);
|
||||
|
||||
Return Response;
|
||||
@@ -133,8 +133,8 @@ Function SendMessage(Val Token, Val Channel, Val Text = "", Val SendingDate = ""
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("channel", Channel, String_ , Parameters);
|
||||
OPI_Tools.AddField("text" , Text, String_ , Parameters);
|
||||
OPI_Tools.AddField("blocks" , Blocks, "Array" , Parameters);
|
||||
OPI_Tools.AddField("text" , Text , String_ , Parameters);
|
||||
OPI_Tools.AddField("blocks" , Blocks , "Array" , Parameters);
|
||||
|
||||
If HasDate Then
|
||||
|
||||
@@ -181,10 +181,10 @@ Function SendEphemeralMessage(Val Token
|
||||
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);
|
||||
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";
|
||||
|
||||
@@ -209,13 +209,13 @@ EndFunction
|
||||
Function EditMessage(Val Token, Val Channel, Val Timestamp, Val Text = "", Val BlockArray = "") Export
|
||||
|
||||
String_ = "String";
|
||||
URL = "https://slack.com/api/chat.update";
|
||||
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("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);
|
||||
@@ -242,15 +242,15 @@ Function DeleteMessage(Val Token, Val Channel, Val Timestamp, Val IsDelayed = Fa
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
|
||||
If IsDelayed Then
|
||||
URL = "https://slack.com/api/chat.deleteScheduledMessage";
|
||||
URL = "https://slack.com/api/chat.deleteScheduledMessage";
|
||||
TimestampField = "scheduled_message_id";
|
||||
Else
|
||||
URL = "https://slack.com/api/chat.delete";
|
||||
URL = "https://slack.com/api/chat.delete";
|
||||
TimestampField = "ts";
|
||||
EndIf;
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("channel" , Channel , "String", Parameters);
|
||||
OPI_Tools.AddField("channel" , Channel , "String", Parameters);
|
||||
OPI_Tools.AddField(TimestampField, Timestamp, "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
@@ -271,12 +271,12 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function GetDelayedMessageList(Val Token, Val Channel, Val Cursor = "") Export
|
||||
|
||||
URL = "https://slack.com/api/chat.scheduledMessages.list";
|
||||
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);
|
||||
OPI_Tools.AddField("cursor" , Cursor , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
|
||||
@@ -296,11 +296,11 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function GetMessageLink(Val Token, Val Channel, Val Timestamp) Export
|
||||
|
||||
URL = "https://slack.com/api/chat.getPermalink";
|
||||
URL = "https://slack.com/api/chat.getPermalink";
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("channel" , Channel , "String", Parameters);
|
||||
OPI_Tools.AddField("channel" , Channel , "String", Parameters);
|
||||
OPI_Tools.AddField("message_ts", Timestamp, "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Get(URL, Parameters, Headers);
|
||||
@@ -323,13 +323,13 @@ EndFunction
|
||||
Function GetMessageReplyList(Val Token, Val Channel, Val Timestamp, Val Cursor = "") Export
|
||||
|
||||
String_ = "String";
|
||||
URL = "https://slack.com/api/conversations.replies";
|
||||
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);
|
||||
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);
|
||||
|
||||
@@ -353,12 +353,12 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function GetChannelList(Val Token, Val ExcludeArchived = False, Val Cursor = "") Export
|
||||
|
||||
URL = "https://slack.com/api/conversations.list";
|
||||
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);
|
||||
OPI_Tools.AddField("cursor" , Cursor , "String" , Parameters);
|
||||
|
||||
Response = OPI_Tools.Get(URL, Parameters, Headers);
|
||||
|
||||
@@ -378,12 +378,12 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function GetChannelUserList(Val Token, Val Channel, Val Cursor = "") Export
|
||||
|
||||
URL = "https://slack.com/api/conversations.members";
|
||||
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);
|
||||
OPI_Tools.AddField("cursor" , Cursor , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Get(URL, Parameters, Headers);
|
||||
|
||||
@@ -403,11 +403,11 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function CreateChannel(Val Token, Val Name, Val Private = False) Export
|
||||
|
||||
URL = "https://slack.com/api/conversations.create";
|
||||
URL = "https://slack.com/api/conversations.create";
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("name" , Name , "String", Parameters);
|
||||
OPI_Tools.AddField("name" , Name , "String" , Parameters);
|
||||
OPI_Tools.AddField("is_private", Private, "Boolean", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
@@ -427,7 +427,7 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function ArchiveChannel(Val Token, Val Channel) Export
|
||||
|
||||
URL = "https://slack.com/api/conversations.archive";
|
||||
URL = "https://slack.com/api/conversations.archive";
|
||||
Response = DialogManagement(Token, Channel, URL);
|
||||
Return Response;
|
||||
|
||||
@@ -444,7 +444,7 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function GetChannel(Val Token, Val Channel) Export
|
||||
|
||||
URL = "https://slack.com/api/conversations.info";
|
||||
URL = "https://slack.com/api/conversations.info";
|
||||
Response = DialogManagement(Token, Channel, URL, "GET");
|
||||
Return Response;
|
||||
|
||||
@@ -461,7 +461,7 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function GetChannelHistory(Val Token, Val Channel) Export
|
||||
|
||||
URL = "https://slack.com/api/conversations.history";
|
||||
URL = "https://slack.com/api/conversations.history";
|
||||
Response = DialogManagement(Token, Channel, URL, "GET");
|
||||
Return Response;
|
||||
|
||||
@@ -479,15 +479,15 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function InviteUsersToChannel(Val Token, Val Channel, Val ArrayOfUsers) Export
|
||||
|
||||
URL = "https://slack.com/api/conversations.invite";
|
||||
URL = "https://slack.com/api/conversations.invite";
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
|
||||
OPI_TypeConversion.GetCollection(ArrayOfUsers);
|
||||
ArrayOfUsers = StrConcat(ArrayOfUsers, ",");
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("channel", Channel , "String", Parameters);
|
||||
OPI_Tools.AddField("users" , ArrayOfUsers, "String", Parameters);
|
||||
OPI_Tools.AddField("channel", Channel , "String", Parameters);
|
||||
OPI_Tools.AddField("users" , ArrayOfUsers, "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
|
||||
@@ -507,12 +507,12 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function KickUserFromChannel(Val Token, Val Channel, Val User) Export
|
||||
|
||||
URL = "https://slack.com/api/conversations.kick";
|
||||
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);
|
||||
OPI_Tools.AddField("user" , User , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
|
||||
@@ -531,7 +531,7 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function JoinChannel(Val Token, Val Channel) Export
|
||||
|
||||
URL = "https://slack.com/api/conversations.join";
|
||||
URL = "https://slack.com/api/conversations.join";
|
||||
Response = DialogManagement(Token, Channel, URL);
|
||||
Return Response;
|
||||
|
||||
@@ -548,7 +548,7 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function LeaveChannel(Val Token, Val Channel) Export
|
||||
|
||||
URL = "https://slack.com/api/conversations.leave";
|
||||
URL = "https://slack.com/api/conversations.leave";
|
||||
Response = DialogManagement(Token, Channel, URL);
|
||||
Return Response;
|
||||
|
||||
@@ -566,12 +566,12 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function SetChannelTopic(Val Token, Val Channel, Val Topic) Export
|
||||
|
||||
URL = "https://slack.com/api/conversations.setTopic";
|
||||
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);
|
||||
OPI_Tools.AddField("topic" , Topic , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
|
||||
@@ -591,7 +591,7 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function SetChannelGoal(Val Token, Val Channel, Val Purpose) Export
|
||||
|
||||
URL = "https://slack.com/api/conversations.setPurpose";
|
||||
URL = "https://slack.com/api/conversations.setPurpose";
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
|
||||
Parameters = New Structure;
|
||||
@@ -616,12 +616,12 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function RenameChannel(Val Token, Val Channel, Val Name) Export
|
||||
|
||||
URL = "https://slack.com/api/conversations.rename";
|
||||
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);
|
||||
OPI_Tools.AddField("name" , Name , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
|
||||
@@ -644,7 +644,7 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function OpenDialog(Val Token, Val ArrayOfUsers) Export
|
||||
|
||||
URL = "https://slack.com/api/conversations.open";
|
||||
URL = "https://slack.com/api/conversations.open";
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
|
||||
OPI_TypeConversion.GetCollection(ArrayOfUsers);
|
||||
@@ -670,7 +670,7 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function CloseDialog(Val Token, Val Dialog) Export
|
||||
|
||||
URL = "https://slack.com/api/conversations.close";
|
||||
URL = "https://slack.com/api/conversations.close";
|
||||
Response = DialogManagement(Token, Dialog, URL);
|
||||
Return Response;
|
||||
|
||||
@@ -692,12 +692,12 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function GetFilesList(Val Token, Val Channel = "", Val PageNumber = 1) Export
|
||||
|
||||
URL = "https://slack.com/api/files.list";
|
||||
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);
|
||||
OPI_Tools.AddField("channel", Channel , "String", Parameters);
|
||||
OPI_Tools.AddField("page" , PageNumber, "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Get(URL, Parameters, Headers);
|
||||
|
||||
@@ -723,19 +723,19 @@ Function UploadFile(Val Token, Val File, Val FileName, Val Title, Val Channel =
|
||||
OPI_TypeConversion.GetLine(FileName);
|
||||
OPI_TypeConversion.GetLine(Title);
|
||||
|
||||
String_ = "String";
|
||||
String_ = "String";
|
||||
Upload_url = "upload_url";
|
||||
File_id = "file_id";
|
||||
URL = "https://slack.com/api/files.getUploadURLExternal";
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
Size = File.Size();
|
||||
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);
|
||||
OPI_Tools.AddField("length" , Size , String_, Parameters);
|
||||
|
||||
Response = OPI_Tools.Get(URL, Parameters, Headers);
|
||||
URL = Response[Upload_url];
|
||||
Response = OPI_Tools.Get(URL, Parameters, Headers);
|
||||
URL = Response[Upload_url];
|
||||
Identifier = Response[File_id];
|
||||
|
||||
If Not ValueIsFilled(URL) Or Not ValueIsFilled(Identifier) Then
|
||||
@@ -745,14 +745,14 @@ Function UploadFile(Val Token, Val File, Val FileName, Val Title, Val Channel =
|
||||
Files = New Map;
|
||||
Files.Insert(FileName, File);
|
||||
|
||||
Response = OPI_Tools.PostMultipart(URL, , Files, , Headers);
|
||||
URL = "https://slack.com/api/files.completeUploadExternal";
|
||||
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_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);
|
||||
|
||||
@@ -771,7 +771,7 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function GetFileData(Val Token, Val FileID) Export
|
||||
|
||||
URL = "https://slack.com/api/files.info";
|
||||
URL = "https://slack.com/api/files.info";
|
||||
Response = FileManagement(Token, FileID, URL, "GET");
|
||||
|
||||
Return Response;
|
||||
@@ -789,7 +789,7 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function DeleteFile(Val Token, Val FileID) Export
|
||||
|
||||
URL = "https://slack.com/api/files.delete";
|
||||
URL = "https://slack.com/api/files.delete";
|
||||
Response = FileManagement(Token, FileID, URL);
|
||||
|
||||
Return Response;
|
||||
@@ -807,7 +807,7 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function MakeFilePublic(Val Token, Val FileID) Export
|
||||
|
||||
URL = "https://slack.com/api/files.sharedPublicURL";
|
||||
URL = "https://slack.com/api/files.sharedPublicURL";
|
||||
Response = FileManagement(Token, FileID, URL);
|
||||
|
||||
Return Response;
|
||||
@@ -825,7 +825,7 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function MakeFilePrivate(Val Token, Val FileID) Export
|
||||
|
||||
URL = "https://slack.com/api/files.revokePublicURL";
|
||||
URL = "https://slack.com/api/files.revokePublicURL";
|
||||
Response = FileManagement(Token, FileID, URL);
|
||||
|
||||
Return Response;
|
||||
@@ -848,12 +848,12 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function GetExternalFileList(Val Token, Val Channel = "", Val Cursor = "") Export
|
||||
|
||||
URL = "https://slack.com/api/files.remote.list";
|
||||
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);
|
||||
OPI_Tools.AddField("cursor" , Cursor , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Get(URL, Parameters, Headers);
|
||||
|
||||
@@ -872,7 +872,7 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function GetExternalFile(Val Token, Val FileID) Export
|
||||
|
||||
URL = "https://slack.com/api/files.remote.info";
|
||||
URL = "https://slack.com/api/files.remote.info";
|
||||
Response = ExternalFileManagement(Token, FileID, URL);
|
||||
|
||||
Return Response;
|
||||
@@ -892,14 +892,14 @@ EndFunction
|
||||
Function AddExternalFile(Val Token, Val URL, Val Title) Export
|
||||
|
||||
String_ = "String";
|
||||
URL = "https://slack.com/api/files.remote.add";
|
||||
URL = "https://slack.com/api/files.remote.add";
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
UID = String(New UUID());
|
||||
UID = String(New UUID());
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
@@ -919,14 +919,14 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function SendExternalFile(Val Token, Val FileID, Val ChannelArray) Export
|
||||
|
||||
URL = "https://slack.com/api/files.remote.share";
|
||||
URL = "https://slack.com/api/files.remote.share";
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
|
||||
OPI_TypeConversion.GetCollection(ChannelArray);
|
||||
ChannelArray = StrConcat(ChannelArray, ",");
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("file" , FileID , "String", Parameters);
|
||||
OPI_Tools.AddField("file" , FileID , "String", Parameters);
|
||||
OPI_Tools.AddField("channels", ChannelArray , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Get(URL, Parameters, Headers);
|
||||
@@ -946,7 +946,7 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function DeleteExternalFile(Val Token, Val FileID) Export
|
||||
|
||||
URL = "https://slack.com/api/files.remote.remove";
|
||||
URL = "https://slack.com/api/files.remote.remove";
|
||||
Response = ExternalFileManagement(Token, FileID, URL);
|
||||
|
||||
Return Response;
|
||||
@@ -971,8 +971,8 @@ Function GenerateImageBlock(Val URL, Val AlternateText = "") Export
|
||||
String_ = "String";
|
||||
|
||||
Block = New Map;
|
||||
OPI_Tools.AddField("type" , "image" , String_, Block);
|
||||
OPI_Tools.AddField("image_url", URL , String_, Block);
|
||||
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;
|
||||
@@ -997,16 +997,16 @@ EndFunction
|
||||
|
||||
Function DialogManagement(Val Token, Val Channel, Val URL, Val RequestType = "POST")
|
||||
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
RequestType = Upper(RequestType);
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("channel", Channel, "String", Parameters);
|
||||
|
||||
If RequestType = "POST" Then
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
Else
|
||||
Response = OPI_Tools.Get(URL, Parameters, Headers);
|
||||
Response = OPI_Tools.Get(URL, Parameters, Headers);
|
||||
EndIf;
|
||||
|
||||
Return Response;
|
||||
@@ -1015,16 +1015,16 @@ EndFunction
|
||||
|
||||
Function FileManagement(Val Token, Val FileID, Val URL, Val RequestType = "POST")
|
||||
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
RequestType = Upper(RequestType);
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("file", FileID , "String", Parameters);
|
||||
|
||||
If RequestType = "POST" Then
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
Else
|
||||
Response = OPI_Tools.Get(URL, Parameters, Headers);
|
||||
Response = OPI_Tools.Get(URL, Parameters, Headers);
|
||||
EndIf;
|
||||
|
||||
Return Response;
|
||||
|
@@ -57,7 +57,7 @@ Function GetBotInformation(Val Token) Export
|
||||
|
||||
OPI_TypeConversion.GetLine(Token);
|
||||
|
||||
URL = "api.telegram.org/bot" + Token + "/getMe";
|
||||
URL = "api.telegram.org/bot" + Token + "/getMe";
|
||||
Response = OPI_Tools.Get(URL);
|
||||
|
||||
Return Response;
|
||||
@@ -82,7 +82,7 @@ Function GetUpdates(Val Token, Val Timeout = 0, Val Offset = "") Export
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("timeout", Timeout , "String", Parameters);
|
||||
OPI_Tools.AddField("offset" , Offset, "String", Parameters);
|
||||
OPI_Tools.AddField("offset" , Offset , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Get(URL, Parameters);
|
||||
Return Response;
|
||||
@@ -105,7 +105,7 @@ Function SetWebhook(Val Token, Val URL) Export
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("url", URL, "String", Parameters);
|
||||
|
||||
URL = "api.telegram.org/bot" + Token + "/setWebHook";
|
||||
URL = "api.telegram.org/bot" + Token + "/setWebHook";
|
||||
Response = OPI_Tools.Get(URL, Parameters);
|
||||
|
||||
Return Response;
|
||||
@@ -124,7 +124,7 @@ Function DeleteWebhook(Val Token) Export
|
||||
|
||||
OPI_TypeConversion.GetLine(Token);
|
||||
|
||||
URL = "api.telegram.org/bot" + Token + "/deleteWebHook";
|
||||
URL = "api.telegram.org/bot" + Token + "/deleteWebHook";
|
||||
Response = OPI_Tools.Get(URL);
|
||||
|
||||
Return Response;
|
||||
@@ -149,7 +149,7 @@ Function DownloadFile(Val Token, Val FileID) Export
|
||||
|
||||
Parameters = New Structure("file_id", FileID);
|
||||
|
||||
URL = "api.telegram.org/bot" + Token + "/getFile";
|
||||
URL = "api.telegram.org/bot" + Token + "/getFile";
|
||||
Response = OPI_Tools.Get(URL, Parameters);
|
||||
|
||||
Path = Response[Result]["file_path"];
|
||||
@@ -158,7 +158,7 @@ Function DownloadFile(Val Token, Val FileID) Export
|
||||
Return Response;
|
||||
EndIf;
|
||||
|
||||
URL = "api.telegram.org/file/bot" + Token + "/" + Path;
|
||||
URL = "api.telegram.org/file/bot" + Token + "/" + Path;
|
||||
Response = OPI_Tools.Get(URL, Parameters);
|
||||
|
||||
Return Response;
|
||||
@@ -179,11 +179,11 @@ Function ProcessTMAData(Val DataString, Val Token) Export
|
||||
OPI_TypeConversion.GetLine(Token);
|
||||
OPI_TypeConversion.GetLine(DataString);
|
||||
|
||||
DataString = DecodeString(DataString, StringEncodingMethod.URLencoding);
|
||||
DataString = DecodeString(DataString, StringEncodingMethod.URLencoding);
|
||||
DataStructure = OPI_Tools.RequestParametersToMap(DataString);
|
||||
KeyString = "WebAppData";
|
||||
Hash = "";
|
||||
BinaryKey = GetBinaryDataFromString(KeyString);
|
||||
KeyString = "WebAppData";
|
||||
Hash = "";
|
||||
BinaryKey = GetBinaryDataFromString(KeyString);
|
||||
|
||||
Result = OPI_Cryptography.HMACSHA256(BinaryKey, GetBinaryDataFromString(Token));
|
||||
|
||||
@@ -193,8 +193,8 @@ Function ProcessTMAData(Val DataString, Val Token) Export
|
||||
|
||||
For Each Data In DataStructure Do
|
||||
|
||||
NewLine = TValue.Add();
|
||||
NewLine.Key = Data.Key;
|
||||
NewLine = TValue.Add();
|
||||
NewLine.Key = Data.Key;
|
||||
NewLine.Value = Data.Value;
|
||||
|
||||
EndDo;
|
||||
@@ -202,12 +202,12 @@ Function ProcessTMAData(Val DataString, Val Token) Export
|
||||
TValue.Sort("Key");
|
||||
|
||||
ReturnMapping = New Map;
|
||||
DCS = "";
|
||||
DCS = "";
|
||||
|
||||
For Each DataString In TValue Do
|
||||
|
||||
If DataString.Key <> "hash" Then
|
||||
DCS = DCS + DataString.Key + "=" + DataString.Value + Chars.LF;
|
||||
DCS = DCS + DataString.Key + " =" + DataString.Value + Chars.LF;
|
||||
ReturnMapping.Insert(DataString.Key, DataString.Value);
|
||||
Else
|
||||
Hash = DataString.Value;
|
||||
@@ -215,12 +215,12 @@ Function ProcessTMAData(Val DataString, Val Token) Export
|
||||
|
||||
EndDo;
|
||||
|
||||
DCS = Left(DCS, StrLen(DCS) - 1);
|
||||
DCS = Left(DCS, StrLen(DCS) - 1);
|
||||
Signature = OPI_Cryptography.HMACSHA256(Result, GetBinaryDataFromString(DCS));
|
||||
|
||||
Final = GetHexStringFromBinaryData(Signature);
|
||||
|
||||
If Final = Upper(Hash) Then
|
||||
If Final = Upper(Hash) Then
|
||||
Response = True;
|
||||
Else
|
||||
Response = False;
|
||||
@@ -262,14 +262,14 @@ Function SendTextMessage(Val Token
|
||||
String_ = "String";
|
||||
|
||||
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);
|
||||
OPI_Tools.AddField("reply_to_message_id", RepliedID, String_ , Parameters);
|
||||
OPI_Tools.AddField("parse_mode" , Markup , String_ , Parameters);
|
||||
OPI_Tools.AddField("text" , Text , String_ , Parameters);
|
||||
OPI_Tools.AddField("reply_markup" , Keyboard , "FileString", Parameters);
|
||||
OPI_Tools.AddField("reply_to_message_id", RepliedID, String_ , Parameters);
|
||||
|
||||
AddChatIdentifier(ChatID, Parameters);
|
||||
|
||||
URL = "api.telegram.org/bot" + Token + "/sendMessage";
|
||||
URL = "api.telegram.org/bot" + Token + "/sendMessage";
|
||||
Response = OPI_Tools.Get(URL, Parameters);
|
||||
|
||||
Return Response;
|
||||
@@ -434,16 +434,16 @@ Function SendMediaGroup(Val Token
|
||||
|
||||
OPI_Tools.ReplaceSpecialCharacters(Text, Markup);
|
||||
|
||||
URL = "api.telegram.org/bot" + Token + "/sendMediaGroup";
|
||||
Media = New Array;
|
||||
URL = "api.telegram.org/bot" + Token + "/sendMediaGroup";
|
||||
Media = New Array;
|
||||
Parameters = New Structure;
|
||||
|
||||
AddChatIdentifier(ChatID, Parameters);
|
||||
ConvertFilesToMedia(FileMapping, Text, 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("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, FileMapping, "mixed");
|
||||
@@ -473,10 +473,10 @@ Function SendLocation(Val Token, Val ChatID, Val Latitude, Val Longitude, Val Ke
|
||||
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);
|
||||
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);
|
||||
|
||||
@@ -508,11 +508,11 @@ Function SendContact(Val Token, Val ChatID, Val Name, Val LastName, Val Phone, V
|
||||
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" , LastName , String_ , Parameters);
|
||||
OPI_Tools.AddField("phone_number", Phone , String_ , Parameters);
|
||||
OPI_Tools.AddField("reply_markup", Keyboard, "FileString", Parameters);
|
||||
OPI_Tools.AddField("parse_mode" , "Markdown", String_ , Parameters);
|
||||
OPI_Tools.AddField("first_name" , Name , String_ , Parameters);
|
||||
OPI_Tools.AddField("last_name" , LastName , String_ , Parameters);
|
||||
OPI_Tools.AddField("phone_number", Phone , String_ , Parameters);
|
||||
OPI_Tools.AddField("reply_markup", Keyboard , "FileString", Parameters);
|
||||
|
||||
AddChatIdentifier(ChatID, Parameters);
|
||||
|
||||
@@ -545,9 +545,9 @@ Function SendPoll(Val Token, Val ChatID, Val Question, Val AnswersArray, Val Ano
|
||||
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);
|
||||
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);
|
||||
@@ -579,8 +579,8 @@ Function ForwardMessage(Val Token, Val OriginalID, Val FromID, Val ToID) Export
|
||||
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_Tools.AddField("from_chat_id", FromID , "String", Parameters);
|
||||
OPI_Tools.AddField("message_id" , OriginalID, "String", Parameters);
|
||||
|
||||
AddChatIdentifier(ToID, Parameters);
|
||||
|
||||
@@ -615,7 +615,7 @@ Function FormKeyboardFromButtonArray(Val ButtonArray
|
||||
EndIf;
|
||||
|
||||
If UnderMessage Then
|
||||
ParameterStructure = New Structure("inline_keyboard,rows", Strings, 1);
|
||||
ParameterStructure = New Structure("inline_keyboard,rows" , Strings, 1);
|
||||
Else
|
||||
ParameterStructure = New Structure("keyboard,resize_keyboard", Strings, True);
|
||||
EndIf;
|
||||
@@ -649,8 +649,8 @@ Function Ban(Val Token, Val ChatID, Val UserID) Export
|
||||
|
||||
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("chat_id" , ChatID , String_, Parameters);
|
||||
OPI_Tools.AddField("user_id" , UserID , String_, Parameters);
|
||||
|
||||
Response = OPI_Tools.Get(URL, Parameters);
|
||||
|
||||
@@ -676,10 +676,10 @@ Function Unban(Val Token, Val ChatID, Val UserID) Export
|
||||
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);
|
||||
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);
|
||||
|
||||
@@ -711,11 +711,11 @@ Function CreateInvitationLink(Val 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);
|
||||
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);
|
||||
|
||||
@@ -741,10 +741,10 @@ Function PinMessage(Val Token, Val ChatID, Val MessageID) Export
|
||||
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);
|
||||
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);
|
||||
|
||||
@@ -771,8 +771,8 @@ Function UnpinMessage(Val Token, Val ChatID, Val MessageID) Export
|
||||
|
||||
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("chat_id" , ChatID , String_, Parameters);
|
||||
OPI_Tools.AddField("message_id", MessageID , String_, Parameters);
|
||||
|
||||
Response = OPI_Tools.Get(URL, Parameters);
|
||||
|
||||
@@ -797,7 +797,7 @@ Function GetParticipantCount(Val Token, Val ChatID) Export
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("parse_mode", "Markdown" , "String", Parameters);
|
||||
OPI_Tools.AddField("chat_id" , ChatID , "String", Parameters);
|
||||
OPI_Tools.AddField("chat_id" , ChatID , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Get(URL, Parameters);
|
||||
|
||||
@@ -823,7 +823,7 @@ Function DeleteMessage(Val Token, Val ChatID, Val MessageID) Export
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("message_id", MessageID, "String", Parameters);
|
||||
OPI_Tools.AddField("chat_id" , ChatID , "String", Parameters);
|
||||
OPI_Tools.AddField("chat_id" , ChatID , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Get(URL, Parameters);
|
||||
Return Response;
|
||||
@@ -846,10 +846,10 @@ Function GetAvatarIconList(Val Token) Export
|
||||
|
||||
OPI_TypeConversion.GetLine(Token);
|
||||
|
||||
Result = "result";
|
||||
URL = "api.telegram.org/bot" + Token + "/getForumTopicIconStickers";
|
||||
Result = "result";
|
||||
URL = "api.telegram.org/bot" + Token + "/getForumTopicIconStickers";
|
||||
Response = OPI_Tools.Get(URL);
|
||||
Icons = Response[Result];
|
||||
Icons = Response[Result];
|
||||
|
||||
If Not ValueIsFilled(Icons) Then
|
||||
Return Response;
|
||||
@@ -999,7 +999,7 @@ Function EditMainForumTopicName(Val Token, Val ChatID, Val Title) Export
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("chat_id", ChatID , "String", Parameters);
|
||||
OPI_Tools.AddField("name" , Title, "String", Parameters);
|
||||
OPI_Tools.AddField("name" , Title , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Get(URL, Parameters);
|
||||
|
||||
@@ -1024,7 +1024,7 @@ Function ClearThreadPinnedMessagesList(Val Token, Val ChatID, Val ThreadID = "")
|
||||
OPI_TypeConversion.GetLine(ThreadID);
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("chat_id" , ChatID, "String", Parameters);
|
||||
OPI_Tools.AddField("chat_id" , ChatID , "String", Parameters);
|
||||
OPI_Tools.AddField("message_thread_id", ThreadID, "String", Parameters);
|
||||
|
||||
If ValueIsFilled(ThreadID) Then
|
||||
@@ -1033,7 +1033,7 @@ Function ClearThreadPinnedMessagesList(Val Token, Val ChatID, Val ThreadID = "")
|
||||
Method = "/unpinAllGeneralForumTopicMessages";
|
||||
EndIf;
|
||||
|
||||
URL = "api.telegram.org/bot" + Token + Method;
|
||||
URL = "api.telegram.org/bot" + Token + Method;
|
||||
Response = OPI_Tools.Get(URL, Parameters);
|
||||
|
||||
Return Response;
|
||||
@@ -1071,8 +1071,8 @@ Function SendFile(Val Token
|
||||
FileName = View + "|" + FileName;
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("parse_mode" , Markup , "String" , Parameters);
|
||||
OPI_Tools.AddField("caption" , Text , "String" , Parameters);
|
||||
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);
|
||||
@@ -1080,8 +1080,8 @@ Function SendFile(Val Token
|
||||
FileMapping = New Map;
|
||||
FileMapping.Insert(FileName, File);
|
||||
|
||||
Method = DetermineSendMethod(View);
|
||||
URL = "api.telegram.org/bot" + Token + Method;
|
||||
Method = DetermineSendMethod(View);
|
||||
URL = "api.telegram.org/bot" + Token + Method;
|
||||
Response = OPI_Tools.PostMultipart(URL, Parameters, FileMapping, "mixed");
|
||||
|
||||
Return Response;
|
||||
@@ -1090,18 +1090,18 @@ EndFunction
|
||||
|
||||
Function ForumTopicManagement(Val Token
|
||||
, Val ChatID
|
||||
, Val Title = Undefined
|
||||
, Val IconID = Undefined
|
||||
, 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);
|
||||
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";
|
||||
@@ -1128,10 +1128,10 @@ Function ManageForumThreadState(Val Token, Val ChatID, Val Status, Val ThreadID
|
||||
Method = DetermineForumManagementMethod(Status, Forum);
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("chat_id" , ChatID, "String", Parameters);
|
||||
OPI_Tools.AddField("chat_id" , ChatID , "String", Parameters);
|
||||
OPI_Tools.AddField("message_thread_id", ThreadID, "String", Parameters);
|
||||
|
||||
URL = "api.telegram.org/bot" + Token + Method;
|
||||
URL = "api.telegram.org/bot" + Token + Method;
|
||||
Response = OPI_Tools.Get(URL, Parameters);
|
||||
|
||||
Return Response;
|
||||
@@ -1152,7 +1152,7 @@ Function ManageMainTopicVisibility(Val Token, Val ChatID, Val Hide)
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("chat_id", ChatID, "String", Parameters);
|
||||
|
||||
URL = "api.telegram.org/bot" + Token + Method;
|
||||
URL = "api.telegram.org/bot" + Token + Method;
|
||||
Response = OPI_Tools.Get(URL, Parameters);
|
||||
|
||||
Return Response;
|
||||
@@ -1161,16 +1161,16 @@ EndFunction
|
||||
|
||||
Function DetermineForumManagementMethod(Val Status, Val Forum)
|
||||
|
||||
Open = 1;
|
||||
Close = 2;
|
||||
Open = 1;
|
||||
Close = 2;
|
||||
Delete = 3;
|
||||
|
||||
If Status = Open Then
|
||||
Method = "/reopen" + Forum + "Topic";
|
||||
If Status = Open Then
|
||||
Method = "/reopen" + Forum + "Topic";
|
||||
ElsIf Status = Close Then
|
||||
Method = "/close" + Forum + "Topic";
|
||||
Method = "/close" + Forum + "Topic";
|
||||
ElsIf Status = Delete Then
|
||||
Method = "/deleteForumTopic";
|
||||
Method = "/deleteForumTopic";
|
||||
Else
|
||||
Raise "Incorrect forum management status";
|
||||
EndIf;
|
||||
@@ -1185,7 +1185,7 @@ Function CreateTallKeyboard(Val ButtonArray)
|
||||
|
||||
For Each Button In ButtonArray Do
|
||||
Buttons = New Array;
|
||||
Button = OPI_Tools.NumberToString(Button);
|
||||
Button = OPI_Tools.NumberToString(Button);
|
||||
Buttons.Add(New Structure("text,callback_data", Button, Button));
|
||||
Strings.Add(Buttons);
|
||||
EndDo;
|
||||
@@ -1212,7 +1212,7 @@ EndFunction
|
||||
|
||||
Function DetermineSendMethod(Val View)
|
||||
|
||||
If View = "photo" Then
|
||||
If View = "photo" Then
|
||||
Method = "/sendPhoto";
|
||||
ElsIf View = "video" Then
|
||||
Method = "/sendVideo";
|
||||
@@ -1235,14 +1235,14 @@ Function ConvertFileData(File, View, Counter)
|
||||
If TypeOf(File) = Type("String") And View = "document" Then
|
||||
|
||||
CurrentFile = New File(File);
|
||||
FileName = CurrentFile.Name;
|
||||
FileName = CurrentFile.Name;
|
||||
|
||||
EndIf;
|
||||
|
||||
If Not ValueIsFilled(FileName) Then
|
||||
FileName = View + String(Counter);
|
||||
|
||||
If View = "animation" Then
|
||||
If View = "animation" Then
|
||||
FileName = FileName + ".gif";
|
||||
EndIf;
|
||||
|
||||
@@ -1290,19 +1290,19 @@ Procedure ConvertFilesToMedia(FileMapping, Text, Media)
|
||||
|
||||
EndDo;
|
||||
|
||||
Media = OPI_Tools.JSONString(Media);
|
||||
Media = OPI_Tools.JSONString(Media);
|
||||
FileMapping = TempMap;
|
||||
|
||||
EndProcedure
|
||||
|
||||
Procedure AddChatIdentifier(Val ChatID, Parameters)
|
||||
|
||||
ChatID = OPI_Tools.NumberToString(ChatID);
|
||||
ChatID = OPI_Tools.NumberToString(ChatID);
|
||||
ChatArray = StrSplit(ChatID, "*", False);
|
||||
|
||||
If ChatArray.Count() > 1 Then
|
||||
|
||||
ChatID = ChatArray[0];
|
||||
ChatID = ChatArray[0];
|
||||
ThreadID = ChatArray[1];
|
||||
|
||||
Parameters.Insert("message_thread_id", ThreadID);
|
||||
|
@@ -60,16 +60,16 @@ Function GetAuthorizationLink(Parameters = "") Export
|
||||
|
||||
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("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;
|
||||
Link = "https://twitter.com/i/oauth2/authorize" + URLParameters;
|
||||
|
||||
Return Link;
|
||||
|
||||
@@ -91,9 +91,9 @@ Function GetToken(Val Code, Val Parameters = "") Export
|
||||
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("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");
|
||||
|
||||
@@ -115,12 +115,12 @@ EndFunction
|
||||
Function RefreshToken(Val Parameters = "") Export
|
||||
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
Refresh = "refresh_token";
|
||||
Refresh = "refresh_token";
|
||||
|
||||
RequestParameters = New Structure;
|
||||
RequestParameters.Insert(Refresh , Parameters_[Refresh]);
|
||||
RequestParameters.Insert(Refresh , Parameters_[Refresh]);
|
||||
RequestParameters.Insert("grant_type" , Refresh);
|
||||
RequestParameters.Insert("client_id" , Parameters_["client_id"]);
|
||||
RequestParameters.Insert("client_id" , Parameters_["client_id"]);
|
||||
|
||||
Response = OPI_Tools.Post("https://api.twitter.com/2/oauth2/token"
|
||||
, RequestParameters, , False);
|
||||
@@ -141,7 +141,7 @@ EndFunction
|
||||
// HTTPResponse, Arbitrary, BinaryData - Result of reading the JSON response from the server
|
||||
Function HandleIncomingRequestAfterAuthorization(Request) Export
|
||||
|
||||
Code = Request.RequestParameters["code"];
|
||||
Code = Request.RequestParameters["code"];
|
||||
TokenResponse = GetToken(Code);
|
||||
|
||||
// BSLLS:CommentedCode-off
|
||||
@@ -188,9 +188,9 @@ Function CreateCustomTweet(Val Text = ""
|
||||
EndIf;
|
||||
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
URL = "https://api.twitter.com/2/tweets";
|
||||
Array = "Array";
|
||||
Fields = New Map;
|
||||
URL = "https://api.twitter.com/2/tweets";
|
||||
Array = "Array";
|
||||
Fields = New Map;
|
||||
|
||||
If ValueIsFilled(Text) Then
|
||||
Fields.Insert("text", Text);
|
||||
@@ -216,7 +216,7 @@ Function CreateCustomTweet(Val Text = ""
|
||||
EndIf;
|
||||
|
||||
Authorization = CreateAuthorizationHeaderV2(Parameters_);
|
||||
Response = OPI_Tools.Post(URL, Fields, Authorization);
|
||||
Response = OPI_Tools.Post(URL, Fields, Authorization);
|
||||
|
||||
Return Response;
|
||||
|
||||
@@ -318,9 +318,9 @@ Function UploadAttachmentsArray(Val ArrayOfFiles, Val AttachmentsType, Val Param
|
||||
OPI_TypeConversion.GetLine(AttachmentsType);
|
||||
OPI_TypeConversion.GetCollection(ArrayOfFiles);
|
||||
|
||||
MediaArray = New Array;
|
||||
MediaArray = New Array;
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
MIS = "media_id_string";
|
||||
MIS = "media_id_string";
|
||||
|
||||
If ValueIsFilled(ArrayOfFiles) Then
|
||||
|
||||
@@ -329,7 +329,7 @@ Function UploadAttachmentsArray(Val ArrayOfFiles, Val AttachmentsType, Val Param
|
||||
OPI_TypeConversion.GetBinaryData(SendingFile);
|
||||
|
||||
Response = UploadMediaFile(SendingFile, AttachmentsType, Parameters_);
|
||||
MediaID = Response[MIS];
|
||||
MediaID = Response[MIS];
|
||||
|
||||
If Not ValueIsFilled(MediaID) Then
|
||||
Return Response;
|
||||
@@ -357,16 +357,16 @@ Function UploadMediaFile(Val File, Val Type, Val Parameters)
|
||||
|
||||
RequestType = "POST";
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
URL = "https://upload.twitter.com/1.1/media/upload.json";
|
||||
URL = "https://upload.twitter.com/1.1/media/upload.json";
|
||||
|
||||
If Type = "photo" Then
|
||||
|
||||
Fields = New Structure;
|
||||
Fields.Insert("media_data" , Base64String(File));
|
||||
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);
|
||||
Response = OPI_Tools.Post(URL, Fields, Authorization, False);
|
||||
|
||||
Else
|
||||
|
||||
@@ -380,32 +380,32 @@ EndFunction
|
||||
|
||||
Function UploadMediaInParts(Val File, Val Type, Val RequestType, Val URL, Parameters)
|
||||
|
||||
Unit = 1024;
|
||||
Count = 4;
|
||||
Unit = 1024;
|
||||
Count = 4;
|
||||
MediaKey = "media_key";
|
||||
MIS = "media_id_string";
|
||||
Command = "command";
|
||||
Size = File.Size();
|
||||
MIS = "media_id_string";
|
||||
Command = "command";
|
||||
Size = File.Size();
|
||||
|
||||
MIMETypeMapping = New Map;
|
||||
MIMETypeMapping.Insert("photo" , "image/jpeg");
|
||||
MIMETypeMapping.Insert("video" , "video/mp4");
|
||||
MIMETypeMapping.Insert("photo" , "image/jpeg");
|
||||
MIMETypeMapping.Insert("video" , "video/mp4");
|
||||
MIMETypeMapping.Insert("animated_gif", "image/gif");
|
||||
|
||||
ChunkSize = Count * Unit * Unit;
|
||||
ChunkSize = Count * 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(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];
|
||||
InitializationKey = InitializationResponse[MediaKey];
|
||||
InitializationID = InitializationResponse[MIS];
|
||||
|
||||
If Not ValueIsFilled(InitializationKey) Or Not ValueIsFilled(InitializationID) Then
|
||||
Return InitializationResponse;
|
||||
@@ -416,10 +416,10 @@ Function UploadMediaInParts(Val File, Val Type, Val RequestType, Val URL, Parame
|
||||
For Each Part In ArrayReading Do
|
||||
|
||||
Fields = New Structure;
|
||||
Fields.Insert(Command , "APPEND");
|
||||
Fields.Insert("media_key" , InitializationKey);
|
||||
Fields.Insert(Command , "APPEND");
|
||||
Fields.Insert("media_key" , InitializationKey);
|
||||
Fields.Insert("segment_index" , OPI_Tools.NumberToString(Counter));
|
||||
Fields.Insert("media" , Part);
|
||||
Fields.Insert("media" , Part);
|
||||
|
||||
Authorization = CreateAuthorizationHeaderV1(Parameters, New Structure, RequestType, URL);
|
||||
|
||||
@@ -430,7 +430,7 @@ Function UploadMediaInParts(Val File, Val Type, Val RequestType, Val URL, Parame
|
||||
EndDo;
|
||||
|
||||
Fields = New Structure;
|
||||
Fields.Insert(Command , "FINALIZE");
|
||||
Fields.Insert(Command , "FINALIZE");
|
||||
Fields.Insert("media_id", InitializationID);
|
||||
|
||||
ProcessingStatus = GetProcessingStatus(Parameters, Fields, URL);
|
||||
@@ -448,17 +448,17 @@ EndFunction
|
||||
Function WaitForProcessingCompletion(Val ProcessingStatus, Val InitializationID, Val URL, Val Parameters)
|
||||
|
||||
ProcessingInfo = "processing_info";
|
||||
Command = "command";
|
||||
Fields = New Structure;
|
||||
Command = "command";
|
||||
Fields = New Structure;
|
||||
|
||||
Fields.Insert(Command , "STATUS");
|
||||
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];
|
||||
Response = OPI_Tools.Get(URL, Fields, Authorization);
|
||||
Information = Response[ProcessingInfo];
|
||||
|
||||
If Not ValueIsFilled(Information) Then
|
||||
Return Response;
|
||||
@@ -527,15 +527,15 @@ Function GetStandardParameters(Val Parameters = "")
|
||||
|
||||
// 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("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);
|
||||
@@ -552,55 +552,55 @@ EndFunction
|
||||
|
||||
Function CreateAuthorizationHeaderV1(Val Parameters, Val Fields, Val RequestType, Val URL)
|
||||
|
||||
CurrentDate = OPI_Tools.GetCurrentDate();
|
||||
CurrentDate = OPI_Tools.GetCurrentDate();
|
||||
AuthorizationHeader = "";
|
||||
HashingMethod = "HMAC-SHA1";
|
||||
APIVersion = "1.0";
|
||||
SignatureString = "";
|
||||
Signature = "";
|
||||
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;
|
||||
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 = ParametersTable.Add();
|
||||
NewLine.Key = Field.Key;
|
||||
NewLine.Value = Field.Value;
|
||||
|
||||
EndDo;
|
||||
|
||||
NewLine = ParametersTable.Add();
|
||||
NewLine.Key = OCK;
|
||||
NewLine = ParametersTable.Add();
|
||||
NewLine.Key = OCK;
|
||||
NewLine.Value = Parameters[OCK];
|
||||
|
||||
NewLine = ParametersTable.Add();
|
||||
NewLine.Key = OTK;
|
||||
NewLine = ParametersTable.Add();
|
||||
NewLine.Key = OTK;
|
||||
NewLine.Value = Parameters[OTK];
|
||||
|
||||
NewLine = ParametersTable.Add();
|
||||
NewLine.Key = "oauth_version";
|
||||
NewLine = ParametersTable.Add();
|
||||
NewLine.Key = "oauth_version";
|
||||
NewLine.Value = APIVersion;
|
||||
|
||||
NewLine = ParametersTable.Add();
|
||||
NewLine.Key = "oauth_signature_method";
|
||||
NewLine = ParametersTable.Add();
|
||||
NewLine.Key = "oauth_signature_method";
|
||||
NewLine.Value = HashingMethod;
|
||||
|
||||
NewLine = ParametersTable.Add();
|
||||
NewLine.Key = "oauth_timestamp";
|
||||
NewLine = ParametersTable.Add();
|
||||
NewLine.Key = "oauth_timestamp";
|
||||
NewLine.Value = CurrentUNIXDate;
|
||||
|
||||
NewLine = ParametersTable.Add();
|
||||
NewLine.Key = "oauth_nonce";
|
||||
NewLine = ParametersTable.Add();
|
||||
NewLine.Key = "oauth_nonce";
|
||||
NewLine.Value = CurrentUNIXDate;
|
||||
|
||||
For Each TableRow In ParametersTable Do
|
||||
|
||||
TableRow.Key = EncodeString(TableRow.Key, StringEncodingMethod.URLencoding);
|
||||
TableRow.Key = EncodeString(TableRow.Key, StringEncodingMethod.URLencoding);
|
||||
TableRow.Value = EncodeString(TableRow.Value, StringEncodingMethod.URLencoding);
|
||||
|
||||
EndDo;
|
||||
@@ -611,7 +611,7 @@ Function CreateAuthorizationHeaderV1(Val Parameters, Val Fields, Val RequestType
|
||||
|
||||
SignatureString = SignatureString
|
||||
+ TableRow.Key
|
||||
+ "="
|
||||
+ " ="
|
||||
+ TableRow.Value
|
||||
+ "&";
|
||||
|
||||
@@ -620,7 +620,7 @@ Function CreateAuthorizationHeaderV1(Val Parameters, Val Fields, Val RequestType
|
||||
SignatureString = Left(SignatureString, StrLen(SignatureString) - 1);
|
||||
SignatureString = Upper(RequestType)
|
||||
+ "&"
|
||||
+ EncodeString(URL, StringEncodingMethod.URLencoding)
|
||||
+ EncodeString(URL , StringEncodingMethod.URLencoding)
|
||||
+ "&"
|
||||
+ EncodeString(SignatureString, StringEncodingMethod.URLencoding);
|
||||
|
||||
@@ -636,15 +636,15 @@ Function CreateAuthorizationHeaderV1(Val Parameters, Val Fields, Val RequestType
|
||||
Signature = EncodeString(Base64String(Signature), StringEncodingMethod.URLencoding);
|
||||
|
||||
Delimiter = """,";
|
||||
AuthorizationHeader = AuthorizationHeader
|
||||
AuthorizationHeader = AuthorizationHeader
|
||||
+ "OAuth "
|
||||
+ "oauth_consumer_key=""" + Parameters[OCK] + Delimiter
|
||||
+ "oauth_token=""" + Parameters[OTK] + Delimiter
|
||||
+ "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;
|
||||
+ "oauth_timestamp =""" + CurrentUNIXDate + Delimiter
|
||||
+ "oauth_nonce =""" + CurrentUNIXDate + Delimiter
|
||||
+ "oauth_version =""" + APIVersion + Delimiter
|
||||
+ "oauth_signature =""" + Signature;
|
||||
|
||||
HeaderMapping = New Map;
|
||||
HeaderMapping.Insert("authorization", AuthorizationHeader);
|
||||
@@ -664,10 +664,10 @@ EndFunction
|
||||
|
||||
Function GetProcessingStatus(Val Parameters, Val Fields, Val URL)
|
||||
|
||||
ProcessingInfo = "processing_info";
|
||||
ProcessingInfo = "processing_info";
|
||||
Authorization = CreateAuthorizationHeaderV1(Parameters, Fields, "POST", URL);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Fields, Authorization, False);
|
||||
Response = OPI_Tools.Post(URL, Fields, Authorization, False);
|
||||
Information = Response[ProcessingInfo];
|
||||
|
||||
If Not ValueIsFilled(Information) Then
|
||||
|
@@ -92,7 +92,7 @@ Function CreatePost(Val Text
|
||||
|
||||
OPI_TypeConversion.GetCollection(ImageArray);
|
||||
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
AttachmentsArray = New Array;
|
||||
|
||||
For Each PostImage In ImageArray Do
|
||||
@@ -100,14 +100,14 @@ Function CreatePost(Val Text
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
ResponseMap = GetImageMap(PostImage, Parameters_, "Post");
|
||||
|
||||
OwnerId = ResponseMap.Get("owner_id");
|
||||
OwnerId = ResponseMap.Get("owner_id");
|
||||
ObjectId = ResponseMap.Get("id");
|
||||
|
||||
If Not ValueIsFilled(OwnerId) Or Not ValueIsFilled(ObjectId) Then
|
||||
Return ResponseMap;
|
||||
EndIf;
|
||||
|
||||
OwnerId = OPI_Tools.NumberToString(OwnerId);
|
||||
OwnerId = OPI_Tools.NumberToString(OwnerId);
|
||||
ObjectId = OPI_Tools.NumberToString(ObjectId);
|
||||
|
||||
PhotoID = "photo" + OwnerId + "_" + ObjectId;
|
||||
@@ -144,13 +144,13 @@ Function CreateCompositePost(Val Text
|
||||
OPI_TypeConversion.GetLine(LinkUnderPost);
|
||||
OPI_TypeConversion.GetBoolean(Advertisement);
|
||||
|
||||
Parameters = GetStandardParameters(Parameters);
|
||||
Parameters = GetStandardParameters(Parameters);
|
||||
AttachmentsString = StrConcat(Objects, ",");
|
||||
AttachmentsString = AttachmentsString + LinkUnderPost;
|
||||
|
||||
Parameters.Insert("message" , Text);
|
||||
Parameters.Insert("attachments" , AttachmentsString);
|
||||
Parameters.Insert("mark_as_ads" , ?(Advertisement, 1, 0));
|
||||
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);
|
||||
@@ -198,7 +198,7 @@ Function CreatePoll(Val Question, Val AnswersArray, Val Image = "", Val Paramete
|
||||
OPI_TypeConversion.GetCollection(AnswersArray);
|
||||
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
Response_ = "response";
|
||||
Response_ = "response";
|
||||
|
||||
If ValueIsFilled(Image) Then
|
||||
|
||||
@@ -227,17 +227,17 @@ Function CreatePoll(Val Question, Val AnswersArray, Val Image = "", Val Paramete
|
||||
Answers = "[""" + Answers + """]";
|
||||
|
||||
Parameters_.Insert("add_answers", Answers);
|
||||
Parameters_.Insert("photo_id" , OPI_Tools.NumberToString(PhotoID));
|
||||
Parameters_.Insert("question" , Question);
|
||||
Parameters_.Insert("photo_id" , OPI_Tools.NumberToString(PhotoID));
|
||||
Parameters_.Insert("question" , Question);
|
||||
|
||||
Poll = OPI_Tools.Get("api.vk.com/method/polls.create", Parameters_);
|
||||
Poll = OPI_Tools.Get("api.vk.com/method/polls.create", Parameters_);
|
||||
PollMap = Poll.Get(Response_);
|
||||
|
||||
If Not ValueIsFilled(PollMap) Then
|
||||
Return Poll;
|
||||
EndIf;
|
||||
|
||||
OwnerId = PollMap.Get("owner_id");
|
||||
OwnerId = PollMap.Get("owner_id");
|
||||
ObjectId = PollMap.Get("id");
|
||||
|
||||
If Not ValueIsFilled(OwnerId) Or Not ValueIsFilled(ObjectId) Then
|
||||
@@ -274,8 +274,8 @@ Function CreateAlbum(Val Name, Val Description = "", Val Parameters = "") Export
|
||||
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
|
||||
Parameters_.Insert("title" , Name);
|
||||
Parameters_.Insert("description" , Description);
|
||||
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_);
|
||||
@@ -321,8 +321,8 @@ 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("link_text" , "more");
|
||||
Parameters_.Insert("link_url" , URL);
|
||||
Parameters_.Insert("add_to_news", "1");
|
||||
|
||||
Response = UploadPhotoToServer(Image, Parameters_, "Story");
|
||||
@@ -395,12 +395,12 @@ Function UploadVideoToServer(Val Video
|
||||
, Val Album = ""
|
||||
, Val Parameters = "") Export
|
||||
|
||||
String_ = "String";
|
||||
String_ = "String";
|
||||
Parameters = GetStandardParameters(Parameters);
|
||||
|
||||
OPI_Tools.AddField("name" , Name, String_, Parameters);
|
||||
OPI_Tools.AddField("name" , Name , String_, Parameters);
|
||||
OPI_Tools.AddField("description", Description , String_, Parameters);
|
||||
OPI_Tools.AddField("album_id" , Album , String_, Parameters);
|
||||
OPI_Tools.AddField("album_id" , Album , String_, Parameters);
|
||||
|
||||
Response = OPI_Tools.Get("api.vk.com/method/video.save", Parameters);
|
||||
|
||||
@@ -441,19 +441,19 @@ EndFunction
|
||||
Function UploadPhotoToServer(Val Image, Val Parameters = "", Val View = "Post") Export
|
||||
|
||||
Parameters = GetStandardParameters(Parameters);
|
||||
Method = DetermineImageUploadMethod(View);
|
||||
Files = New Map;
|
||||
Method = DetermineImageUploadMethod(View);
|
||||
Files = New Map;
|
||||
|
||||
Response_ = "response";
|
||||
URL = "api.vk.com/method/";
|
||||
Upload = URL + Method["Upload"];
|
||||
Save = URL + Method["Save"];
|
||||
URL = "api.vk.com/method/";
|
||||
Upload = URL + Method["Upload"];
|
||||
Save = URL + Method["Save"];
|
||||
|
||||
If TypeOf(Image) = Type("String") Then
|
||||
ImageKey = StrReplace(Image, ".", "___");
|
||||
ImageKey = StrReplace(Image, ".", "___");
|
||||
OPI_TypeConversion.GetBinaryData(Image);
|
||||
Else
|
||||
ImageKey = "image___jpeg";
|
||||
ImageKey = "image___jpeg";
|
||||
EndIf;
|
||||
|
||||
Files.Insert(ImageKey, Image);
|
||||
@@ -461,7 +461,7 @@ Function UploadPhotoToServer(Val Image, Val Parameters = "", Val View = "Post")
|
||||
For N = 1 To 5 Do
|
||||
|
||||
Response = OPI_Tools.Get(Upload, Parameters);
|
||||
Result = Response[Response_];
|
||||
Result = Response[Response_];
|
||||
|
||||
If ValueIsFilled(Result) Then
|
||||
|
||||
@@ -543,7 +543,7 @@ Function CloseDiscussion(Val DiscussionID, Val DeleteCompletely = False, Val Par
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
Parameters_.Insert("topic_id", DiscussionID);
|
||||
|
||||
Method = ?(DeleteCompletely, "deleteTopic", "closeTopic");
|
||||
Method = ?(DeleteCompletely, "deleteTopic", "closeTopic");
|
||||
Response = OPI_Tools.Get("api.vk.com/method/board." + Method, Parameters_);
|
||||
|
||||
Return Response;
|
||||
@@ -617,13 +617,13 @@ Function LikePost(Val PostID, Val WallID = "", Val Parameters = "") Export
|
||||
OPI_TypeConversion.GetLine(WallID);
|
||||
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
WallID = ?(ValueIsFilled(WallID), WallID, Parameters_["owner_id"]);
|
||||
VKObject = "wall" + WallID + "_" + OPI_Tools.NumberToString(PostID);
|
||||
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("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_);
|
||||
@@ -651,7 +651,7 @@ Function MakeRepost(Val PostID
|
||||
, Val Parameters = "") Export
|
||||
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
GroupId = Parameters_["group_id"];
|
||||
GroupId = Parameters_["group_id"];
|
||||
|
||||
OPI_TypeConversion.GetLine(GroupId);
|
||||
OPI_TypeConversion.GetLine(PostID);
|
||||
@@ -659,12 +659,12 @@ Function MakeRepost(Val PostID
|
||||
OPI_TypeConversion.GetLine(TargetWall);
|
||||
OPI_TypeConversion.GetBoolean(Advertising);
|
||||
|
||||
Source = ?(ValueIsFilled(WallID), WallID, GroupId);
|
||||
Source = ?(ValueIsFilled(WallID), WallID, GroupId);
|
||||
Receiver = ?(ValueIsFilled(TargetWall), TargetWall, GroupId);
|
||||
|
||||
Parameters_.Insert("object" , "wall" + Source + "_" + OPI_Tools.NumberToString(PostID));
|
||||
Parameters_.Insert("group_id" , StrReplace(Receiver, "-", ""));
|
||||
Parameters_.Insert("mark_as_ads" , ?(Advertising, 1, 0));
|
||||
Parameters_.Insert("object" , "wall" + Source + "_" + OPI_Tools.NumberToString(PostID));
|
||||
Parameters_.Insert("group_id" , StrReplace(Receiver, "-", ""));
|
||||
Parameters_.Insert("mark_as_ads" , ?(Advertising , 1 , 0));
|
||||
|
||||
Response = OPI_Tools.Get("api.vk.com/method/wall.repost", Parameters_);
|
||||
|
||||
@@ -698,11 +698,11 @@ Function WriteMessage(Val Text
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
Parameters_.Insert("access_token", Communitytoken);
|
||||
|
||||
Parameters_.Insert("user_id" , UserID);
|
||||
Parameters_.Insert("peer_id" , UserID);
|
||||
Parameters_.Insert("user_id" , UserID);
|
||||
Parameters_.Insert("peer_id" , UserID);
|
||||
Parameters_.Insert("parse_mode" , "Markdown");
|
||||
Parameters_.Insert("random_id" , 0);
|
||||
Parameters_.Insert("message" , Text);
|
||||
Parameters_.Insert("random_id" , 0);
|
||||
Parameters_.Insert("message" , Text);
|
||||
|
||||
If ValueIsFilled(Keyboard) Then
|
||||
Parameters_.Insert("keyboard", Keyboard);
|
||||
@@ -728,17 +728,17 @@ EndFunction
|
||||
Function WriteComment(Val PostID, Val WallID, Val Text, Val Parameters = "") Export
|
||||
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
GroupId = Parameters_["group_id"];
|
||||
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("owner_id" , WallID);
|
||||
Parameters_.Insert("from_group" , GroupId);
|
||||
Parameters_.Insert("post_id" , PostID);
|
||||
Parameters_.Insert("message" , Text);
|
||||
Parameters_.Insert("post_id" , PostID);
|
||||
Parameters_.Insert("message" , Text);
|
||||
|
||||
Parameters_.Delete("group_id");
|
||||
|
||||
@@ -761,13 +761,13 @@ Function ShortenLink(Val URL, Val Parameters = "") Export
|
||||
|
||||
OPI_TypeConversion.GetLine(URL);
|
||||
|
||||
Response_ = "response";
|
||||
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_];
|
||||
Result = Response[Response_];
|
||||
|
||||
If ValueIsFilled(Result) Then
|
||||
|
||||
@@ -807,11 +807,11 @@ Function GetStatistics(Val StartDate, Val EndDate, Val Parameters = "") Export
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
|
||||
StartDate = OPI_Tools.UNIXTime(StartDate);
|
||||
EndDate = OPI_Tools.UNIXTime(EndDate);
|
||||
EndDate = OPI_Tools.UNIXTime(EndDate);
|
||||
|
||||
Parameters_.Insert("timestamp_from", StartDate);
|
||||
Parameters_.Insert("timestamp_to" , EndDate);
|
||||
Parameters_.Insert("stats_groups" , "visitors, reach, activity");
|
||||
Parameters_.Insert("timestamp_to" , EndDate);
|
||||
Parameters_.Insert("stats_groups" , "visitors, reach, activity");
|
||||
|
||||
Response = OPI_Tools.Get("api.vk.com/method/stats.get", Parameters_);
|
||||
|
||||
@@ -832,11 +832,11 @@ Function GetPostStatistics(Val PostIDsArray, Val Parameters = "") Export
|
||||
|
||||
OPI_TypeConversion.GetCollection(PostIDsArray);
|
||||
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
AnswersArray = New Array;
|
||||
SetsArray = New Array;
|
||||
SetsArray = New Array;
|
||||
MaximumPosts = 30;
|
||||
Response_ = "response";
|
||||
Response_ = "response";
|
||||
|
||||
For Each Post In PostIDsArray Do
|
||||
|
||||
@@ -847,7 +847,7 @@ Function GetPostStatistics(Val PostIDsArray, Val Parameters = "") Export
|
||||
NumbersString = StrConcat(SetsArray, ",");
|
||||
Parameters_.Insert("post_ids", NumbersString);
|
||||
|
||||
Statistics = OPI_Tools.Get("api.vk.com/method/stats.getPostReach", Parameters_);
|
||||
Statistics = OPI_Tools.Get("api.vk.com/method/stats.getPostReach", Parameters_);
|
||||
StatisticsArray = Statistics[Response_];
|
||||
|
||||
For Each StatisticsItem In StatisticsArray Do
|
||||
@@ -863,7 +863,7 @@ Function GetPostStatistics(Val PostIDsArray, Val Parameters = "") Export
|
||||
NumbersString = StrConcat(SetsArray, ",");
|
||||
Parameters_.Insert("post_ids", NumbersString);
|
||||
|
||||
Statistics = OPI_Tools.Get("api.vk.com/method/stats.getPostReach", Parameters_);
|
||||
Statistics = OPI_Tools.Get("api.vk.com/method/stats.getPostReach", Parameters_);
|
||||
StatisticsArray = Statistics[Response_];
|
||||
|
||||
If TypeOf(StatisticsArray) = Type("Array") Then
|
||||
@@ -896,23 +896,23 @@ Function CreateAdvertisingCampaign(Val AccountID, Val Name, Val Parameters = "")
|
||||
OPI_TypeConversion.GetLine(Name);
|
||||
|
||||
CurrentDate = OPI_Tools.GetCurrentDate();
|
||||
EndDate = AddMonth(CurrentDate, 24);
|
||||
EndDate = AddMonth(CurrentDate, 24);
|
||||
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
Parameters_.Insert("account_id", AccountID);
|
||||
|
||||
StructuresArray = New Array;
|
||||
StartDate = OPI_Tools.UNIXTime(CurrentDate);
|
||||
EndDate = OPI_Tools.UNIXTime(EndDate);
|
||||
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("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);
|
||||
CampaignStructure.Insert("stop_time" , EndDate);
|
||||
CampaignStructure.Insert("status" , 1);
|
||||
|
||||
StructuresArray.Add(CampaignStructure);
|
||||
|
||||
@@ -947,7 +947,7 @@ Function CreateAd(Val CampaignNumber
|
||||
, Val Parameters = "") Export
|
||||
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
GroupId = Parameters_["group_id"];
|
||||
GroupId = Parameters_["group_id"];
|
||||
|
||||
OPI_TypeConversion.GetLine(GroupId);
|
||||
OPI_TypeConversion.GetLine(CampaignNumber);
|
||||
@@ -958,30 +958,30 @@ Function CreateAd(Val CampaignNumber
|
||||
|
||||
Link = "https://vk.com/wall-" + GroupId + "_" + PostID;
|
||||
|
||||
StructuresArray = New Array;
|
||||
StructuresArray = 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("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);
|
||||
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);
|
||||
|
||||
StructuresArray.Add(CampaignStructure);
|
||||
|
||||
OPI_TypeConversion.GetLine(StructuresArray, True);
|
||||
|
||||
Parameters_.Insert("data" , StructuresArray);
|
||||
Parameters_.Insert("data" , StructuresArray);
|
||||
Parameters_.Insert("account_id" , AccountID);
|
||||
|
||||
Response = OPI_Tools.Get("api.vk.com/method/ads.createAds", Parameters_);
|
||||
@@ -1009,10 +1009,10 @@ Function PauseAdvertising(Val AccountID, Val AdID, Val Parameters = "") Export
|
||||
|
||||
Parameters_.Insert("account_id", AccountID);
|
||||
|
||||
StructuresArray = New Array;
|
||||
StructuresArray = New Array;
|
||||
CampaignStructure = New Structure;
|
||||
|
||||
CampaignStructure.Insert("ad_id" , AdID);
|
||||
CampaignStructure.Insert("ad_id" , AdID);
|
||||
CampaignStructure.Insert("status" , 0);
|
||||
|
||||
StructuresArray.Add(CampaignStructure);
|
||||
@@ -1038,7 +1038,7 @@ EndFunction
|
||||
Function GetAdvertisingCategoryList(Val Parameters = "") Export
|
||||
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
Response = OPI_Tools.Get("api.vk.com/method/ads.getCategories", Parameters_);
|
||||
Response = OPI_Tools.Get("api.vk.com/method/ads.getCategories", Parameters_);
|
||||
|
||||
Return Response;
|
||||
|
||||
@@ -1058,10 +1058,10 @@ EndFunction
|
||||
// Map Of String - Key - ID, Value - Name
|
||||
Function GetProductCategoryList(Val Parameters = "") Export
|
||||
|
||||
Response_ = "response";
|
||||
Response_ = "response";
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
Response = OPI_Tools.Get("api.vk.com/method/market.getCategories", Parameters_);
|
||||
Result = Response[Response_];
|
||||
Response = OPI_Tools.Get("api.vk.com/method/market.getCategories", Parameters_);
|
||||
Result = Response[Response_];
|
||||
|
||||
If ValueIsFilled(Result) Then
|
||||
|
||||
@@ -1077,7 +1077,7 @@ Function GetProductCategoryList(Val Parameters = "") Export
|
||||
|
||||
Parameters_.Insert("count", Count);
|
||||
Response = OPI_Tools.Get("api.vk.com/method/market.getCategories", Parameters_);
|
||||
Result = Response[Response_];
|
||||
Result = Response[Response_];
|
||||
|
||||
If ValueIsFilled(Result) Then
|
||||
|
||||
@@ -1115,8 +1115,8 @@ Function GetProductList(Val Selection = "", Val Parameters = "") Export
|
||||
OPI_TypeConversion.GetLine(Selection);
|
||||
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
Parameters_.Insert("count" , 200);
|
||||
Parameters_.Insert("extended" , 1);
|
||||
Parameters_.Insert("count" , 200);
|
||||
Parameters_.Insert("extended" , 1);
|
||||
Parameters_.Insert("with_disabled", 1);
|
||||
|
||||
If ValueIsFilled(Selection) Then
|
||||
@@ -1143,9 +1143,9 @@ Function GetProductsByID(Val Products, Val Parameters = "") Export
|
||||
|
||||
OPI_TypeConversion.GetCollection(Products);
|
||||
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
ProductsString = "";
|
||||
Owner = "owner_id";
|
||||
Owner = "owner_id";
|
||||
|
||||
For Each Product In Products Do
|
||||
CurrentProduct = Parameters_[Owner] + "_" + Product;
|
||||
@@ -1233,7 +1233,7 @@ Function GroupProducts(Val ProductsArray, Val ExistingGroup = "", Val Parameters
|
||||
OPI_TypeConversion.GetLine(ExistingGroup);
|
||||
OPI_TypeConversion.GetCollection(ProductsArray);
|
||||
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
ArrayOfProducts_ = New Array;
|
||||
|
||||
For Each Product In ProductsArray Do
|
||||
@@ -1277,21 +1277,21 @@ EndFunction
|
||||
Function GetProductDescription() Export
|
||||
|
||||
Product = New Map();
|
||||
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("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("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;
|
||||
@@ -1335,8 +1335,8 @@ Function GetSelectionsByID(Val Selections, Val Parameters = "") Export
|
||||
|
||||
OPI_TypeConversion.GetCollection(Selections);
|
||||
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
Selections_ = New Array;
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
Selections_ = New Array;
|
||||
SelectionsString = "";
|
||||
|
||||
For Each Selection In Selections Do
|
||||
@@ -1414,7 +1414,7 @@ Function AddProductToCollection(Val ProductsArray, Val Selection, Val Parameters
|
||||
OPI_TypeConversion.GetCollection(ProductsArray);
|
||||
OPI_TypeConversion.GetLine(Selection);
|
||||
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
ArrayOfProducts_ = New Array;
|
||||
|
||||
For Each Product In ProductsArray Do
|
||||
@@ -1449,7 +1449,7 @@ Function RemoveProductFromSelection(Val Product, Val Selection, Val Parameters =
|
||||
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
|
||||
Parameters_.Insert("item_id" , Product);
|
||||
Parameters_.Insert("item_id" , Product);
|
||||
Parameters_.Insert("album_ids", Selection);
|
||||
|
||||
Response = OPI_Tools.Get("api.vk.com/method/market.removeFromAlbum", Parameters_);
|
||||
@@ -1494,10 +1494,10 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from VK
|
||||
Function GetPropertyList(Val Parameters = "") Export
|
||||
|
||||
Response_ = "response";
|
||||
Response_ = "response";
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
|
||||
Response = OPI_Tools.Get("api.vk.com/method/market.getProperties", Parameters_);
|
||||
Response = OPI_Tools.Get("api.vk.com/method/market.getProperties", Parameters_);
|
||||
Properties = Response[Response_]["items"];
|
||||
|
||||
Return Properties;
|
||||
@@ -1542,9 +1542,9 @@ Function EditProductProperty(Val Name, Val Property, Val Parameters = "") Export
|
||||
OPI_TypeConversion.GetLine(Property);
|
||||
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
Parameters_.Insert("title" , Name);
|
||||
Parameters_.Insert("title" , Name);
|
||||
Parameters_.Insert("property_id", Property);
|
||||
Parameters_.Insert("type" , "text");
|
||||
Parameters_.Insert("type" , "text");
|
||||
|
||||
Response = OPI_Tools.Get("api.vk.com/method/market.editProperty", Parameters_);
|
||||
|
||||
@@ -1591,7 +1591,7 @@ Function AddProductPropertyVariant(Val Value, Val Property, Val Parameters = "")
|
||||
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
Parameters_.Insert("property_id", Property);
|
||||
Parameters_.Insert("title" , Value);
|
||||
Parameters_.Insert("title" , Value);
|
||||
|
||||
Response = OPI_Tools.Get("api.vk.com/method/market.addPropertyVariant", Parameters_);
|
||||
|
||||
@@ -1619,7 +1619,7 @@ Function EditProductPropertyVariant(Val Value, Val Property, Val Option, Val Par
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
Parameters_.Insert("property_id", Property);
|
||||
Parameters_.Insert("variant_id" , Option);
|
||||
Parameters_.Insert("title" , Value);
|
||||
Parameters_.Insert("title" , Value);
|
||||
|
||||
Response = OPI_Tools.Get("api.vk.com/method/market.editPropertyVariant", Parameters_);
|
||||
|
||||
@@ -1689,13 +1689,13 @@ Function FormKeyboard(Val ButtonArray) Export
|
||||
|
||||
OPI_TypeConversion.GetCollection(ButtonArray);
|
||||
|
||||
Keyboard = New Structure;
|
||||
Keyboard = New Structure;
|
||||
KeyboardArray = New Array;
|
||||
ArrayBlock = New Array;
|
||||
ArrayBlock = New Array;
|
||||
|
||||
For Each Action In ButtonArray Do
|
||||
|
||||
Button = New Structure;
|
||||
Button = New Structure;
|
||||
Expression = New Structure;
|
||||
|
||||
Expression.Insert("type" , "text");
|
||||
@@ -1737,11 +1737,11 @@ Function GetStandardParameters(Val Parameters = "")
|
||||
// group_id - owner_id, but 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" , "");
|
||||
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);
|
||||
|
||||
@@ -1757,9 +1757,9 @@ EndFunction
|
||||
|
||||
Function GetImageID(Val Image, Val Parameters, Val View)
|
||||
|
||||
Response_ = "response";
|
||||
Response_ = "response";
|
||||
Response = UploadPhotoToServer(Image, Parameters, View);
|
||||
Result = Response[Response_];
|
||||
Result = Response[Response_];
|
||||
|
||||
If ValueIsFilled(Result) Then
|
||||
PhotoID = Result["photo_id"];
|
||||
@@ -1779,7 +1779,7 @@ EndFunction
|
||||
|
||||
Function GetImageMap(Val Image, Val Parameters, Val View)
|
||||
|
||||
Response = UploadPhotoToServer(Image, Parameters, View);
|
||||
Response = UploadPhotoToServer(Image, Parameters, View);
|
||||
ResponseArray = Response.Get("response");
|
||||
|
||||
If Not ValueIsFilled(ResponseArray) Or Not TypeOf(ResponseArray) = Type("Array") Then
|
||||
@@ -1798,9 +1798,9 @@ EndFunction
|
||||
|
||||
Function GetSelectionArray(Val Selections, Val Parameters = "")
|
||||
|
||||
Response_ = "response";
|
||||
Response_ = "response";
|
||||
Selections = GetSelectionsByID(Selections, Parameters);
|
||||
Result = Selections[Response_];
|
||||
Result = Selections[Response_];
|
||||
|
||||
If ValueIsFilled(Result) Then
|
||||
|
||||
@@ -1821,43 +1821,43 @@ EndFunction
|
||||
Function DetermineImageUploadMethod(Val View)
|
||||
|
||||
MethodMap = New Map;
|
||||
Upload = "Upload";
|
||||
Save = "Save";
|
||||
Way = "Way";
|
||||
Photo = "Photo";
|
||||
Upload = "Upload";
|
||||
Save = "Save";
|
||||
Way = "Way";
|
||||
Photo = "Photo";
|
||||
|
||||
If View = "Post" Then
|
||||
|
||||
MethodMap.Insert(Upload , "photos.getWallUploadServer");
|
||||
MethodMap.Insert(Save, "photos.saveWallPhoto");
|
||||
MethodMap.Insert(Photo , "photo");
|
||||
MethodMap.Insert(Way , 1);
|
||||
MethodMap.Insert(Save , "photos.saveWallPhoto");
|
||||
MethodMap.Insert(Photo , "photo");
|
||||
MethodMap.Insert(Way , 1);
|
||||
|
||||
ElsIf View = "Product" Then
|
||||
|
||||
MethodMap.Insert(Upload , "market.getProductPhotoUploadServer");
|
||||
MethodMap.Insert(Save, "market.saveProductPhoto");
|
||||
MethodMap.Insert(Way , 2);
|
||||
MethodMap.Insert(Save , "market.saveProductPhoto");
|
||||
MethodMap.Insert(Way , 2);
|
||||
|
||||
ElsIf View = "Story" Then
|
||||
|
||||
MethodMap.Insert(Upload , "stories.getPhotoUploadServer");
|
||||
MethodMap.Insert(Save, "stories.save");
|
||||
MethodMap.Insert(Way , 3);
|
||||
MethodMap.Insert(Save , "stories.save");
|
||||
MethodMap.Insert(Way , 3);
|
||||
|
||||
ElsIf View = "Poll" Then
|
||||
|
||||
MethodMap.Insert(Upload , "polls.getPhotoUploadServer");
|
||||
MethodMap.Insert(Save, "polls.savePhoto");
|
||||
MethodMap.Insert(Photo , "photo");
|
||||
MethodMap.Insert(Way , 1);
|
||||
MethodMap.Insert(Save , "polls.savePhoto");
|
||||
MethodMap.Insert(Photo , "photo");
|
||||
MethodMap.Insert(Way , 1);
|
||||
|
||||
Else
|
||||
|
||||
MethodMap.Insert(Upload , "photos.getUploadServer");
|
||||
MethodMap.Insert(Save, "photos.save");
|
||||
MethodMap.Insert(Photo , "photos_list");
|
||||
MethodMap.Insert(Way , 1);
|
||||
MethodMap.Insert(Save , "photos.save");
|
||||
MethodMap.Insert(Photo , "photos_list");
|
||||
MethodMap.Insert(Way , 1);
|
||||
|
||||
EndIf;
|
||||
|
||||
@@ -1868,18 +1868,18 @@ EndFunction
|
||||
Function GetProductParameterMapping()
|
||||
|
||||
Fields = New Map();
|
||||
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("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;
|
||||
@@ -1907,7 +1907,7 @@ Function ProductManagement(Val ProductDescription, Val ProductID = "", Val Selec
|
||||
EndIf;
|
||||
|
||||
Response = OPI_Tools.Get("api.vk.com/method/market." + Method, Parameters_);
|
||||
Result = Response[Response_];
|
||||
Result = Response[Response_];
|
||||
|
||||
If Not ValueIsFilled(ProductID) And ValueIsFilled(Result) Then
|
||||
|
||||
@@ -1930,11 +1930,11 @@ Function ProductManagement(Val ProductDescription, Val ProductID = "", Val Selec
|
||||
EndFunction
|
||||
|
||||
Function SelectionManagement(Val Name
|
||||
, Val Image = ""
|
||||
, Val Image = ""
|
||||
, Val SelectionID = ""
|
||||
, Val Main = False
|
||||
, Val Hidden = False
|
||||
, Val Parameters = "")
|
||||
, Val Main = False
|
||||
, Val Hidden = False
|
||||
, Val Parameters = "")
|
||||
|
||||
OPI_TypeConversion.GetLine(Name);
|
||||
OPI_TypeConversion.GetLine(SelectionID);
|
||||
@@ -1942,15 +1942,15 @@ Function SelectionManagement(Val Name
|
||||
OPI_TypeConversion.GetBoolean(Hidden);
|
||||
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
Response = AddImageParameter(Image, SelectionID, 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));
|
||||
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);
|
||||
@@ -2005,19 +2005,19 @@ EndFunction
|
||||
|
||||
Procedure FillPhotoUploadParameters(Val Method, Val Response, Parameters)
|
||||
|
||||
Response_ = "response";
|
||||
Way = Method["Way"];
|
||||
Response_ = "response";
|
||||
Way = Method["Way"];
|
||||
StandardMethod = 1;
|
||||
NewMethod = 2;
|
||||
NewMethod = 2;
|
||||
|
||||
If Way = StandardMethod Then
|
||||
|
||||
Hash = "hash";
|
||||
Serv = "server";
|
||||
Aid = "aid";
|
||||
Hash = "hash";
|
||||
Serv = "server";
|
||||
Aid = "aid";
|
||||
Photo = Method["Photo"];
|
||||
|
||||
Parameters.Insert(Hash, Response[Hash]);
|
||||
Parameters.Insert(Hash , Response[Hash]);
|
||||
Parameters.Insert(Photo, Response[Photo]);
|
||||
|
||||
PhotoServer = Response.Get(Serv);
|
||||
@@ -2049,15 +2049,15 @@ EndProcedure
|
||||
|
||||
Procedure FillProductRequestFields(Val ProductDescription, Parameters)
|
||||
|
||||
Response_ = "response";
|
||||
MainPhoto = ProductDescription["MainPhoto"];
|
||||
Response_ = "response";
|
||||
MainPhoto = ProductDescription["MainPhoto"];
|
||||
AdditionalPhoto = ProductDescription["AdditionalPhotos"];
|
||||
Properties = ProductDescription["PropertyValues"];
|
||||
Properties = ProductDescription["PropertyValues"];
|
||||
|
||||
If ValueIsFilled(MainPhoto) Then
|
||||
|
||||
Response = UploadPhotoToServer(MainPhoto, Parameters, "Product");
|
||||
Result = Response[Response_];
|
||||
Result = Response[Response_];
|
||||
|
||||
If ValueIsFilled(Result) Then
|
||||
PhotoID = Result["photo_id"];
|
||||
@@ -2133,10 +2133,10 @@ EndProcedure
|
||||
|
||||
Procedure GetProductListRecursively(ProductsArray, Parameters, Shift = 0)
|
||||
|
||||
Response_ = "response";
|
||||
Response_ = "response";
|
||||
MaxInRequest = 200;
|
||||
Response = OPI_Tools.Get("api.vk.com/method/market.get", Parameters);
|
||||
Products = Response[Response_]["items"];
|
||||
Response = OPI_Tools.Get("api.vk.com/method/market.get", Parameters);
|
||||
Products = Response[Response_]["items"];
|
||||
|
||||
If Products.Count() = 0 Then
|
||||
Return;
|
||||
@@ -2154,10 +2154,10 @@ EndProcedure
|
||||
|
||||
Procedure GetAlbumListRecursively(ArrayOfAlbums, Parameters, Shift = 0)
|
||||
|
||||
Response_ = "response";
|
||||
Response_ = "response";
|
||||
MaxInRequest = 100;
|
||||
Response = OPI_Tools.Get("api.vk.com/method/market.getAlbums", Parameters);
|
||||
Albums = Response[Response_]["items"];
|
||||
Response = OPI_Tools.Get("api.vk.com/method/market.getAlbums", Parameters);
|
||||
Albums = Response[Response_]["items"];
|
||||
|
||||
If Albums.Count() = 0 Then
|
||||
Return;
|
||||
@@ -2175,10 +2175,10 @@ EndProcedure
|
||||
|
||||
Procedure GetOrderListRecursively(ArrayOfOrders, Parameters, Shift = 0)
|
||||
|
||||
Response_ = "response";
|
||||
Response_ = "response";
|
||||
MaxInRequest = 50;
|
||||
Response = OPI_Tools.Get("api.vk.com/method/market.getGroupOrders", Parameters);
|
||||
Orders = Response[Response_]["items"];
|
||||
Response = OPI_Tools.Get("api.vk.com/method/market.getGroupOrders", Parameters);
|
||||
Orders = Response[Response_]["items"];
|
||||
|
||||
If Orders.Count() = 0 Then
|
||||
Return;
|
||||
|
@@ -56,7 +56,7 @@
|
||||
Function SetWebhook(Val Token, Val URL) Export
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("url" , URL , "String", Parameters);
|
||||
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);
|
||||
@@ -190,16 +190,16 @@ Function SendFile(Val Token
|
||||
If Not ValueIsFilled(Size) Then
|
||||
|
||||
Response = OPI_Tools.Get(URL);
|
||||
Size = Response.Size();
|
||||
Size = Response.Size();
|
||||
|
||||
EndIf;
|
||||
|
||||
String_ = "String";
|
||||
String_ = "String";
|
||||
Extension = StrReplace(Extension, ".", "");
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("URL" , URL , String_, Parameters);
|
||||
OPI_Tools.AddField("Size" , Size , String_, Parameters);
|
||||
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);
|
||||
@@ -225,8 +225,8 @@ Function SendContact(Val Token
|
||||
, Val SendingToChannel) Export
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("name" , ContactName , "String", Parameters);
|
||||
OPI_Tools.AddField("phone_number", PhoneNumber, "String", Parameters);
|
||||
OPI_Tools.AddField("name" , ContactName , "String", Parameters);
|
||||
OPI_Tools.AddField("phone_number", PhoneNumber , "String", Parameters);
|
||||
|
||||
Return SendMessage(Token, "contact", UserID, SendingToChannel, Parameters);
|
||||
|
||||
@@ -288,23 +288,23 @@ Function CreateKeyboardFromArrayButton(Val ButtonArray, Val ButtonColor = "#2db9
|
||||
OPI_TypeConversion.GetCollection(ButtonArray);
|
||||
|
||||
ArrayOfButtonStructures = New Array;
|
||||
KeyboardStructure = New Structure;
|
||||
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);
|
||||
ButtonStructure.Insert("Text" , ButtonText);
|
||||
ButtonStructure.Insert("BgColor" , ButtonColor);
|
||||
ButtonStructure.Insert("Coloumns" , 3);
|
||||
|
||||
ArrayOfButtonStructures.Add(ButtonStructure);
|
||||
|
||||
EndDo;
|
||||
|
||||
KeyboardStructure.Insert("Buttons", ArrayOfButtonStructures);
|
||||
KeyboardStructure.Insert("Type" , "keyboard");
|
||||
KeyboardStructure.Insert("Type" , "keyboard");
|
||||
|
||||
Return KeyboardStructure;
|
||||
|
||||
@@ -360,22 +360,22 @@ Function SendMessage(Val Token
|
||||
|
||||
If ValueIsFilled(Value) Then
|
||||
|
||||
If Type = "file" Then
|
||||
ParametersStructure.Insert("media" , Value["URL"]);
|
||||
ParametersStructure.Insert("size" , Value["Size"]);
|
||||
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);
|
||||
ParametersStructure.Insert("contact" , Value);
|
||||
ElsIf Type = "location" Then
|
||||
ParametersStructure.Insert("location" , Value);
|
||||
Else
|
||||
ParametersStructure.Insert("media" , Value);
|
||||
ParametersStructure.Insert("media" , Value);
|
||||
EndIf;
|
||||
|
||||
EndIf;
|
||||
|
||||
If IsChannel Then
|
||||
ParametersStructure.Insert("from", UserID);
|
||||
ParametersStructure.Insert("from" , UserID);
|
||||
URL = "https://chatapi.viber.com/pa/post";
|
||||
Else
|
||||
ParametersStructure.Insert("receiver", UserID);
|
||||
@@ -395,11 +395,11 @@ EndFunction
|
||||
Function ReturnStandardParameters()
|
||||
|
||||
SenderStructure = New Structure;
|
||||
SenderStructure.Insert("name" , "Bot");
|
||||
SenderStructure.Insert("name" , "Bot");
|
||||
SenderStructure.Insert("avatar", "");
|
||||
|
||||
ParametersStructure = New Structure;
|
||||
ParametersStructure.Insert("sender", SenderStructure);
|
||||
ParametersStructure.Insert("sender" , SenderStructure);
|
||||
ParametersStructure.Insert("min_api_version", 1);
|
||||
|
||||
Return ParametersStructure;
|
||||
|
@@ -55,7 +55,7 @@ Function GetDiskInformation(Val Token) Export
|
||||
|
||||
OPI_TypeConversion.GetLine(Token);
|
||||
|
||||
Headers = AuthorizationHeader(Token);
|
||||
Headers = AuthorizationHeader(Token);
|
||||
Response = OPI_Tools.Get("https://cloud-api.yandex.net/v1/disk", , Headers);
|
||||
|
||||
Return Response;
|
||||
@@ -77,14 +77,14 @@ Function CreateFolder(Val Token, Val Path) Export
|
||||
OPI_TypeConversion.GetLine(Path);
|
||||
|
||||
Headers = AuthorizationHeader(Token);
|
||||
URL = "https://cloud-api.yandex.net/v1/disk/resources";
|
||||
Href = "href";
|
||||
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);
|
||||
Response = OPI_Tools.Put(URL + Parameters, , Headers, False);
|
||||
|
||||
ResponseURL = Response[Href];
|
||||
|
||||
@@ -112,7 +112,7 @@ Function GetObject(Val Token, Val Path) Export
|
||||
OPI_TypeConversion.GetLine(Token);
|
||||
OPI_TypeConversion.GetLine(Path);
|
||||
|
||||
Headers = AuthorizationHeader(Token);
|
||||
Headers = AuthorizationHeader(Token);
|
||||
Parameters = New Structure;
|
||||
Parameters.Insert("path", Path);
|
||||
|
||||
@@ -141,7 +141,7 @@ Function DeleteObject(Val Token, Val Path, Val ToCart = True) Export
|
||||
Headers = AuthorizationHeader(Token);
|
||||
|
||||
Parameters = New Structure;
|
||||
Parameters.Insert("path" , Path);
|
||||
Parameters.Insert("path" , Path);
|
||||
Parameters.Insert("permanently", Not ToCart);
|
||||
|
||||
Response = OPI_Tools.Delete("https://cloud-api.yandex.net/v1/disk/resources", Parameters, Headers);
|
||||
@@ -169,16 +169,16 @@ Function CreateObjectCopy(Val Token, Val Original, Val Path, Val Overwrite = Fal
|
||||
OPI_TypeConversion.GetBoolean(Overwrite);
|
||||
|
||||
Headers = AuthorizationHeader(Token);
|
||||
URL = "https://cloud-api.yandex.net/v1/disk/resources/copy";
|
||||
Href = "href";
|
||||
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("from" , Original);
|
||||
Parameters.Insert("path" , Path);
|
||||
Parameters.Insert("overwrite" , Overwrite);
|
||||
|
||||
Parameters = OPI_Tools.RequestParametersToString(Parameters);
|
||||
Response = OPI_Tools.Post(URL + Parameters, , Headers, False);
|
||||
Response = OPI_Tools.Post(URL + Parameters, , Headers, False);
|
||||
|
||||
ResponseURL = Response[Href];
|
||||
|
||||
@@ -231,7 +231,7 @@ Function DownloadFile(Val Token, Val Path, Val SavePath = "") Export
|
||||
|
||||
OPI_TypeConversion.GetLine(SavePath);
|
||||
Response = GetDownloadLink(Token, Path);
|
||||
URL = Response["href"];
|
||||
URL = Response["href"];
|
||||
|
||||
If Not ValueIsFilled(URL) Then
|
||||
Return Response;
|
||||
@@ -317,16 +317,16 @@ Function MoveObject(Val Token, Val Original, Val Path, Val Overwrite = False) Ex
|
||||
OPI_TypeConversion.GetBoolean(Overwrite);
|
||||
|
||||
Headers = AuthorizationHeader(Token);
|
||||
URL = "https://cloud-api.yandex.net/v1/disk/resources/move";
|
||||
Href = "href";
|
||||
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("from" , Original);
|
||||
Parameters.Insert("path" , Path);
|
||||
Parameters.Insert("overwrite" , Overwrite);
|
||||
|
||||
Parameters = OPI_Tools.RequestParametersToString(Parameters);
|
||||
Response = OPI_Tools.Post(URL + Parameters, , Headers, False);
|
||||
Parameters = OPI_Tools.RequestParametersToString(Parameters);
|
||||
Response = OPI_Tools.Post(URL + Parameters, , Headers, False);
|
||||
ResponseURL = Response[Href];
|
||||
|
||||
If Not ValueIsFilled(ResponseURL) Then
|
||||
@@ -358,15 +358,15 @@ Function UploadFile(Val Token, Val Path, Val File, Val Overwrite = False) Export
|
||||
OPI_TypeConversion.GetBinaryData(File);
|
||||
|
||||
Headers = AuthorizationHeader(Token);
|
||||
Href = "href";
|
||||
File = New Structure("file", File);
|
||||
Href = "href";
|
||||
File = New Structure("file", File);
|
||||
|
||||
Parameters = New Structure;
|
||||
Parameters.Insert("path" , Path);
|
||||
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];
|
||||
URL = Response[Href];
|
||||
|
||||
If Not ValueIsFilled(URL) Then
|
||||
Return Response;
|
||||
@@ -395,14 +395,14 @@ Function UploadFileByURL(Val Token, Val Path, Val Address) Export
|
||||
OPI_TypeConversion.GetLine(Address);
|
||||
|
||||
Headers = AuthorizationHeader(Token);
|
||||
URL = "https://cloud-api.yandex.net/v1/disk/resources/upload";
|
||||
URL = "https://cloud-api.yandex.net/v1/disk/resources/upload";
|
||||
|
||||
Parameters = New Structure;
|
||||
Parameters.Insert("url" , EncodeString(Address, StringEncodingMethod.URLencoding));
|
||||
Parameters.Insert("path", Path);
|
||||
|
||||
Parameters = OPI_Tools.RequestParametersToString(Parameters);
|
||||
Response = OPI_Tools.Post(URL + Parameters, , Headers, False);
|
||||
Response = OPI_Tools.Post(URL + Parameters, , Headers, False);
|
||||
|
||||
Return Response;
|
||||
|
||||
@@ -566,7 +566,7 @@ Function SavePublicObjectToDisk(Val Token, Val URL, From = "", Target = "") Expo
|
||||
|
||||
Headers = AuthorizationHeader(Token);
|
||||
Address = "https://cloud-api.yandex.net/v1/disk/public/resources/save-to-disk";
|
||||
Href = "href";
|
||||
Href = "href";
|
||||
|
||||
Parameters = New Structure;
|
||||
Parameters.Insert("public_key", EncodeString(URL, StringEncodingMethod.URLencoding));
|
||||
@@ -580,7 +580,7 @@ Function SavePublicObjectToDisk(Val Token, Val URL, From = "", Target = "") Expo
|
||||
EndIf;
|
||||
|
||||
Parameters = OPI_Tools.RequestParametersToString(Parameters);
|
||||
Response = OPI_Tools.Post(Address + Parameters, , Headers, False);
|
||||
Response = OPI_Tools.Post(Address + Parameters, , Headers, False);
|
||||
|
||||
ResponseURL = Response[Href];
|
||||
|
||||
@@ -615,9 +615,9 @@ Function TogglePublicAccess(Val Token, Val Path, Val PublicAccess)
|
||||
OPI_TypeConversion.GetLine(Path);
|
||||
OPI_TypeConversion.GetBoolean(PublicAccess);
|
||||
|
||||
Headers = AuthorizationHeader(Token);
|
||||
Headers = AuthorizationHeader(Token);
|
||||
Destination = ?(PublicAccess, "publish", "unpublish");
|
||||
Href = "href";
|
||||
Href = "href";
|
||||
|
||||
URL = "https://cloud-api.yandex.net/v1/disk/resources/" + Destination;
|
||||
|
||||
@@ -625,7 +625,7 @@ Function TogglePublicAccess(Val Token, Val Path, Val PublicAccess)
|
||||
Parameters.Insert("path", Path);
|
||||
|
||||
Parameters = OPI_Tools.RequestParametersToString(Parameters);
|
||||
Response = OPI_Tools.Put(URL + Parameters, , Headers, False);
|
||||
Response = OPI_Tools.Put(URL + Parameters, , Headers, False);
|
||||
|
||||
ResponseURL = Response[Href];
|
||||
|
||||
|
@@ -52,7 +52,7 @@ 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);
|
||||
Response = OPI_Tools.Post("https://oauth.yandex.ru/device/code", Parameters, , False);
|
||||
|
||||
Return Response;
|
||||
|
||||
@@ -75,9 +75,9 @@ Function ConvertCodeToToken(Val ClientId, Val ClientSecret, Val DeviceCode) Expo
|
||||
OPI_TypeConversion.GetLine(DeviceCode);
|
||||
|
||||
Parameters = New Structure;
|
||||
Parameters.Insert("grant_type" , "device_code");
|
||||
Parameters.Insert("code" , DeviceCode);
|
||||
Parameters.Insert("client_id" , ClientId);
|
||||
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);
|
||||
@@ -103,9 +103,9 @@ Function RefreshToken(Val ClientId, Val ClientSecret, Val RefreshToken) Export
|
||||
OPI_TypeConversion.GetLine(RefreshToken);
|
||||
|
||||
Parameters = New Structure;
|
||||
Parameters.Insert("grant_type" , "refresh_token");
|
||||
Parameters.Insert("grant_type" , "refresh_token");
|
||||
Parameters.Insert("refresh_token" , RefreshToken);
|
||||
Parameters.Insert("client_id" , ClientId);
|
||||
Parameters.Insert("client_id" , ClientId);
|
||||
Parameters.Insert("client_secret" , ClientSecret);
|
||||
|
||||
Response = OPI_Tools.Post("https://oauth.yandex.ru/token", Parameters, , False);
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -48,23 +48,23 @@
|
||||
Function GetTestingSectionMapping() Export
|
||||
|
||||
StandardDependencies = "[Decode, Build]";
|
||||
GoogleDependencies = "Testing-GoogleWorkspace";
|
||||
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("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);
|
||||
Sections.Insert("Bitrix24" , StandardDependencies);
|
||||
Sections.Insert("GoogleDrive" , GoogleDependencies);
|
||||
Sections.Insert("GoogleSheets" , GoogleDependencies);
|
||||
Sections.Insert("Notion" , StandardDependencies);
|
||||
Sections.Insert("Slack" , StandardDependencies);
|
||||
Sections.Insert("Airtable" , StandardDependencies);
|
||||
Sections.Insert("Dropbox" , StandardDependencies);
|
||||
Sections.Insert("Bitrix24" , StandardDependencies);
|
||||
|
||||
Return Sections;
|
||||
|
||||
@@ -72,164 +72,164 @@ EndFunction
|
||||
|
||||
Function GetTestTable() Export
|
||||
|
||||
Telegram = "Telegram";
|
||||
Telegram = "Telegram";
|
||||
VKontakte = "VK";
|
||||
YDisk = "YandexDisk";
|
||||
Calendar = "GoogleCalendar";
|
||||
Twitter = "Twitter";
|
||||
Viber = "Viber";
|
||||
Drive = "GoogleDrive";
|
||||
VSpace = "GoogleWorkspace";
|
||||
Notion = "Notion";
|
||||
Slack = "Slack";
|
||||
Tables = "GoogleSheets";
|
||||
AirT = "Airtable";
|
||||
Dropbox = "Dropbox";
|
||||
Bitrix = "Bitrix24";
|
||||
YDisk = "YandexDisk";
|
||||
Calendar = "GoogleCalendar";
|
||||
Twitter = "Twitter";
|
||||
Viber = "Viber";
|
||||
Drive = "GoogleDrive";
|
||||
VSpace = "GoogleWorkspace";
|
||||
Notion = "Notion";
|
||||
Slack = "Slack";
|
||||
Tables = "GoogleSheets";
|
||||
AirT = "Airtable";
|
||||
Dropbox = "Dropbox";
|
||||
Bitrix = "Bitrix24";
|
||||
|
||||
TestTable = New ValueTable;
|
||||
TestTable.Columns.Add("Method");
|
||||
TestTable.Columns.Add("Synonym");
|
||||
TestTable.Columns.Add("Section");
|
||||
|
||||
NewTest(TestTable, "TelegramAPI_GetBotInfo" , "Get bot information" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_GetUpdates" , "Get updates" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_SetWebhook" , "Set Webhook" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_SendTextMessage" , "Send text message" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_SendImage" , "Send image" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_SendVideo" , "Send video" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_SendAudio" , "Send audio" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_SendDocument" , "Send document" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_SendGIF" , "Send GIF" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_SendMediaGroup" , "Send mediagroup" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_SendLocation" , "Send location" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_SendContact" , "Send contact" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_SendPoll" , "Send poll" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_ForwardMessage" , "Forward message" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_BanUnban" , "Ban/Unban" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_CreateInvitationLink" , "Create invitation link" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_PinUnpinMessage" , "Pin/Unpin message" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_GetMemberCount" , "Get participant count" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_GetForumAvatarsList", "Get forum avatars list", Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_GetBotInfo" , "Get bot information" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_GetUpdates" , "Get updates" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_SetWebhook" , "Set Webhook" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_SendTextMessage" , "Send text message" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_SendImage" , "Send image" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_SendVideo" , "Send video" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_SendAudio" , "Send audio" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_SendDocument" , "Send document" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_SendGIF" , "Send GIF" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_SendMediaGroup" , "Send mediagroup" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_SendLocation" , "Send location" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_SendContact" , "Send contact" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_SendPoll" , "Send poll" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_ForwardMessage" , "Forward message" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_BanUnban" , "Ban/Unban" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_CreateInvitationLink" , "Create invitation link" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_PinUnpinMessage" , "Pin/Unpin message" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_GetMemberCount" , "Get participant count" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_GetForumAvatarsList" , "Get forum avatars list" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_CreateDeleteForumTopic" , "Create/Delete forum topic" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_ChangeMainTopicName" , "Change main topic name" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_HideShowMainTopic" , "Hide/Show main topic" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_ChangeMainTopicName" , "Change main topic name" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_HideShowMainTopic" , "Hide/Show main topic" , Telegram);
|
||||
|
||||
NewTest(TestTable, "VKAPI_CreateTokenLink" , "Create token retrieval link", VKontakte);
|
||||
NewTest(TestTable, "VKAPI_CreateDeletePost" , "Create/Delete post" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_CreateCompositePost" , "Create/Delete composite post" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_CreatePoll" , "Create poll" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_SaveDeleteImage" , "Add/Delete image" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_CreateStory" , "Create story" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_DiscussionMethods" , "Actions with discussions" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_LikeRepostComment" , "Like/Repost/Comment" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_GetStatistics" , "Get statistics" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_GetPostStatistics" , "Get post statistics" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_CreateAdCampaign" , "Create advertising campaign" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_SendMessage" , "Send message" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_GetProductCategories" , "Get product categories" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_CreateProductSelection" , "Create product and selection" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_CreateTokenLink" , "Create token retrieval link" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_CreateDeletePost" , "Create/Delete post" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_CreateCompositePost" , "Create/Delete composite post" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_CreatePoll" , "Create poll" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_SaveDeleteImage" , "Add/Delete image" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_CreateStory" , "Create story" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_DiscussionMethods" , "Actions with discussions" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_LikeRepostComment" , "Like/Repost/Comment" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_GetStatistics" , "Get statistics" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_GetPostStatistics" , "Get post statistics" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_CreateAdCampaign" , "Create advertising campaign" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_SendMessage" , "Send message" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_GetProductCategories" , "Get product categories" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_CreateProductSelection" , "Create product and selection" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_CreateProductWithProperties" , "Create product with properties" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_GetProductList" , "Get product list" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_GetSelectionList" , "Get selection list" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_GetPropertyList" , "Get property list" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_GetOrderList" , "Get order list" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_UploadVideo" , "Upload video" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_GetProductList" , "Get product list" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_GetSelectionList" , "Get selection list" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_GetPropertyList" , "Get property list" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_GetOrderList" , "Get order list" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_UploadVideo" , "Upload video" , VKontakte);
|
||||
|
||||
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, "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, "GV_GetToken" , "Get token" , VSpace);
|
||||
NewTest(TestTable, "GV_UpdateToken" , "Refresh token" , VSpace);
|
||||
|
||||
NewTest(TestTable, "GC_GetCalendarList" , "Get list of calendars" , Calendar);
|
||||
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, "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, "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_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, "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_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" , "Send location" , Viber);
|
||||
NewTest(TestTable, "Viber_SendLink" , "Send link" , 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" , "Send location" , Viber);
|
||||
NewTest(TestTable, "Viber_SendLink" , "Send link" , 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_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, "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_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_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, "DropboxAPI_GetUpdateToken" , "Get/Update token" , Dropbox);
|
||||
NewTest(TestTable, "DropboxAPI_UploadFile" , "Upload file" , Dropbox);
|
||||
NewTest(TestTable, "DropboxAPI_UploadFileByURL" , "Upload file by URL" , Dropbox);
|
||||
NewTest(TestTable, "DropboxAPI_CreateFolder" , "Create folder" , Dropbox);
|
||||
NewTest(TestTable, "DropboxAPI_CreateDeleteTag" , "Create/Delete tag" , Dropbox);
|
||||
NewTest(TestTable, "DropboxAPI_GetAccount" , "Get account data" , Dropbox);
|
||||
NewTest(TestTable, "DropboxAPI_AccessManagement" , "Access management" , Dropbox);
|
||||
NewTest(TestTable, "DropboxAPI_GetUpdateToken" , "Get/Update token" , Dropbox);
|
||||
NewTest(TestTable, "DropboxAPI_UploadFile" , "Upload file" , Dropbox);
|
||||
NewTest(TestTable, "DropboxAPI_UploadFileByURL" , "Upload file by URL" , Dropbox);
|
||||
NewTest(TestTable, "DropboxAPI_CreateFolder" , "Create folder" , Dropbox);
|
||||
NewTest(TestTable, "DropboxAPI_CreateDeleteTag" , "Create/Delete tag" , Dropbox);
|
||||
NewTest(TestTable, "DropboxAPI_GetAccount" , "Get account data" , Dropbox);
|
||||
NewTest(TestTable, "DropboxAPI_AccessManagement" , "Access management" , Dropbox);
|
||||
NewTest(TestTable, "DropboxAPI_GetFolderFileList" , "Get list of folder files" , Dropbox);
|
||||
|
||||
NewTest(TestTable, "B24_TokenManagment" , "Token management" , Bitrix);
|
||||
NewTest(TestTable, "B24_ServerTime" , "Server time" , Bitrix);
|
||||
NewTest(TestTable, "B24_PostsManagment" , "Posts managment" , Bitrix);
|
||||
NewTest(TestTable, "B24_TaskManagment" , "Tasks managment" , Bitrix);
|
||||
NewTest(TestTable, "B24_CommentsManagment" , "Comments managment" , Bitrix);
|
||||
NewTest(TestTable, "B24_WorkingWithDrive" , "Working with drive" , Bitrix);
|
||||
NewTest(TestTable, "B24_Kanban" , "Kanban" , Bitrix);
|
||||
NewTest(TestTable, "B24_Timekeeping" , "Timekeeping" , Bitrix);
|
||||
NewTest(TestTable, "B24_ChatManagment" , "Chats works" , Bitrix);
|
||||
NewTest(TestTable, "B24_TokenManagment" , "Token management" , Bitrix);
|
||||
NewTest(TestTable, "B24_ServerTime" , "Server time" , Bitrix);
|
||||
NewTest(TestTable, "B24_PostsManagment" , "Posts managment" , Bitrix);
|
||||
NewTest(TestTable, "B24_TaskManagment" , "Tasks managment" , Bitrix);
|
||||
NewTest(TestTable, "B24_CommentsManagment" , "Comments managment" , Bitrix);
|
||||
NewTest(TestTable, "B24_WorkingWithDrive" , "Working with drive" , Bitrix);
|
||||
NewTest(TestTable, "B24_Kanban" , "Kanban" , Bitrix);
|
||||
NewTest(TestTable, "B24_Timekeeping" , "Timekeeping" , Bitrix);
|
||||
NewTest(TestTable, "B24_ChatManagment" , "Chats works" , Bitrix);
|
||||
NewTest(TestTable, "B24_NotificationsManagment" , "Notifications managment" , Bitrix);
|
||||
|
||||
Return TestTable;
|
||||
@@ -240,7 +240,7 @@ Function ExpectsThat(Value) Export
|
||||
|
||||
Try
|
||||
|
||||
Module = GetCommonModule("ЮТест");
|
||||
Module = GetCommonModule("ЮТест");
|
||||
Ожидаем = TypeOf(Module) = Type("CommonModule");
|
||||
Return Module.ОжидаетЧто(Value);
|
||||
|
||||
@@ -252,15 +252,15 @@ EndFunction
|
||||
|
||||
Function FormYAXTests() Export
|
||||
|
||||
Module = GetCommonModule("ЮТТесты");
|
||||
Sections = GetTestingSectionMapping();
|
||||
Module = GetCommonModule("ЮТТесты");
|
||||
Sections = GetTestingSectionMapping();
|
||||
TestTable = GetTestTable();
|
||||
|
||||
For Each Section In Sections Do
|
||||
|
||||
CurrentSection = Section.Key;
|
||||
Filter = New Structure("Section", CurrentSection);
|
||||
SectionTests = TestTable.FindRows(Filter);
|
||||
Filter = New Structure("Section", CurrentSection);
|
||||
SectionTests = TestTable.FindRows(Filter);
|
||||
|
||||
Set = Module.ДобавитьТестовыйНабор(CurrentSection);
|
||||
|
||||
@@ -276,7 +276,7 @@ EndFunction
|
||||
|
||||
Function FormAssertsTests() Export
|
||||
|
||||
TestTable = GetTestTable();
|
||||
TestTable = GetTestTable();
|
||||
ArrayOfTests = New Array;
|
||||
|
||||
For Each Test In TestTable Do
|
||||
@@ -296,10 +296,10 @@ EndFunction
|
||||
|
||||
Function GetBinary(Parameter) Export
|
||||
|
||||
Path = DataFilePath();
|
||||
Path = DataFilePath();
|
||||
LocalParameter = Parameter + "Local";
|
||||
MainValue = GetValueFromFile(Parameter , Path);
|
||||
LocalValue = GetValueFromFile(LocalParameter, Path);
|
||||
MainValue = GetValueFromFile(Parameter , Path);
|
||||
LocalValue = GetValueFromFile(LocalParameter, Path);
|
||||
|
||||
LocalFile = New File(LocalValue);
|
||||
|
||||
@@ -310,7 +310,7 @@ Function GetBinary(Parameter) Export
|
||||
EndIf;
|
||||
|
||||
If TypeOf(Value) = Type("String") Then
|
||||
Value = GetFilePath(Value, LocalParameter);
|
||||
Value = GetFilePath(Value, LocalParameter);
|
||||
EndIf;
|
||||
|
||||
Return Value;
|
||||
@@ -322,9 +322,9 @@ Function GetFilePath(Val Path, LocalParameter, Val SaveLocally = True) Export
|
||||
If StrFind(Path, "http") > 0
|
||||
Or StrFind(Path, "www") > 0 Then
|
||||
|
||||
TFN = GetTempFileName();
|
||||
TFN = GetTempFileName();
|
||||
CopyFile(Path, TFN);
|
||||
Path = TFN;
|
||||
Path = TFN;
|
||||
Binary = New BinaryData(Path);
|
||||
|
||||
If SaveLocally Then
|
||||
@@ -402,7 +402,7 @@ EndFunction
|
||||
|
||||
Function DataFilePath()
|
||||
|
||||
Path = "";
|
||||
Path = "";
|
||||
PossiblePaths = New Array;
|
||||
PossiblePaths.Add("./data.json");
|
||||
PossiblePaths.Add("C:\GDrive\Мой Диск\data.json");
|
||||
@@ -431,8 +431,8 @@ EndFunction
|
||||
|
||||
Procedure NewTest(ValueTable, Val Method, Val Synonym, Val Section)
|
||||
|
||||
NewTest = ValueTable.Add();
|
||||
NewTest.Method = Method;
|
||||
NewTest = ValueTable.Add();
|
||||
NewTest.Method = Method;
|
||||
NewTest.Synonym = Synonym;
|
||||
NewTest.Section = Section;
|
||||
|
||||
@@ -443,7 +443,7 @@ Procedure WriteParameterToFile(Val Parameter, Val Value, Val Path)
|
||||
Values = OPI_Tools.ReadJSONFile(Path);
|
||||
Values.Insert(Parameter, Value);
|
||||
|
||||
Record = New JSONWriter;
|
||||
Record = New JSONWriter;
|
||||
JSONWriterSettings = New JSONWriterSettings(JSONLineBreak.Auto, Chars.Tab);
|
||||
Record.OpenFile(Path, , , JSONWriterSettings);
|
||||
WriteJSON(Record, Values);
|
||||
@@ -455,7 +455,7 @@ Procedure WriteLogFile(Val Data, Val Method, Val Library)
|
||||
|
||||
Try
|
||||
|
||||
LogPath = "./docs/ru/results";
|
||||
LogPath = "./docs/ru/results";
|
||||
LibraryLogPath = LogPath + "/" + Library;
|
||||
|
||||
LogDirectory = New File(LogPath);
|
||||
@@ -471,7 +471,7 @@ Procedure WriteLogFile(Val Data, Val Method, Val Library)
|
||||
EndIf;
|
||||
|
||||
FilePath = LibraryLogPath + "/" + Method + ".log";
|
||||
LogFile = New File(FilePath);
|
||||
LogFile = New File(FilePath);
|
||||
|
||||
If Not LogFile.Exist() Then
|
||||
LogDocument = New TextDocument;
|
||||
|
@@ -109,12 +109,12 @@ Procedure GetCollection(Value) Export
|
||||
Else
|
||||
|
||||
If TypeOf(Value) = Type("BinaryData") Then
|
||||
Value = GetStringFromBinaryData(Value);
|
||||
Value = GetStringFromBinaryData(Value);
|
||||
Else
|
||||
Value = OPI_Tools.NumberToString(Value);
|
||||
Value = OPI_Tools.NumberToString(Value);
|
||||
EndIf;
|
||||
|
||||
File = New File(Value);
|
||||
File = New File(Value);
|
||||
JSONReader = New JSONReader;
|
||||
|
||||
If File.Exist() Then
|
||||
@@ -169,22 +169,22 @@ Procedure GetArray(Value) Export
|
||||
|
||||
CommaInQuotes = "','";
|
||||
|
||||
Value = StrReplace(Value, "['" , "");
|
||||
Value = StrReplace(Value, "']" , "");
|
||||
Value = StrReplace(Value, "['" , "");
|
||||
Value = StrReplace(Value, "']" , "");
|
||||
Value = StrReplace(Value, "', '" , CommaInQuotes);
|
||||
Value = StrReplace(Value, "' , '", CommaInQuotes);
|
||||
Value = StrReplace(Value, "' ,'" , CommaInQuotes);
|
||||
|
||||
Value = StrSplit(Value, CommaInQuotes, False);
|
||||
|
||||
For N = 0 To Value.UBound() Do
|
||||
For N = 0 To Value.UBound() Do
|
||||
Value[N] = TrimAll(Value[N]);
|
||||
EndDo;
|
||||
|
||||
Else
|
||||
|
||||
If TypeOf(Value) = Type("Number") Then
|
||||
Value = OPI_Tools.NumberToString(Value);
|
||||
Value = OPI_Tools.NumberToString(Value);
|
||||
EndIf;
|
||||
|
||||
OPI_Tools.ValueToArray(Value);
|
||||
@@ -204,7 +204,7 @@ Procedure GetBoolean(Value) Export
|
||||
If TypeOf(Value) = Type("Boolean") Then
|
||||
Return;
|
||||
Else
|
||||
Value = Boolean(Value);
|
||||
Value = Boolean(Value);
|
||||
EndIf;
|
||||
|
||||
Except
|
||||
@@ -229,12 +229,12 @@ Procedure GetLine(Value, Val FromSource = False) Export
|
||||
EndIf;
|
||||
|
||||
Value = OPI_Tools.NumberToString(Value);
|
||||
File = New File(Value);
|
||||
File = New File(Value);
|
||||
|
||||
If File.Exist() Then
|
||||
|
||||
TextReader = New TextReader(Value);
|
||||
Value = TextReader.Read();
|
||||
Value = TextReader.Read();
|
||||
TextReader.Close();
|
||||
|
||||
ElsIf StrStartsWith(Lower(Value), "http") Then
|
||||
@@ -243,7 +243,7 @@ Procedure GetLine(Value, Val FromSource = False) Export
|
||||
CopyFile(Value, TFN);
|
||||
|
||||
TextReader = New TextReader(TFN);
|
||||
Value = TextReader.Read();
|
||||
Value = TextReader.Read();
|
||||
TextReader.Close();
|
||||
|
||||
DeleteFiles(TFN);
|
||||
@@ -286,11 +286,11 @@ Procedure GetDate(Value) Export
|
||||
If TypeOf(Value) = Type(Date) Then
|
||||
Return;
|
||||
Else
|
||||
Value = XMLValue(Type(Date), Value);
|
||||
Value = XMLValue(Type(Date), Value);
|
||||
EndIf;
|
||||
|
||||
Except
|
||||
OOD = New TypeDescription(Date);
|
||||
OOD = New TypeDescription(Date);
|
||||
Value = OOD.AdjustValue(Value);
|
||||
EndTry;
|
||||
|
||||
@@ -299,7 +299,7 @@ EndProcedure
|
||||
Procedure GetNumber(Value) Export
|
||||
|
||||
TypeDescription = New TypeDescription("Number");
|
||||
Value = TypeDescription.AdjustValue(Value);
|
||||
Value = TypeDescription.AdjustValue(Value);
|
||||
|
||||
EndProcedure
|
||||
|
||||
@@ -309,7 +309,7 @@ EndProcedure
|
||||
|
||||
Function ThisIsCollection(Val Value)
|
||||
|
||||
Return TypeOf(Value) = Type("Array")
|
||||
Return TypeOf(Value) = Type("Array")
|
||||
Or TypeOf(Value) = Type("Structure")
|
||||
Or TypeOf(Value) = Type("Map");
|
||||
|
||||
@@ -317,7 +317,7 @@ EndFunction
|
||||
|
||||
Function ThisIsSymbolic(Val Value)
|
||||
|
||||
Return TypeOf(Value) = Type("String")
|
||||
Return TypeOf(Value) = Type("String")
|
||||
Or TypeOf(Value) = Type("Number")
|
||||
Or TypeOf(Value) = Type("Date");
|
||||
|
||||
|
@@ -69,8 +69,8 @@ Function HMAC(Val Key, Val Data, Type, BlockSize) Export
|
||||
EndIf;
|
||||
|
||||
If Key.Size() <= BlockSize Then
|
||||
Key = GetHexStringFromBinaryData(Key);
|
||||
Key = Left(Key + RepeatString("00", BlockSize), BlockSize * Twice);
|
||||
Key = GetHexStringFromBinaryData(Key);
|
||||
Key = Left(Key + RepeatString("00", BlockSize), BlockSize * Twice);
|
||||
EndIf;
|
||||
|
||||
Key = GetBinaryDataBufferFromBinaryData(GetBinaryDataFromHexString(Key));
|
||||
|
@@ -56,33 +56,33 @@ EndFunction
|
||||
#Region RequestsWithBody
|
||||
|
||||
Function Post(Val URL
|
||||
, Val Parameters = ""
|
||||
, Val Parameters = ""
|
||||
, Val AdditionalHeaders = ""
|
||||
, Val JSON = True
|
||||
, Val FullResponse = False
|
||||
, Val ResponseFile = Undefined) Export
|
||||
, Val FullResponse = False
|
||||
, Val ResponseFile = Undefined) Export
|
||||
|
||||
Return ExecuteRequestWithBody(URL, "POST", Parameters, AdditionalHeaders, JSON, FullResponse, ResponseFile);
|
||||
|
||||
EndFunction
|
||||
|
||||
Function Patch(Val URL
|
||||
, Val Parameters = ""
|
||||
, Val Parameters = ""
|
||||
, Val AdditionalHeaders = ""
|
||||
, Val JSON = True
|
||||
, Val FullResponse = False
|
||||
, Val ResponseFile = Undefined) Export
|
||||
, Val FullResponse = False
|
||||
, Val ResponseFile = Undefined) Export
|
||||
|
||||
Return ExecuteRequestWithBody(URL, "PATCH", Parameters, AdditionalHeaders, JSON, FullResponse, ResponseFile);
|
||||
|
||||
EndFunction
|
||||
|
||||
Function Put(Val URL
|
||||
, Val Parameters = ""
|
||||
, Val Parameters = ""
|
||||
, Val AdditionalHeaders = ""
|
||||
, Val JSON = True
|
||||
, Val FullResponse = False
|
||||
, Val ResponseFile = Undefined) Export
|
||||
, Val FullResponse = False
|
||||
, Val ResponseFile = Undefined) Export
|
||||
|
||||
Return ExecuteRequestWithBody(URL, "PUT", Parameters, AdditionalHeaders, JSON, FullResponse, ResponseFile);
|
||||
|
||||
@@ -92,7 +92,7 @@ Function PostBinary(Val URL
|
||||
, Val Body
|
||||
, Val AdditionalHeaders
|
||||
, Val FullResponse = False
|
||||
, Val DataType = "application/octet-stream") Export
|
||||
, Val DataType = "application/octet-stream") Export
|
||||
|
||||
Return ExecuteRequestWithBinaryData(URL, "POST", Body, AdditionalHeaders, FullResponse, DataType);
|
||||
|
||||
@@ -103,22 +103,22 @@ EndFunction
|
||||
#Region MultipartRequests
|
||||
|
||||
Function PostMultipart(Val URL
|
||||
, Val Parameters = ""
|
||||
, Val Files = ""
|
||||
, Val ContentType = "image/jpeg"
|
||||
, Val Parameters = ""
|
||||
, Val Files = ""
|
||||
, Val ContentType = "image/jpeg"
|
||||
, Val AdditionalHeaders = ""
|
||||
, Val ResponseFile = Undefined) Export
|
||||
, 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 Parameters = ""
|
||||
, Val Files = ""
|
||||
, Val ContentType = "image/jpeg"
|
||||
, Val AdditionalHeaders = ""
|
||||
, Val ResponseFile = Undefined) Export
|
||||
, Val ResponseFile = Undefined) Export
|
||||
|
||||
Return ExecuteMultipartRequest(URL, "PUT", Parameters, Files, ContentType, AdditionalHeaders, ResponseFile);
|
||||
|
||||
@@ -126,9 +126,9 @@ EndFunction
|
||||
|
||||
Function PostMultipartRelated(Val URL
|
||||
, Val JSON = ""
|
||||
, Val Files = ""
|
||||
, Val Files = ""
|
||||
, Val AdditionalHeaders = ""
|
||||
, Val ResponseFile = Undefined) Export
|
||||
, Val ResponseFile = Undefined) Export
|
||||
|
||||
Return ExecuteMultipartRelatedRequest(URL, "POST", JSON, Files, AdditionalHeaders, ResponseFile);
|
||||
|
||||
@@ -136,9 +136,9 @@ EndFunction
|
||||
|
||||
Function PatchMultipartRelated(Val URL
|
||||
, Val JSON = ""
|
||||
, Val Files = ""
|
||||
, Val Files = ""
|
||||
, Val AdditionalHeaders = ""
|
||||
, Val ResponseFile = Undefined) Export
|
||||
, Val ResponseFile = Undefined) Export
|
||||
|
||||
Return ExecuteMultipartRelatedRequest(URL, "PATCH", JSON, Files, AdditionalHeaders, ResponseFile);
|
||||
|
||||
@@ -157,13 +157,13 @@ Procedure ProcessResponse(Response, Val FullResponse = False) Export
|
||||
BodyFile = Response.GetBodyFileName();
|
||||
|
||||
If Not BodyFile = Undefined Then
|
||||
Response = BodyFile;
|
||||
Response = BodyFile;
|
||||
Return;
|
||||
EndIf;
|
||||
|
||||
GZip = "gzip";
|
||||
NeedsUnpacking =
|
||||
Response.Headers.Get("Content-Encoding") = GZip
|
||||
Response.Headers.Get("Content-Encoding") = GZip
|
||||
Or Response.Headers.Get("content-encoding") = GZip;
|
||||
|
||||
If NeedsUnpacking Then
|
||||
@@ -188,8 +188,8 @@ Function CreateRequest(Val Address, Val AdditionalHeaders = "", Val DataType = "
|
||||
|
||||
Headers = New Map;
|
||||
Headers.Insert("Accept-Encoding", "gzip");
|
||||
Headers.Insert("Accept" , "*/*");
|
||||
Headers.Insert("Connection" , "keep-alive");
|
||||
Headers.Insert("Accept" , "*/*");
|
||||
Headers.Insert("Connection" , "keep-alive");
|
||||
Headers.Insert("Accept-Charset" , "utf-8");
|
||||
|
||||
If ValueIsFilled(DataType) Then
|
||||
@@ -241,7 +241,7 @@ Function RequestParametersToString(Val Parameters) Export
|
||||
|
||||
ParameterString = ParameterString
|
||||
+ Parameter.Key
|
||||
+ "="
|
||||
+ " ="
|
||||
+ ParameterValue
|
||||
+ "&";
|
||||
EndDo;
|
||||
@@ -255,20 +255,20 @@ EndFunction
|
||||
Function SplitURL(Val URL) Export
|
||||
|
||||
URL = StrReplace(URL, "https://", "");
|
||||
URL = StrReplace(URL, "http://", "");
|
||||
URL = StrReplace(URL, ":443", "");
|
||||
URL = StrReplace(URL, "http://" , "");
|
||||
URL = StrReplace(URL, ":443" , "");
|
||||
|
||||
Address = Right(URL, StrLen(URL) - StrFind(URL, "/", SearchDirection.FromBegin) + 1);
|
||||
Server = Left(URL, StrFind(URL, "/", SearchDirection.FromBegin) - 1);
|
||||
Server = Left(URL, StrFind(URL, "/", SearchDirection.FromBegin) - 1);
|
||||
|
||||
Try
|
||||
SSL = New OpenSSLSecureConnection;
|
||||
SSL = New OpenSSLSecureConnection;
|
||||
Except
|
||||
Server = "https://" + Server;
|
||||
EndTry;
|
||||
|
||||
ReturnStructure = New Structure;
|
||||
ReturnStructure.Insert("Server", Server);
|
||||
ReturnStructure.Insert("Server" , Server);
|
||||
ReturnStructure.Insert("Address" , Address);
|
||||
|
||||
Return ReturnStructure;
|
||||
@@ -326,7 +326,7 @@ Function ReadJSONFile(Val Path) Export
|
||||
|
||||
JSONReader = New JSONReader;
|
||||
JSONReader.OpenFile(Path);
|
||||
Values = ReadJSON(JSONReader);
|
||||
Values = ReadJSON(JSONReader);
|
||||
|
||||
JSONReader.Close();
|
||||
|
||||
@@ -336,8 +336,8 @@ EndFunction
|
||||
|
||||
Function RequestParametersToMap(Val ParameterString) Export
|
||||
|
||||
ReturnMapping = New Map;
|
||||
NumberOfParts = 2;
|
||||
ReturnMapping = New Map;
|
||||
NumberOfParts = 2;
|
||||
ParameterArray = StrSplit(ParameterString, "&", False);
|
||||
|
||||
For Each Parameter In ParameterArray Do
|
||||
@@ -360,13 +360,13 @@ EndFunction
|
||||
|
||||
Function UNIXTime(Val Date) Export
|
||||
|
||||
OTD = New TypeDescription("Date");
|
||||
OTD = New TypeDescription("Date");
|
||||
Date = OTD.AdjustValue(Date);
|
||||
|
||||
UNIX = Format(Date - Date(1970, 1, 1, 1, 0, 0), "HC=10; HDC=0; HG=0");
|
||||
UNIX = StrReplace(UNIX, ",", "");
|
||||
UNIX = StrReplace(UNIX, "," , "");
|
||||
UNIX = StrReplace(UNIX, Chars.NBSp, "");
|
||||
UNIX = StrReplace(UNIX, " ", "");
|
||||
UNIX = StrReplace(UNIX, " " , "");
|
||||
UNIX = Left(UNIX, 10);
|
||||
|
||||
Return UNIX;
|
||||
@@ -375,13 +375,13 @@ EndFunction
|
||||
|
||||
Function ProgressInformation(Val Current, Val Total, Val Unit, Val Divider = 1) Export
|
||||
|
||||
Whole = 100;
|
||||
Whole = 100;
|
||||
Current = Round(Current / Divider, 2);
|
||||
Total = Round(Total / Divider, 2);
|
||||
Total = Round(Total / Divider, 2);
|
||||
Percent = Int(Current / Total * Whole);
|
||||
|
||||
StrCurrent = NumberToString(Current);
|
||||
StrTotal = NumberToString(Total);
|
||||
StrCurrent = NumberToString(Current);
|
||||
StrTotal = NumberToString(Total);
|
||||
StrPercentage = NumberToString(Percent);
|
||||
|
||||
Information = StrCurrent + "/" + StrTotal + " " + Unit + " ( " + StrPercentage + "% )";
|
||||
@@ -428,7 +428,7 @@ Procedure ValueToArray(Value) Export
|
||||
|
||||
Value_ = New Array;
|
||||
Value_.Add(Value);
|
||||
Value = Value_;
|
||||
Value = Value_;
|
||||
|
||||
EndProcedure
|
||||
|
||||
@@ -462,7 +462,7 @@ EndProcedure
|
||||
|
||||
Procedure RemoveEmptyCollectionFields(Collection) Export
|
||||
|
||||
CollectionType = TypeOf(Collection);
|
||||
CollectionType = TypeOf(Collection);
|
||||
OutputCollection = New(CollectionType);
|
||||
|
||||
If CollectionType = Type("Map") Or CollectionType = Type("Structure") Then
|
||||
@@ -502,13 +502,13 @@ Procedure AddField(Val Name, Val Value, Val Type, Collection) Export
|
||||
Return;
|
||||
EndIf;
|
||||
|
||||
If Type = "Date" Then
|
||||
If Type = "Date" Then
|
||||
OPI_TypeConversion.GetDate(Value);
|
||||
Value = UNIXTime(Value);
|
||||
|
||||
ElsIf Type = "DateISO" Then
|
||||
OPI_TypeConversion.GetDate(Value);
|
||||
Value = XMLString(Value);
|
||||
Value = XMLString(Value);
|
||||
|
||||
ElsIf Type = "Collection" Then
|
||||
OPI_TypeConversion.GetCollection(Value);
|
||||
@@ -545,22 +545,22 @@ EndProcedure
|
||||
|
||||
Function ExecuteRequestWithBody(Val URL
|
||||
, Val View
|
||||
, Val Parameters = ""
|
||||
, Val Parameters = ""
|
||||
, Val AdditionalHeaders = ""
|
||||
, Val JSON = True
|
||||
, Val FullResponse = False
|
||||
, Val ResponseFile = Undefined)
|
||||
, Val FullResponse = False
|
||||
, Val ResponseFile = Undefined)
|
||||
|
||||
If Not ValueIsFilled(Parameters) Then
|
||||
Parameters = New Structure;
|
||||
EndIf;
|
||||
|
||||
DataType = ?(JSON, "application/json; charset=utf-8", "application/x-www-form-urlencoded; charset=utf-8");
|
||||
DataType = ?(JSON, "application/json; charset =utf-8", "application/x-www-form-urlencoded; charset =utf-8");
|
||||
URLStructure = SplitURL(URL);
|
||||
Server = URLStructure["Server"];
|
||||
Address = URLStructure["Address"];
|
||||
Server = URLStructure["Server"];
|
||||
Address = URLStructure["Address"];
|
||||
|
||||
Request = CreateRequest(Address, AdditionalHeaders, DataType);
|
||||
Request = CreateRequest(Address, AdditionalHeaders, DataType);
|
||||
Connection = CreateConnection(Server);
|
||||
|
||||
SetRequestBody(Request, Parameters, JSON);
|
||||
@@ -595,10 +595,10 @@ Function ExecuteRequestWithBinaryData(Val URL
|
||||
, Val DataType)
|
||||
|
||||
URLStructure = SplitURL(URL);
|
||||
Server = URLStructure["Server"];
|
||||
Address = URLStructure["Address"];
|
||||
Server = URLStructure["Server"];
|
||||
Address = URLStructure["Address"];
|
||||
|
||||
Request = CreateRequest(Address, AdditionalHeaders, DataType);
|
||||
Request = CreateRequest(Address, AdditionalHeaders, DataType);
|
||||
Connection = CreateConnection(Server);
|
||||
|
||||
If Not Data.Size() = 0 Then
|
||||
@@ -624,19 +624,19 @@ EndFunction
|
||||
|
||||
Function ExecuteRequestWithoutBody(Val URL
|
||||
, Val View
|
||||
, Val Parameters = ""
|
||||
, Val Parameters = ""
|
||||
, Val AdditionalHeaders = ""
|
||||
, Val ResponseFile = Undefined)
|
||||
, Val ResponseFile = Undefined)
|
||||
|
||||
If Not ValueIsFilled(Parameters) Then
|
||||
Parameters = New Structure;
|
||||
EndIf;
|
||||
|
||||
URLStructure = SplitURL(URL);
|
||||
Server = URLStructure["Server"];
|
||||
Address = URLStructure["Address"] + RequestParametersToString(Parameters);
|
||||
Server = URLStructure["Server"];
|
||||
Address = URLStructure["Address"] + RequestParametersToString(Parameters);
|
||||
|
||||
Request = CreateRequest(Address, AdditionalHeaders);
|
||||
Request = CreateRequest(Address, AdditionalHeaders);
|
||||
Connection = CreateConnection(Server);
|
||||
|
||||
If ValueIsFilled(ResponseFile) Then
|
||||
@@ -657,11 +657,11 @@ EndFunction
|
||||
|
||||
Function ExecuteMultipartRequest(Val URL
|
||||
, Val View
|
||||
, Val Parameters = ""
|
||||
, Val Files = ""
|
||||
, Val ContentType = "image/jpeg"
|
||||
, Val Parameters = ""
|
||||
, Val Files = ""
|
||||
, Val ContentType = "image/jpeg"
|
||||
, Val AdditionalHeaders = ""
|
||||
, Val ResponseFile = Undefined)
|
||||
, Val ResponseFile = Undefined)
|
||||
|
||||
If Not ValueIsFilled(Parameters) Then
|
||||
Parameters = New Structure;
|
||||
@@ -671,20 +671,20 @@ Function ExecuteMultipartRequest(Val URL
|
||||
Files = New Map;
|
||||
EndIf;
|
||||
|
||||
Redirection = 300;
|
||||
Error = 400;
|
||||
Boundary = StrReplace(String(New UUID), "-", "");
|
||||
Redirection = 300;
|
||||
Error = 400;
|
||||
Boundary = StrReplace(String(New UUID), "-", "");
|
||||
LineSeparator = Chars.CR + Chars.LF;
|
||||
DataType = "multipart/form-data; boundary=" + Boundary;
|
||||
URLStructure = SplitURL(URL);
|
||||
Server = URLStructure["Server"];
|
||||
Address = URLStructure["Address"];
|
||||
DataType = "multipart/form-data; boundary =" + Boundary;
|
||||
URLStructure = SplitURL(URL);
|
||||
Server = URLStructure["Server"];
|
||||
Address = URLStructure["Address"];
|
||||
|
||||
Request = CreateRequest(Address, AdditionalHeaders, DataType);
|
||||
Request = CreateRequest(Address, AdditionalHeaders, DataType);
|
||||
Connection = CreateConnection(Server);
|
||||
|
||||
RequestBody = GetTempFileName();
|
||||
TextRecord = New DataWriter(RequestBody
|
||||
TextRecord = New DataWriter(RequestBody
|
||||
, TextEncoding.UTF8
|
||||
, ByteOrder.LittleEndian
|
||||
, ""
|
||||
@@ -720,7 +720,7 @@ Function ExecuteMultipartRequest(Val URL
|
||||
ProcessResponse(Response);
|
||||
EndIf;
|
||||
|
||||
Request = Undefined;
|
||||
Request = Undefined;
|
||||
TextRecord = Undefined;
|
||||
|
||||
DeleteFiles(RequestBody);
|
||||
@@ -731,24 +731,24 @@ EndFunction
|
||||
Function ExecuteMultipartRelatedRequest(Val URL
|
||||
, Val View
|
||||
, Val JSON = ""
|
||||
, Val Files = ""
|
||||
, Val Files = ""
|
||||
, Val AdditionalHeaders = ""
|
||||
, Val ResponseFile = Undefined)
|
||||
, Val ResponseFile = Undefined)
|
||||
|
||||
Redirection = 300;
|
||||
Error = 400;
|
||||
Boundary = StrReplace(String(New UUID), "-", "");
|
||||
Redirection = 300;
|
||||
Error = 400;
|
||||
Boundary = StrReplace(String(New UUID), "-", "");
|
||||
LineSeparator = Chars.CR + Chars.LF;
|
||||
DataType = "multipart/related; boundary=" + Boundary;
|
||||
URLStructure = SplitURL(URL);
|
||||
Server = URLStructure["Server"];
|
||||
Address = URLStructure["Address"];
|
||||
DataType = "multipart/related; boundary =" + Boundary;
|
||||
URLStructure = SplitURL(URL);
|
||||
Server = URLStructure["Server"];
|
||||
Address = URLStructure["Address"];
|
||||
|
||||
Request = CreateRequest(Address, AdditionalHeaders, DataType);
|
||||
Request = CreateRequest(Address, AdditionalHeaders, DataType);
|
||||
Connection = CreateConnection(Server);
|
||||
|
||||
RequestBody = GetTempFileName();
|
||||
TextRecord = New DataWriter(RequestBody
|
||||
TextRecord = New DataWriter(RequestBody
|
||||
, TextEncoding.UTF8
|
||||
, ByteOrder.LittleEndian
|
||||
, ""
|
||||
@@ -785,7 +785,7 @@ Function ExecuteMultipartRelatedRequest(Val URL
|
||||
ProcessResponse(Response);
|
||||
EndIf;
|
||||
|
||||
Request = Undefined;
|
||||
Request = Undefined;
|
||||
TextRecord = Undefined;
|
||||
|
||||
DeleteFiles(RequestBody);
|
||||
@@ -796,7 +796,7 @@ EndFunction
|
||||
Function ThisIsRedirection(Val Response)
|
||||
|
||||
Redirection = 300;
|
||||
Error = 400;
|
||||
Error = 400;
|
||||
|
||||
ThisIsRedirection = Response.StatusCode >= Redirection
|
||||
And Response.StatusCode < Error
|
||||
@@ -809,12 +809,12 @@ EndFunction
|
||||
Function ConvertParameterToString(Val Value)
|
||||
|
||||
If TypeOf(Value) = Type("Array") Then
|
||||
Value = StrConcat(Value, ",");
|
||||
Value = EncodeString(Value, StringEncodingMethod.URLInURLEncoding);
|
||||
Value = "[" + Value + "]";
|
||||
Value = StrConcat(Value, ",");
|
||||
Value = EncodeString(Value, StringEncodingMethod.URLInURLEncoding);
|
||||
Value = "[" + Value + "]";
|
||||
Else
|
||||
Value = NumberToString(Value);
|
||||
Value = EncodeString(Value, StringEncodingMethod.URLInURLEncoding);
|
||||
Value = NumberToString(Value);
|
||||
Value = EncodeString(Value, StringEncodingMethod.URLInURLEncoding);
|
||||
EndIf;
|
||||
|
||||
Return Value;
|
||||
@@ -824,20 +824,20 @@ EndFunction
|
||||
Function SplitFileKey(Val FileData, Val ContentType)
|
||||
|
||||
DotReplacement = "___";
|
||||
FileName = StrReplace(FileData, DotReplacement, ".");
|
||||
NameParts = StrSplit(FileName, "|", False);
|
||||
NeedParts = 2;
|
||||
FileName = StrReplace(FileData, DotReplacement, ".");
|
||||
NameParts = StrSplit(FileName, "|", False);
|
||||
NeedParts = 2;
|
||||
|
||||
If NameParts.Count() = NeedParts Then
|
||||
FieldName = NameParts[0];
|
||||
FileName = NameParts[1];
|
||||
FieldName = NameParts[0];
|
||||
FileName = NameParts[1];
|
||||
Else
|
||||
|
||||
If ContentType = "image/jpeg" Then
|
||||
FieldName = "photo";
|
||||
FieldName = "photo";
|
||||
Else
|
||||
FieldName = Left(FileName, StrFind(FileName, ".") - 1);
|
||||
FieldName = ?(ValueIsFilled(FieldName), FieldName, StrReplace(FileData,
|
||||
FieldName = Left(FileName, StrFind(FileName, ".") - 1);
|
||||
FieldName = ?(ValueIsFilled(FieldName), FieldName, StrReplace(FileData,
|
||||
DotReplacement, "."));
|
||||
EndIf;
|
||||
|
||||
@@ -856,12 +856,12 @@ Procedure SetRequestBody(Request, Val Parameters, Val JSON)
|
||||
Or TypeOf(Parameters) = Type("Array");
|
||||
|
||||
If JSON Then
|
||||
Data = JSONString(Parameters);
|
||||
Data = JSONString(Parameters);
|
||||
ElsIf Not Collection Then
|
||||
Data = Parameters;
|
||||
Data = Parameters;
|
||||
Else
|
||||
ParameterString = RequestParametersToString(Parameters);
|
||||
Data = Right(ParameterString, StrLen(ParameterString) - 1);
|
||||
Data = Right(ParameterString, StrLen(ParameterString) - 1);
|
||||
EndIf;
|
||||
|
||||
If TypeOf(Data) = Type("String") Then
|
||||
@@ -879,7 +879,7 @@ Procedure WriteMultipartParameters(TextRecord, Val Boundary, Val Parameters)
|
||||
|
||||
For Each Parameter In Parameters Do
|
||||
|
||||
If Parameter.Value = Undefined
|
||||
If Parameter.Value = Undefined
|
||||
Or Parameter.Value = NULL Then
|
||||
Continue;
|
||||
EndIf;
|
||||
@@ -889,7 +889,7 @@ Procedure WriteMultipartParameters(TextRecord, Val Boundary, Val Parameters)
|
||||
TextRecord.WriteLine(LineSeparator);
|
||||
TextRecord.WriteLine(LineSeparator);
|
||||
|
||||
If TypeOf(Parameter.Value) = Type("String")
|
||||
If TypeOf(Parameter.Value) = Type("String")
|
||||
Or TypeOf(Parameter.Value) = Type("Number") Then
|
||||
|
||||
ValueAsString = NumberToString(Parameter.Value);
|
||||
@@ -913,7 +913,7 @@ EndProcedure
|
||||
|
||||
Procedure WriteMultipartFiles(TextRecord, Val Boundary, Val ContentType, Val Files)
|
||||
|
||||
ContentType = TrimAll(ContentType);
|
||||
ContentType = TrimAll(ContentType);
|
||||
LineSeparator = Chars.CR + Chars.LF;
|
||||
|
||||
For Each File In Files Do
|
||||
@@ -921,7 +921,7 @@ Procedure WriteMultipartFiles(TextRecord, Val Boundary, Val ContentType, Val Fil
|
||||
DataStructure = SplitFileKey(File.Key, ContentType);
|
||||
|
||||
FieldName = DataStructure["FieldName"];
|
||||
FileName = DataStructure["FileName"];
|
||||
FileName = DataStructure["FileName"];
|
||||
|
||||
TextRecord.WriteLine("--" + boundary + LineSeparator);
|
||||
TextRecord.WriteLine("Content-Disposition: form-data; name="""
|
||||
@@ -971,16 +971,16 @@ EndProcedure
|
||||
|
||||
Procedure WriteBinaryData(DataWriter, Val BinaryData)
|
||||
|
||||
ChunkSize = 268435456;
|
||||
BytesRead = 0;
|
||||
ChunkSize = 268435456;
|
||||
BytesRead = 0;
|
||||
CurrentPosition = 0;
|
||||
TotalSize = BinaryData.Size();
|
||||
TotalSize = BinaryData.Size();
|
||||
|
||||
WHile BytesRead < TotalSize Do
|
||||
|
||||
DataReader = New DataReader(BinaryData);
|
||||
BytesRead = DataReader.Skip(CurrentPosition);
|
||||
Result = DataReader.Read(ChunkSize);
|
||||
DataReader = New DataReader(BinaryData);
|
||||
BytesRead = DataReader.Skip(CurrentPosition);
|
||||
Result = DataReader.Read(ChunkSize);
|
||||
CurrentData = Result.GetBinaryData();
|
||||
CurrentSize = CurrentData.Size();
|
||||
|
||||
@@ -1094,15 +1094,15 @@ EndFunction
|
||||
|
||||
Function ReadGZip(CompressedData) Export
|
||||
|
||||
GZipPrefixSize = 10;
|
||||
GZipPrefixSize = 10;
|
||||
GZipPostfixSize = 8;
|
||||
|
||||
SizeDD = ZipSizeDD();
|
||||
SizeDD = ZipSizeDD();
|
||||
SizeCDH = ZipSizeCDH();
|
||||
SizeESD = ZipSizeEOCD();
|
||||
SizeLFH = ZipSizeLFH();
|
||||
|
||||
DataReader = New DataReader(CompressedData);
|
||||
DataReader = New DataReader(CompressedData);
|
||||
DataReader.Skip(GZipPrefixSize);
|
||||
CompressedDataSize = DataReader.SourceStream().Size() - GZipPrefixSize - GZipPostfixSize;
|
||||
|
||||
@@ -1123,7 +1123,7 @@ Function ReadGZip(CompressedData) Export
|
||||
UncompressedDataSize = DataReader.ReadInt32();
|
||||
DataReader.Close();
|
||||
|
||||
DataWriter.WriteBinaryDataBuffer(ZipDD(CRC32, CompressedDataSize, UncompressedDataSize));
|
||||
DataWriter.WriteBinaryDataBuffer(ZipDD(CRC32 , CompressedDataSize, UncompressedDataSize));
|
||||
DataWriter.WriteBinaryDataBuffer(ZipCDH(CRC32, CompressedDataSize, UncompressedDataSize));
|
||||
DataWriter.WriteBinaryDataBuffer(ZipEOCD(CompressedDataSize));
|
||||
DataWriter.Close();
|
||||
@@ -1134,9 +1134,9 @@ EndFunction
|
||||
|
||||
Function ReadZip(CompressedData, ErrorText = Undefined)
|
||||
|
||||
Directory = GetTempFileName();
|
||||
ReadingZip = New ZipFileReader(CompressedData);
|
||||
FileName = ReadingZip.Items[0].Name;
|
||||
Directory = GetTempFileName();
|
||||
ReadingZip = New ZipFileReader(CompressedData);
|
||||
FileName = ReadingZip.Items[0].Name;
|
||||
Try
|
||||
ReadingZip.Extract(ReadingZip.Items[0], Directory, ZIPRestoreFilePathsMode.DontRestore);
|
||||
Except
|
||||
|
@@ -53,8 +53,8 @@ Function GetListOfBases(Val Token, Val Indent = "") Export
|
||||
|
||||
OPI_TypeConversion.GetLine(Indent);
|
||||
|
||||
URL = "https://api.airtable.com/v0/meta/bases";
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
URL = "https://api.airtable.com/v0/meta/bases";
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
Parameters = New Structure;
|
||||
|
||||
OPI_Tools.AddField("offset", Indent, "String", Parameters);
|
||||
@@ -78,7 +78,7 @@ Function GetDatabaseTables(Val Token, Val Base) Export
|
||||
|
||||
OPI_TypeConversion.GetLine(Base);
|
||||
|
||||
URL = "https://api.airtable.com/v0/meta/bases/" + Base + "/tables";
|
||||
URL = "https://api.airtable.com/v0/meta/bases/" + Base + "/tables";
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
|
||||
Response = OPI_Tools.Get(URL, , Headers);
|
||||
@@ -102,15 +102,15 @@ Function CreateDatabase(Val Token, Val Workspace, Val Name, Val TableCollection)
|
||||
|
||||
OPI_TypeConversion.GetCollection(TableCollection);
|
||||
|
||||
If Not TypeOf(TableCollection) = Type("Structure")
|
||||
If Not TypeOf(TableCollection) = Type("Structure")
|
||||
And Not TypeOf(TableCollection) = Type("Map") Then
|
||||
|
||||
Raise "Error in table collection data";
|
||||
|
||||
EndIf;
|
||||
|
||||
URL = "https://api.airtable.com/v0/meta/bases";
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
URL = "https://api.airtable.com/v0/meta/bases";
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
TableArray = New Array;
|
||||
|
||||
For Each Table In TableCollection Do
|
||||
@@ -121,9 +121,9 @@ Function CreateDatabase(Val Token, Val Workspace, Val Name, Val TableCollection)
|
||||
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);
|
||||
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);
|
||||
|
||||
@@ -151,8 +151,8 @@ Function CreateTable(Val Token, Val Base, Val Name, Val FieldArray, Val Descript
|
||||
|
||||
OPI_TypeConversion.GetLine(Base);
|
||||
|
||||
URL = "https://api.airtable.com/v0/meta/bases/" + Base + "/tables";
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
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);
|
||||
@@ -178,11 +178,11 @@ Function ModifyTable(Val Token, Val Base, Val Table, Val Name = "", Val Descript
|
||||
OPI_TypeConversion.GetLine(Base);
|
||||
OPI_TypeConversion.GetLine(Table);
|
||||
|
||||
URL = "https://api.airtable.com/v0/meta/bases/" + Base + "/tables/" + Table;
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
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("name" , Name , "String", Parameters);
|
||||
OPI_Tools.AddField("description", Description , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Patch(URL, Parameters, Headers);
|
||||
@@ -212,14 +212,14 @@ Function CreateField(Val Token, Val Base, Val Table, Val FieldStructure) Export
|
||||
OPI_TypeConversion.GetLine(Table);
|
||||
OPI_TypeConversion.GetCollection(FieldStructure);
|
||||
|
||||
If Not TypeOf(FieldStructure) = Type("Structure")
|
||||
If Not TypeOf(FieldStructure) = Type("Structure")
|
||||
And Not TypeOf(FieldStructure) = Type("Map") Then
|
||||
|
||||
Raise "Error in field description data";
|
||||
|
||||
EndIf;
|
||||
|
||||
URL = "https://api.airtable.com/v0/meta/bases/" + Base + "/tables/" + Table + "/fields";
|
||||
URL = "https://api.airtable.com/v0/meta/bases/" + Base + "/tables/" + Table + "/fields";
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
|
||||
Response = OPI_Tools.Post(URL, FieldStructure, Headers);
|
||||
@@ -257,7 +257,7 @@ Function ModifyField(Val Token, Val Base, Val Table, Val Field, Val Name = "", V
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
|
||||
Parameters = New Structure();
|
||||
OPI_Tools.AddField("name" , Name, "String", Parameters);
|
||||
OPI_Tools.AddField("name" , Name , "String", Parameters);
|
||||
OPI_Tools.AddField("description", Description , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Patch(URL, Parameters, Headers);
|
||||
@@ -337,7 +337,7 @@ EndFunction
|
||||
// Structure - Field description
|
||||
Function GetDateField(Val Name) Export
|
||||
|
||||
FormatStructure = New Structure("format,name", "YYYY-MM-DD", "iso");
|
||||
FormatStructure = New Structure("format,name", "YYYY-MM-DD", "iso");
|
||||
OptionsStructure = New Structure("dateFormat", FormatStructure);
|
||||
|
||||
Return PrimitiveFieldDescription(Name, "date", OptionsStructure);
|
||||
@@ -406,7 +406,7 @@ Function GetListOfRecords(Val Token, Val Base, Val Table, Val Indent = "") Expor
|
||||
OPI_TypeConversion.GetLine(Base);
|
||||
OPI_TypeConversion.GetLine(Table);
|
||||
|
||||
URL = "https://api.airtable.com/v0/" + Base + "/" + Table;
|
||||
URL = "https://api.airtable.com/v0/" + Base + "/" + Table;
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
|
||||
Parameters = New Structure();
|
||||
@@ -435,7 +435,7 @@ Function GetRecord(Val Token, Val Base, Val Table, Val Record) Export
|
||||
OPI_TypeConversion.GetLine(Table);
|
||||
OPI_TypeConversion.GetLine(Record);
|
||||
|
||||
URL = "https://api.airtable.com/v0/" + Base + "/" + Table + "/" + Record;
|
||||
URL = "https://api.airtable.com/v0/" + Base + "/" + Table + "/" + Record;
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
|
||||
Response = OPI_Tools.Get(URL, , Headers);
|
||||
@@ -464,7 +464,7 @@ Function CreatePosts(Val Token, Val Base, Val Table, Val Data) Export
|
||||
Parameters = New Structure();
|
||||
AddDataDescription(Data, Parameters);
|
||||
|
||||
URL = "https://api.airtable.com/v0/" + Base + "/" + Table;
|
||||
URL = "https://api.airtable.com/v0/" + Base + "/" + Table;
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
@@ -493,13 +493,13 @@ Function DeletePosts(Val Token, Val Base, Val Table, Val Records) Export
|
||||
RecordString = "";
|
||||
|
||||
For Each Record In Records Do
|
||||
RecordString = RecordString
|
||||
RecordString = RecordString
|
||||
+ ?(ValueIsFilled(RecordString), "&", "?")
|
||||
+ "records[]="
|
||||
+ OPI_Tools.NumberToString(Record);
|
||||
EndDo;
|
||||
|
||||
URL = "https://api.airtable.com/v0/" + Base + "/" + Table + RecordString;
|
||||
URL = "https://api.airtable.com/v0/" + Base + "/" + Table + RecordString;
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
|
||||
Response = OPI_Tools.Delete(URL, , Headers);
|
||||
@@ -530,7 +530,7 @@ Function GetComments(Val Token, Val Base, Val Table, Val Record, Val Indent = ""
|
||||
OPI_TypeConversion.GetLine(Table);
|
||||
OPI_TypeConversion.GetLine(Record);
|
||||
|
||||
URL = "https://api.airtable.com/v0/" + Base + "/" + Table + "/" + Record + "/comments";
|
||||
URL = "https://api.airtable.com/v0/" + Base + "/" + Table + "/" + Record + "/comments";
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
|
||||
Parameters = New Structure();
|
||||
@@ -560,7 +560,7 @@ Function CreateComment(Val Token, Val Base, Val Table, Val Record, Val Text) Exp
|
||||
OPI_TypeConversion.GetLine(Table);
|
||||
OPI_TypeConversion.GetLine(Record);
|
||||
|
||||
URL = "https://api.airtable.com/v0/" + Base + "/" + Table + "/" + Record + "/comments";
|
||||
URL = "https://api.airtable.com/v0/" + Base + "/" + Table + "/" + Record + "/comments";
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
|
||||
Parameters = New Structure();
|
||||
@@ -592,7 +592,7 @@ Function EditComment(Val Token, Val Base, Val Table, Val Record, Val Comment, Va
|
||||
OPI_TypeConversion.GetLine(Record);
|
||||
OPI_TypeConversion.GetLine(Comment);
|
||||
|
||||
URL = "https://api.airtable.com/v0/" + Base + "/" + Table + "/" + Record + "/comments/" + Comment;
|
||||
URL = "https://api.airtable.com/v0/" + Base + "/" + Table + "/" + Record + "/comments/" + Comment;
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
|
||||
Parameters = New Structure();
|
||||
@@ -623,7 +623,7 @@ Function DeleteComment(Val Token, Val Base, Val Table, Val Record, Val Comment)
|
||||
OPI_TypeConversion.GetLine(Record);
|
||||
OPI_TypeConversion.GetLine(Comment);
|
||||
|
||||
URL = "https://api.airtable.com/v0/" + Base + "/" + Table + "/" + Record + "/comments/" + Comment;
|
||||
URL = "https://api.airtable.com/v0/" + Base + "/" + Table + "/" + Record + "/comments/" + Comment;
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
|
||||
Response = OPI_Tools.Delete(URL, , Headers);
|
||||
@@ -665,8 +665,8 @@ 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("name" , Name , "String" , FieldStructure);
|
||||
OPI_Tools.AddField("type" , Type , "String" , FieldStructure);
|
||||
OPI_Tools.AddField("options", Options , "Collection", FieldStructure);
|
||||
|
||||
Return FieldStructure;
|
||||
|
@@ -85,14 +85,14 @@ EndFunction
|
||||
// Map Of KeyAndValue - serialized JSON of answer from Bitrix24 API
|
||||
Function GetToken(Val ClientID, Val ClientSecret, Val Code) Export
|
||||
|
||||
URL = "https://oauth.bitrix.info/oauth/token/";
|
||||
URL = "https://oauth.bitrix.info/oauth/token/";
|
||||
String_ = "String";
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("grant_type" , "authorization_code", String_, Parameters);
|
||||
OPI_Tools.AddField("client_id" , ClientID , String_, Parameters);
|
||||
OPI_Tools.AddField("client_secret", ClientSecret , String_, Parameters);
|
||||
OPI_Tools.AddField("code" , Code , String_, Parameters);
|
||||
OPI_Tools.AddField("grant_type" , "authorization_code", String_, Parameters);
|
||||
OPI_Tools.AddField("client_id" , ClientID , String_, Parameters);
|
||||
OPI_Tools.AddField("client_secret", ClientSecret , String_, Parameters);
|
||||
OPI_Tools.AddField("code" , Code , String_, Parameters);
|
||||
|
||||
Response = OPI_Tools.Get(URL, Parameters);
|
||||
|
||||
@@ -112,14 +112,14 @@ EndFunction
|
||||
// Map Of KeyAndValue - serialized JSON of answer from Bitrix24 API
|
||||
Function RefreshToken(Val ClientID, Val ClientSecret, Val Refresh) Export
|
||||
|
||||
URL = "https://oauth.bitrix.info/oauth/token/";
|
||||
URL = "https://oauth.bitrix.info/oauth/token/";
|
||||
String_ = "String";
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("grant_type" , "refresh_token" , String_, Parameters);
|
||||
OPI_Tools.AddField("client_id" , ClientID , String_, Parameters);
|
||||
OPI_Tools.AddField("client_secret", ClientSecret , String_, Parameters);
|
||||
OPI_Tools.AddField("refresh_token", Refresh , String_, Parameters);
|
||||
OPI_Tools.AddField("grant_type" , "refresh_token" , String_, Parameters);
|
||||
OPI_Tools.AddField("client_id" , ClientID , String_, Parameters);
|
||||
OPI_Tools.AddField("client_secret", ClientSecret , String_, Parameters);
|
||||
OPI_Tools.AddField("refresh_token", Refresh , String_, Parameters);
|
||||
|
||||
Response = OPI_Tools.Get(URL, Parameters);
|
||||
|
||||
@@ -142,7 +142,7 @@ EndFunction
|
||||
Function ServerTime(Val URL, Val Token = "") Export
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "server.time");
|
||||
Response = OPI_Tools.Get(URL, Parameters);
|
||||
Response = OPI_Tools.Get(URL, Parameters);
|
||||
|
||||
Return Response;
|
||||
|
||||
@@ -182,10 +182,10 @@ Function CreatePost(Val URL
|
||||
String_ = "String";
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "log.blogpost.add");
|
||||
OPI_Tools.AddField("POST_MESSAGE", Text , String_, Parameters);
|
||||
OPI_Tools.AddField("POST_TITLE" , Title , String_, Parameters);
|
||||
OPI_Tools.AddField("DEST" , Visibility , "Array", Parameters);
|
||||
OPI_Tools.AddField("IMPORTANT" , Important , String_, Parameters);
|
||||
OPI_Tools.AddField("POST_MESSAGE", Text , String_, Parameters);
|
||||
OPI_Tools.AddField("POST_TITLE" , Title , String_, Parameters);
|
||||
OPI_Tools.AddField("DEST" , Visibility , "Array", Parameters);
|
||||
OPI_Tools.AddField("IMPORTANT" , Important , String_, Parameters);
|
||||
|
||||
If ValueIsFilled(Files) Then
|
||||
|
||||
@@ -233,10 +233,10 @@ Function UpdatePost(Val URL
|
||||
String_ = "String";
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "log.blogpost.update");
|
||||
OPI_Tools.AddField("POST_MESSAGE", Text , String_, Parameters);
|
||||
OPI_Tools.AddField("POST_TITLE" , Title , String_, Parameters);
|
||||
OPI_Tools.AddField("DEST" , Visibility , "Array", Parameters);
|
||||
OPI_Tools.AddField("POST_ID" , PostID , String_, Parameters);
|
||||
OPI_Tools.AddField("POST_MESSAGE", Text , String_, Parameters);
|
||||
OPI_Tools.AddField("POST_TITLE" , Title , String_, Parameters);
|
||||
OPI_Tools.AddField("DEST" , Visibility , "Array", Parameters);
|
||||
OPI_Tools.AddField("POST_ID" , PostID , String_, Parameters);
|
||||
|
||||
If ValueIsFilled(Files) Then
|
||||
|
||||
@@ -322,7 +322,7 @@ Function GetPosts(Val URL, Val PostID = "", Val Filter = "UA", Val Token = "") E
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "log.blogpost.get");
|
||||
|
||||
OPI_Tools.AddField("POST_ID" , PostID, "String", Parameters);
|
||||
OPI_Tools.AddField("POST_ID" , PostID , "String", Parameters);
|
||||
OPI_Tools.AddField("LOG_RIGHTS", Filter , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
@@ -350,7 +350,7 @@ Function AddPostComment(Val URL, Val PostID, Val Text, Val Token = "") Export
|
||||
Parameters = NormalizeAuth(URL, Token, "log.blogcomment.add");
|
||||
|
||||
OPI_Tools.AddField("POST_ID" , PostID, "String", Parameters);
|
||||
OPI_Tools.AddField("TEXT" , Text , "String", Parameters);
|
||||
OPI_Tools.AddField("TEXT" , Text , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -376,8 +376,8 @@ Function AddPostRecipients(Val URL, Val PostID, Val Visibility, Val Token = "")
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "log.blogpost.share");
|
||||
|
||||
OPI_Tools.AddField("POST_ID" , PostID, "String", Parameters);
|
||||
OPI_Tools.AddField("DEST" , Visibility, "String", Parameters);
|
||||
OPI_Tools.AddField("POST_ID" , PostID , "String", Parameters);
|
||||
OPI_Tools.AddField("DEST" , Visibility, "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -427,7 +427,7 @@ Function GetTasksList(Val URL, Val Filter = "", Val Indent = 0, Val Token = "")
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "tasks.task.list");
|
||||
OPI_Tools.AddField("filter", Filter, "Collection", Parameters);
|
||||
OPI_Tools.AddField("start" , Indent, "String" , Parameters);
|
||||
OPI_Tools.AddField("start" , Indent, "String" , Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -477,7 +477,7 @@ Function UpdateTask(Val URL, Val TaskID, Val FieldsStructure, Val Token = "") Ex
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "tasks.task.update");
|
||||
OPI_Tools.AddField("fields", FieldsStructure, "Collection", Parameters);
|
||||
OPI_Tools.AddField("taskId", TaskID , "String" , Parameters);
|
||||
OPI_Tools.AddField("taskId", TaskID , "String" , Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -523,7 +523,7 @@ Function AttachFileToTopic(Val URL, Val TaskID, Val FileID, Val Token = "") Expo
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "tasks.task.files.attach");
|
||||
OPI_Tools.AddField("fileId", FileID , "String", Parameters);
|
||||
OPI_Tools.AddField("taskId", TaskID, "String", Parameters);
|
||||
OPI_Tools.AddField("taskId", TaskID , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -729,7 +729,7 @@ Function DelegateTask(Val URL, Val TaskID, Val UserID, Val Token = "") Export
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "tasks.task.delegate");
|
||||
OPI_Tools.AddField("taskId", TaskID , "String", Parameters);
|
||||
OPI_Tools.AddField("userId", UserID, "String", Parameters);
|
||||
OPI_Tools.AddField("userId", UserID , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -815,7 +815,7 @@ Function CheckTaskAccesses(Val URL, Val TaskID, Val Users = "", Val Token = "")
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "tasks.task.getaccess");
|
||||
OPI_Tools.AddField("taskId", TaskID , "String" , Parameters);
|
||||
OPI_Tools.AddField("users" , Users, "Array", Parameters);
|
||||
OPI_Tools.AddField("users" , Users , "Array" , Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -885,9 +885,9 @@ Function CreateTasksDependencies(Val URL, Val FromID, Val DestinationID, Val Lin
|
||||
OPI_TypeConversion.GetLine(LinkType);
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "task.dependence.add");
|
||||
OPI_Tools.AddField("taskIdFrom", FromID, String_, Parameters);
|
||||
OPI_Tools.AddField("taskIdTo" , DestinationID, String_, Parameters);
|
||||
OPI_Tools.AddField("linkType" , LinkType , String_, Parameters);
|
||||
OPI_Tools.AddField("taskIdFrom", FromID , String_, Parameters);
|
||||
OPI_Tools.AddField("taskIdTo" , DestinationID, String_, Parameters);
|
||||
OPI_Tools.AddField("linkType" , LinkType , String_, Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -917,9 +917,9 @@ Function DeleteTasksDependencies(Val URL, Val FromID, Val DestinationID, Val Lin
|
||||
OPI_TypeConversion.GetLine(LinkType);
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "task.dependence.delete");
|
||||
OPI_Tools.AddField("taskIdFrom", FromID, String_, Parameters);
|
||||
OPI_Tools.AddField("taskIdTo" , DestinationID, String_, Parameters);
|
||||
OPI_Tools.AddField("linkType" , LinkType , String_, Parameters);
|
||||
OPI_Tools.AddField("taskIdFrom", FromID , String_, Parameters);
|
||||
OPI_Tools.AddField("taskIdTo" , DestinationID, String_, Parameters);
|
||||
OPI_Tools.AddField("linkType" , LinkType , String_, Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -964,7 +964,7 @@ EndFunction
|
||||
Function GetTaskFieldsStructure(Val URL, Val Token = "") Export
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "tasks.task.getFields");
|
||||
Response = OPI_Tools.Get(URL, Parameters);
|
||||
Response = OPI_Tools.Get(URL, Parameters);
|
||||
|
||||
Return Response;
|
||||
|
||||
@@ -986,31 +986,31 @@ Function GetTasksFilterStructure(Val Clear = False) Export
|
||||
OPI_TypeConversion.GetBoolean(Clear);
|
||||
|
||||
FilterStructure = New Structure;
|
||||
FilterStructure.Insert("ID" , "<task identifier>");
|
||||
FilterStructure.Insert("PARENT_ID" , "<parent task identifier>");
|
||||
FilterStructure.Insert("GROUP_ID" , "<workgroup identifier>");
|
||||
FilterStructure.Insert("CREATED_BY" , "<producer>");
|
||||
FilterStructure.Insert("ID" , "<task identifier>");
|
||||
FilterStructure.Insert("PARENT_ID" , "<parent task identifier>");
|
||||
FilterStructure.Insert("GROUP_ID" , "<workgroup identifier>");
|
||||
FilterStructure.Insert("CREATED_BY" , "<producer>");
|
||||
FilterStructure.Insert("STATUS_CHANGED_BY", "<the user who last changed the task status>");
|
||||
FilterStructure.Insert("PRIORITY" , "<priority>");
|
||||
FilterStructure.Insert("FORUM_TOPIC_ID" , "<forum topic identifier>");
|
||||
FilterStructure.Insert("RESPONSIBLE_ID" , "<performer>");
|
||||
FilterStructure.Insert("TITLE" , "<task name (can be searched using the template [%_])>");
|
||||
FilterStructure.Insert("TAG" , "<tag>");
|
||||
FilterStructure.Insert("REAL_STATUS" , "<task status>");
|
||||
FilterStructure.Insert("MARK" , "<mark>");
|
||||
FilterStructure.Insert("SITE_ID" , "<site identifier>");
|
||||
FilterStructure.Insert("ADD_IN_REPORT" , "<task in the report (Y|N)>");
|
||||
FilterStructure.Insert("DATE_START" , "<start date>");
|
||||
FilterStructure.Insert("DEADLINE" , "<deadline>");
|
||||
FilterStructure.Insert("CREATED_DATE" , "<date of creation>");
|
||||
FilterStructure.Insert("CLOSED_DATE" , "<completion date>");
|
||||
FilterStructure.Insert("CHANGED_DATE" , "<date of last modification>");
|
||||
FilterStructure.Insert("ACCOMPLICE" , "<co-executor identifier>");
|
||||
FilterStructure.Insert("AUDITOR" , "<auditor identifier>");
|
||||
FilterStructure.Insert("DEPENDS_ON" , "<previous task identifier>");
|
||||
FilterStructure.Insert("ONLY_ROOT_TASKS" , "<only tasks that are not subtasks (Y|N)>");
|
||||
FilterStructure.Insert("STAGE_ID" , "<stage>");
|
||||
FilterStructure.Insert("UF_CRM_TASK" , "<CRM elements>");
|
||||
FilterStructure.Insert("PRIORITY" , "<priority>");
|
||||
FilterStructure.Insert("FORUM_TOPIC_ID" , "<forum topic identifier>");
|
||||
FilterStructure.Insert("RESPONSIBLE_ID" , "<performer>");
|
||||
FilterStructure.Insert("TITLE" , "<task name (can be searched using the template [%_])>");
|
||||
FilterStructure.Insert("TAG" , "<tag>");
|
||||
FilterStructure.Insert("REAL_STATUS" , "<task status>");
|
||||
FilterStructure.Insert("MARK" , "<mark>");
|
||||
FilterStructure.Insert("SITE_ID" , "<site identifier>");
|
||||
FilterStructure.Insert("ADD_IN_REPORT" , "<task in the report (Y|N)>");
|
||||
FilterStructure.Insert("DATE_START" , "<start date>");
|
||||
FilterStructure.Insert("DEADLINE" , "<deadline>");
|
||||
FilterStructure.Insert("CREATED_DATE" , "<date of creation>");
|
||||
FilterStructure.Insert("CLOSED_DATE" , "<completion date>");
|
||||
FilterStructure.Insert("CHANGED_DATE" , "<date of last modification>");
|
||||
FilterStructure.Insert("ACCOMPLICE" , "<co-executor identifier>");
|
||||
FilterStructure.Insert("AUDITOR" , "<auditor identifier>");
|
||||
FilterStructure.Insert("DEPENDS_ON" , "<previous task identifier>");
|
||||
FilterStructure.Insert("ONLY_ROOT_TASKS" , "<only tasks that are not subtasks (Y|N)>");
|
||||
FilterStructure.Insert("STAGE_ID" , "<stage>");
|
||||
FilterStructure.Insert("UF_CRM_TASK" , "<CRM elements>");
|
||||
FilterStructure.Insert("STATUS"
|
||||
, "<status for sorting. Similar to REAL_STATUS, but has three additional meta-statuses>");
|
||||
|
||||
@@ -1049,14 +1049,14 @@ Function AddTasksChecklistElement(Val URL, Val TaskID, Val Text, Val Completed =
|
||||
String_ = "String";
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "task.checklistitem.add");
|
||||
Fields = New Structure;
|
||||
Fields = New Structure;
|
||||
|
||||
MakeBoolean(Completed);
|
||||
|
||||
OPI_Tools.AddField("TITLE" , Text , String_, Fields);
|
||||
OPI_Tools.AddField("TITLE" , Text , String_, Fields);
|
||||
OPI_Tools.AddField("IS_COMPLETE", Completed, String_, Fields);
|
||||
|
||||
OPI_Tools.AddField("TASKID", TaskID, String_ , Parameters);
|
||||
OPI_Tools.AddField("TASKID", TaskID , String_ , Parameters);
|
||||
OPI_Tools.AddField("FIELDS", Fields , "Collection", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
@@ -1085,13 +1085,13 @@ Function UpdateTasksChecklistElement(Val URL, Val TaskID, Val ElementID, Val Tex
|
||||
String_ = "String";
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "task.checklistitem.update");
|
||||
Fields = New Structure;
|
||||
Fields = New Structure;
|
||||
|
||||
OPI_Tools.AddField("TITLE", Text, String_, Fields);
|
||||
|
||||
OPI_Tools.AddField("TASKID", TaskID , String_ , Parameters);
|
||||
OPI_Tools.AddField("ITEMID", ElementID, String_ , Parameters);
|
||||
OPI_Tools.AddField("FIELDS", Fields , "Collection", Parameters);
|
||||
OPI_Tools.AddField("TASKID", TaskID , String_ , Parameters);
|
||||
OPI_Tools.AddField("ITEMID", ElementID, String_ , Parameters);
|
||||
OPI_Tools.AddField("FIELDS", Fields , "Collection", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -1253,7 +1253,7 @@ EndFunction
|
||||
Function GetTaskComment(Val URL, Val TaskID, Val CommentID, Val Token = "") Export
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "task.commentitem.get");
|
||||
OPI_Tools.AddField("TASKID", TaskID , "String", Parameters);
|
||||
OPI_Tools.AddField("TASKID", TaskID , "String", Parameters);
|
||||
OPI_Tools.AddField("ITEMID", CommentID, "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
@@ -1283,7 +1283,7 @@ Function AddTaskComment(Val URL, Val TaskID, Val Text, Val Token = "") Export
|
||||
Comment = New Structure;
|
||||
OPI_Tools.AddField("POST_MESSAGE", Text, "String", Comment);
|
||||
|
||||
OPI_Tools.AddField("TASKID", TaskID , "String" , Parameters);
|
||||
OPI_Tools.AddField("TASKID", TaskID , "String" , Parameters);
|
||||
OPI_Tools.AddField("FIELDS", Comment, "Collection", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
@@ -1316,9 +1316,9 @@ Function UpdateTaskComment(Val URL, Val TaskID, Val CommentID, Val Text, Val Tok
|
||||
Comment = New Structure;
|
||||
OPI_Tools.AddField("POST_MESSAGE", Text, "String", Comment);
|
||||
|
||||
OPI_Tools.AddField("TASKID", TaskID , String_ , Parameters);
|
||||
OPI_Tools.AddField("ITEMID", CommentID, String_ , Parameters);
|
||||
OPI_Tools.AddField("FIELDS", Comment , "Collection", Parameters);
|
||||
OPI_Tools.AddField("TASKID", TaskID , String_ , Parameters);
|
||||
OPI_Tools.AddField("ITEMID", CommentID, String_ , Parameters);
|
||||
OPI_Tools.AddField("FIELDS", Comment , "Collection", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -1343,7 +1343,7 @@ EndFunction
|
||||
Function DeleteTaskComment(Val URL, Val TaskID, Val CommentID, Val Token = "") Export
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "task.commentitem.delete");
|
||||
OPI_Tools.AddField("TASKID", TaskID , "String", Parameters);
|
||||
OPI_Tools.AddField("TASKID", TaskID , "String", Parameters);
|
||||
OPI_Tools.AddField("ITEMID", CommentID, "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
@@ -1436,11 +1436,11 @@ Function GetCommentStructure(Val Clear = False) Export
|
||||
OPI_TypeConversion.GetBoolean(Clear);
|
||||
|
||||
FieldsStructure = New Structure;
|
||||
FieldsStructure.Insert("AUTHOR_ID" , "<comment author identifier>");
|
||||
FieldsStructure.Insert("AUTHOR_NAME" , "<Name of user (optional)>");
|
||||
FieldsStructure.Insert("AUTHOR_EMAIL" , "<E-mail of user (optional)>");
|
||||
FieldsStructure.Insert("USE_SMILES" , "<(Y|N) - parse comments for emoticons or not>");
|
||||
FieldsStructure.Insert("POST_MESSAGE" , "<Message text>");
|
||||
FieldsStructure.Insert("AUTHOR_ID" , "<comment author identifier>");
|
||||
FieldsStructure.Insert("AUTHOR_NAME" , "<Name of user (optional)>");
|
||||
FieldsStructure.Insert("AUTHOR_EMAIL" , "<E-mail of user (optional)>");
|
||||
FieldsStructure.Insert("USE_SMILES" , "<(Y|N) - parse comments for emoticons or not>");
|
||||
FieldsStructure.Insert("POST_MESSAGE" , "<Message text>");
|
||||
FieldsStructure.Insert("UF_FORUM_MESSAGE_DOC" , "<Files array with of drive for of attachments>");
|
||||
|
||||
If Clear Then
|
||||
@@ -1486,15 +1486,15 @@ Function AddKanbanStage(Val URL
|
||||
String_ = "String";
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "task.stages.add");
|
||||
Fields = New Structure;
|
||||
Fields = New Structure;
|
||||
|
||||
MakeBoolean(AsAdmin);
|
||||
|
||||
OPI_Tools.AddField("TITLE" , Name , String_, Fields);
|
||||
OPI_Tools.AddField("COLOR" , Color , String_, Fields);
|
||||
OPI_Tools.AddField("TITLE" , Name , String_, Fields);
|
||||
OPI_Tools.AddField("COLOR" , Color , String_, Fields);
|
||||
OPI_Tools.AddField("AFTER_ID" , PrevStageID , String_, Fields);
|
||||
OPI_Tools.AddField("ENTITY_ID", EntityID , String_, Fields);
|
||||
OPI_Tools.AddField("isAdmin" , AsAdmin, String_, Fields);
|
||||
OPI_Tools.AddField("ENTITY_ID", EntityID , String_, Fields);
|
||||
OPI_Tools.AddField("isAdmin" , AsAdmin , String_, Fields);
|
||||
|
||||
Parameters.Insert("fields", Fields);
|
||||
|
||||
@@ -1532,14 +1532,14 @@ Function UpdateKanbansStage(Val URL
|
||||
String_ = "String";
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "task.stages.update");
|
||||
Fields = New Structure;
|
||||
Fields = New Structure;
|
||||
|
||||
OPI_Tools.AddField("TITLE" , Name , String_, Fields);
|
||||
OPI_Tools.AddField("COLOR" , Color , String_, Fields);
|
||||
OPI_Tools.AddField("AFTER_ID" , PrevStageID , String_, Fields);
|
||||
OPI_Tools.AddField("isAdmin" , AsAdmin, "Boolean", Fields);
|
||||
OPI_Tools.AddField("TITLE" , Name , String_ , Fields);
|
||||
OPI_Tools.AddField("COLOR" , Color , String_ , Fields);
|
||||
OPI_Tools.AddField("AFTER_ID" , PrevStageID , String_ , Fields);
|
||||
OPI_Tools.AddField("isAdmin" , AsAdmin , "Boolean", Fields);
|
||||
|
||||
OPI_Tools.AddField("id" , StageID, String_ , Parameters);
|
||||
OPI_Tools.AddField("id" , StageID, String_ , Parameters);
|
||||
OPI_Tools.AddField("fields", Fields , "Collection", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
@@ -1568,8 +1568,8 @@ Function DeleteKanbanStage(Val URL, Val StageID, Val AsAdmin = False, Val Token
|
||||
|
||||
MakeBoolean(AsAdmin);
|
||||
|
||||
OPI_Tools.AddField("id" , StageID , "String", Parameters);
|
||||
OPI_Tools.AddField("isAdmin", AsAdmin, "String", Parameters);
|
||||
OPI_Tools.AddField("id" , StageID , "String", Parameters);
|
||||
OPI_Tools.AddField("isAdmin", AsAdmin , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -1593,13 +1593,13 @@ EndFunction
|
||||
// Map Of KeyAndValue - serialized JSON of answer from Bitrix24 API
|
||||
Function GetKanbanStages(Val URL, Val EntityID = 0, Val AsAdmin = False, Val Token = "") Export
|
||||
|
||||
EntityID = OPI_Tools.NumberToString(EntityID);
|
||||
EntityID = OPI_Tools.NumberToString(EntityID);
|
||||
Parameters = NormalizeAuth(URL, Token, "task.stages.get");
|
||||
|
||||
MakeBoolean(AsAdmin);
|
||||
|
||||
OPI_Tools.AddField("entityId", EntityID , "String", Parameters);
|
||||
OPI_Tools.AddField("isAdmin" , AsAdmin, "String", Parameters);
|
||||
OPI_Tools.AddField("isAdmin" , AsAdmin , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -1634,7 +1634,7 @@ Function MoveTaskToKanbanStage(Val URL
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "task.stages.movetask");
|
||||
|
||||
OPI_Tools.AddField("id" , TaskID, String_, Parameters);
|
||||
OPI_Tools.AddField("id" , TaskID , String_, Parameters);
|
||||
OPI_Tools.AddField("stageId", StageID, String_, Parameters);
|
||||
|
||||
If ValueIsFilled(Prev) Then
|
||||
@@ -1686,14 +1686,14 @@ Function AddTaskTimeAccounting(Val URL
|
||||
String_ = "String";
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "task.elapseditem.add");
|
||||
Fields = New Structure;
|
||||
Fields = New Structure;
|
||||
|
||||
OPI_Tools.AddField("SECONDS" , Time , String_ , Fields);
|
||||
OPI_Tools.AddField("COMMENT_TEXT", Text , String_ , Fields);
|
||||
OPI_Tools.AddField("USER_ID" , UserID, String_ , Fields);
|
||||
OPI_Tools.AddField("SECONDS" , Time , String_ , Fields);
|
||||
OPI_Tools.AddField("COMMENT_TEXT", Text , String_ , Fields);
|
||||
OPI_Tools.AddField("USER_ID" , UserID , String_ , Fields);
|
||||
OPI_Tools.AddField("CREATED_DATE", SetupDate , "DateISO", Fields);
|
||||
|
||||
OPI_Tools.AddField("TASKID" , TaskID, String_ , Parameters);
|
||||
OPI_Tools.AddField("TASKID" , TaskID , String_ , Parameters);
|
||||
OPI_Tools.AddField("ARFIELDS", Fields , "Collection", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
@@ -1720,7 +1720,7 @@ Function DeleteTaskTimeAccounting(Val URL, Val TaskID, Val RecordID, Val Token =
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "task.elapseditem.delete");
|
||||
|
||||
OPI_Tools.AddField("TASKID", TaskID, "String", Parameters);
|
||||
OPI_Tools.AddField("TASKID", TaskID , "String", Parameters);
|
||||
OPI_Tools.AddField("ITEMID", RecordID, "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
@@ -1772,7 +1772,7 @@ Function GetTaskTimeAccounting(Val URL, Val TaskID, Val RecordID, Val Token = ""
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "task.elapseditem.get");
|
||||
|
||||
OPI_Tools.AddField("TASKID", TaskID, "String", Parameters);
|
||||
OPI_Tools.AddField("TASKID", TaskID , "String", Parameters);
|
||||
OPI_Tools.AddField("ITEMID", RecordID, "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
@@ -1809,15 +1809,15 @@ Function UpdateTaskTimeAccounting(Val URL
|
||||
String_ = "String";
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "task.elapseditem.update");
|
||||
Fields = New Structure;
|
||||
Fields = New Structure;
|
||||
|
||||
OPI_Tools.AddField("SECONDS" , Time , String_ , Fields);
|
||||
OPI_Tools.AddField("COMMENT_TEXT", Text , String_ , Fields);
|
||||
OPI_Tools.AddField("SECONDS" , Time , String_ , Fields);
|
||||
OPI_Tools.AddField("COMMENT_TEXT", Text , String_ , Fields);
|
||||
OPI_Tools.AddField("CREATED_DATE", SetupDate , "DateISO", Fields);
|
||||
|
||||
OPI_Tools.AddField("TASKID" , TaskID, String_ , Parameters);
|
||||
OPI_Tools.AddField("ITEMID" , RecordID, String_ , Parameters);
|
||||
OPI_Tools.AddField("ARFIELDS", Fields , "Collection", Parameters);
|
||||
OPI_Tools.AddField("TASKID" , TaskID , String_ , Parameters);
|
||||
OPI_Tools.AddField("ITEMID" , RecordID, String_ , Parameters);
|
||||
OPI_Tools.AddField("ARFIELDS", Fields , "Collection", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -1844,7 +1844,7 @@ EndFunction
|
||||
Function GetStoragesList(Val URL, Val Token = "") Export
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "disk.storage.getlist");
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
Return Response;
|
||||
|
||||
@@ -1864,7 +1864,7 @@ EndFunction
|
||||
// Map Of KeyAndValue - serialized JSON of answer from Bitrix24 API
|
||||
Function GetAppSotrage(Val URL, Val Token = "") Export
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "disk.storage.getforapp");
|
||||
Parameters = NormalizeAuth(URL, Token, "disk.storage.getforapp");
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
Return Response;
|
||||
@@ -1909,8 +1909,8 @@ Function RenameStorage(Val URL, Val StorageID, Val Name, Val Token = "") Export
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "disk.storage.rename");
|
||||
|
||||
OPI_Tools.AddField("id" , StorageID , "String", Parameters);
|
||||
OPI_Tools.AddField("newName", Name, "String", Parameters);
|
||||
OPI_Tools.AddField("id" , StorageID , "String", Parameters);
|
||||
OPI_Tools.AddField("newName", Name , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -1960,7 +1960,7 @@ Function CreateStorageFolder(Val URL, Val StorageID, Val Name, Val Token = "") E
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "disk.storage.addfolder");
|
||||
|
||||
OPI_Tools.AddField("id" , StorageID , "String" , Parameters);
|
||||
OPI_Tools.AddField("id" , StorageID , "String" , Parameters);
|
||||
OPI_Tools.AddField("data", FolderStructure, "Collection", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
@@ -2015,7 +2015,7 @@ Function CreateSubfolder(Val URL, Val FolderID, Val Name, Val Token = "") Export
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "disk.folder.addsubfolder");
|
||||
|
||||
OPI_Tools.AddField("id" , FolderID , "String" , Parameters);
|
||||
OPI_Tools.AddField("id" , FolderID , "String" , Parameters);
|
||||
OPI_Tools.AddField("data", FolderStructure, "Collection", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
@@ -2042,7 +2042,7 @@ Function MakeFolderCopy(Val URL, Val FolderID, Val DestinationID, Val Token = ""
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "disk.folder.copyto");
|
||||
|
||||
OPI_Tools.AddField("id" , FolderID , "String", Parameters);
|
||||
OPI_Tools.AddField("id" , FolderID , "String", Parameters);
|
||||
OPI_Tools.AddField("targetFolderId", DestinationID, "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
@@ -2069,7 +2069,7 @@ Function MoveFolder(Val URL, Val FolderID, Val DestinationID, Val Token = "") Ex
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "disk.folder.moveto");
|
||||
|
||||
OPI_Tools.AddField("id" , FolderID , "String", Parameters);
|
||||
OPI_Tools.AddField("id" , FolderID , "String", Parameters);
|
||||
OPI_Tools.AddField("targetFolderId", DestinationID, "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
@@ -2135,8 +2135,8 @@ EndFunction
|
||||
Function GetFolderItems(Val URL, Val FolderID, Val Filter = "", Val Token = "") Export
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "disk.folder.getchildren");
|
||||
OPI_Tools.AddField("id" , FolderID, "String" , Parameters);
|
||||
OPI_Tools.AddField("filter", Filter , "Collection", Parameters);
|
||||
OPI_Tools.AddField("id" , FolderID, "String" , Parameters);
|
||||
OPI_Tools.AddField("filter", Filter , "Collection", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -2202,8 +2202,8 @@ Function RenameFolder(Val URL, Val FolderID, Val Name, Val Token = "") Export
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "disk.folder.rename");
|
||||
|
||||
OPI_Tools.AddField("id" , FolderID , "String", Parameters);
|
||||
OPI_Tools.AddField("newName", Name, "String", Parameters);
|
||||
OPI_Tools.AddField("id" , FolderID , "String", Parameters);
|
||||
OPI_Tools.AddField("newName", Name , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -2227,14 +2227,14 @@ EndFunction
|
||||
Function GetFolderFilterStructure(Val URL, Val Clear = False, Val Token = "") Export
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "disk.folder.getfields");
|
||||
Filter = New Structure;
|
||||
Filter = New Structure;
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
Fields = Response["result"];
|
||||
Fields = Response["result"];
|
||||
|
||||
For Each Field In Fields Do
|
||||
|
||||
Name = Field.Key;
|
||||
Name = Field.Key;
|
||||
Description = Field.Value;
|
||||
|
||||
If Description["USE_IN_FILTER"] Then
|
||||
@@ -2282,14 +2282,14 @@ Function UploadFileToStorage(Val URL
|
||||
|
||||
Method = "disk.storage.uploadfile";
|
||||
|
||||
FileData = New Structure("NAME", Name);
|
||||
FileData = New Structure("NAME", Name);
|
||||
FileContent = New Map();
|
||||
FileContent.Insert(Name, File);
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, Method);
|
||||
OPI_Tools.AddField("data" , FileData, "Collection", Parameters);
|
||||
OPI_Tools.AddField("rights", Rights , "Array" , Parameters);
|
||||
OPI_Tools.AddField("id" , StorageID, "String" , Parameters);
|
||||
OPI_Tools.AddField("data" , FileData , "Collection", Parameters);
|
||||
OPI_Tools.AddField("rights", Rights , "Array" , Parameters);
|
||||
OPI_Tools.AddField("id" , StorageID, "String" , Parameters);
|
||||
|
||||
FileArray = NormalizeFiles(FileContent);
|
||||
|
||||
@@ -2327,7 +2327,7 @@ Function UploadFileToFolder(Val URL, Val Name, Val File, Val FolderID, Val Token
|
||||
OPI_Tools.AddField("id", FolderID, "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Get(URL, Parameters);
|
||||
Result = Response["result"];
|
||||
Result = Response["result"];
|
||||
|
||||
If ValueIsFilled(Result) Then
|
||||
|
||||
@@ -2338,7 +2338,7 @@ Function UploadFileToFolder(Val URL, Val Name, Val File, Val FolderID, Val Token
|
||||
|
||||
FieldName = TrimAll(FieldName);
|
||||
UploadURL = TrimAll(UploadURL);
|
||||
FileName = FieldName + "|" + Name;
|
||||
FileName = FieldName + "|" + Name;
|
||||
|
||||
FileMapping = New Map;
|
||||
FileMapping.Insert(FileName, File);
|
||||
@@ -2471,7 +2471,7 @@ Function MakeFileCopy(Val URL, Val FileID, Val FolderID, Val Token = "") Export
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "disk.file.copyto");
|
||||
|
||||
OPI_Tools.AddField("id" , FileID , "String", Parameters);
|
||||
OPI_Tools.AddField("id" , FileID , "String", Parameters);
|
||||
OPI_Tools.AddField("targetFolderId", FolderID, "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
@@ -2498,7 +2498,7 @@ Function MoveFileToFolder(Val URL, Val FileID, Val FolderID, Val Token = "") Exp
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "disk.file.moveto");
|
||||
|
||||
OPI_Tools.AddField("id" , FileID , "String", Parameters);
|
||||
OPI_Tools.AddField("id" , FileID , "String", Parameters);
|
||||
OPI_Tools.AddField("targetFolderId", FolderID, "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
@@ -2525,8 +2525,8 @@ Function RenameFile(Val URL, Val FileID, Val Name, Val Token = "") Export
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "disk.file.rename");
|
||||
|
||||
OPI_Tools.AddField("id" , FileID , "String", Parameters);
|
||||
OPI_Tools.AddField("newName", Name, "String", Parameters);
|
||||
OPI_Tools.AddField("id" , FileID , "String", Parameters);
|
||||
OPI_Tools.AddField("newName", Name , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -2655,9 +2655,9 @@ Function AddUsersToChat(Val URL
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "im.chat.user.add");
|
||||
|
||||
OPI_Tools.AddField("CHAT_ID" , ChatID , "String" , Parameters);
|
||||
OPI_Tools.AddField("USERS" , UserIDs, "Collection", Parameters);
|
||||
OPI_Tools.AddField("HIDE_HISTORY", HideHistory , "String" , Parameters);
|
||||
OPI_Tools.AddField("CHAT_ID" , ChatID , "String" , Parameters);
|
||||
OPI_Tools.AddField("USERS" , UserIDs , "Collection", Parameters);
|
||||
OPI_Tools.AddField("HIDE_HISTORY", HideHistory , "String" , Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -2684,7 +2684,7 @@ Function DeleteUserFromChat(Val URL, Val ChatID, Val UserID, Val Token = "") Exp
|
||||
Parameters = NormalizeAuth(URL, Token, "im.chat.user.delete");
|
||||
|
||||
OPI_Tools.AddField("CHAT_ID", ChatID , "String", Parameters);
|
||||
OPI_Tools.AddField("USER_ID", UserID, "String", Parameters);
|
||||
OPI_Tools.AddField("USER_ID", UserID , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -2711,7 +2711,7 @@ Function ChangeChatTitle(Val URL, Val ChatID, Val Title, Val Token = "") Export
|
||||
Parameters = NormalizeAuth(URL, Token, "im.chat.updateTitle");
|
||||
|
||||
OPI_Tools.AddField("CHAT_ID", ChatID , "String", Parameters);
|
||||
OPI_Tools.AddField("TITLE" , Title, "String", Parameters);
|
||||
OPI_Tools.AddField("TITLE" , Title , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -2739,7 +2739,7 @@ Function ChangeChatColor(Val URL, Val ChatID, Val Color, Val Token = "") Export
|
||||
Parameters = NormalizeAuth(URL, Token, "im.chat.updateColor");
|
||||
|
||||
OPI_Tools.AddField("CHAT_ID", ChatID, "String", Parameters);
|
||||
OPI_Tools.AddField("COLOR" , Color , "String", Parameters);
|
||||
OPI_Tools.AddField("COLOR" , Color , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -2765,11 +2765,11 @@ Function ChangeChatPicture(Val URL, Val ChatID, Val Image, Val Token = "") Expor
|
||||
|
||||
OPI_TypeConversion.GetBinaryData(Image);
|
||||
|
||||
Image = Base64String(Image);
|
||||
Image = Base64String(Image);
|
||||
Parameters = NormalizeAuth(URL, Token, "im.chat.updateAvatar");
|
||||
|
||||
OPI_Tools.AddField("CHAT_ID", ChatID , "String", Parameters);
|
||||
OPI_Tools.AddField("AVATAR" , Image, "String", Parameters);
|
||||
OPI_Tools.AddField("AVATAR" , Image , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -2796,7 +2796,7 @@ Function ChangeChatOwner(Val URL, Val ChatID, Val UserID, Val Token = "") Export
|
||||
Parameters = NormalizeAuth(URL, Token, "im.chat.setOwner");
|
||||
|
||||
OPI_Tools.AddField("CHAT_ID", ChatID , "String", Parameters);
|
||||
OPI_Tools.AddField("USER_ID", UserID, "String", Parameters);
|
||||
OPI_Tools.AddField("USER_ID", UserID , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -2872,8 +2872,8 @@ Function GetChatMessagesList(Val URL
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "im.dialog.messages.get");
|
||||
|
||||
OPI_Tools.AddField("DIALOG_ID", ChatID , String_, Parameters);
|
||||
OPI_Tools.AddField("LAST_ID" , LastID, String_, Parameters);
|
||||
OPI_Tools.AddField("DIALOG_ID", ChatID , String_, Parameters);
|
||||
OPI_Tools.AddField("LAST_ID" , LastID , String_, Parameters);
|
||||
OPI_Tools.AddField("FIRST_ID" , FirstID , String_, Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
@@ -3019,7 +3019,7 @@ EndFunction
|
||||
Function ReadAll(Val URL, Val Token = "") Export
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "im.dialog.read.all");
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
Return Response;
|
||||
|
||||
@@ -3058,14 +3058,14 @@ Function GetChatStructure(Val Clear = False) Export
|
||||
OPI_TypeConversion.GetBoolean(Clear);
|
||||
|
||||
ChatStructure = New Structure;
|
||||
ChatStructure.Insert("TYPE" , "<Chat type OPEN (Public) | CHAT (Private)>");
|
||||
ChatStructure.Insert("TITLE" , "<Chat title>");
|
||||
ChatStructure.Insert("TYPE" , "<Chat type OPEN (Public) | CHAT (Private)>");
|
||||
ChatStructure.Insert("TITLE" , "<Chat title>");
|
||||
ChatStructure.Insert("DESCRIPTION", "<Chat description>");
|
||||
ChatStructure.Insert("COLOR" , "<Chat color: RED, GREEN, MINT, LIGHT_BLUE, DARK_BLUE, PURPLE, AQUA, ...>");
|
||||
ChatStructure.Insert("MESSAGE" , "<First chat message>");
|
||||
ChatStructure.Insert("USERS" , "<Chat members array>");
|
||||
ChatStructure.Insert("AVATAR" , "<Base64 chat picture>");
|
||||
ChatStructure.Insert("OWNER_ID" , "<ID of chat owner. Current user by default>");
|
||||
ChatStructure.Insert("COLOR" , "<Chat color: RED, GREEN, MINT, LIGHT_BLUE, DARK_BLUE, PURPLE, AQUA, ...>");
|
||||
ChatStructure.Insert("MESSAGE" , "<First chat message>");
|
||||
ChatStructure.Insert("USERS" , "<Chat members array>");
|
||||
ChatStructure.Insert("AVATAR" , "<Base64 chat picture>");
|
||||
ChatStructure.Insert("OWNER_ID" , "<ID of chat owner. Current user by default>");
|
||||
|
||||
If Clear Then
|
||||
For Each Element In ChatStructure Do
|
||||
@@ -3101,9 +3101,9 @@ Function SendMessage(Val URL, Val ChatID, Val Text, Val Attachments = "", Val To
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "im.message.add");
|
||||
|
||||
OPI_Tools.AddField("DIALOG_ID", ChatID , "String", Parameters);
|
||||
OPI_Tools.AddField("MESSAGE" , Text , "String", Parameters);
|
||||
OPI_Tools.AddField("ATTACH" , Attachments, "Array", Parameters);
|
||||
OPI_Tools.AddField("DIALOG_ID", ChatID , "String", Parameters);
|
||||
OPI_Tools.AddField("MESSAGE" , Text , "String", Parameters);
|
||||
OPI_Tools.AddField("ATTACH" , Attachments, "Array" , Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -3130,9 +3130,9 @@ Function EditMessage(Val URL, Val MessageID, Val Text = "", Val Attachments = ""
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "im.message.update");
|
||||
|
||||
OPI_Tools.AddField("MESSAGE_ID", MessageID, "String", Parameters);
|
||||
OPI_Tools.AddField("MESSAGE" , Text , "String", Parameters);
|
||||
OPI_Tools.AddField("ATTACH" , Attachments , "Array", Parameters);
|
||||
OPI_Tools.AddField("MESSAGE_ID", MessageID , "String", Parameters);
|
||||
OPI_Tools.AddField("MESSAGE" , Text , "String", Parameters);
|
||||
OPI_Tools.AddField("ATTACH" , Attachments , "Array" , Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -3211,9 +3211,9 @@ Function SendFile(Val URL, Val ChatID, Val FileID, Val Description = "", Val Tok
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "im.disk.file.commit");
|
||||
|
||||
OPI_Tools.AddField("CHAT_ID" , ChatID , String_, Parameters);
|
||||
OPI_Tools.AddField("UPLOAD_ID", FileID , String_, Parameters);
|
||||
OPI_Tools.AddField("MESSAGE" , Description, String_, Parameters);
|
||||
OPI_Tools.AddField("CHAT_ID" , ChatID , String_, Parameters);
|
||||
OPI_Tools.AddField("UPLOAD_ID", FileID , String_, Parameters);
|
||||
OPI_Tools.AddField("MESSAGE" , Description, String_, Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -3239,7 +3239,7 @@ Function MarkMessageAsReaded(Val URL, Val ChatID, Val MessageID, Val Token = "")
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "im.dialog.read");
|
||||
|
||||
OPI_Tools.AddField("DIALOG_ID" , ChatID , "String", Parameters);
|
||||
OPI_Tools.AddField("DIALOG_ID" , ChatID , "String", Parameters);
|
||||
OPI_Tools.AddField("MESSAGE_ID", MessageID, "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
@@ -3266,7 +3266,7 @@ Function MarkMessageAsUnreaded(Val URL, Val ChatID, Val MessageID, Val Token = "
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "im.dialog.unread");
|
||||
|
||||
OPI_Tools.AddField("DIALOG_ID" , ChatID , "String", Parameters);
|
||||
OPI_Tools.AddField("DIALOG_ID" , ChatID , "String", Parameters);
|
||||
OPI_Tools.AddField("MESSAGE_ID", MessageID, "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
@@ -3350,10 +3350,10 @@ Function CreatePersonalNotification(Val URL
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "im.notify.personal.add");
|
||||
|
||||
OPI_Tools.AddField("USER_ID", UserID, "String", Parameters);
|
||||
OPI_Tools.AddField("MESSAGE", Text , "String", Parameters);
|
||||
OPI_Tools.AddField("TAG" , Tag , "String", Parameters);
|
||||
OPI_Tools.AddField("ATTACH" , Attachments , "Array", Parameters);
|
||||
OPI_Tools.AddField("USER_ID", UserID , "String", Parameters);
|
||||
OPI_Tools.AddField("MESSAGE", Text , "String", Parameters);
|
||||
OPI_Tools.AddField("TAG" , Tag , "String", Parameters);
|
||||
OPI_Tools.AddField("ATTACH" , Attachments , "Array" , Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -3386,10 +3386,10 @@ Function CreateSystemNotification(Val URL
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, "im.notify.system.add");
|
||||
|
||||
OPI_Tools.AddField("USER_ID", UserID, "String", Parameters);
|
||||
OPI_Tools.AddField("MESSAGE", Text , "String", Parameters);
|
||||
OPI_Tools.AddField("TAG" , Tag , "String", Parameters);
|
||||
OPI_Tools.AddField("ATTACH" , Attachments , "Array", Parameters);
|
||||
OPI_Tools.AddField("USER_ID", UserID , "String", Parameters);
|
||||
OPI_Tools.AddField("MESSAGE", Text , "String", Parameters);
|
||||
OPI_Tools.AddField("TAG" , Tag , "String", Parameters);
|
||||
OPI_Tools.AddField("ATTACH" , Attachments , "Array" , Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
@@ -3440,7 +3440,7 @@ Function NormalizeAuth(URL, Val Token, Val Method = "")
|
||||
OPI_TypeConversion.GetLine(URL);
|
||||
OPI_TypeConversion.GetLine(Token);
|
||||
|
||||
Parameters = New Structure;
|
||||
Parameters = New Structure;
|
||||
IsTokenAuth = ValueIsFilled(Token);
|
||||
|
||||
UncorrectItems = New Array;
|
||||
@@ -3485,8 +3485,8 @@ Function NormalizeFiles(Val Files)
|
||||
For Each File In Files Do
|
||||
|
||||
CurrentArray = New Array;
|
||||
CurrentFile = File.Value;
|
||||
CurrentName = File.Key;
|
||||
CurrentFile = File.Value;
|
||||
CurrentName = File.Key;
|
||||
|
||||
OPI_TypeConversion.GetBinaryData(CurrentFile);
|
||||
OPI_TypeConversion.GetLine(CurrentName);
|
||||
@@ -3530,7 +3530,7 @@ Function ChecklistElementManagment(Val URL, Val TaskID, Val ElementID, Val Metho
|
||||
|
||||
Parameters = NormalizeAuth(URL, Token, Method);
|
||||
|
||||
OPI_Tools.AddField("TASKID", TaskID , "String", Parameters);
|
||||
OPI_Tools.AddField("TASKID", TaskID , "String", Parameters);
|
||||
OPI_Tools.AddField("ITEMID", ElementID, "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
@@ -3557,7 +3557,7 @@ Function ChatNotificationsSwitch(Val URL, Val ChatID, Val Off, Val Token = "")
|
||||
Parameters = NormalizeAuth(URL, Token, "im.chat.mute");
|
||||
|
||||
OPI_Tools.AddField("CHAT_ID", ChatID , "String", Parameters);
|
||||
OPI_Tools.AddField("MUTE" , Off, "String", Parameters);
|
||||
OPI_Tools.AddField("MUTE" , Off , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters);
|
||||
|
||||
|
@@ -69,8 +69,8 @@ Function HMAC(Val Key, Val Data, Type, BlockSize) Export
|
||||
EndIf;
|
||||
|
||||
If Key.Size() <= BlockSize Then
|
||||
Key = GetHexStringFromBinaryData(Key);
|
||||
Key = Left(Key + RepeatString("00", BlockSize), BlockSize * Twice);
|
||||
Key = GetHexStringFromBinaryData(Key);
|
||||
Key = Left(Key + RepeatString("00", BlockSize), BlockSize * Twice);
|
||||
EndIf;
|
||||
|
||||
Key = GetBinaryDataBufferFromBinaryData(GetBinaryDataFromHexString(Key));
|
||||
|
@@ -69,22 +69,22 @@ EndFunction
|
||||
// Map Of KeyAndValue - serialized JSON response from Dropbox
|
||||
Function GetToken(Val AppKey, Val AppSecret, Val Code) Export
|
||||
|
||||
URL = "https://api.dropbox.com/oauth2/token";
|
||||
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("code" , Code , "String", Parameters);
|
||||
OPI_Tools.AddField("grant_type", "authorization_code", "String", Parameters);
|
||||
|
||||
URLStructure = OPI_Tools.SplitURL(URL);
|
||||
Server = URLStructure["Server"];
|
||||
Address = URLStructure["Address"];
|
||||
Server = URLStructure["Server"];
|
||||
Address = URLStructure["Address"];
|
||||
|
||||
Request = OPI_Tools.CreateRequest(Address, , DataType);
|
||||
Request = OPI_Tools.CreateRequest(Address, , DataType);
|
||||
Connection = OPI_Tools.CreateConnection(Server, AppKey, AppSecret);
|
||||
|
||||
ParameterString = OPI_Tools.RequestParametersToString(Parameters);
|
||||
Data = Right(ParameterString, StrLen(ParameterString) - 1);
|
||||
Data = Right(ParameterString, StrLen(ParameterString) - 1);
|
||||
|
||||
Request.SetBodyFromString(Data);
|
||||
|
||||
@@ -108,13 +108,13 @@ EndFunction
|
||||
Function RefreshToken(Val AppKey, Val AppSecret, Val RefreshToken) Export
|
||||
|
||||
String_ = "String";
|
||||
URL = "https://api.dropbox.com/oauth2/token";
|
||||
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);
|
||||
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);
|
||||
|
||||
@@ -153,7 +153,7 @@ EndFunction
|
||||
// Map Of KeyAndValue - serialized JSON response from Dropbox
|
||||
Function GetSpaceUsageData(Val Token) Export
|
||||
|
||||
URL = "https://api.dropboxapi.com/2/users/get_space_usage";
|
||||
URL = "https://api.dropboxapi.com/2/users/get_space_usage";
|
||||
Headers = GetRequestHeaders(Token);
|
||||
|
||||
Response = OPI_Tools.PostBinary(URL
|
||||
@@ -185,10 +185,10 @@ 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("path" , Path , "String" , Parameters);
|
||||
OPI_Tools.AddField("include_media_info", Detailed, "Boolean", Parameters);
|
||||
|
||||
Headers = GetRequestHeaders(Token);
|
||||
Headers = GetRequestHeaders(Token);
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
|
||||
Return Response;
|
||||
@@ -213,7 +213,7 @@ Function GetListOfFolderFiles(Val Token, Val Path = "", Val Detailed = False, Va
|
||||
URL = "https://api.dropboxapi.com/2/files/list_folder";
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("path" , Path , "String", Parameters);
|
||||
OPI_Tools.AddField("path" , Path , "String" , Parameters);
|
||||
OPI_Tools.AddField("include_media_info", Detailed , "Boolean", Parameters);
|
||||
|
||||
Else
|
||||
@@ -244,7 +244,7 @@ EndFunction
|
||||
// BinaryData - document preview
|
||||
Function GetPreview(Val Token, Val Path) Export
|
||||
|
||||
URL = "https://content.dropboxapi.com/2/files/get_preview";
|
||||
URL = "https://content.dropboxapi.com/2/files/get_preview";
|
||||
Response = ProcessObject(Token, URL, Path, True);
|
||||
|
||||
Return Response;
|
||||
@@ -268,8 +268,8 @@ Function UploadFile(Val Token, Val File, Val Path, Val Overwrite = False) Export
|
||||
OPI_TypeConversion.GetBoolean(Overwrite);
|
||||
OPI_TypeConversion.GetLine(Path);
|
||||
|
||||
Mode = ?(Overwrite, "overwrite", "add");
|
||||
Size = File.Size();
|
||||
Mode = ?(Overwrite, "overwrite", "add");
|
||||
Size = File.Size();
|
||||
Border = 100000000;
|
||||
|
||||
If Size > Border Then
|
||||
@@ -297,10 +297,10 @@ 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("path", Path , "String", Parameters);
|
||||
OPI_Tools.AddField("url" , FileURL , "String", Parameters);
|
||||
|
||||
Headers = GetRequestHeaders(Token);
|
||||
Headers = GetRequestHeaders(Token);
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
|
||||
Return Response;
|
||||
@@ -323,7 +323,7 @@ Function GetUploadStatusByURL(Val Token, Val JobID) Export
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("async_job_id", JobID, "String", Parameters);
|
||||
|
||||
Headers = GetRequestHeaders(Token);
|
||||
Headers = GetRequestHeaders(Token);
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
|
||||
Return Response;
|
||||
@@ -371,8 +371,8 @@ Function CopyObject(Val Token, Val From, Val Target) 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" , Target , "String", Parameters);
|
||||
OPI_Tools.AddField("from_path", From , "String", Parameters);
|
||||
OPI_Tools.AddField("to_path" , Target , "String", Parameters);
|
||||
|
||||
Headers = GetRequestHeaders(Token);
|
||||
|
||||
@@ -397,8 +397,8 @@ Function MoveObject(Val Token, Val From, Val Target) 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" , Target , "String", Parameters);
|
||||
OPI_Tools.AddField("from_path", From , "String", Parameters);
|
||||
OPI_Tools.AddField("to_path" , Target , "String", Parameters);
|
||||
|
||||
Headers = GetRequestHeaders(Token);
|
||||
|
||||
@@ -419,7 +419,7 @@ EndFunction
|
||||
// Map Of KeyAndValue - serialized JSON response from Dropbox
|
||||
Function CreateFolder(Val Token, Val Path) Export
|
||||
|
||||
URL = "https://api.dropboxapi.com/2/files/create_folder_v2";
|
||||
URL = "https://api.dropboxapi.com/2/files/create_folder_v2";
|
||||
Response = ProcessObject(Token, URL, Path);
|
||||
|
||||
Return Response;
|
||||
@@ -437,7 +437,7 @@ EndFunction
|
||||
// BinaryData - binary data of the file
|
||||
Function DownloadFile(Val Token, Val Path) Export
|
||||
|
||||
URL = "https://content.dropboxapi.com/2/files/download";
|
||||
URL = "https://content.dropboxapi.com/2/files/download";
|
||||
Response = ProcessObject(Token, URL, Path, True);
|
||||
|
||||
Return Response;
|
||||
@@ -455,7 +455,7 @@ EndFunction
|
||||
// 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";
|
||||
URL = "https://content.dropboxapi.com/2/files/download_zip";
|
||||
Response = ProcessObject(Token, URL, Path, True);
|
||||
|
||||
Return Response;
|
||||
@@ -477,10 +477,10 @@ Function GetObjectVersionList(Val Token, Val Path, Val Count = 10) Export
|
||||
URL = "https://api.dropboxapi.com/2/files/list_revisions";
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("path" , Path , "String", Parameters);
|
||||
OPI_Tools.AddField("path" , Path , "String" , Parameters);
|
||||
OPI_Tools.AddField("limit", Count, "Number" , Parameters);
|
||||
|
||||
Headers = GetRequestHeaders(Token);
|
||||
Headers = GetRequestHeaders(Token);
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
|
||||
Return Response;
|
||||
@@ -502,10 +502,10 @@ 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("path", Path , "String", Parameters);
|
||||
OPI_Tools.AddField("rev" , Version, "String", Parameters);
|
||||
|
||||
Headers = GetRequestHeaders(Token);
|
||||
Headers = GetRequestHeaders(Token);
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
|
||||
Return Response;
|
||||
@@ -587,7 +587,7 @@ EndFunction
|
||||
// Map Of KeyAndValue - serialized JSON response from Dropbox
|
||||
Function PublishFolder(Val Token, Val Path) Export
|
||||
|
||||
URL = "https://api.dropboxapi.com/2/sharing/share_folder";
|
||||
URL = "https://api.dropboxapi.com/2/sharing/share_folder";
|
||||
Response = ProcessObject(Token, URL, Path);
|
||||
|
||||
Return Response;
|
||||
@@ -610,7 +610,7 @@ Function CancelFolderPublication(Val Token, Val FolderID) Export
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("shared_folder_id", FolderID, "String", Parameters);
|
||||
|
||||
Headers = GetRequestHeaders(Token);
|
||||
Headers = GetRequestHeaders(Token);
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
|
||||
Return Response;
|
||||
@@ -647,7 +647,7 @@ Function AddUsersToFile(Val Token, Val FileID, Val EmailAddresses, Val ViewOnly
|
||||
For Each Address In EmailAddresses Do
|
||||
|
||||
UserData = New Map;
|
||||
OPI_Tools.AddField(".tag" , "email", String_, UserData);
|
||||
OPI_Tools.AddField(".tag" , "email" , String_, UserData);
|
||||
OPI_Tools.AddField("email", Address , String_, UserData);
|
||||
|
||||
ArrayOfUsers.Add(UserData);
|
||||
@@ -655,7 +655,7 @@ Function AddUsersToFile(Val Token, Val FileID, Val EmailAddresses, Val ViewOnly
|
||||
EndDo;
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("file" , FileID , String_, Parameters);
|
||||
OPI_Tools.AddField("file" , FileID , String_, Parameters);
|
||||
OPI_Tools.AddField("members", ArrayOfUsers , "Array", Parameters);
|
||||
|
||||
Mode = ?(ViewOnly, "viewer", "editor");
|
||||
@@ -696,7 +696,7 @@ Function AddUsersToFolder(Val Token, Val FolderID, Val EmailAddresses, Val ViewO
|
||||
For Each Address In EmailAddresses Do
|
||||
|
||||
UserData = New Map;
|
||||
OPI_Tools.AddField(".tag" , "email", String_, UserData);
|
||||
OPI_Tools.AddField(".tag" , "email" , String_, UserData);
|
||||
OPI_Tools.AddField("email", Address , String_, UserData);
|
||||
|
||||
UserStructure = New Structure("member,access_level", UserData, Mode);
|
||||
@@ -706,8 +706,8 @@ Function AddUsersToFolder(Val Token, Val FolderID, Val EmailAddresses, Val ViewO
|
||||
EndDo;
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("shared_folder_id", FolderID , String_, Parameters);
|
||||
OPI_Tools.AddField("members" , ArrayOfUsers , "Array", Parameters);
|
||||
OPI_Tools.AddField("shared_folder_id", FolderID , String_, Parameters);
|
||||
OPI_Tools.AddField("members" , ArrayOfUsers , "Array", Parameters);
|
||||
|
||||
Headers = GetRequestHeaders(Token);
|
||||
|
||||
@@ -733,7 +733,7 @@ Function GetAsynchronousChangeStatus(Val Token, Val JobID) Export
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("async_job_id", JobID, "String", Parameters);
|
||||
|
||||
Headers = GetRequestHeaders(Token);
|
||||
Headers = GetRequestHeaders(Token);
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
|
||||
Return Response;
|
||||
@@ -762,7 +762,7 @@ Function CancelFilePublication(Val Token, Val FileID) Export
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("file", FileID, "String", Parameters);
|
||||
|
||||
Headers = GetRequestHeaders(Token);
|
||||
Headers = GetRequestHeaders(Token);
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
|
||||
Return Response;
|
||||
@@ -781,10 +781,10 @@ Function ProcessObject(Val Token, Val URL, Val Path, Val InHeaders = False)
|
||||
OPI_Tools.AddField("path", Path, "String", Parameters);
|
||||
|
||||
If InHeaders Then
|
||||
Headers = GetRequestHeaders(Token, Parameters);
|
||||
Headers = GetRequestHeaders(Token, Parameters);
|
||||
Response = OPI_Tools.PostBinary(URL, GetBinaryDataFromString(""), Headers);
|
||||
Else
|
||||
Headers = GetRequestHeaders(Token);
|
||||
Headers = GetRequestHeaders(Token);
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
EndIf;
|
||||
|
||||
@@ -801,7 +801,7 @@ Function ProcessTag(Val Token, Val Path, Val Tag, Val ThisIsDeletion = False)
|
||||
EndIf;
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("path" , Path, "String", Parameters);
|
||||
OPI_Tools.AddField("path" , Path, "String", Parameters);
|
||||
OPI_Tools.AddField("tag_text" , Tag , "String", Parameters);
|
||||
|
||||
Headers = GetRequestHeaders(Token);
|
||||
@@ -836,11 +836,11 @@ Function UploadLargeFile(Val Token, Val File, Val Path, Val Mode)
|
||||
|
||||
URL = "https://content.dropboxapi.com/2/files/upload_session/append_v2";
|
||||
|
||||
ChunkSize = 100000000;
|
||||
ChunkSize = 100000000;
|
||||
CurrentPosition = 0;
|
||||
BytesRead = 0;
|
||||
TotalSize = File.Size();
|
||||
Session = OpenSession(Token);
|
||||
BytesRead = 0;
|
||||
TotalSize = File.Size();
|
||||
Session = OpenSession(Token);
|
||||
|
||||
WHile BytesRead < TotalSize Do
|
||||
|
||||
@@ -848,13 +848,13 @@ Function UploadLargeFile(Val Token, Val File, Val Path, Val Mode)
|
||||
Cursor = New Structure("offset,session_id", Indent, Session);
|
||||
|
||||
Parameters = New Structure("cursor", Cursor);
|
||||
Headers = GetRequestHeaders(Token, Parameters);
|
||||
Headers = GetRequestHeaders(Token, Parameters);
|
||||
|
||||
DataReader = New DataReader(File);
|
||||
BytesRead = DataReader.Skip(CurrentPosition);
|
||||
Result = DataReader.Read(ChunkSize);
|
||||
CurrentData = Result.GetBinaryData();
|
||||
CurrentSize = CurrentData.Size();
|
||||
DataReader = New DataReader(File);
|
||||
BytesRead = DataReader.Skip(CurrentPosition);
|
||||
Result = DataReader.Read(ChunkSize);
|
||||
CurrentData = Result.GetBinaryData();
|
||||
CurrentSize = CurrentData.Size();
|
||||
NextPosition = CurrentPosition + CurrentSize;
|
||||
|
||||
If Not ValueIsFilled(CurrentData) Then
|
||||
@@ -883,15 +883,15 @@ EndFunction
|
||||
Function UploadSmallFile(Val Token, Val File, Val Path, Val Mode)
|
||||
|
||||
Boolean_ = "Boolean";
|
||||
String_ = "String";
|
||||
URL = "https://content.dropboxapi.com/2/files/upload";
|
||||
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("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);
|
||||
@@ -905,8 +905,8 @@ EndFunction
|
||||
Function OpenSession(Val Token)
|
||||
|
||||
SessionId = "session_id";
|
||||
URL = "https://content.dropboxapi.com/2/files/upload_session/start";
|
||||
Headers = GetRequestHeaders(Token);
|
||||
URL = "https://content.dropboxapi.com/2/files/upload_session/start";
|
||||
Headers = GetRequestHeaders(Token);
|
||||
|
||||
Response = OPI_Tools.PostBinary(URL, GetBinaryDataFromString(""), Headers);
|
||||
|
||||
@@ -925,7 +925,7 @@ Function CloseSession(Val Token, Val Path, Val Mode, Val TotalSize, Val Session)
|
||||
Cursor = New Structure("offset,session_id", TotalSize, Session);
|
||||
|
||||
Parameters = New Structure("commit,cursor", Commit, Cursor);
|
||||
Headers = GetRequestHeaders(Token, Parameters);
|
||||
Headers = GetRequestHeaders(Token, Parameters);
|
||||
|
||||
Response = OPI_Tools.PostBinary(URL, GetBinaryDataFromString(""), Headers);
|
||||
|
||||
@@ -950,7 +950,7 @@ EndFunction
|
||||
|
||||
Function GetOwnAccount(Val Token)
|
||||
|
||||
URL = "https://api.dropboxapi.com/2/users/get_current_account";
|
||||
URL = "https://api.dropboxapi.com/2/users/get_current_account";
|
||||
Headers = GetRequestHeaders(Token);
|
||||
|
||||
Response = OPI_Tools.PostBinary(URL
|
||||
|
@@ -56,7 +56,7 @@ Function CreateCalendar(Val Token, Val Name) Export
|
||||
OPI_TypeConversion.GetLine(Name);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://www.googleapis.com/calendar/v3/calendars";
|
||||
URL = "https://www.googleapis.com/calendar/v3/calendars";
|
||||
|
||||
Parameters = New Structure;
|
||||
Parameters.Insert("summary" , Name);
|
||||
@@ -82,8 +82,8 @@ 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;
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://www.googleapis.com/calendar/v3/calendars/" + Calendar;
|
||||
Response = OPI_Tools.Get(URL, , Headers);
|
||||
|
||||
Return Response;
|
||||
@@ -112,7 +112,7 @@ Function EditCalendarMetadata(Val Token
|
||||
OPI_TypeConversion.GetLine(Description);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://www.googleapis.com/calendar/v3/calendars/" + Calendar;
|
||||
URL = "https://www.googleapis.com/calendar/v3/calendars/" + Calendar;
|
||||
|
||||
Parameters = New Structure;
|
||||
|
||||
@@ -142,8 +142,8 @@ Function ClearMainCalendar(Val Token) Export
|
||||
|
||||
OPI_TypeConversion.GetLine(Token);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://www.googleapis.com/calendar/v3/calendars/primary/clear";
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://www.googleapis.com/calendar/v3/calendars/primary/clear";
|
||||
Response = OPI_Tools.Post(URL, , Headers, False);
|
||||
|
||||
Return Response;
|
||||
@@ -164,8 +164,8 @@ 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;
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://www.googleapis.com/calendar/v3/calendars/" + Calendar;
|
||||
Response = OPI_Tools.Delete(URL, , Headers);
|
||||
|
||||
Return Response;
|
||||
@@ -188,7 +188,7 @@ Function GetCalendarList(Val Token) Export
|
||||
|
||||
OPI_TypeConversion.GetLine(Token);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
ArrayOfCalendars = New Array;
|
||||
|
||||
GetCalendarsListRecursively(Headers, ArrayOfCalendars);
|
||||
@@ -212,7 +212,7 @@ Function AddCalendarToList(Val Token, Val Calendar) Export
|
||||
OPI_TypeConversion.GetLine(Calendar);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://www.googleapis.com/calendar/v3/users/me/calendarList";
|
||||
URL = "https://www.googleapis.com/calendar/v3/users/me/calendarList";
|
||||
|
||||
Parameters = New Structure;
|
||||
Parameters.Insert("id", Calendar);
|
||||
@@ -237,8 +237,8 @@ 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;
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://www.googleapis.com/calendar/v3/users/me/calendarList/" + Calendar;
|
||||
Response = OPI_Tools.Get(URL, , Headers);
|
||||
|
||||
Return Response;
|
||||
@@ -259,8 +259,8 @@ 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;
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://www.googleapis.com/calendar/v3/users/me/calendarList/" + Calendar;
|
||||
Response = OPI_Tools.Delete(URL, , Headers);
|
||||
|
||||
Return Response;
|
||||
@@ -292,10 +292,10 @@ Function EditListCalendar(Val Token
|
||||
OPI_TypeConversion.GetBoolean(Hidden);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://www.googleapis.com/calendar/v3/users/me/calendarList/" + Calendar + "?colorRgbFormat=true";
|
||||
URL = "https://www.googleapis.com/calendar/v3/users/me/calendarList/" + Calendar + "?colorRgbFormat =true";
|
||||
|
||||
Parameters = New Map;
|
||||
Parameters.Insert("hidden" , Hidden);
|
||||
Parameters.Insert("hidden" , Hidden);
|
||||
Parameters.Insert("foregroundColor", PrimaryColor);
|
||||
Parameters.Insert("backgroundColor", SecondaryColor);
|
||||
|
||||
@@ -316,16 +316,16 @@ EndFunction
|
||||
Function GetEventDescription() Export
|
||||
|
||||
CurrentDate = OPI_Tools.GetCurrentDate();
|
||||
Hour = 3600;
|
||||
Event = New Map;
|
||||
Hour = 3600;
|
||||
Event = New Map;
|
||||
|
||||
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("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 Map); // Key - name, Value - URL to file
|
||||
Event.Insert("SendNotifications" , True); // Indication of sending notifications to participants
|
||||
Event.Insert("SendNotifications" , True); // Indication of sending notifications to participants
|
||||
|
||||
Return Event;
|
||||
|
||||
@@ -345,7 +345,7 @@ Function GetEventList(Val Token, Val Calendar) Export
|
||||
OPI_TypeConversion.GetLine(Token);
|
||||
OPI_TypeConversion.GetLine(Calendar);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
ArrayOfEvents = New Array;
|
||||
|
||||
GetEventsListRecursively(Headers, Calendar, ArrayOfEvents);
|
||||
@@ -371,7 +371,7 @@ Function GetEvent(Val Token, Val Calendar, Val Event) Export
|
||||
OPI_TypeConversion.GetLine(Event);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://www.googleapis.com/calendar/v3/calendars/"
|
||||
URL = "https://www.googleapis.com/calendar/v3/calendars/"
|
||||
+ Calendar
|
||||
+ "/events/"
|
||||
+ Event;
|
||||
@@ -464,7 +464,7 @@ Function DeleteEvent(Val Token, Val Calendar, Val Event) Export
|
||||
OPI_TypeConversion.GetLine(Event);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://www.googleapis.com/calendar/v3/calendars/"
|
||||
URL = "https://www.googleapis.com/calendar/v3/calendars/"
|
||||
+ Calendar
|
||||
+ "/events/"
|
||||
+ Event;
|
||||
@@ -491,16 +491,16 @@ Function ConvertDate(Val Date)
|
||||
Return Undefined;
|
||||
EndIf;
|
||||
|
||||
If Date = BegOfDay(Date) Then
|
||||
If Date = BegOfDay(Date) Then
|
||||
DateFormat = "DF=yyyy-MM-dd";
|
||||
Field = "date";
|
||||
Field = "date";
|
||||
Else
|
||||
DateFormat = "DF=yyyy-MM-ddTHH:mm:ssZ";
|
||||
Field = "dateTime";
|
||||
Field = "dateTime";
|
||||
EndIf;
|
||||
|
||||
Date = Format(Date, DateFormat);
|
||||
DateStructure.Insert(Field , Date);
|
||||
DateStructure.Insert(Field , Date);
|
||||
DateStructure.Insert("timeZone", "Europe/Moscow");
|
||||
|
||||
Return DateStructure;
|
||||
@@ -518,7 +518,7 @@ Function ConvertAttachments(Val Attachments)
|
||||
For Each Attachment In Attachments Do
|
||||
|
||||
CurrentAttachment = New Structure;
|
||||
CurrentAttachment.Insert("title" , Attachment.Key);
|
||||
CurrentAttachment.Insert("title" , Attachment.Key);
|
||||
CurrentAttachment.Insert("fileUrl", Attachment.Value);
|
||||
|
||||
AttachmentsArray.Add(CurrentAttachment);
|
||||
@@ -542,31 +542,31 @@ Function EventManagement(Val Token, Val Calendar, Val EventDescription, Val Even
|
||||
OPI_TypeConversion.GetLine(Event);
|
||||
OPI_TypeConversion.GetCollection(EventDescription);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
Existing = ValueIsFilled(Event);
|
||||
URL = "https://www.googleapis.com/calendar/v3/calendars/"
|
||||
URL = "https://www.googleapis.com/calendar/v3/calendars/"
|
||||
+ Calendar
|
||||
+ "/events"
|
||||
+ ?(Existing, "/" + Event, "");
|
||||
|
||||
Date0 = EventDescription["StartDate"];
|
||||
Date1 = EventDescription["EndDate"];
|
||||
Attachments = EventDescription["ArrayOfAttachmentURLs"];
|
||||
Attachments = ConvertAttachments(Attachments);
|
||||
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("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("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("sendUpdates" , ?(Notifications , "all" , "none"));
|
||||
URLParameters.Insert("supportsAttachments" , ?(ValueIsFilled(Attachments), "true", "false"));
|
||||
|
||||
URL = URL + OPI_Tools.RequestParametersToString(URLParameters);
|
||||
@@ -585,8 +585,8 @@ EndFunction
|
||||
|
||||
Procedure GetCalendarsListRecursively(Val Headers, ArrayOfCalendars, Page = "")
|
||||
|
||||
Items = "items";
|
||||
NPT = "nextPageToken";
|
||||
Items = "items";
|
||||
NPT = "nextPageToken";
|
||||
Parameters = New Structure;
|
||||
|
||||
If ValueIsFilled(Page) Then
|
||||
@@ -598,7 +598,7 @@ Procedure GetCalendarsListRecursively(Val Headers, ArrayOfCalendars, Page = "")
|
||||
, Headers);
|
||||
|
||||
Calendars = Result[Items];
|
||||
Page = Result[NPT];
|
||||
Page = Result[NPT];
|
||||
|
||||
For Each Calendar In Calendars Do
|
||||
ArrayOfCalendars.Add(Calendar);
|
||||
@@ -612,8 +612,8 @@ EndProcedure
|
||||
|
||||
Procedure GetEventsListRecursively(Val Headers, Val Calendar, ArrayOfEvents, Page = "")
|
||||
|
||||
Items = "items";
|
||||
NPT = "nextPageToken";
|
||||
Items = "items";
|
||||
NPT = "nextPageToken";
|
||||
Parameters = New Structure;
|
||||
|
||||
If ValueIsFilled(Page) Then
|
||||
@@ -625,7 +625,7 @@ Procedure GetEventsListRecursively(Val Headers, Val Calendar, ArrayOfEvents, Pag
|
||||
, Headers);
|
||||
|
||||
Events = Result[Items];
|
||||
Page = Result[NPT];
|
||||
Page = Result[NPT];
|
||||
|
||||
For Each Event In Events Do
|
||||
ArrayOfEvents.Add(Event);
|
||||
|
@@ -56,7 +56,7 @@ Function GetObjectInformation(Val Token, Val Identifier) Export
|
||||
OPI_TypeConversion.GetLine(Identifier);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://www.googleapis.com/drive/v3/files/" + Identifier;
|
||||
URL = "https://www.googleapis.com/drive/v3/files/" + Identifier;
|
||||
|
||||
Parameters = New Structure;
|
||||
Parameters.Insert("fields", "*");
|
||||
@@ -83,9 +83,9 @@ Function GetDirectoriesList(Val Token, Val NameContains = "", Val Detailed = Fal
|
||||
OPI_TypeConversion.GetLine(NameContains);
|
||||
OPI_TypeConversion.GetBoolean(Detailed);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
ArrayOfObjects = New Array;
|
||||
Filter = New Array;
|
||||
Filter = New Array;
|
||||
|
||||
Filter.Add("mimeType = 'application/vnd.google-apps.folder'");
|
||||
|
||||
@@ -119,9 +119,9 @@ Function GetFilesList(Val Token, Val NameContains = "", Val Directory = "") Expo
|
||||
OPI_TypeConversion.GetLine(NameContains);
|
||||
OPI_TypeConversion.GetLine(Directory);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
ArrayOfObjects = New Array;
|
||||
Filter = New Array;
|
||||
Filter = New Array;
|
||||
|
||||
Filter.Add("mimeType != 'application/vnd.google-apps.folder'");
|
||||
|
||||
@@ -172,10 +172,10 @@ Function CreateFolder(Val Token, Val Name, Val Parent = "") Export
|
||||
OPI_TypeConversion.GetLine(Parent);
|
||||
|
||||
Description = New Map;
|
||||
Description.Insert("MIME" , "application/vnd.google-apps.folder");
|
||||
Description.Insert("Name" , Name);
|
||||
Description.Insert("MIME" , "application/vnd.google-apps.folder");
|
||||
Description.Insert("Name" , Name);
|
||||
Description.Insert("Description", "");
|
||||
Description.Insert("Parent", ?(ValueIsFilled(Parent), Parent, "root"));
|
||||
Description.Insert("Parent" , ?(ValueIsFilled(Parent), Parent, "root"));
|
||||
|
||||
Return FileManagement(Token, , Description);
|
||||
|
||||
@@ -197,7 +197,7 @@ Function DownloadFile(Val Token, Val Identifier, Val SavePath = "") Export
|
||||
OPI_TypeConversion.GetLine(Identifier);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://www.googleapis.com/drive/v3/files/" + Identifier;
|
||||
URL = "https://www.googleapis.com/drive/v3/files/" + Identifier;
|
||||
|
||||
Parameters = New Map;
|
||||
Parameters.Insert("alt", "media");
|
||||
@@ -227,7 +227,7 @@ Function CopyObject(Val Token, Val Identifier, Val NewName = "", Val NewParent =
|
||||
OPI_TypeConversion.GetLine(NewParent);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://www.googleapis.com/drive/v3/files/" + Identifier + "/copy";
|
||||
URL = "https://www.googleapis.com/drive/v3/files/" + Identifier + "/copy";
|
||||
|
||||
Parameters = New Structure;
|
||||
|
||||
@@ -292,8 +292,8 @@ 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;
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://www.googleapis.com/drive/v3/files/" + Identifier;
|
||||
Response = OPI_Tools.Delete(URL, , Headers);
|
||||
|
||||
Return Response;
|
||||
@@ -307,10 +307,10 @@ EndFunction
|
||||
Function GetFileDescription() Export
|
||||
|
||||
Description = New Map;
|
||||
Description.Insert("MIME" , "image/jpeg"); // MIME-type uploading file
|
||||
Description.Insert("Name" , "New file.jpg"); // File name with extension
|
||||
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
|
||||
Description.Insert("Parent" , "root"); // ID directory upload or "root" for upload in root
|
||||
|
||||
Return Description;
|
||||
|
||||
@@ -337,7 +337,7 @@ Function CreateComment(Val Token, Val Identifier, Val Comment) Export
|
||||
OPI_TypeConversion.GetLine(Comment);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://www.googleapis.com/drive/v3/files/" + Identifier + "/comments?fields=*";
|
||||
URL = "https://www.googleapis.com/drive/v3/files/" + Identifier + "/comments?fields =*";
|
||||
|
||||
Parameters = New Structure;
|
||||
Parameters.Insert("content", Comment);
|
||||
@@ -365,7 +365,7 @@ Function GetComment(Val Token, Val ObjectID, Val CommentID) Export
|
||||
OPI_TypeConversion.GetLine(CommentID);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://www.googleapis.com/drive/v3/files/" + ObjectID + "/comments/" + CommentID;
|
||||
URL = "https://www.googleapis.com/drive/v3/files/" + ObjectID + "/comments/" + CommentID;
|
||||
|
||||
Parameters = New Structure;
|
||||
Parameters.Insert("fields", "*");
|
||||
@@ -391,7 +391,7 @@ Function GetCommentList(Val Token, Val ObjectID) Export
|
||||
OPI_TypeConversion.GetLine(ObjectID);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://www.googleapis.com/drive/v3/files/" + ObjectID + "/comments";
|
||||
URL = "https://www.googleapis.com/drive/v3/files/" + ObjectID + "/comments";
|
||||
|
||||
Parameters = New Structure;
|
||||
Parameters.Insert("fields", "*");
|
||||
@@ -419,7 +419,7 @@ Function DeleteComment(Val Token, Val ObjectID, Val CommentID) Export
|
||||
OPI_TypeConversion.GetLine(CommentID);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://www.googleapis.com/drive/v3/files/" + ObjectID + "/comments/" + CommentID;
|
||||
URL = "https://www.googleapis.com/drive/v3/files/" + ObjectID + "/comments/" + CommentID;
|
||||
|
||||
Response = OPI_Tools.Delete(URL, , Headers);
|
||||
|
||||
@@ -435,9 +435,9 @@ EndFunction
|
||||
|
||||
Procedure GetObjectsListRecursively(Val Headers, ArrayOfObjects, Detailed = False, Filter = "", Page = "")
|
||||
|
||||
URL = "https://www.googleapis.com/drive/v3/files";
|
||||
Files = "files";
|
||||
NPT = "nextPageToken";
|
||||
URL = "https://www.googleapis.com/drive/v3/files";
|
||||
Files = "files";
|
||||
NPT = "nextPageToken";
|
||||
Parameters = New Structure;
|
||||
Parameters.Insert("fields", "*");
|
||||
|
||||
@@ -453,7 +453,7 @@ Procedure GetObjectsListRecursively(Val Headers, ArrayOfObjects, Detailed = Fals
|
||||
Result = OPI_Tools.Get(URL, Parameters, Headers);
|
||||
|
||||
Objects = Result[Files];
|
||||
Page = Result[NPT];
|
||||
Page = Result[NPT];
|
||||
|
||||
For Each CurrentObject In Objects Do
|
||||
ArrayOfObjects.Add(CurrentObject);
|
||||
@@ -470,7 +470,7 @@ Procedure BreakDownObjectsInDetail(Val Token, ArrayOfObjects)
|
||||
For Each CurrentObject In ArrayOfObjects Do
|
||||
|
||||
ArrayOfFiles = New Array;
|
||||
CurrentID = CurrentObject["id"];
|
||||
CurrentID = CurrentObject["id"];
|
||||
|
||||
Result = GetFilesList(Token, , CurrentID);
|
||||
|
||||
@@ -490,11 +490,11 @@ Procedure FormFileUploadParameters(Description)
|
||||
OPI_Tools.RemoveEmptyCollectionFields(Description);
|
||||
|
||||
FieldMapping = New Map;
|
||||
FieldMapping.Insert("MIME" , "mimeType");
|
||||
FieldMapping.Insert("Name" , "name");
|
||||
FieldMapping.Insert("MIME" , "mimeType");
|
||||
FieldMapping.Insert("Name" , "name");
|
||||
FieldMapping.Insert("Description" , "description");
|
||||
FieldMapping.Insert("Parent" , "parents");
|
||||
FieldMapping.Insert("Extension", "fileExtension");
|
||||
FieldMapping.Insert("Parent" , "parents");
|
||||
FieldMapping.Insert("Extension" , "fileExtension");
|
||||
|
||||
For Each Element In Description Do
|
||||
|
||||
@@ -539,7 +539,7 @@ Function FileManagement(Val Token, Val File = "", Val Description = "", Val Iden
|
||||
Description = New Map;
|
||||
EndIf;
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
FormFileUploadParameters(Description);
|
||||
JSONDescription = OPI_Tools.JSONString(Description);
|
||||
|
||||
@@ -548,7 +548,7 @@ Function FileManagement(Val Token, Val File = "", Val Description = "", Val Iden
|
||||
If ValueIsFilled(File) Then
|
||||
|
||||
ChunkSize = 268435457;
|
||||
Size = OPI_Tools.ConvertDataWithSizeRetrieval(File, ChunkSize);
|
||||
Size = OPI_Tools.ConvertDataWithSizeRetrieval(File, ChunkSize);
|
||||
|
||||
FileMapping.Insert(File, MIME);
|
||||
|
||||
@@ -571,7 +571,7 @@ Function UploadSmallFile(Val Description, Val FileMapping, Val Headers, Val Iden
|
||||
URL = "https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart";
|
||||
|
||||
If ValueIsFilled(Identifier) Then
|
||||
URL = StrReplace(URL, "/files", "/files/" + Identifier);
|
||||
URL = StrReplace(URL, "/files", "/files/" + Identifier);
|
||||
Response = OPI_Tools.PatchMultipartRelated(URL, Description, FileMapping, Headers);
|
||||
Else
|
||||
Response = OPI_Tools.PostMultipartRelated(URL, Description, FileMapping, Headers);
|
||||
@@ -591,7 +591,7 @@ Function UploadLargeFile(Val Description, Val FileMapping, Val Headers, Val Iden
|
||||
URL = "https://www.googleapis.com/upload/drive/v3/files?uploadType=resumable";
|
||||
|
||||
If ValueIsFilled(Identifier) Then
|
||||
URL = StrReplace(URL, "/files", "/files/" + Identifier);
|
||||
URL = StrReplace(URL, "/files", "/files/" + Identifier);
|
||||
Response = OPI_Tools.Patch(URL, Description, Headers, True, True);
|
||||
Else
|
||||
Response = OPI_Tools.Post(URL, Description, Headers, True, True);
|
||||
@@ -605,7 +605,7 @@ Function UploadLargeFile(Val Description, Val FileMapping, Val Headers, Val Iden
|
||||
EndIf;
|
||||
|
||||
UploadResponse = UploadFileInParts(Binary, UploadURL);
|
||||
Response = ?(ValueIsFilled(UploadResponse), UploadResponse, Response);
|
||||
Response = ?(ValueIsFilled(UploadResponse), UploadResponse, Response);
|
||||
|
||||
OPI_Tools.ProcessResponse(Response);
|
||||
Return Response;
|
||||
@@ -614,21 +614,21 @@ EndFunction
|
||||
|
||||
Function UploadFileInParts(Val Binary, Val UploadURL)
|
||||
|
||||
Response = "";
|
||||
ChunkSize = 268435456;
|
||||
BytesRead = 0;
|
||||
Response = "";
|
||||
ChunkSize = 268435456;
|
||||
BytesRead = 0;
|
||||
CurrentPosition = 0;
|
||||
TotalSize = Binary.Size();
|
||||
StrTotalSize = OPI_Tools.NumberToString(TotalSize);
|
||||
DataReader = New DataReader(Binary);
|
||||
SourceStream = DataReader.SourceStream();
|
||||
TotalSize = Binary.Size();
|
||||
StrTotalSize = OPI_Tools.NumberToString(TotalSize);
|
||||
DataReader = New DataReader(Binary);
|
||||
SourceStream = DataReader.SourceStream();
|
||||
|
||||
WHile BytesRead < TotalSize Do
|
||||
|
||||
BytesRead = SourceStream.CurrentPosition();
|
||||
Result = DataReader.Read(ChunkSize);
|
||||
CurrentData = Result.GetBinaryData();
|
||||
CurrentSize = CurrentData.Size();
|
||||
BytesRead = SourceStream.CurrentPosition();
|
||||
Result = DataReader.Read(ChunkSize);
|
||||
CurrentData = Result.GetBinaryData();
|
||||
CurrentSize = CurrentData.Size();
|
||||
NextPosition = CurrentPosition + CurrentSize - 1;
|
||||
|
||||
If Not ValueIsFilled(CurrentData) Then
|
||||
@@ -645,7 +645,7 @@ Function UploadFileInParts(Val Binary, Val UploadURL)
|
||||
AdditionalHeaders = New Map;
|
||||
AdditionalHeaders.Insert("Content-Length", OPI_Tools.NumberToString(CurrentSize));
|
||||
AdditionalHeaders.Insert("Content-Range" , StreamHeader);
|
||||
AdditionalHeaders.Insert("Content-Type" , "application/octet-stream");
|
||||
AdditionalHeaders.Insert("Content-Type" , "application/octet-stream");
|
||||
|
||||
Response = OPI_Tools.Put(UploadURL, CurrentData, AdditionalHeaders, False, True);
|
||||
|
||||
@@ -670,11 +670,11 @@ EndFunction
|
||||
|
||||
Function CheckPartUpload(Response, StrTotalSize, AdditionalHeaders, UploadURL, CurrentPosition)
|
||||
|
||||
StartOfErrorCodes = 400;
|
||||
EndOfFailureCodes = 600;
|
||||
StartOfErrorCodes = 400;
|
||||
EndOfFailureCodes = 600;
|
||||
StartOfSuccessCodes = 200;
|
||||
EndOfSuccessCodes = 300;
|
||||
Redirection = 308;
|
||||
EndOfSuccessCodes = 300;
|
||||
Redirection = 308;
|
||||
|
||||
If Response.StatusCode >= StartOfErrorCodes And Response.StatusCode < EndOfFailureCodes Then
|
||||
|
||||
@@ -708,9 +708,9 @@ Function CheckPartUpload(Response, StrTotalSize, AdditionalHeaders, UploadURL, C
|
||||
Return Response;
|
||||
EndIf;
|
||||
|
||||
UploadedData = StrReplace(UploadedData, "bytes=", "");
|
||||
UploadedData = StrReplace(UploadedData, "bytes =", "");
|
||||
ArrayOfInformation = StrSplit(UploadedData, "-", False);
|
||||
PartsRequired = 2;
|
||||
PartsRequired = 2;
|
||||
|
||||
If Not ArrayOfInformation.Count() = PartsRequired Then
|
||||
OPI_Tools.ProcessResponse(Response);
|
||||
|
@@ -57,16 +57,16 @@ Function CreateSpreadsheet(Val Token, Val Name, Val ArrayOfSheetNames) Export
|
||||
OPI_TypeConversion.GetCollection(ArrayOfSheetNames);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://sheets.googleapis.com/v4/spreadsheets";
|
||||
URL = "https://sheets.googleapis.com/v4/spreadsheets";
|
||||
|
||||
Properties = New Structure("title" , Name);
|
||||
Sheets = New Array;
|
||||
Sheets = New Array;
|
||||
|
||||
FillSheetArray(ArrayOfSheetNames, Sheets);
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("properties", Properties, "Collection", Parameters);
|
||||
OPI_Tools.AddField("sheets" , Sheets , "Collection", Parameters);
|
||||
OPI_Tools.AddField("sheets" , Sheets , "Collection", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
|
||||
@@ -88,7 +88,7 @@ Function GetSpreadsheet(Val Token, Val Identifier) Export
|
||||
OPI_TypeConversion.GetLine(Identifier);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://sheets.googleapis.com/v4/spreadsheets/" + Identifier;
|
||||
URL = "https://sheets.googleapis.com/v4/spreadsheets/" + Identifier;
|
||||
|
||||
Response = OPI_Tools.Get(URL, , Headers);
|
||||
|
||||
@@ -112,11 +112,11 @@ Function EditSpreadsheetTitle(Val Token, Val Spreadsheet, Val Name) Export
|
||||
OPI_TypeConversion.GetLine(Name);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://sheets.googleapis.com/v4/spreadsheets/" + Spreadsheet + ":batchUpdate";
|
||||
URL = "https://sheets.googleapis.com/v4/spreadsheets/" + Spreadsheet + ":batchUpdate";
|
||||
|
||||
Change = New Structure("title", Name);
|
||||
Change = New Structure("title", Name);
|
||||
ChangeRequest = New Structure("properties,fields", Change, "title");
|
||||
Request = New Structure("updateSpreadsheetProperties", ChangeRequest);
|
||||
Request = New Structure("updateSpreadsheetProperties", ChangeRequest);
|
||||
|
||||
ArrayOfRequests = New Array;
|
||||
ArrayOfRequests.Add(Request);
|
||||
@@ -149,11 +149,11 @@ Function AddSheet(Val Token, Val Spreadsheet, Val Name) Export
|
||||
OPI_TypeConversion.GetLine(Spreadsheet);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://sheets.googleapis.com/v4/spreadsheets/" + Spreadsheet + ":batchUpdate";
|
||||
Sheet = CreateSheet(Name);
|
||||
URL = "https://sheets.googleapis.com/v4/spreadsheets/" + Spreadsheet + ":batchUpdate";
|
||||
Sheet = CreateSheet(Name);
|
||||
|
||||
Requests = New Array;
|
||||
Change = New Structure("addSheet", Sheet);
|
||||
Change = New Structure("addSheet", Sheet);
|
||||
Requests.Add(Change);
|
||||
|
||||
Parameters = New Structure("requests", Requests);
|
||||
@@ -180,11 +180,11 @@ Function DeleteSheet(Val Token, Val Spreadsheet, Val Sheet) Export
|
||||
OPI_TypeConversion.GetLine(Sheet);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://sheets.googleapis.com/v4/spreadsheets/" + Spreadsheet + ":batchUpdate";
|
||||
URL = "https://sheets.googleapis.com/v4/spreadsheets/" + Spreadsheet + ":batchUpdate";
|
||||
|
||||
Requests = New Array;
|
||||
Sheet = New Structure("sheetId" , Sheet);
|
||||
Change = New Structure("deleteSheet", Sheet);
|
||||
Sheet = New Structure("sheetId" , Sheet);
|
||||
Change = New Structure("deleteSheet", Sheet);
|
||||
Requests.Add(Change);
|
||||
|
||||
Parameters = New Structure("requests", Requests);
|
||||
@@ -213,14 +213,14 @@ Function CopySheet(Val Token, Val From, Val Target, Val Sheet) Export
|
||||
OPI_TypeConversion.GetLine(Sheet);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://sheets.googleapis.com/v4/spreadsheets/"
|
||||
URL = "https://sheets.googleapis.com/v4/spreadsheets/"
|
||||
+ From
|
||||
+ "/sheets/"
|
||||
+ Sheet
|
||||
+ ":copyTo";
|
||||
|
||||
Parameters = New Structure("destinationSpreadsheetId", Target);
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
|
||||
Return Response;
|
||||
|
||||
@@ -251,17 +251,17 @@ Function SetCellValues(Val Token
|
||||
OPI_TypeConversion.GetLine(Spreadsheet);
|
||||
OPI_TypeConversion.GetCollection(ValueMapping);
|
||||
|
||||
If Not TypeOf(ValueMapping) = Type("Structure")
|
||||
If Not TypeOf(ValueMapping) = Type("Structure")
|
||||
And Not TypeOf(ValueMapping) = Type("Map") 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/" + Spreadsheet + "/values:batchUpdate";
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://sheets.googleapis.com/v4/spreadsheets/" + Spreadsheet + "/values:batchUpdate";
|
||||
DataArray = FormCellDataArray(ValueMapping, MajorDimension, Sheet);
|
||||
|
||||
Parameters = New Structure("data,valueInputOption", DataArray, "USER_ENTERED");
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
|
||||
Return Response;
|
||||
|
||||
@@ -284,12 +284,12 @@ Function ClearCells(Val Token, Val Spreadsheet, Val CellsArray, Val Sheet = "")
|
||||
OPI_TypeConversion.GetCollection(CellsArray);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://sheets.googleapis.com/v4/spreadsheets/" + Spreadsheet + "/values:batchClear";
|
||||
URL = "https://sheets.googleapis.com/v4/spreadsheets/" + Spreadsheet + "/values:batchClear";
|
||||
|
||||
FormCellNameArray(CellsArray, Sheet);
|
||||
|
||||
Parameters = New Structure("ranges", CellsArray);
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
|
||||
Return Response;
|
||||
|
||||
@@ -311,20 +311,20 @@ Function GetCellValues(Val Token, Val Spreadsheet, Val CellsArray = "", Val Shee
|
||||
OPI_TypeConversion.GetLine(Spreadsheet);
|
||||
|
||||
Headers = OPI_GoogleWorkspace.GetAuthorizationHeader(Token);
|
||||
URL = "https://sheets.googleapis.com/v4/spreadsheets/" + Spreadsheet + "/values:batchGet";
|
||||
URL = "https://sheets.googleapis.com/v4/spreadsheets/" + Spreadsheet + "/values:batchGet";
|
||||
|
||||
If ValueIsFilled(CellsArray) Then
|
||||
OPI_TypeConversion.GetCollection(CellsArray);
|
||||
FormCellNameArray(CellsArray, Sheet);
|
||||
|
||||
First = True;
|
||||
First = True;
|
||||
For Each Cell In CellsArray Do
|
||||
Delimiter = ?(First, "?", "&");
|
||||
URL = URL + Delimiter + "ranges=" + Cell;
|
||||
First = False;
|
||||
URL = URL + Delimiter + "ranges =" + Cell;
|
||||
First = False;
|
||||
EndDo;
|
||||
Else
|
||||
URL = URL + "?ranges='" + Sheet + "'";
|
||||
URL = URL + "?ranges ='" + Sheet + "'";
|
||||
EndIf;
|
||||
|
||||
Response = OPI_Tools.Get(URL, , Headers);
|
||||
@@ -363,7 +363,7 @@ Function CreateSheet(Val Name)
|
||||
OPI_TypeConversion.GetLine(Name);
|
||||
|
||||
SheetProperties = New Structure("title" , Name);
|
||||
Sheet = New Structure("properties", SheetProperties);
|
||||
Sheet = New Structure("properties", SheetProperties);
|
||||
|
||||
Return Sheet;
|
||||
|
||||
@@ -378,19 +378,19 @@ Function FormCellDataArray(Val ValueStructure, Val MajorDimension, Val Sheet)
|
||||
For Each CellData In ValueStructure Do
|
||||
|
||||
CurrentValue = CellData.Value;
|
||||
CurrentKey = CellData.Key;
|
||||
CurrentKey = CellData.Key;
|
||||
|
||||
AddSheetName(CurrentKey, Sheet);
|
||||
|
||||
OPI_TypeConversion.GetArray(CurrentValue);
|
||||
|
||||
CurrentData = New Map;
|
||||
CurrentData = New Map;
|
||||
CurrentArray = New Array;
|
||||
|
||||
CurrentArray.Add(CurrentValue);
|
||||
|
||||
OPI_Tools.AddField("range" , CurrentKey , "String", CurrentData);
|
||||
OPI_Tools.AddField("values" , CurrentArray , "Array", CurrentData);
|
||||
OPI_Tools.AddField("range" , CurrentKey , "String", CurrentData);
|
||||
OPI_Tools.AddField("values" , CurrentArray , "Array" , CurrentData);
|
||||
OPI_Tools.AddField("majorDimension", MajorDimension, "String", CurrentData);
|
||||
|
||||
DataArray.Add(CurrentData);
|
||||
|
@@ -64,10 +64,10 @@ Function FormCodeRetrievalLink(Val ClientID
|
||||
|
||||
URLParameters = New Structure;
|
||||
URLParameters.Insert("response_type", "code");
|
||||
URLParameters.Insert("client_id" , ClientID);
|
||||
URLParameters.Insert("client_id" , ClientID);
|
||||
URLParameters.Insert("redirect_uri" , "http://localhost");
|
||||
URLParameters.Insert("access_type" , "offline");
|
||||
URLParameters.Insert("scope" , GetPermissionsList(Calendar, Drive, Sheets));
|
||||
URLParameters.Insert("access_type" , "offline");
|
||||
URLParameters.Insert("scope" , GetPermissionsList(Calendar, Drive, Sheets));
|
||||
|
||||
URL = URL + OPI_Tools.RequestParametersToString(URLParameters);
|
||||
|
||||
@@ -94,11 +94,11 @@ Function GetTokenByCode(Val ClientID, Val ClientSecret, Val Code) Export
|
||||
URL = "https://accounts.google.com/o/oauth2/token";
|
||||
|
||||
URLParameters = New Structure;
|
||||
URLParameters.Insert("grant_type" , "authorization_code");
|
||||
URLParameters.Insert("client_id" , ClientID);
|
||||
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);
|
||||
URLParameters.Insert("code" , Code);
|
||||
|
||||
Response = OPI_Tools.Post(URL, URLParameters, , False);
|
||||
|
||||
@@ -125,8 +125,8 @@ Function RefreshToken(Val ClientID, Val ClientSecret, Val RefreshToken) Export
|
||||
URL = "https://accounts.google.com/o/oauth2/token";
|
||||
|
||||
URLParameters = New Structure;
|
||||
URLParameters.Insert("grant_type" , "refresh_token");
|
||||
URLParameters.Insert("client_id" , ClientID);
|
||||
URLParameters.Insert("grant_type" , "refresh_token");
|
||||
URLParameters.Insert("client_id" , ClientID);
|
||||
URLParameters.Insert("client_secret", ClientSecret);
|
||||
URLParameters.Insert("refresh_token", RefreshToken);
|
||||
|
||||
|
@@ -59,7 +59,7 @@ Function CreatePage(Val Token, Val Parent, Val Title) Export
|
||||
OPI_TypeConversion.GetLine(Parent);
|
||||
OPI_TypeConversion.GetLine(Title);
|
||||
|
||||
Headers = CreateRequestHeaders(Token);
|
||||
Headers = CreateRequestHeaders(Token);
|
||||
Properties = New Structure;
|
||||
Parameters = New Structure;
|
||||
|
||||
@@ -90,7 +90,7 @@ Function CreatePageInDatabase(Val Token, Val Parent, Val Data) Export
|
||||
OPI_TypeConversion.GetLine(Parent);
|
||||
OPI_TypeConversion.GetCollection(Data);
|
||||
|
||||
Headers = CreateRequestHeaders(Token);
|
||||
Headers = CreateRequestHeaders(Token);
|
||||
Parameters = New Structure;
|
||||
|
||||
AddPageParent(Parent, True, Parameters);
|
||||
@@ -154,15 +154,15 @@ Function EditPageProperties(Val Token
|
||||
OPI_TypeConversion.GetBoolean(Archived);
|
||||
OPI_TypeConversion.GetCollection(Data);
|
||||
|
||||
Headers = CreateRequestHeaders(Token);
|
||||
Headers = CreateRequestHeaders(Token);
|
||||
Parameters = New Structure;
|
||||
Files = "files";
|
||||
Files = "files";
|
||||
|
||||
If ValueIsFilled(Data)
|
||||
And (TypeOf(Data) = Type("Map") Or TypeOf(Data) = Type("Structure")) Then
|
||||
Properties = FillDataBySchema(Page, Data, Token, False);
|
||||
Properties = FillDataBySchema(Page, Data, Token, False);
|
||||
Else
|
||||
Properties = New Map;
|
||||
Properties = New Map;
|
||||
EndIf;
|
||||
|
||||
If ValueIsFilled(Icon) Then
|
||||
@@ -188,7 +188,7 @@ Function EditPageProperties(Val Token
|
||||
EndIf;
|
||||
|
||||
Parameters.Insert("properties", Properties);
|
||||
Parameters.Insert("archived" , Archived);
|
||||
Parameters.Insert("archived" , Archived);
|
||||
|
||||
ConvertID(Page);
|
||||
|
||||
@@ -235,10 +235,10 @@ Function CreateDatabase(Val Token, Val Parent, Val Title, Val Properties = "") E
|
||||
// All pages created as children must have parent base properties
|
||||
|
||||
If Not TypeOf(Properties) = Type("Structure") And Not TypeOf(Properties) = Type("Map") Then
|
||||
Properties = New Structure("Name", "title");
|
||||
Properties = New Structure("Name", "title");
|
||||
EndIf;
|
||||
|
||||
Headers = CreateRequestHeaders(Token);
|
||||
Headers = CreateRequestHeaders(Token);
|
||||
Parameters = New Structure;
|
||||
|
||||
AddDatabaseParent(Parent, False, Parameters);
|
||||
@@ -295,7 +295,7 @@ Function EditDatabaseProperties(Val Token, Val Base, Val Properties = "", Val Ti
|
||||
OPI_TypeConversion.GetCollection(Properties);
|
||||
|
||||
Parameters = New Structure;
|
||||
Headers = CreateRequestHeaders(Token);
|
||||
Headers = CreateRequestHeaders(Token);
|
||||
ConvertID(Base);
|
||||
|
||||
If ValueIsFilled(Title) Then
|
||||
@@ -339,7 +339,7 @@ Function CreateBlock(Val Token, Val Parent, Val Block, Val InsertAfter = "") Exp
|
||||
OPI_TypeConversion.GetCollection(Block);
|
||||
|
||||
If TypeOf(Block) = Type("Array") Then
|
||||
Block = Block[0];
|
||||
Block = Block[0];
|
||||
EndIf;
|
||||
|
||||
Headers = CreateRequestHeaders(Token);
|
||||
@@ -347,7 +347,7 @@ Function CreateBlock(Val Token, Val Parent, Val Block, Val InsertAfter = "") Exp
|
||||
|
||||
If TypeOf(Block) = Type("String") Then
|
||||
ConvertID(Block);
|
||||
Block = ReturnBlock(Token, Block);
|
||||
Block = ReturnBlock(Token, Block);
|
||||
EndIf;
|
||||
|
||||
BlockArray = New Array;
|
||||
@@ -360,7 +360,7 @@ Function CreateBlock(Val Token, Val Parent, Val Block, Val InsertAfter = "") Exp
|
||||
Parameters.Insert("after", InsertAfter);
|
||||
EndIf;
|
||||
|
||||
URL = "https://api.notion.com/v1/blocks/" + Parent + "/children";
|
||||
URL = "https://api.notion.com/v1/blocks/" + Parent + "/children";
|
||||
Response = OPI_Tools.Patch(URL, Parameters, Headers);
|
||||
|
||||
Return Response;
|
||||
@@ -385,7 +385,7 @@ Function ReturnBlock(Val Token, Val BlockID, Val OnlyBase = True) Export
|
||||
|
||||
ConvertID(BlockID);
|
||||
|
||||
Headers = CreateRequestHeaders(Token);
|
||||
Headers = CreateRequestHeaders(Token);
|
||||
Response = OPI_Tools.Get("https://api.notion.com/v1/blocks/" + BlockID, , Headers);
|
||||
|
||||
If OnlyBase Then
|
||||
@@ -412,7 +412,7 @@ Function ReturnChildBlocks(Val Token, Val BlockID) Export
|
||||
|
||||
ConvertID(BlockID);
|
||||
|
||||
Headers = CreateRequestHeaders(Token);
|
||||
Headers = CreateRequestHeaders(Token);
|
||||
Response = OPI_Tools.Get("https://api.notion.com/v1/blocks/" + BlockID + "/children", , Headers);
|
||||
|
||||
Return Response;
|
||||
@@ -435,7 +435,7 @@ Function DeleteBlock(Val Token, Val BlockID) Export
|
||||
|
||||
ConvertID(BlockID);
|
||||
|
||||
Headers = CreateRequestHeaders(Token);
|
||||
Headers = CreateRequestHeaders(Token);
|
||||
Response = OPI_Tools.Delete("https://api.notion.com/v1/blocks/" + BlockID, , Headers);
|
||||
|
||||
Return Response;
|
||||
@@ -458,7 +458,7 @@ Function UserList(Val Token) Export
|
||||
|
||||
OPI_TypeConversion.GetLine(Token);
|
||||
|
||||
Headers = CreateRequestHeaders(Token);
|
||||
Headers = CreateRequestHeaders(Token);
|
||||
Response = OPI_Tools.Get("https://api.notion.com/v1/users", , Headers);
|
||||
|
||||
Return Response;
|
||||
@@ -481,7 +481,7 @@ Function GetUserData(Val Token, Val UserID) Export
|
||||
|
||||
ConvertID(UserID);
|
||||
|
||||
Headers = CreateRequestHeaders(Token);
|
||||
Headers = CreateRequestHeaders(Token);
|
||||
Response = OPI_Tools.Get("https://api.notion.com/v1/users/" + UserID, , Headers);
|
||||
|
||||
Return Response;
|
||||
@@ -536,7 +536,7 @@ Procedure AddDatabaseParent(Val Parent, Val ParentBase, MainStructure)
|
||||
IdentifierField = ?(ParentBase, "database_id", "page_id");
|
||||
|
||||
ParentStructure = New Structure();
|
||||
ParentStructure.Insert("type" , IdentifierField);
|
||||
ParentStructure.Insert("type" , IdentifierField);
|
||||
ParentStructure.Insert(IdentifierField, Parent);
|
||||
|
||||
MainStructure.Insert("parent", ParentStructure);
|
||||
@@ -548,22 +548,22 @@ Procedure AddPageHeader(Val Title, MainStructure)
|
||||
OPI_TypeConversion.GetLine(Title);
|
||||
|
||||
SubordinateStructure = New Structure;
|
||||
DataStructure = New Structure;
|
||||
TextStructure = New Structure;
|
||||
DataArray = New Array;
|
||||
DataStructure = New Structure;
|
||||
TextStructure = New Structure;
|
||||
DataArray = New Array;
|
||||
Title = "title";
|
||||
|
||||
TextStructure.Insert("content", Title);
|
||||
TextStructure.Insert("link" , Undefined);
|
||||
TextStructure.Insert("link" , Undefined);
|
||||
|
||||
DataStructure.Insert("text", TextStructure);
|
||||
DataStructure.Insert("type", "text");
|
||||
|
||||
DataArray.Add(DataStructure);
|
||||
|
||||
SubordinateStructure.Insert("id" , Title);
|
||||
SubordinateStructure.Insert("id" , Title);
|
||||
SubordinateStructure.Insert("type" , Title);
|
||||
SubordinateStructure.Insert(Title , DataArray);
|
||||
SubordinateStructure.Insert(Title , DataArray);
|
||||
|
||||
MainStructure.Insert(Title, SubordinateStructure);
|
||||
|
||||
@@ -602,7 +602,7 @@ Procedure AddDatabaseProperties(Val Properties, MainStructure)
|
||||
|
||||
ParameterMap.Insert(Property.Key, New Structure(Property.Value, New Structure));
|
||||
|
||||
ElsIf TypeOf(Property.Value) = Type("Structure")
|
||||
ElsIf TypeOf(Property.Value) = Type("Structure")
|
||||
Or TypeOf(Property.Value) = Type("Map") Then
|
||||
|
||||
ValueSelection = FormSelectionValues(Property.Value);
|
||||
@@ -705,7 +705,7 @@ EndProcedure
|
||||
|
||||
Function ConvertValueByType(Val Type, Val Value)
|
||||
|
||||
If Type = "title" Then
|
||||
If Type = "title" Then
|
||||
Return ConvertHeader(Value);
|
||||
ElsIf Type = "rich_text" Then
|
||||
Return ConvertText(Value);
|
||||
@@ -743,10 +743,10 @@ Function ConvertHeader(Val Title)
|
||||
|
||||
DataStructure = New Structure;
|
||||
TextStructure = New Structure;
|
||||
DataArray = New Array;
|
||||
DataArray = New Array;
|
||||
|
||||
TextStructure.Insert("content", Title);
|
||||
TextStructure.Insert("link" , Undefined);
|
||||
TextStructure.Insert("link" , Undefined);
|
||||
|
||||
DataStructure.Insert("type", "text");
|
||||
DataStructure.Insert("text", TextStructure);
|
||||
@@ -759,7 +759,7 @@ EndFunction
|
||||
|
||||
Function ConvertText(Val Text)
|
||||
|
||||
TextArray = New Array;
|
||||
TextArray = New Array;
|
||||
TextStructure = New Structure;
|
||||
|
||||
TextStructure.Insert("type", "text");
|
||||
@@ -809,7 +809,7 @@ Function ConvertDate(Val Date)
|
||||
|
||||
DateStructure = New Structure;
|
||||
|
||||
If Date = BegOfDay(Date) Then
|
||||
If Date = BegOfDay(Date) Then
|
||||
DateFormat = "DF=yyyy-MM-dd";
|
||||
Else
|
||||
DateFormat = "ISO8601Datetime";
|
||||
@@ -834,9 +834,9 @@ EndFunction
|
||||
Function ConvertUsers(Val IDArray)
|
||||
|
||||
If Not TypeOf(IDArray) = Type("Array") Then
|
||||
ArrayID_ = New Array;
|
||||
ArrayID_ = New Array;
|
||||
ArrayID_.Add(IDArray);
|
||||
IDArray = ArrayID_;
|
||||
IDArray = ArrayID_;
|
||||
EndIf;
|
||||
|
||||
ArrayOfUsers = New Array;
|
||||
@@ -845,7 +845,7 @@ Function ConvertUsers(Val IDArray)
|
||||
|
||||
UserStructure = New Structure;
|
||||
UserStructure.Insert("object", "user");
|
||||
UserStructure.Insert("id" , Identifier);
|
||||
UserStructure.Insert("id" , Identifier);
|
||||
ArrayOfUsers.Add(UserStructure);
|
||||
|
||||
EndDo;
|
||||
@@ -861,8 +861,8 @@ Function ConvertFiles(Val FileMapping)
|
||||
For Each File In FileMapping Do
|
||||
|
||||
FileStructure = New Structure;
|
||||
FileStructure.Insert("type" , "external");
|
||||
FileStructure.Insert("name" , File.Key);
|
||||
FileStructure.Insert("type" , "external");
|
||||
FileStructure.Insert("name" , File.Key);
|
||||
FileStructure.Insert("external", New Structure("url", File.Value));
|
||||
|
||||
ArrayOfFiles.Add(FileStructure);
|
||||
|
@@ -51,7 +51,7 @@
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function GetBotInformation(Val Token) Export
|
||||
|
||||
URL = "https://slack.com/api/auth.test";
|
||||
URL = "https://slack.com/api/auth.test";
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
|
||||
Response = OPI_Tools.Get(URL, , Headers);
|
||||
@@ -71,7 +71,7 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function GetWorkspaceList(Val Token, Val Cursor = "") Export
|
||||
|
||||
URL = "https://slack.com/api/auth.teams.list";
|
||||
URL = "https://slack.com/api/auth.teams.list";
|
||||
Response = GeneralDataRetrieval(Token, URL, Cursor);
|
||||
|
||||
Return Response;
|
||||
@@ -89,7 +89,7 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function GetUserList(Val Token, Val Cursor = "") Export
|
||||
|
||||
URL = "https://slack.com/api/users.list";
|
||||
URL = "https://slack.com/api/users.list";
|
||||
Response = GeneralDataRetrieval(Token, URL, Cursor);
|
||||
|
||||
Return Response;
|
||||
@@ -133,8 +133,8 @@ Function SendMessage(Val Token, Val Channel, Val Text = "", Val SendingDate = ""
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("channel", Channel, String_ , Parameters);
|
||||
OPI_Tools.AddField("text" , Text, String_ , Parameters);
|
||||
OPI_Tools.AddField("blocks" , Blocks, "Array" , Parameters);
|
||||
OPI_Tools.AddField("text" , Text , String_ , Parameters);
|
||||
OPI_Tools.AddField("blocks" , Blocks , "Array" , Parameters);
|
||||
|
||||
If HasDate Then
|
||||
|
||||
@@ -181,10 +181,10 @@ Function SendEphemeralMessage(Val Token
|
||||
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);
|
||||
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";
|
||||
|
||||
@@ -209,13 +209,13 @@ EndFunction
|
||||
Function EditMessage(Val Token, Val Channel, Val Timestamp, Val Text = "", Val BlockArray = "") Export
|
||||
|
||||
String_ = "String";
|
||||
URL = "https://slack.com/api/chat.update";
|
||||
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("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);
|
||||
@@ -242,15 +242,15 @@ Function DeleteMessage(Val Token, Val Channel, Val Timestamp, Val IsDelayed = Fa
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
|
||||
If IsDelayed Then
|
||||
URL = "https://slack.com/api/chat.deleteScheduledMessage";
|
||||
URL = "https://slack.com/api/chat.deleteScheduledMessage";
|
||||
TimestampField = "scheduled_message_id";
|
||||
Else
|
||||
URL = "https://slack.com/api/chat.delete";
|
||||
URL = "https://slack.com/api/chat.delete";
|
||||
TimestampField = "ts";
|
||||
EndIf;
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("channel" , Channel , "String", Parameters);
|
||||
OPI_Tools.AddField("channel" , Channel , "String", Parameters);
|
||||
OPI_Tools.AddField(TimestampField, Timestamp, "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
@@ -271,12 +271,12 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function GetDelayedMessageList(Val Token, Val Channel, Val Cursor = "") Export
|
||||
|
||||
URL = "https://slack.com/api/chat.scheduledMessages.list";
|
||||
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);
|
||||
OPI_Tools.AddField("cursor" , Cursor , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
|
||||
@@ -296,11 +296,11 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function GetMessageLink(Val Token, Val Channel, Val Timestamp) Export
|
||||
|
||||
URL = "https://slack.com/api/chat.getPermalink";
|
||||
URL = "https://slack.com/api/chat.getPermalink";
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("channel" , Channel , "String", Parameters);
|
||||
OPI_Tools.AddField("channel" , Channel , "String", Parameters);
|
||||
OPI_Tools.AddField("message_ts", Timestamp, "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Get(URL, Parameters, Headers);
|
||||
@@ -323,13 +323,13 @@ EndFunction
|
||||
Function GetMessageReplyList(Val Token, Val Channel, Val Timestamp, Val Cursor = "") Export
|
||||
|
||||
String_ = "String";
|
||||
URL = "https://slack.com/api/conversations.replies";
|
||||
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);
|
||||
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);
|
||||
|
||||
@@ -353,12 +353,12 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function GetChannelList(Val Token, Val ExcludeArchived = False, Val Cursor = "") Export
|
||||
|
||||
URL = "https://slack.com/api/conversations.list";
|
||||
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);
|
||||
OPI_Tools.AddField("cursor" , Cursor , "String" , Parameters);
|
||||
|
||||
Response = OPI_Tools.Get(URL, Parameters, Headers);
|
||||
|
||||
@@ -378,12 +378,12 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function GetChannelUserList(Val Token, Val Channel, Val Cursor = "") Export
|
||||
|
||||
URL = "https://slack.com/api/conversations.members";
|
||||
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);
|
||||
OPI_Tools.AddField("cursor" , Cursor , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Get(URL, Parameters, Headers);
|
||||
|
||||
@@ -403,11 +403,11 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function CreateChannel(Val Token, Val Name, Val Private = False) Export
|
||||
|
||||
URL = "https://slack.com/api/conversations.create";
|
||||
URL = "https://slack.com/api/conversations.create";
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("name" , Name , "String", Parameters);
|
||||
OPI_Tools.AddField("name" , Name , "String" , Parameters);
|
||||
OPI_Tools.AddField("is_private", Private, "Boolean", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
@@ -427,7 +427,7 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function ArchiveChannel(Val Token, Val Channel) Export
|
||||
|
||||
URL = "https://slack.com/api/conversations.archive";
|
||||
URL = "https://slack.com/api/conversations.archive";
|
||||
Response = DialogManagement(Token, Channel, URL);
|
||||
Return Response;
|
||||
|
||||
@@ -444,7 +444,7 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function GetChannel(Val Token, Val Channel) Export
|
||||
|
||||
URL = "https://slack.com/api/conversations.info";
|
||||
URL = "https://slack.com/api/conversations.info";
|
||||
Response = DialogManagement(Token, Channel, URL, "GET");
|
||||
Return Response;
|
||||
|
||||
@@ -461,7 +461,7 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function GetChannelHistory(Val Token, Val Channel) Export
|
||||
|
||||
URL = "https://slack.com/api/conversations.history";
|
||||
URL = "https://slack.com/api/conversations.history";
|
||||
Response = DialogManagement(Token, Channel, URL, "GET");
|
||||
Return Response;
|
||||
|
||||
@@ -479,15 +479,15 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function InviteUsersToChannel(Val Token, Val Channel, Val ArrayOfUsers) Export
|
||||
|
||||
URL = "https://slack.com/api/conversations.invite";
|
||||
URL = "https://slack.com/api/conversations.invite";
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
|
||||
OPI_TypeConversion.GetCollection(ArrayOfUsers);
|
||||
ArrayOfUsers = StrConcat(ArrayOfUsers, ",");
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("channel", Channel , "String", Parameters);
|
||||
OPI_Tools.AddField("users" , ArrayOfUsers, "String", Parameters);
|
||||
OPI_Tools.AddField("channel", Channel , "String", Parameters);
|
||||
OPI_Tools.AddField("users" , ArrayOfUsers, "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
|
||||
@@ -507,12 +507,12 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function KickUserFromChannel(Val Token, Val Channel, Val User) Export
|
||||
|
||||
URL = "https://slack.com/api/conversations.kick";
|
||||
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);
|
||||
OPI_Tools.AddField("user" , User , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
|
||||
@@ -531,7 +531,7 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function JoinChannel(Val Token, Val Channel) Export
|
||||
|
||||
URL = "https://slack.com/api/conversations.join";
|
||||
URL = "https://slack.com/api/conversations.join";
|
||||
Response = DialogManagement(Token, Channel, URL);
|
||||
Return Response;
|
||||
|
||||
@@ -548,7 +548,7 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function LeaveChannel(Val Token, Val Channel) Export
|
||||
|
||||
URL = "https://slack.com/api/conversations.leave";
|
||||
URL = "https://slack.com/api/conversations.leave";
|
||||
Response = DialogManagement(Token, Channel, URL);
|
||||
Return Response;
|
||||
|
||||
@@ -566,12 +566,12 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function SetChannelTopic(Val Token, Val Channel, Val Topic) Export
|
||||
|
||||
URL = "https://slack.com/api/conversations.setTopic";
|
||||
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);
|
||||
OPI_Tools.AddField("topic" , Topic , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
|
||||
@@ -591,7 +591,7 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function SetChannelGoal(Val Token, Val Channel, Val Purpose) Export
|
||||
|
||||
URL = "https://slack.com/api/conversations.setPurpose";
|
||||
URL = "https://slack.com/api/conversations.setPurpose";
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
|
||||
Parameters = New Structure;
|
||||
@@ -616,12 +616,12 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function RenameChannel(Val Token, Val Channel, Val Name) Export
|
||||
|
||||
URL = "https://slack.com/api/conversations.rename";
|
||||
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);
|
||||
OPI_Tools.AddField("name" , Name , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
|
||||
@@ -644,7 +644,7 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function OpenDialog(Val Token, Val ArrayOfUsers) Export
|
||||
|
||||
URL = "https://slack.com/api/conversations.open";
|
||||
URL = "https://slack.com/api/conversations.open";
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
|
||||
OPI_TypeConversion.GetCollection(ArrayOfUsers);
|
||||
@@ -670,7 +670,7 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function CloseDialog(Val Token, Val Dialog) Export
|
||||
|
||||
URL = "https://slack.com/api/conversations.close";
|
||||
URL = "https://slack.com/api/conversations.close";
|
||||
Response = DialogManagement(Token, Dialog, URL);
|
||||
Return Response;
|
||||
|
||||
@@ -692,12 +692,12 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function GetFilesList(Val Token, Val Channel = "", Val PageNumber = 1) Export
|
||||
|
||||
URL = "https://slack.com/api/files.list";
|
||||
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);
|
||||
OPI_Tools.AddField("channel", Channel , "String", Parameters);
|
||||
OPI_Tools.AddField("page" , PageNumber, "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Get(URL, Parameters, Headers);
|
||||
|
||||
@@ -723,19 +723,19 @@ Function UploadFile(Val Token, Val File, Val FileName, Val Title, Val Channel =
|
||||
OPI_TypeConversion.GetLine(FileName);
|
||||
OPI_TypeConversion.GetLine(Title);
|
||||
|
||||
String_ = "String";
|
||||
String_ = "String";
|
||||
Upload_url = "upload_url";
|
||||
File_id = "file_id";
|
||||
URL = "https://slack.com/api/files.getUploadURLExternal";
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
Size = File.Size();
|
||||
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);
|
||||
OPI_Tools.AddField("length" , Size , String_, Parameters);
|
||||
|
||||
Response = OPI_Tools.Get(URL, Parameters, Headers);
|
||||
URL = Response[Upload_url];
|
||||
Response = OPI_Tools.Get(URL, Parameters, Headers);
|
||||
URL = Response[Upload_url];
|
||||
Identifier = Response[File_id];
|
||||
|
||||
If Not ValueIsFilled(URL) Or Not ValueIsFilled(Identifier) Then
|
||||
@@ -745,14 +745,14 @@ Function UploadFile(Val Token, Val File, Val FileName, Val Title, Val Channel =
|
||||
Files = New Map;
|
||||
Files.Insert(FileName, File);
|
||||
|
||||
Response = OPI_Tools.PostMultipart(URL, , Files, , Headers);
|
||||
URL = "https://slack.com/api/files.completeUploadExternal";
|
||||
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_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);
|
||||
|
||||
@@ -771,7 +771,7 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function GetFileData(Val Token, Val FileID) Export
|
||||
|
||||
URL = "https://slack.com/api/files.info";
|
||||
URL = "https://slack.com/api/files.info";
|
||||
Response = FileManagement(Token, FileID, URL, "GET");
|
||||
|
||||
Return Response;
|
||||
@@ -789,7 +789,7 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function DeleteFile(Val Token, Val FileID) Export
|
||||
|
||||
URL = "https://slack.com/api/files.delete";
|
||||
URL = "https://slack.com/api/files.delete";
|
||||
Response = FileManagement(Token, FileID, URL);
|
||||
|
||||
Return Response;
|
||||
@@ -807,7 +807,7 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function MakeFilePublic(Val Token, Val FileID) Export
|
||||
|
||||
URL = "https://slack.com/api/files.sharedPublicURL";
|
||||
URL = "https://slack.com/api/files.sharedPublicURL";
|
||||
Response = FileManagement(Token, FileID, URL);
|
||||
|
||||
Return Response;
|
||||
@@ -825,7 +825,7 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function MakeFilePrivate(Val Token, Val FileID) Export
|
||||
|
||||
URL = "https://slack.com/api/files.revokePublicURL";
|
||||
URL = "https://slack.com/api/files.revokePublicURL";
|
||||
Response = FileManagement(Token, FileID, URL);
|
||||
|
||||
Return Response;
|
||||
@@ -848,12 +848,12 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function GetExternalFileList(Val Token, Val Channel = "", Val Cursor = "") Export
|
||||
|
||||
URL = "https://slack.com/api/files.remote.list";
|
||||
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);
|
||||
OPI_Tools.AddField("cursor" , Cursor , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Get(URL, Parameters, Headers);
|
||||
|
||||
@@ -872,7 +872,7 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function GetExternalFile(Val Token, Val FileID) Export
|
||||
|
||||
URL = "https://slack.com/api/files.remote.info";
|
||||
URL = "https://slack.com/api/files.remote.info";
|
||||
Response = ExternalFileManagement(Token, FileID, URL);
|
||||
|
||||
Return Response;
|
||||
@@ -892,14 +892,14 @@ EndFunction
|
||||
Function AddExternalFile(Val Token, Val URL, Val Title) Export
|
||||
|
||||
String_ = "String";
|
||||
URL = "https://slack.com/api/files.remote.add";
|
||||
URL = "https://slack.com/api/files.remote.add";
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
UID = String(New UUID());
|
||||
UID = String(New UUID());
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
@@ -919,14 +919,14 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function SendExternalFile(Val Token, Val FileID, Val ChannelArray) Export
|
||||
|
||||
URL = "https://slack.com/api/files.remote.share";
|
||||
URL = "https://slack.com/api/files.remote.share";
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
|
||||
OPI_TypeConversion.GetCollection(ChannelArray);
|
||||
ChannelArray = StrConcat(ChannelArray, ",");
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("file" , FileID , "String", Parameters);
|
||||
OPI_Tools.AddField("file" , FileID , "String", Parameters);
|
||||
OPI_Tools.AddField("channels", ChannelArray , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Get(URL, Parameters, Headers);
|
||||
@@ -946,7 +946,7 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from Slack
|
||||
Function DeleteExternalFile(Val Token, Val FileID) Export
|
||||
|
||||
URL = "https://slack.com/api/files.remote.remove";
|
||||
URL = "https://slack.com/api/files.remote.remove";
|
||||
Response = ExternalFileManagement(Token, FileID, URL);
|
||||
|
||||
Return Response;
|
||||
@@ -971,8 +971,8 @@ Function GenerateImageBlock(Val URL, Val AlternateText = "") Export
|
||||
String_ = "String";
|
||||
|
||||
Block = New Map;
|
||||
OPI_Tools.AddField("type" , "image" , String_, Block);
|
||||
OPI_Tools.AddField("image_url", URL , String_, Block);
|
||||
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;
|
||||
@@ -997,16 +997,16 @@ EndFunction
|
||||
|
||||
Function DialogManagement(Val Token, Val Channel, Val URL, Val RequestType = "POST")
|
||||
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
RequestType = Upper(RequestType);
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("channel", Channel, "String", Parameters);
|
||||
|
||||
If RequestType = "POST" Then
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
Else
|
||||
Response = OPI_Tools.Get(URL, Parameters, Headers);
|
||||
Response = OPI_Tools.Get(URL, Parameters, Headers);
|
||||
EndIf;
|
||||
|
||||
Return Response;
|
||||
@@ -1015,16 +1015,16 @@ EndFunction
|
||||
|
||||
Function FileManagement(Val Token, Val FileID, Val URL, Val RequestType = "POST")
|
||||
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
Headers = GetAuthorizationHeader(Token);
|
||||
RequestType = Upper(RequestType);
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("file", FileID , "String", Parameters);
|
||||
|
||||
If RequestType = "POST" Then
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
Response = OPI_Tools.Post(URL, Parameters, Headers);
|
||||
Else
|
||||
Response = OPI_Tools.Get(URL, Parameters, Headers);
|
||||
Response = OPI_Tools.Get(URL, Parameters, Headers);
|
||||
EndIf;
|
||||
|
||||
Return Response;
|
||||
|
@@ -57,7 +57,7 @@ Function GetBotInformation(Val Token) Export
|
||||
|
||||
OPI_TypeConversion.GetLine(Token);
|
||||
|
||||
URL = "api.telegram.org/bot" + Token + "/getMe";
|
||||
URL = "api.telegram.org/bot" + Token + "/getMe";
|
||||
Response = OPI_Tools.Get(URL);
|
||||
|
||||
Return Response;
|
||||
@@ -82,7 +82,7 @@ Function GetUpdates(Val Token, Val Timeout = 0, Val Offset = "") Export
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("timeout", Timeout , "String", Parameters);
|
||||
OPI_Tools.AddField("offset" , Offset, "String", Parameters);
|
||||
OPI_Tools.AddField("offset" , Offset , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Get(URL, Parameters);
|
||||
Return Response;
|
||||
@@ -105,7 +105,7 @@ Function SetWebhook(Val Token, Val URL) Export
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("url", URL, "String", Parameters);
|
||||
|
||||
URL = "api.telegram.org/bot" + Token + "/setWebHook";
|
||||
URL = "api.telegram.org/bot" + Token + "/setWebHook";
|
||||
Response = OPI_Tools.Get(URL, Parameters);
|
||||
|
||||
Return Response;
|
||||
@@ -124,7 +124,7 @@ Function DeleteWebhook(Val Token) Export
|
||||
|
||||
OPI_TypeConversion.GetLine(Token);
|
||||
|
||||
URL = "api.telegram.org/bot" + Token + "/deleteWebHook";
|
||||
URL = "api.telegram.org/bot" + Token + "/deleteWebHook";
|
||||
Response = OPI_Tools.Get(URL);
|
||||
|
||||
Return Response;
|
||||
@@ -149,7 +149,7 @@ Function DownloadFile(Val Token, Val FileID) Export
|
||||
|
||||
Parameters = New Structure("file_id", FileID);
|
||||
|
||||
URL = "api.telegram.org/bot" + Token + "/getFile";
|
||||
URL = "api.telegram.org/bot" + Token + "/getFile";
|
||||
Response = OPI_Tools.Get(URL, Parameters);
|
||||
|
||||
Path = Response[Result]["file_path"];
|
||||
@@ -158,7 +158,7 @@ Function DownloadFile(Val Token, Val FileID) Export
|
||||
Return Response;
|
||||
EndIf;
|
||||
|
||||
URL = "api.telegram.org/file/bot" + Token + "/" + Path;
|
||||
URL = "api.telegram.org/file/bot" + Token + "/" + Path;
|
||||
Response = OPI_Tools.Get(URL, Parameters);
|
||||
|
||||
Return Response;
|
||||
@@ -179,11 +179,11 @@ Function ProcessTMAData(Val DataString, Val Token) Export
|
||||
OPI_TypeConversion.GetLine(Token);
|
||||
OPI_TypeConversion.GetLine(DataString);
|
||||
|
||||
DataString = DecodeString(DataString, StringEncodingMethod.URLencoding);
|
||||
DataString = DecodeString(DataString, StringEncodingMethod.URLencoding);
|
||||
DataStructure = OPI_Tools.RequestParametersToMap(DataString);
|
||||
KeyString = "WebAppData";
|
||||
Hash = "";
|
||||
BinaryKey = GetBinaryDataFromString(KeyString);
|
||||
KeyString = "WebAppData";
|
||||
Hash = "";
|
||||
BinaryKey = GetBinaryDataFromString(KeyString);
|
||||
|
||||
Result = OPI_Cryptography.HMACSHA256(BinaryKey, GetBinaryDataFromString(Token));
|
||||
|
||||
@@ -193,8 +193,8 @@ Function ProcessTMAData(Val DataString, Val Token) Export
|
||||
|
||||
For Each Data In DataStructure Do
|
||||
|
||||
NewLine = TValue.Add();
|
||||
NewLine.Key = Data.Key;
|
||||
NewLine = TValue.Add();
|
||||
NewLine.Key = Data.Key;
|
||||
NewLine.Value = Data.Value;
|
||||
|
||||
EndDo;
|
||||
@@ -202,12 +202,12 @@ Function ProcessTMAData(Val DataString, Val Token) Export
|
||||
TValue.Sort("Key");
|
||||
|
||||
ReturnMapping = New Map;
|
||||
DCS = "";
|
||||
DCS = "";
|
||||
|
||||
For Each DataString In TValue Do
|
||||
|
||||
If DataString.Key <> "hash" Then
|
||||
DCS = DCS + DataString.Key + "=" + DataString.Value + Chars.LF;
|
||||
DCS = DCS + DataString.Key + " =" + DataString.Value + Chars.LF;
|
||||
ReturnMapping.Insert(DataString.Key, DataString.Value);
|
||||
Else
|
||||
Hash = DataString.Value;
|
||||
@@ -215,12 +215,12 @@ Function ProcessTMAData(Val DataString, Val Token) Export
|
||||
|
||||
EndDo;
|
||||
|
||||
DCS = Left(DCS, StrLen(DCS) - 1);
|
||||
DCS = Left(DCS, StrLen(DCS) - 1);
|
||||
Signature = OPI_Cryptography.HMACSHA256(Result, GetBinaryDataFromString(DCS));
|
||||
|
||||
Final = GetHexStringFromBinaryData(Signature);
|
||||
|
||||
If Final = Upper(Hash) Then
|
||||
If Final = Upper(Hash) Then
|
||||
Response = True;
|
||||
Else
|
||||
Response = False;
|
||||
@@ -262,14 +262,14 @@ Function SendTextMessage(Val Token
|
||||
String_ = "String";
|
||||
|
||||
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);
|
||||
OPI_Tools.AddField("reply_to_message_id", RepliedID, String_ , Parameters);
|
||||
OPI_Tools.AddField("parse_mode" , Markup , String_ , Parameters);
|
||||
OPI_Tools.AddField("text" , Text , String_ , Parameters);
|
||||
OPI_Tools.AddField("reply_markup" , Keyboard , "FileString", Parameters);
|
||||
OPI_Tools.AddField("reply_to_message_id", RepliedID, String_ , Parameters);
|
||||
|
||||
AddChatIdentifier(ChatID, Parameters);
|
||||
|
||||
URL = "api.telegram.org/bot" + Token + "/sendMessage";
|
||||
URL = "api.telegram.org/bot" + Token + "/sendMessage";
|
||||
Response = OPI_Tools.Get(URL, Parameters);
|
||||
|
||||
Return Response;
|
||||
@@ -434,16 +434,16 @@ Function SendMediaGroup(Val Token
|
||||
|
||||
OPI_Tools.ReplaceSpecialCharacters(Text, Markup);
|
||||
|
||||
URL = "api.telegram.org/bot" + Token + "/sendMediaGroup";
|
||||
Media = New Array;
|
||||
URL = "api.telegram.org/bot" + Token + "/sendMediaGroup";
|
||||
Media = New Array;
|
||||
Parameters = New Structure;
|
||||
|
||||
AddChatIdentifier(ChatID, Parameters);
|
||||
ConvertFilesToMedia(FileMapping, Text, 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("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, FileMapping, "mixed");
|
||||
@@ -473,10 +473,10 @@ Function SendLocation(Val Token, Val ChatID, Val Latitude, Val Longitude, Val Ke
|
||||
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);
|
||||
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);
|
||||
|
||||
@@ -508,11 +508,11 @@ Function SendContact(Val Token, Val ChatID, Val Name, Val LastName, Val Phone, V
|
||||
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" , LastName , String_ , Parameters);
|
||||
OPI_Tools.AddField("phone_number", Phone , String_ , Parameters);
|
||||
OPI_Tools.AddField("reply_markup", Keyboard, "FileString", Parameters);
|
||||
OPI_Tools.AddField("parse_mode" , "Markdown", String_ , Parameters);
|
||||
OPI_Tools.AddField("first_name" , Name , String_ , Parameters);
|
||||
OPI_Tools.AddField("last_name" , LastName , String_ , Parameters);
|
||||
OPI_Tools.AddField("phone_number", Phone , String_ , Parameters);
|
||||
OPI_Tools.AddField("reply_markup", Keyboard , "FileString", Parameters);
|
||||
|
||||
AddChatIdentifier(ChatID, Parameters);
|
||||
|
||||
@@ -545,9 +545,9 @@ Function SendPoll(Val Token, Val ChatID, Val Question, Val AnswersArray, Val Ano
|
||||
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);
|
||||
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);
|
||||
@@ -579,8 +579,8 @@ Function ForwardMessage(Val Token, Val OriginalID, Val FromID, Val ToID) Export
|
||||
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_Tools.AddField("from_chat_id", FromID , "String", Parameters);
|
||||
OPI_Tools.AddField("message_id" , OriginalID, "String", Parameters);
|
||||
|
||||
AddChatIdentifier(ToID, Parameters);
|
||||
|
||||
@@ -615,7 +615,7 @@ Function FormKeyboardFromButtonArray(Val ButtonArray
|
||||
EndIf;
|
||||
|
||||
If UnderMessage Then
|
||||
ParameterStructure = New Structure("inline_keyboard,rows", Strings, 1);
|
||||
ParameterStructure = New Structure("inline_keyboard,rows" , Strings, 1);
|
||||
Else
|
||||
ParameterStructure = New Structure("keyboard,resize_keyboard", Strings, True);
|
||||
EndIf;
|
||||
@@ -649,8 +649,8 @@ Function Ban(Val Token, Val ChatID, Val UserID) Export
|
||||
|
||||
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("chat_id" , ChatID , String_, Parameters);
|
||||
OPI_Tools.AddField("user_id" , UserID , String_, Parameters);
|
||||
|
||||
Response = OPI_Tools.Get(URL, Parameters);
|
||||
|
||||
@@ -676,10 +676,10 @@ Function Unban(Val Token, Val ChatID, Val UserID) Export
|
||||
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);
|
||||
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);
|
||||
|
||||
@@ -711,11 +711,11 @@ Function CreateInvitationLink(Val 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);
|
||||
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);
|
||||
|
||||
@@ -741,10 +741,10 @@ Function PinMessage(Val Token, Val ChatID, Val MessageID) Export
|
||||
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);
|
||||
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);
|
||||
|
||||
@@ -771,8 +771,8 @@ Function UnpinMessage(Val Token, Val ChatID, Val MessageID) Export
|
||||
|
||||
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("chat_id" , ChatID , String_, Parameters);
|
||||
OPI_Tools.AddField("message_id", MessageID , String_, Parameters);
|
||||
|
||||
Response = OPI_Tools.Get(URL, Parameters);
|
||||
|
||||
@@ -797,7 +797,7 @@ Function GetParticipantCount(Val Token, Val ChatID) Export
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("parse_mode", "Markdown" , "String", Parameters);
|
||||
OPI_Tools.AddField("chat_id" , ChatID , "String", Parameters);
|
||||
OPI_Tools.AddField("chat_id" , ChatID , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Get(URL, Parameters);
|
||||
|
||||
@@ -823,7 +823,7 @@ Function DeleteMessage(Val Token, Val ChatID, Val MessageID) Export
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("message_id", MessageID, "String", Parameters);
|
||||
OPI_Tools.AddField("chat_id" , ChatID , "String", Parameters);
|
||||
OPI_Tools.AddField("chat_id" , ChatID , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Get(URL, Parameters);
|
||||
Return Response;
|
||||
@@ -846,10 +846,10 @@ Function GetAvatarIconList(Val Token) Export
|
||||
|
||||
OPI_TypeConversion.GetLine(Token);
|
||||
|
||||
Result = "result";
|
||||
URL = "api.telegram.org/bot" + Token + "/getForumTopicIconStickers";
|
||||
Result = "result";
|
||||
URL = "api.telegram.org/bot" + Token + "/getForumTopicIconStickers";
|
||||
Response = OPI_Tools.Get(URL);
|
||||
Icons = Response[Result];
|
||||
Icons = Response[Result];
|
||||
|
||||
If Not ValueIsFilled(Icons) Then
|
||||
Return Response;
|
||||
@@ -999,7 +999,7 @@ Function EditMainForumTopicName(Val Token, Val ChatID, Val Title) Export
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("chat_id", ChatID , "String", Parameters);
|
||||
OPI_Tools.AddField("name" , Title, "String", Parameters);
|
||||
OPI_Tools.AddField("name" , Title , "String", Parameters);
|
||||
|
||||
Response = OPI_Tools.Get(URL, Parameters);
|
||||
|
||||
@@ -1024,7 +1024,7 @@ Function ClearThreadPinnedMessagesList(Val Token, Val ChatID, Val ThreadID = "")
|
||||
OPI_TypeConversion.GetLine(ThreadID);
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("chat_id" , ChatID, "String", Parameters);
|
||||
OPI_Tools.AddField("chat_id" , ChatID , "String", Parameters);
|
||||
OPI_Tools.AddField("message_thread_id", ThreadID, "String", Parameters);
|
||||
|
||||
If ValueIsFilled(ThreadID) Then
|
||||
@@ -1033,7 +1033,7 @@ Function ClearThreadPinnedMessagesList(Val Token, Val ChatID, Val ThreadID = "")
|
||||
Method = "/unpinAllGeneralForumTopicMessages";
|
||||
EndIf;
|
||||
|
||||
URL = "api.telegram.org/bot" + Token + Method;
|
||||
URL = "api.telegram.org/bot" + Token + Method;
|
||||
Response = OPI_Tools.Get(URL, Parameters);
|
||||
|
||||
Return Response;
|
||||
@@ -1071,8 +1071,8 @@ Function SendFile(Val Token
|
||||
FileName = View + "|" + FileName;
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("parse_mode" , Markup , "String" , Parameters);
|
||||
OPI_Tools.AddField("caption" , Text , "String" , Parameters);
|
||||
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);
|
||||
@@ -1080,8 +1080,8 @@ Function SendFile(Val Token
|
||||
FileMapping = New Map;
|
||||
FileMapping.Insert(FileName, File);
|
||||
|
||||
Method = DetermineSendMethod(View);
|
||||
URL = "api.telegram.org/bot" + Token + Method;
|
||||
Method = DetermineSendMethod(View);
|
||||
URL = "api.telegram.org/bot" + Token + Method;
|
||||
Response = OPI_Tools.PostMultipart(URL, Parameters, FileMapping, "mixed");
|
||||
|
||||
Return Response;
|
||||
@@ -1090,18 +1090,18 @@ EndFunction
|
||||
|
||||
Function ForumTopicManagement(Val Token
|
||||
, Val ChatID
|
||||
, Val Title = Undefined
|
||||
, Val IconID = Undefined
|
||||
, 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);
|
||||
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";
|
||||
@@ -1128,10 +1128,10 @@ Function ManageForumThreadState(Val Token, Val ChatID, Val Status, Val ThreadID
|
||||
Method = DetermineForumManagementMethod(Status, Forum);
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("chat_id" , ChatID, "String", Parameters);
|
||||
OPI_Tools.AddField("chat_id" , ChatID , "String", Parameters);
|
||||
OPI_Tools.AddField("message_thread_id", ThreadID, "String", Parameters);
|
||||
|
||||
URL = "api.telegram.org/bot" + Token + Method;
|
||||
URL = "api.telegram.org/bot" + Token + Method;
|
||||
Response = OPI_Tools.Get(URL, Parameters);
|
||||
|
||||
Return Response;
|
||||
@@ -1152,7 +1152,7 @@ Function ManageMainTopicVisibility(Val Token, Val ChatID, Val Hide)
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("chat_id", ChatID, "String", Parameters);
|
||||
|
||||
URL = "api.telegram.org/bot" + Token + Method;
|
||||
URL = "api.telegram.org/bot" + Token + Method;
|
||||
Response = OPI_Tools.Get(URL, Parameters);
|
||||
|
||||
Return Response;
|
||||
@@ -1161,16 +1161,16 @@ EndFunction
|
||||
|
||||
Function DetermineForumManagementMethod(Val Status, Val Forum)
|
||||
|
||||
Open = 1;
|
||||
Close = 2;
|
||||
Open = 1;
|
||||
Close = 2;
|
||||
Delete = 3;
|
||||
|
||||
If Status = Open Then
|
||||
Method = "/reopen" + Forum + "Topic";
|
||||
If Status = Open Then
|
||||
Method = "/reopen" + Forum + "Topic";
|
||||
ElsIf Status = Close Then
|
||||
Method = "/close" + Forum + "Topic";
|
||||
Method = "/close" + Forum + "Topic";
|
||||
ElsIf Status = Delete Then
|
||||
Method = "/deleteForumTopic";
|
||||
Method = "/deleteForumTopic";
|
||||
Else
|
||||
Raise "Incorrect forum management status";
|
||||
EndIf;
|
||||
@@ -1185,7 +1185,7 @@ Function CreateTallKeyboard(Val ButtonArray)
|
||||
|
||||
For Each Button In ButtonArray Do
|
||||
Buttons = New Array;
|
||||
Button = OPI_Tools.NumberToString(Button);
|
||||
Button = OPI_Tools.NumberToString(Button);
|
||||
Buttons.Add(New Structure("text,callback_data", Button, Button));
|
||||
Strings.Add(Buttons);
|
||||
EndDo;
|
||||
@@ -1212,7 +1212,7 @@ EndFunction
|
||||
|
||||
Function DetermineSendMethod(Val View)
|
||||
|
||||
If View = "photo" Then
|
||||
If View = "photo" Then
|
||||
Method = "/sendPhoto";
|
||||
ElsIf View = "video" Then
|
||||
Method = "/sendVideo";
|
||||
@@ -1235,14 +1235,14 @@ Function ConvertFileData(File, View, Counter)
|
||||
If TypeOf(File) = Type("String") And View = "document" Then
|
||||
|
||||
CurrentFile = New File(File);
|
||||
FileName = CurrentFile.Name;
|
||||
FileName = CurrentFile.Name;
|
||||
|
||||
EndIf;
|
||||
|
||||
If Not ValueIsFilled(FileName) Then
|
||||
FileName = View + String(Counter);
|
||||
|
||||
If View = "animation" Then
|
||||
If View = "animation" Then
|
||||
FileName = FileName + ".gif";
|
||||
EndIf;
|
||||
|
||||
@@ -1290,19 +1290,19 @@ Procedure ConvertFilesToMedia(FileMapping, Text, Media)
|
||||
|
||||
EndDo;
|
||||
|
||||
Media = OPI_Tools.JSONString(Media);
|
||||
Media = OPI_Tools.JSONString(Media);
|
||||
FileMapping = TempMap;
|
||||
|
||||
EndProcedure
|
||||
|
||||
Procedure AddChatIdentifier(Val ChatID, Parameters)
|
||||
|
||||
ChatID = OPI_Tools.NumberToString(ChatID);
|
||||
ChatID = OPI_Tools.NumberToString(ChatID);
|
||||
ChatArray = StrSplit(ChatID, "*", False);
|
||||
|
||||
If ChatArray.Count() > 1 Then
|
||||
|
||||
ChatID = ChatArray[0];
|
||||
ChatID = ChatArray[0];
|
||||
ThreadID = ChatArray[1];
|
||||
|
||||
Parameters.Insert("message_thread_id", ThreadID);
|
||||
|
@@ -48,23 +48,23 @@
|
||||
Function GetTestingSectionMapping() Export
|
||||
|
||||
StandardDependencies = "[Decode, Build]";
|
||||
GoogleDependencies = "Testing-GoogleWorkspace";
|
||||
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("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);
|
||||
Sections.Insert("Bitrix24" , StandardDependencies);
|
||||
Sections.Insert("GoogleDrive" , GoogleDependencies);
|
||||
Sections.Insert("GoogleSheets" , GoogleDependencies);
|
||||
Sections.Insert("Notion" , StandardDependencies);
|
||||
Sections.Insert("Slack" , StandardDependencies);
|
||||
Sections.Insert("Airtable" , StandardDependencies);
|
||||
Sections.Insert("Dropbox" , StandardDependencies);
|
||||
Sections.Insert("Bitrix24" , StandardDependencies);
|
||||
|
||||
Return Sections;
|
||||
|
||||
@@ -72,164 +72,164 @@ EndFunction
|
||||
|
||||
Function GetTestTable() Export
|
||||
|
||||
Telegram = "Telegram";
|
||||
Telegram = "Telegram";
|
||||
VKontakte = "VK";
|
||||
YDisk = "YandexDisk";
|
||||
Calendar = "GoogleCalendar";
|
||||
Twitter = "Twitter";
|
||||
Viber = "Viber";
|
||||
Drive = "GoogleDrive";
|
||||
VSpace = "GoogleWorkspace";
|
||||
Notion = "Notion";
|
||||
Slack = "Slack";
|
||||
Tables = "GoogleSheets";
|
||||
AirT = "Airtable";
|
||||
Dropbox = "Dropbox";
|
||||
Bitrix = "Bitrix24";
|
||||
YDisk = "YandexDisk";
|
||||
Calendar = "GoogleCalendar";
|
||||
Twitter = "Twitter";
|
||||
Viber = "Viber";
|
||||
Drive = "GoogleDrive";
|
||||
VSpace = "GoogleWorkspace";
|
||||
Notion = "Notion";
|
||||
Slack = "Slack";
|
||||
Tables = "GoogleSheets";
|
||||
AirT = "Airtable";
|
||||
Dropbox = "Dropbox";
|
||||
Bitrix = "Bitrix24";
|
||||
|
||||
TestTable = New ValueTable;
|
||||
TestTable.Columns.Add("Method");
|
||||
TestTable.Columns.Add("Synonym");
|
||||
TestTable.Columns.Add("Section");
|
||||
|
||||
NewTest(TestTable, "TelegramAPI_GetBotInfo" , "Get bot information" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_GetUpdates" , "Get updates" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_SetWebhook" , "Set Webhook" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_SendTextMessage" , "Send text message" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_SendImage" , "Send image" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_SendVideo" , "Send video" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_SendAudio" , "Send audio" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_SendDocument" , "Send document" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_SendGIF" , "Send GIF" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_SendMediaGroup" , "Send mediagroup" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_SendLocation" , "Send location" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_SendContact" , "Send contact" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_SendPoll" , "Send poll" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_ForwardMessage" , "Forward message" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_BanUnban" , "Ban/Unban" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_CreateInvitationLink" , "Create invitation link" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_PinUnpinMessage" , "Pin/Unpin message" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_GetMemberCount" , "Get participant count" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_GetForumAvatarsList", "Get forum avatars list", Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_GetBotInfo" , "Get bot information" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_GetUpdates" , "Get updates" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_SetWebhook" , "Set Webhook" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_SendTextMessage" , "Send text message" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_SendImage" , "Send image" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_SendVideo" , "Send video" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_SendAudio" , "Send audio" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_SendDocument" , "Send document" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_SendGIF" , "Send GIF" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_SendMediaGroup" , "Send mediagroup" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_SendLocation" , "Send location" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_SendContact" , "Send contact" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_SendPoll" , "Send poll" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_ForwardMessage" , "Forward message" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_BanUnban" , "Ban/Unban" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_CreateInvitationLink" , "Create invitation link" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_PinUnpinMessage" , "Pin/Unpin message" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_GetMemberCount" , "Get participant count" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_GetForumAvatarsList" , "Get forum avatars list" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_CreateDeleteForumTopic" , "Create/Delete forum topic" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_ChangeMainTopicName" , "Change main topic name" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_HideShowMainTopic" , "Hide/Show main topic" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_ChangeMainTopicName" , "Change main topic name" , Telegram);
|
||||
NewTest(TestTable, "TelegramAPI_HideShowMainTopic" , "Hide/Show main topic" , Telegram);
|
||||
|
||||
NewTest(TestTable, "VKAPI_CreateTokenLink" , "Create token retrieval link", VKontakte);
|
||||
NewTest(TestTable, "VKAPI_CreateDeletePost" , "Create/Delete post" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_CreateCompositePost" , "Create/Delete composite post" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_CreatePoll" , "Create poll" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_SaveDeleteImage" , "Add/Delete image" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_CreateStory" , "Create story" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_DiscussionMethods" , "Actions with discussions" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_LikeRepostComment" , "Like/Repost/Comment" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_GetStatistics" , "Get statistics" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_GetPostStatistics" , "Get post statistics" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_CreateAdCampaign" , "Create advertising campaign" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_SendMessage" , "Send message" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_GetProductCategories" , "Get product categories" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_CreateProductSelection" , "Create product and selection" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_CreateTokenLink" , "Create token retrieval link" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_CreateDeletePost" , "Create/Delete post" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_CreateCompositePost" , "Create/Delete composite post" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_CreatePoll" , "Create poll" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_SaveDeleteImage" , "Add/Delete image" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_CreateStory" , "Create story" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_DiscussionMethods" , "Actions with discussions" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_LikeRepostComment" , "Like/Repost/Comment" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_GetStatistics" , "Get statistics" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_GetPostStatistics" , "Get post statistics" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_CreateAdCampaign" , "Create advertising campaign" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_SendMessage" , "Send message" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_GetProductCategories" , "Get product categories" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_CreateProductSelection" , "Create product and selection" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_CreateProductWithProperties" , "Create product with properties" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_GetProductList" , "Get product list" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_GetSelectionList" , "Get selection list" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_GetPropertyList" , "Get property list" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_GetOrderList" , "Get order list" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_UploadVideo" , "Upload video" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_GetProductList" , "Get product list" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_GetSelectionList" , "Get selection list" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_GetPropertyList" , "Get property list" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_GetOrderList" , "Get order list" , VKontakte);
|
||||
NewTest(TestTable, "VKAPI_UploadVideo" , "Upload video" , VKontakte);
|
||||
|
||||
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, "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, "GV_GetToken" , "Get token" , VSpace);
|
||||
NewTest(TestTable, "GV_UpdateToken" , "Refresh token" , VSpace);
|
||||
|
||||
NewTest(TestTable, "GC_GetCalendarList" , "Get list of calendars" , Calendar);
|
||||
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, "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, "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_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, "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_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" , "Send location" , Viber);
|
||||
NewTest(TestTable, "Viber_SendLink" , "Send link" , 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" , "Send location" , Viber);
|
||||
NewTest(TestTable, "Viber_SendLink" , "Send link" , 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_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, "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_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_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, "DropboxAPI_GetUpdateToken" , "Get/Update token" , Dropbox);
|
||||
NewTest(TestTable, "DropboxAPI_UploadFile" , "Upload file" , Dropbox);
|
||||
NewTest(TestTable, "DropboxAPI_UploadFileByURL" , "Upload file by URL" , Dropbox);
|
||||
NewTest(TestTable, "DropboxAPI_CreateFolder" , "Create folder" , Dropbox);
|
||||
NewTest(TestTable, "DropboxAPI_CreateDeleteTag" , "Create/Delete tag" , Dropbox);
|
||||
NewTest(TestTable, "DropboxAPI_GetAccount" , "Get account data" , Dropbox);
|
||||
NewTest(TestTable, "DropboxAPI_AccessManagement" , "Access management" , Dropbox);
|
||||
NewTest(TestTable, "DropboxAPI_GetUpdateToken" , "Get/Update token" , Dropbox);
|
||||
NewTest(TestTable, "DropboxAPI_UploadFile" , "Upload file" , Dropbox);
|
||||
NewTest(TestTable, "DropboxAPI_UploadFileByURL" , "Upload file by URL" , Dropbox);
|
||||
NewTest(TestTable, "DropboxAPI_CreateFolder" , "Create folder" , Dropbox);
|
||||
NewTest(TestTable, "DropboxAPI_CreateDeleteTag" , "Create/Delete tag" , Dropbox);
|
||||
NewTest(TestTable, "DropboxAPI_GetAccount" , "Get account data" , Dropbox);
|
||||
NewTest(TestTable, "DropboxAPI_AccessManagement" , "Access management" , Dropbox);
|
||||
NewTest(TestTable, "DropboxAPI_GetFolderFileList" , "Get list of folder files" , Dropbox);
|
||||
|
||||
NewTest(TestTable, "B24_TokenManagment" , "Token management" , Bitrix);
|
||||
NewTest(TestTable, "B24_ServerTime" , "Server time" , Bitrix);
|
||||
NewTest(TestTable, "B24_PostsManagment" , "Posts managment" , Bitrix);
|
||||
NewTest(TestTable, "B24_TaskManagment" , "Tasks managment" , Bitrix);
|
||||
NewTest(TestTable, "B24_CommentsManagment" , "Comments managment" , Bitrix);
|
||||
NewTest(TestTable, "B24_WorkingWithDrive" , "Working with drive" , Bitrix);
|
||||
NewTest(TestTable, "B24_Kanban" , "Kanban" , Bitrix);
|
||||
NewTest(TestTable, "B24_Timekeeping" , "Timekeeping" , Bitrix);
|
||||
NewTest(TestTable, "B24_ChatManagment" , "Chats works" , Bitrix);
|
||||
NewTest(TestTable, "B24_TokenManagment" , "Token management" , Bitrix);
|
||||
NewTest(TestTable, "B24_ServerTime" , "Server time" , Bitrix);
|
||||
NewTest(TestTable, "B24_PostsManagment" , "Posts managment" , Bitrix);
|
||||
NewTest(TestTable, "B24_TaskManagment" , "Tasks managment" , Bitrix);
|
||||
NewTest(TestTable, "B24_CommentsManagment" , "Comments managment" , Bitrix);
|
||||
NewTest(TestTable, "B24_WorkingWithDrive" , "Working with drive" , Bitrix);
|
||||
NewTest(TestTable, "B24_Kanban" , "Kanban" , Bitrix);
|
||||
NewTest(TestTable, "B24_Timekeeping" , "Timekeeping" , Bitrix);
|
||||
NewTest(TestTable, "B24_ChatManagment" , "Chats works" , Bitrix);
|
||||
NewTest(TestTable, "B24_NotificationsManagment" , "Notifications managment" , Bitrix);
|
||||
|
||||
Return TestTable;
|
||||
@@ -240,7 +240,7 @@ Function ExpectsThat(Value) Export
|
||||
|
||||
Try
|
||||
|
||||
Module = GetCommonModule("ЮТест");
|
||||
Module = GetCommonModule("ЮТест");
|
||||
Ожидаем = TypeOf(Module) = Type("CommonModule");
|
||||
Return Module.ОжидаетЧто(Value);
|
||||
|
||||
@@ -252,15 +252,15 @@ EndFunction
|
||||
|
||||
Function FormYAXTests() Export
|
||||
|
||||
Module = GetCommonModule("ЮТТесты");
|
||||
Sections = GetTestingSectionMapping();
|
||||
Module = GetCommonModule("ЮТТесты");
|
||||
Sections = GetTestingSectionMapping();
|
||||
TestTable = GetTestTable();
|
||||
|
||||
For Each Section In Sections Do
|
||||
|
||||
CurrentSection = Section.Key;
|
||||
Filter = New Structure("Section", CurrentSection);
|
||||
SectionTests = TestTable.FindRows(Filter);
|
||||
Filter = New Structure("Section", CurrentSection);
|
||||
SectionTests = TestTable.FindRows(Filter);
|
||||
|
||||
Set = Module.ДобавитьТестовыйНабор(CurrentSection);
|
||||
|
||||
@@ -276,7 +276,7 @@ EndFunction
|
||||
|
||||
Function FormAssertsTests() Export
|
||||
|
||||
TestTable = GetTestTable();
|
||||
TestTable = GetTestTable();
|
||||
ArrayOfTests = New Array;
|
||||
|
||||
For Each Test In TestTable Do
|
||||
@@ -296,10 +296,10 @@ EndFunction
|
||||
|
||||
Function GetBinary(Parameter) Export
|
||||
|
||||
Path = DataFilePath();
|
||||
Path = DataFilePath();
|
||||
LocalParameter = Parameter + "Local";
|
||||
MainValue = GetValueFromFile(Parameter , Path);
|
||||
LocalValue = GetValueFromFile(LocalParameter, Path);
|
||||
MainValue = GetValueFromFile(Parameter , Path);
|
||||
LocalValue = GetValueFromFile(LocalParameter, Path);
|
||||
|
||||
LocalFile = New File(LocalValue);
|
||||
|
||||
@@ -310,7 +310,7 @@ Function GetBinary(Parameter) Export
|
||||
EndIf;
|
||||
|
||||
If TypeOf(Value) = Type("String") Then
|
||||
Value = GetFilePath(Value, LocalParameter);
|
||||
Value = GetFilePath(Value, LocalParameter);
|
||||
EndIf;
|
||||
|
||||
Return Value;
|
||||
@@ -322,9 +322,9 @@ Function GetFilePath(Val Path, LocalParameter, Val SaveLocally = True) Export
|
||||
If StrFind(Path, "http") > 0
|
||||
Or StrFind(Path, "www") > 0 Then
|
||||
|
||||
TFN = GetTempFileName();
|
||||
TFN = GetTempFileName();
|
||||
FileCopy(Path, TFN);
|
||||
Path = TFN;
|
||||
Path = TFN;
|
||||
Binary = New BinaryData(Path);
|
||||
|
||||
If SaveLocally Then
|
||||
@@ -402,7 +402,7 @@ EndFunction
|
||||
|
||||
Function DataFilePath()
|
||||
|
||||
Path = "";
|
||||
Path = "";
|
||||
PossiblePaths = New Array;
|
||||
PossiblePaths.Add("./data.json");
|
||||
PossiblePaths.Add("C:\GDrive\Мой Диск\data.json");
|
||||
@@ -431,8 +431,8 @@ EndFunction
|
||||
|
||||
Procedure NewTest(ValueTable, Val Method, Val Synonym, Val Section)
|
||||
|
||||
NewTest = ValueTable.Add();
|
||||
NewTest.Method = Method;
|
||||
NewTest = ValueTable.Add();
|
||||
NewTest.Method = Method;
|
||||
NewTest.Synonym = Synonym;
|
||||
NewTest.Section = Section;
|
||||
|
||||
@@ -443,7 +443,7 @@ Procedure WriteParameterToFile(Val Parameter, Val Value, Val Path)
|
||||
Values = OPI_Tools.ReadJSONFile(Path);
|
||||
Values.Insert(Parameter, Value);
|
||||
|
||||
Record = New JSONWriter;
|
||||
Record = New JSONWriter;
|
||||
JSONWriterSettings = New JSONWriterSettings(JSONLineBreak.Auto, Chars.Tab);
|
||||
Record.OpenFile(Path, , , JSONWriterSettings);
|
||||
WriteJSON(Record, Values);
|
||||
@@ -455,7 +455,7 @@ Procedure WriteLogFile(Val Data, Val Method, Val Library)
|
||||
|
||||
Try
|
||||
|
||||
LogPath = "./docs/ru/results";
|
||||
LogPath = "./docs/ru/results";
|
||||
LibraryLogPath = LogPath + "/" + Library;
|
||||
|
||||
LogDirectory = New File(LogPath);
|
||||
@@ -471,7 +471,7 @@ Procedure WriteLogFile(Val Data, Val Method, Val Library)
|
||||
EndIf;
|
||||
|
||||
FilePath = LibraryLogPath + "/" + Method + ".log";
|
||||
LogFile = New File(FilePath);
|
||||
LogFile = New File(FilePath);
|
||||
|
||||
If Not LogFile.Exists() Then
|
||||
LogDocument = New TextDocument;
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -56,33 +56,33 @@ EndFunction
|
||||
#Region RequestsWithBody
|
||||
|
||||
Function Post(Val URL
|
||||
, Val Parameters = ""
|
||||
, Val Parameters = ""
|
||||
, Val AdditionalHeaders = ""
|
||||
, Val JSON = True
|
||||
, Val FullResponse = False
|
||||
, Val ResponseFile = Undefined) Export
|
||||
, Val FullResponse = False
|
||||
, Val ResponseFile = Undefined) Export
|
||||
|
||||
Return ExecuteRequestWithBody(URL, "POST", Parameters, AdditionalHeaders, JSON, FullResponse, ResponseFile);
|
||||
|
||||
EndFunction
|
||||
|
||||
Function Patch(Val URL
|
||||
, Val Parameters = ""
|
||||
, Val Parameters = ""
|
||||
, Val AdditionalHeaders = ""
|
||||
, Val JSON = True
|
||||
, Val FullResponse = False
|
||||
, Val ResponseFile = Undefined) Export
|
||||
, Val FullResponse = False
|
||||
, Val ResponseFile = Undefined) Export
|
||||
|
||||
Return ExecuteRequestWithBody(URL, "PATCH", Parameters, AdditionalHeaders, JSON, FullResponse, ResponseFile);
|
||||
|
||||
EndFunction
|
||||
|
||||
Function Put(Val URL
|
||||
, Val Parameters = ""
|
||||
, Val Parameters = ""
|
||||
, Val AdditionalHeaders = ""
|
||||
, Val JSON = True
|
||||
, Val FullResponse = False
|
||||
, Val ResponseFile = Undefined) Export
|
||||
, Val FullResponse = False
|
||||
, Val ResponseFile = Undefined) Export
|
||||
|
||||
Return ExecuteRequestWithBody(URL, "PUT", Parameters, AdditionalHeaders, JSON, FullResponse, ResponseFile);
|
||||
|
||||
@@ -92,7 +92,7 @@ Function PostBinary(Val URL
|
||||
, Val Body
|
||||
, Val AdditionalHeaders
|
||||
, Val FullResponse = False
|
||||
, Val DataType = "application/octet-stream") Export
|
||||
, Val DataType = "application/octet-stream") Export
|
||||
|
||||
Return ExecuteRequestWithBinaryData(URL, "POST", Body, AdditionalHeaders, FullResponse, DataType);
|
||||
|
||||
@@ -103,22 +103,22 @@ EndFunction
|
||||
#Region MultipartRequests
|
||||
|
||||
Function PostMultipart(Val URL
|
||||
, Val Parameters = ""
|
||||
, Val Files = ""
|
||||
, Val ContentType = "image/jpeg"
|
||||
, Val Parameters = ""
|
||||
, Val Files = ""
|
||||
, Val ContentType = "image/jpeg"
|
||||
, Val AdditionalHeaders = ""
|
||||
, Val ResponseFile = Undefined) Export
|
||||
, 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 Parameters = ""
|
||||
, Val Files = ""
|
||||
, Val ContentType = "image/jpeg"
|
||||
, Val AdditionalHeaders = ""
|
||||
, Val ResponseFile = Undefined) Export
|
||||
, Val ResponseFile = Undefined) Export
|
||||
|
||||
Return ExecuteMultipartRequest(URL, "PUT", Parameters, Files, ContentType, AdditionalHeaders, ResponseFile);
|
||||
|
||||
@@ -126,9 +126,9 @@ EndFunction
|
||||
|
||||
Function PostMultipartRelated(Val URL
|
||||
, Val JSON = ""
|
||||
, Val Files = ""
|
||||
, Val Files = ""
|
||||
, Val AdditionalHeaders = ""
|
||||
, Val ResponseFile = Undefined) Export
|
||||
, Val ResponseFile = Undefined) Export
|
||||
|
||||
Return ExecuteMultipartRelatedRequest(URL, "POST", JSON, Files, AdditionalHeaders, ResponseFile);
|
||||
|
||||
@@ -136,9 +136,9 @@ EndFunction
|
||||
|
||||
Function PatchMultipartRelated(Val URL
|
||||
, Val JSON = ""
|
||||
, Val Files = ""
|
||||
, Val Files = ""
|
||||
, Val AdditionalHeaders = ""
|
||||
, Val ResponseFile = Undefined) Export
|
||||
, Val ResponseFile = Undefined) Export
|
||||
|
||||
Return ExecuteMultipartRelatedRequest(URL, "PATCH", JSON, Files, AdditionalHeaders, ResponseFile);
|
||||
|
||||
@@ -157,13 +157,13 @@ Procedure ProcessResponse(Response, Val FullResponse = False) Export
|
||||
BodyFile = Response.GetBodyFileName();
|
||||
|
||||
If Not BodyFile = Undefined Then
|
||||
Response = BodyFile;
|
||||
Response = BodyFile;
|
||||
Return;
|
||||
EndIf;
|
||||
|
||||
GZip = "gzip";
|
||||
NeedsUnpacking =
|
||||
Response.Headers.Get("Content-Encoding") = GZip
|
||||
Response.Headers.Get("Content-Encoding") = GZip
|
||||
Or Response.Headers.Get("content-encoding") = GZip;
|
||||
|
||||
If NeedsUnpacking Then
|
||||
@@ -188,8 +188,8 @@ Function CreateRequest(Val Address, Val AdditionalHeaders = "", Val DataType = "
|
||||
|
||||
Headers = New Map;
|
||||
Headers.Insert("Accept-Encoding", "gzip");
|
||||
Headers.Insert("Accept" , "*/*");
|
||||
Headers.Insert("Connection" , "keep-alive");
|
||||
Headers.Insert("Accept" , "*/*");
|
||||
Headers.Insert("Connection" , "keep-alive");
|
||||
Headers.Insert("Accept-Charset" , "utf-8");
|
||||
|
||||
If ValueIsFilled(DataType) Then
|
||||
@@ -241,7 +241,7 @@ Function RequestParametersToString(Val Parameters) Export
|
||||
|
||||
ParameterString = ParameterString
|
||||
+ Parameter.Key
|
||||
+ "="
|
||||
+ " ="
|
||||
+ ParameterValue
|
||||
+ "&";
|
||||
EndDo;
|
||||
@@ -255,20 +255,20 @@ EndFunction
|
||||
Function SplitURL(Val URL) Export
|
||||
|
||||
URL = StrReplace(URL, "https://", "");
|
||||
URL = StrReplace(URL, "http://", "");
|
||||
URL = StrReplace(URL, ":443", "");
|
||||
URL = StrReplace(URL, "http://" , "");
|
||||
URL = StrReplace(URL, ":443" , "");
|
||||
|
||||
Address = Right(URL, StrLen(URL) - StrFind(URL, "/", SearchDirection.FromBegin) + 1);
|
||||
Server = Left(URL, StrFind(URL, "/", SearchDirection.FromBegin) - 1);
|
||||
Server = Left(URL, StrFind(URL, "/", SearchDirection.FromBegin) - 1);
|
||||
|
||||
Try
|
||||
SSL = New OpenSSLSecureConnection;
|
||||
SSL = New OpenSSLSecureConnection;
|
||||
Except
|
||||
Server = "https://" + Server;
|
||||
EndTry;
|
||||
|
||||
ReturnStructure = New Structure;
|
||||
ReturnStructure.Insert("Server", Server);
|
||||
ReturnStructure.Insert("Server" , Server);
|
||||
ReturnStructure.Insert("Address" , Address);
|
||||
|
||||
Return ReturnStructure;
|
||||
@@ -326,7 +326,7 @@ Function ReadJSONFile(Val Path) Export
|
||||
|
||||
JSONReader = New JSONReader;
|
||||
JSONReader.OpenFile(Path);
|
||||
Values = ReadJSON(JSONReader);
|
||||
Values = ReadJSON(JSONReader);
|
||||
|
||||
JSONReader.Close();
|
||||
|
||||
@@ -336,8 +336,8 @@ EndFunction
|
||||
|
||||
Function RequestParametersToMap(Val ParameterString) Export
|
||||
|
||||
ReturnMapping = New Map;
|
||||
NumberOfParts = 2;
|
||||
ReturnMapping = New Map;
|
||||
NumberOfParts = 2;
|
||||
ParameterArray = StrSplit(ParameterString, "&", False);
|
||||
|
||||
For Each Parameter In ParameterArray Do
|
||||
@@ -360,13 +360,13 @@ EndFunction
|
||||
|
||||
Function UNIXTime(Val Date) Export
|
||||
|
||||
OTD = New TypeDescription("Date");
|
||||
OTD = New TypeDescription("Date");
|
||||
Date = OTD.AdjustValue(Date);
|
||||
|
||||
UNIX = Format(Date - Date(1970, 1, 1, 1, 0, 0), "HC=10; HDC=0; HG=0");
|
||||
UNIX = StrReplace(UNIX, ",", "");
|
||||
UNIX = StrReplace(UNIX, "," , "");
|
||||
UNIX = StrReplace(UNIX, Chars.NBSp, "");
|
||||
UNIX = StrReplace(UNIX, " ", "");
|
||||
UNIX = StrReplace(UNIX, " " , "");
|
||||
UNIX = Left(UNIX, 10);
|
||||
|
||||
Return UNIX;
|
||||
@@ -375,13 +375,13 @@ EndFunction
|
||||
|
||||
Function ProgressInformation(Val Current, Val Total, Val Unit, Val Divider = 1) Export
|
||||
|
||||
Whole = 100;
|
||||
Whole = 100;
|
||||
Current = Round(Current / Divider, 2);
|
||||
Total = Round(Total / Divider, 2);
|
||||
Total = Round(Total / Divider, 2);
|
||||
Percent = Int(Current / Total * Whole);
|
||||
|
||||
StrCurrent = NumberToString(Current);
|
||||
StrTotal = NumberToString(Total);
|
||||
StrCurrent = NumberToString(Current);
|
||||
StrTotal = NumberToString(Total);
|
||||
StrPercentage = NumberToString(Percent);
|
||||
|
||||
Information = StrCurrent + "/" + StrTotal + " " + Unit + " ( " + StrPercentage + "% )";
|
||||
@@ -428,7 +428,7 @@ Procedure ValueToArray(Value) Export
|
||||
|
||||
Value_ = New Array;
|
||||
Value_.Add(Value);
|
||||
Value = Value_;
|
||||
Value = Value_;
|
||||
|
||||
EndProcedure
|
||||
|
||||
@@ -462,7 +462,7 @@ EndProcedure
|
||||
|
||||
Procedure RemoveEmptyCollectionFields(Collection) Export
|
||||
|
||||
CollectionType = TypeOf(Collection);
|
||||
CollectionType = TypeOf(Collection);
|
||||
OutputCollection = New(CollectionType);
|
||||
|
||||
If CollectionType = Type("Map") Or CollectionType = Type("Structure") Then
|
||||
@@ -502,13 +502,13 @@ Procedure AddField(Val Name, Val Value, Val Type, Collection) Export
|
||||
Return;
|
||||
EndIf;
|
||||
|
||||
If Type = "Date" Then
|
||||
If Type = "Date" Then
|
||||
OPI_TypeConversion.GetDate(Value);
|
||||
Value = UNIXTime(Value);
|
||||
|
||||
ElsIf Type = "DateISO" Then
|
||||
OPI_TypeConversion.GetDate(Value);
|
||||
Value = XMLString(Value);
|
||||
Value = XMLString(Value);
|
||||
|
||||
ElsIf Type = "Collection" Then
|
||||
OPI_TypeConversion.GetCollection(Value);
|
||||
@@ -545,22 +545,22 @@ EndProcedure
|
||||
|
||||
Function ExecuteRequestWithBody(Val URL
|
||||
, Val View
|
||||
, Val Parameters = ""
|
||||
, Val Parameters = ""
|
||||
, Val AdditionalHeaders = ""
|
||||
, Val JSON = True
|
||||
, Val FullResponse = False
|
||||
, Val ResponseFile = Undefined)
|
||||
, Val FullResponse = False
|
||||
, Val ResponseFile = Undefined)
|
||||
|
||||
If Not ValueIsFilled(Parameters) Then
|
||||
Parameters = New Structure;
|
||||
EndIf;
|
||||
|
||||
DataType = ?(JSON, "application/json; charset=utf-8", "application/x-www-form-urlencoded; charset=utf-8");
|
||||
DataType = ?(JSON, "application/json; charset =utf-8", "application/x-www-form-urlencoded; charset =utf-8");
|
||||
URLStructure = SplitURL(URL);
|
||||
Server = URLStructure["Server"];
|
||||
Address = URLStructure["Address"];
|
||||
Server = URLStructure["Server"];
|
||||
Address = URLStructure["Address"];
|
||||
|
||||
Request = CreateRequest(Address, AdditionalHeaders, DataType);
|
||||
Request = CreateRequest(Address, AdditionalHeaders, DataType);
|
||||
Connection = CreateConnection(Server);
|
||||
|
||||
SetRequestBody(Request, Parameters, JSON);
|
||||
@@ -595,10 +595,10 @@ Function ExecuteRequestWithBinaryData(Val URL
|
||||
, Val DataType)
|
||||
|
||||
URLStructure = SplitURL(URL);
|
||||
Server = URLStructure["Server"];
|
||||
Address = URLStructure["Address"];
|
||||
Server = URLStructure["Server"];
|
||||
Address = URLStructure["Address"];
|
||||
|
||||
Request = CreateRequest(Address, AdditionalHeaders, DataType);
|
||||
Request = CreateRequest(Address, AdditionalHeaders, DataType);
|
||||
Connection = CreateConnection(Server);
|
||||
|
||||
If Not Data.Size() = 0 Then
|
||||
@@ -624,19 +624,19 @@ EndFunction
|
||||
|
||||
Function ExecuteRequestWithoutBody(Val URL
|
||||
, Val View
|
||||
, Val Parameters = ""
|
||||
, Val Parameters = ""
|
||||
, Val AdditionalHeaders = ""
|
||||
, Val ResponseFile = Undefined)
|
||||
, Val ResponseFile = Undefined)
|
||||
|
||||
If Not ValueIsFilled(Parameters) Then
|
||||
Parameters = New Structure;
|
||||
EndIf;
|
||||
|
||||
URLStructure = SplitURL(URL);
|
||||
Server = URLStructure["Server"];
|
||||
Address = URLStructure["Address"] + RequestParametersToString(Parameters);
|
||||
Server = URLStructure["Server"];
|
||||
Address = URLStructure["Address"] + RequestParametersToString(Parameters);
|
||||
|
||||
Request = CreateRequest(Address, AdditionalHeaders);
|
||||
Request = CreateRequest(Address, AdditionalHeaders);
|
||||
Connection = CreateConnection(Server);
|
||||
|
||||
If ValueIsFilled(ResponseFile) Then
|
||||
@@ -657,11 +657,11 @@ EndFunction
|
||||
|
||||
Function ExecuteMultipartRequest(Val URL
|
||||
, Val View
|
||||
, Val Parameters = ""
|
||||
, Val Files = ""
|
||||
, Val ContentType = "image/jpeg"
|
||||
, Val Parameters = ""
|
||||
, Val Files = ""
|
||||
, Val ContentType = "image/jpeg"
|
||||
, Val AdditionalHeaders = ""
|
||||
, Val ResponseFile = Undefined)
|
||||
, Val ResponseFile = Undefined)
|
||||
|
||||
If Not ValueIsFilled(Parameters) Then
|
||||
Parameters = New Structure;
|
||||
@@ -671,20 +671,20 @@ Function ExecuteMultipartRequest(Val URL
|
||||
Files = New Map;
|
||||
EndIf;
|
||||
|
||||
Redirection = 300;
|
||||
Error = 400;
|
||||
Boundary = StrReplace(String(New UUID), "-", "");
|
||||
Redirection = 300;
|
||||
Error = 400;
|
||||
Boundary = StrReplace(String(New UUID), "-", "");
|
||||
LineSeparator = Chars.CR + Chars.LF;
|
||||
DataType = "multipart/form-data; boundary=" + Boundary;
|
||||
URLStructure = SplitURL(URL);
|
||||
Server = URLStructure["Server"];
|
||||
Address = URLStructure["Address"];
|
||||
DataType = "multipart/form-data; boundary =" + Boundary;
|
||||
URLStructure = SplitURL(URL);
|
||||
Server = URLStructure["Server"];
|
||||
Address = URLStructure["Address"];
|
||||
|
||||
Request = CreateRequest(Address, AdditionalHeaders, DataType);
|
||||
Request = CreateRequest(Address, AdditionalHeaders, DataType);
|
||||
Connection = CreateConnection(Server);
|
||||
|
||||
RequestBody = GetTempFileName();
|
||||
TextRecord = New DataWriter(RequestBody
|
||||
TextRecord = New DataWriter(RequestBody
|
||||
, TextEncoding.UTF8
|
||||
, ByteOrder.LittleEndian
|
||||
, ""
|
||||
@@ -720,7 +720,7 @@ Function ExecuteMultipartRequest(Val URL
|
||||
ProcessResponse(Response);
|
||||
EndIf;
|
||||
|
||||
Request = Undefined;
|
||||
Request = Undefined;
|
||||
TextRecord = Undefined;
|
||||
|
||||
DeleteFiles(RequestBody);
|
||||
@@ -731,24 +731,24 @@ EndFunction
|
||||
Function ExecuteMultipartRelatedRequest(Val URL
|
||||
, Val View
|
||||
, Val JSON = ""
|
||||
, Val Files = ""
|
||||
, Val Files = ""
|
||||
, Val AdditionalHeaders = ""
|
||||
, Val ResponseFile = Undefined)
|
||||
, Val ResponseFile = Undefined)
|
||||
|
||||
Redirection = 300;
|
||||
Error = 400;
|
||||
Boundary = StrReplace(String(New UUID), "-", "");
|
||||
Redirection = 300;
|
||||
Error = 400;
|
||||
Boundary = StrReplace(String(New UUID), "-", "");
|
||||
LineSeparator = Chars.CR + Chars.LF;
|
||||
DataType = "multipart/related; boundary=" + Boundary;
|
||||
URLStructure = SplitURL(URL);
|
||||
Server = URLStructure["Server"];
|
||||
Address = URLStructure["Address"];
|
||||
DataType = "multipart/related; boundary =" + Boundary;
|
||||
URLStructure = SplitURL(URL);
|
||||
Server = URLStructure["Server"];
|
||||
Address = URLStructure["Address"];
|
||||
|
||||
Request = CreateRequest(Address, AdditionalHeaders, DataType);
|
||||
Request = CreateRequest(Address, AdditionalHeaders, DataType);
|
||||
Connection = CreateConnection(Server);
|
||||
|
||||
RequestBody = GetTempFileName();
|
||||
TextRecord = New DataWriter(RequestBody
|
||||
TextRecord = New DataWriter(RequestBody
|
||||
, TextEncoding.UTF8
|
||||
, ByteOrder.LittleEndian
|
||||
, ""
|
||||
@@ -785,7 +785,7 @@ Function ExecuteMultipartRelatedRequest(Val URL
|
||||
ProcessResponse(Response);
|
||||
EndIf;
|
||||
|
||||
Request = Undefined;
|
||||
Request = Undefined;
|
||||
TextRecord = Undefined;
|
||||
|
||||
DeleteFiles(RequestBody);
|
||||
@@ -796,7 +796,7 @@ EndFunction
|
||||
Function ThisIsRedirection(Val Response)
|
||||
|
||||
Redirection = 300;
|
||||
Error = 400;
|
||||
Error = 400;
|
||||
|
||||
ThisIsRedirection = Response.StatusCode >= Redirection
|
||||
And Response.StatusCode < Error
|
||||
@@ -809,12 +809,12 @@ EndFunction
|
||||
Function ConvertParameterToString(Val Value)
|
||||
|
||||
If TypeOf(Value) = Type("Array") Then
|
||||
Value = StrConcat(Value, ",");
|
||||
Value = EncodeString(Value, StringEncodingMethod.URLInURLEncoding);
|
||||
Value = "[" + Value + "]";
|
||||
Value = StrConcat(Value, ",");
|
||||
Value = EncodeString(Value, StringEncodingMethod.URLInURLEncoding);
|
||||
Value = "[" + Value + "]";
|
||||
Else
|
||||
Value = NumberToString(Value);
|
||||
Value = EncodeString(Value, StringEncodingMethod.URLInURLEncoding);
|
||||
Value = NumberToString(Value);
|
||||
Value = EncodeString(Value, StringEncodingMethod.URLInURLEncoding);
|
||||
EndIf;
|
||||
|
||||
Return Value;
|
||||
@@ -824,20 +824,20 @@ EndFunction
|
||||
Function SplitFileKey(Val FileData, Val ContentType)
|
||||
|
||||
DotReplacement = "___";
|
||||
FileName = StrReplace(FileData, DotReplacement, ".");
|
||||
NameParts = StrSplit(FileName, "|", False);
|
||||
NeedParts = 2;
|
||||
FileName = StrReplace(FileData, DotReplacement, ".");
|
||||
NameParts = StrSplit(FileName, "|", False);
|
||||
NeedParts = 2;
|
||||
|
||||
If NameParts.Count() = NeedParts Then
|
||||
FieldName = NameParts[0];
|
||||
FileName = NameParts[1];
|
||||
FieldName = NameParts[0];
|
||||
FileName = NameParts[1];
|
||||
Else
|
||||
|
||||
If ContentType = "image/jpeg" Then
|
||||
FieldName = "photo";
|
||||
FieldName = "photo";
|
||||
Else
|
||||
FieldName = Left(FileName, StrFind(FileName, ".") - 1);
|
||||
FieldName = ?(ValueIsFilled(FieldName), FieldName, StrReplace(FileData,
|
||||
FieldName = Left(FileName, StrFind(FileName, ".") - 1);
|
||||
FieldName = ?(ValueIsFilled(FieldName), FieldName, StrReplace(FileData,
|
||||
DotReplacement, "."));
|
||||
EndIf;
|
||||
|
||||
@@ -856,12 +856,12 @@ Procedure SetRequestBody(Request, Val Parameters, Val JSON)
|
||||
Or TypeOf(Parameters) = Type("Array");
|
||||
|
||||
If JSON Then
|
||||
Data = JSONString(Parameters);
|
||||
Data = JSONString(Parameters);
|
||||
ElsIf Not Collection Then
|
||||
Data = Parameters;
|
||||
Data = Parameters;
|
||||
Else
|
||||
ParameterString = RequestParametersToString(Parameters);
|
||||
Data = Right(ParameterString, StrLen(ParameterString) - 1);
|
||||
Data = Right(ParameterString, StrLen(ParameterString) - 1);
|
||||
EndIf;
|
||||
|
||||
If TypeOf(Data) = Type("String") Then
|
||||
@@ -879,7 +879,7 @@ Procedure WriteMultipartParameters(TextRecord, Val Boundary, Val Parameters)
|
||||
|
||||
For Each Parameter In Parameters Do
|
||||
|
||||
If Parameter.Value = Undefined
|
||||
If Parameter.Value = Undefined
|
||||
Or Parameter.Value = NULL Then
|
||||
Continue;
|
||||
EndIf;
|
||||
@@ -889,7 +889,7 @@ Procedure WriteMultipartParameters(TextRecord, Val Boundary, Val Parameters)
|
||||
TextRecord.WriteLine(LineSeparator);
|
||||
TextRecord.WriteLine(LineSeparator);
|
||||
|
||||
If TypeOf(Parameter.Value) = Type("String")
|
||||
If TypeOf(Parameter.Value) = Type("String")
|
||||
Or TypeOf(Parameter.Value) = Type("Number") Then
|
||||
|
||||
ValueAsString = NumberToString(Parameter.Value);
|
||||
@@ -913,7 +913,7 @@ EndProcedure
|
||||
|
||||
Procedure WriteMultipartFiles(TextRecord, Val Boundary, Val ContentType, Val Files)
|
||||
|
||||
ContentType = TrimAll(ContentType);
|
||||
ContentType = TrimAll(ContentType);
|
||||
LineSeparator = Chars.CR + Chars.LF;
|
||||
|
||||
For Each File In Files Do
|
||||
@@ -921,7 +921,7 @@ Procedure WriteMultipartFiles(TextRecord, Val Boundary, Val ContentType, Val Fil
|
||||
DataStructure = SplitFileKey(File.Key, ContentType);
|
||||
|
||||
FieldName = DataStructure["FieldName"];
|
||||
FileName = DataStructure["FileName"];
|
||||
FileName = DataStructure["FileName"];
|
||||
|
||||
TextRecord.WriteLine("--" + boundary + LineSeparator);
|
||||
TextRecord.WriteLine("Content-Disposition: form-data; name="""
|
||||
@@ -971,16 +971,16 @@ EndProcedure
|
||||
|
||||
Procedure WriteBinaryData(DataWriter, Val BinaryData)
|
||||
|
||||
ChunkSize = 268435456;
|
||||
BytesRead = 0;
|
||||
ChunkSize = 268435456;
|
||||
BytesRead = 0;
|
||||
CurrentPosition = 0;
|
||||
TotalSize = BinaryData.Size();
|
||||
TotalSize = BinaryData.Size();
|
||||
|
||||
WHile BytesRead < TotalSize Do
|
||||
|
||||
DataReader = New DataReader(BinaryData);
|
||||
BytesRead = DataReader.Skip(CurrentPosition);
|
||||
Result = DataReader.Read(ChunkSize);
|
||||
DataReader = New DataReader(BinaryData);
|
||||
BytesRead = DataReader.Skip(CurrentPosition);
|
||||
Result = DataReader.Read(ChunkSize);
|
||||
CurrentData = Result.GetBinaryData();
|
||||
CurrentSize = CurrentData.Size();
|
||||
|
||||
@@ -1094,15 +1094,15 @@ EndFunction
|
||||
|
||||
Function ReadGZip(CompressedData) Export
|
||||
|
||||
GZipPrefixSize = 10;
|
||||
GZipPrefixSize = 10;
|
||||
GZipPostfixSize = 8;
|
||||
|
||||
SizeDD = ZipSizeDD();
|
||||
SizeDD = ZipSizeDD();
|
||||
SizeCDH = ZipSizeCDH();
|
||||
SizeESD = ZipSizeEOCD();
|
||||
SizeLFH = ZipSizeLFH();
|
||||
|
||||
DataReader = New DataReader(CompressedData);
|
||||
DataReader = New DataReader(CompressedData);
|
||||
DataReader.Skip(GZipPrefixSize);
|
||||
CompressedDataSize = DataReader.SourceStream().Size() - GZipPrefixSize - GZipPostfixSize;
|
||||
|
||||
@@ -1123,7 +1123,7 @@ Function ReadGZip(CompressedData) Export
|
||||
UncompressedDataSize = DataReader.ReadInt32();
|
||||
DataReader.Close();
|
||||
|
||||
DataWriter.WriteBinaryDataBuffer(ZipDD(CRC32, CompressedDataSize, UncompressedDataSize));
|
||||
DataWriter.WriteBinaryDataBuffer(ZipDD(CRC32 , CompressedDataSize, UncompressedDataSize));
|
||||
DataWriter.WriteBinaryDataBuffer(ZipCDH(CRC32, CompressedDataSize, UncompressedDataSize));
|
||||
DataWriter.WriteBinaryDataBuffer(ZipEOCD(CompressedDataSize));
|
||||
DataWriter.Close();
|
||||
@@ -1134,9 +1134,9 @@ EndFunction
|
||||
|
||||
Function ReadZip(CompressedData, ErrorText = Undefined)
|
||||
|
||||
Directory = GetTempFileName();
|
||||
ReadingZip = New ZipFileReader(CompressedData);
|
||||
FileName = ReadingZip.Items[0].Name;
|
||||
Directory = GetTempFileName();
|
||||
ReadingZip = New ZipFileReader(CompressedData);
|
||||
FileName = ReadingZip.Items[0].Name;
|
||||
Try
|
||||
ReadingZip.Extract(ReadingZip.Items[0], Directory, ZIPRestoreFilePathsMode.DontRestore);
|
||||
Except
|
||||
|
@@ -60,16 +60,16 @@ Function GetAuthorizationLink(Parameters = "") Export
|
||||
|
||||
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("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;
|
||||
Link = "https://twitter.com/i/oauth2/authorize" + URLParameters;
|
||||
|
||||
Return Link;
|
||||
|
||||
@@ -91,9 +91,9 @@ Function GetToken(Val Code, Val Parameters = "") Export
|
||||
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("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");
|
||||
|
||||
@@ -115,12 +115,12 @@ EndFunction
|
||||
Function RefreshToken(Val Parameters = "") Export
|
||||
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
Refresh = "refresh_token";
|
||||
Refresh = "refresh_token";
|
||||
|
||||
RequestParameters = New Structure;
|
||||
RequestParameters.Insert(Refresh , Parameters_[Refresh]);
|
||||
RequestParameters.Insert(Refresh , Parameters_[Refresh]);
|
||||
RequestParameters.Insert("grant_type" , Refresh);
|
||||
RequestParameters.Insert("client_id" , Parameters_["client_id"]);
|
||||
RequestParameters.Insert("client_id" , Parameters_["client_id"]);
|
||||
|
||||
Response = OPI_Tools.Post("https://api.twitter.com/2/oauth2/token"
|
||||
, RequestParameters, , False);
|
||||
@@ -141,7 +141,7 @@ EndFunction
|
||||
// HTTPResponse, Arbitrary, BinaryData - Result of reading the JSON response from the server
|
||||
Function HandleIncomingRequestAfterAuthorization(Request) Export
|
||||
|
||||
Code = Request.RequestParameters["code"];
|
||||
Code = Request.RequestParameters["code"];
|
||||
TokenResponse = GetToken(Code);
|
||||
|
||||
// BSLLS:CommentedCode-off
|
||||
@@ -188,9 +188,9 @@ Function CreateCustomTweet(Val Text = ""
|
||||
EndIf;
|
||||
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
URL = "https://api.twitter.com/2/tweets";
|
||||
Array = "Array";
|
||||
Fields = New Map;
|
||||
URL = "https://api.twitter.com/2/tweets";
|
||||
Array = "Array";
|
||||
Fields = New Map;
|
||||
|
||||
If ValueIsFilled(Text) Then
|
||||
Fields.Insert("text", Text);
|
||||
@@ -216,7 +216,7 @@ Function CreateCustomTweet(Val Text = ""
|
||||
EndIf;
|
||||
|
||||
Authorization = CreateAuthorizationHeaderV2(Parameters_);
|
||||
Response = OPI_Tools.Post(URL, Fields, Authorization);
|
||||
Response = OPI_Tools.Post(URL, Fields, Authorization);
|
||||
|
||||
Return Response;
|
||||
|
||||
@@ -318,9 +318,9 @@ Function UploadAttachmentsArray(Val ArrayOfFiles, Val AttachmentsType, Val Param
|
||||
OPI_TypeConversion.GetLine(AttachmentsType);
|
||||
OPI_TypeConversion.GetCollection(ArrayOfFiles);
|
||||
|
||||
MediaArray = New Array;
|
||||
MediaArray = New Array;
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
MIS = "media_id_string";
|
||||
MIS = "media_id_string";
|
||||
|
||||
If ValueIsFilled(ArrayOfFiles) Then
|
||||
|
||||
@@ -329,7 +329,7 @@ Function UploadAttachmentsArray(Val ArrayOfFiles, Val AttachmentsType, Val Param
|
||||
OPI_TypeConversion.GetBinaryData(SendingFile);
|
||||
|
||||
Response = UploadMediaFile(SendingFile, AttachmentsType, Parameters_);
|
||||
MediaID = Response[MIS];
|
||||
MediaID = Response[MIS];
|
||||
|
||||
If Not ValueIsFilled(MediaID) Then
|
||||
Return Response;
|
||||
@@ -357,16 +357,16 @@ Function UploadMediaFile(Val File, Val Type, Val Parameters)
|
||||
|
||||
RequestType = "POST";
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
URL = "https://upload.twitter.com/1.1/media/upload.json";
|
||||
URL = "https://upload.twitter.com/1.1/media/upload.json";
|
||||
|
||||
If Type = "photo" Then
|
||||
|
||||
Fields = New Structure;
|
||||
Fields.Insert("media_data" , Base64String(File));
|
||||
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);
|
||||
Response = OPI_Tools.Post(URL, Fields, Authorization, False);
|
||||
|
||||
Else
|
||||
|
||||
@@ -380,32 +380,32 @@ EndFunction
|
||||
|
||||
Function UploadMediaInParts(Val File, Val Type, Val RequestType, Val URL, Parameters)
|
||||
|
||||
Unit = 1024;
|
||||
Count = 4;
|
||||
Unit = 1024;
|
||||
Count = 4;
|
||||
MediaKey = "media_key";
|
||||
MIS = "media_id_string";
|
||||
Command = "command";
|
||||
Size = File.Size();
|
||||
MIS = "media_id_string";
|
||||
Command = "command";
|
||||
Size = File.Size();
|
||||
|
||||
MIMETypeMapping = New Map;
|
||||
MIMETypeMapping.Insert("photo" , "image/jpeg");
|
||||
MIMETypeMapping.Insert("video" , "video/mp4");
|
||||
MIMETypeMapping.Insert("photo" , "image/jpeg");
|
||||
MIMETypeMapping.Insert("video" , "video/mp4");
|
||||
MIMETypeMapping.Insert("animated_gif", "image/gif");
|
||||
|
||||
ChunkSize = Count * Unit * Unit;
|
||||
ChunkSize = Count * 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(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];
|
||||
InitializationKey = InitializationResponse[MediaKey];
|
||||
InitializationID = InitializationResponse[MIS];
|
||||
|
||||
If Not ValueIsFilled(InitializationKey) Or Not ValueIsFilled(InitializationID) Then
|
||||
Return InitializationResponse;
|
||||
@@ -416,10 +416,10 @@ Function UploadMediaInParts(Val File, Val Type, Val RequestType, Val URL, Parame
|
||||
For Each Part In ArrayReading Do
|
||||
|
||||
Fields = New Structure;
|
||||
Fields.Insert(Command , "APPEND");
|
||||
Fields.Insert("media_key" , InitializationKey);
|
||||
Fields.Insert(Command , "APPEND");
|
||||
Fields.Insert("media_key" , InitializationKey);
|
||||
Fields.Insert("segment_index" , OPI_Tools.NumberToString(Counter));
|
||||
Fields.Insert("media" , Part);
|
||||
Fields.Insert("media" , Part);
|
||||
|
||||
Authorization = CreateAuthorizationHeaderV1(Parameters, New Structure, RequestType, URL);
|
||||
|
||||
@@ -430,7 +430,7 @@ Function UploadMediaInParts(Val File, Val Type, Val RequestType, Val URL, Parame
|
||||
EndDo;
|
||||
|
||||
Fields = New Structure;
|
||||
Fields.Insert(Command , "FINALIZE");
|
||||
Fields.Insert(Command , "FINALIZE");
|
||||
Fields.Insert("media_id", InitializationID);
|
||||
|
||||
ProcessingStatus = GetProcessingStatus(Parameters, Fields, URL);
|
||||
@@ -448,17 +448,17 @@ EndFunction
|
||||
Function WaitForProcessingCompletion(Val ProcessingStatus, Val InitializationID, Val URL, Val Parameters)
|
||||
|
||||
ProcessingInfo = "processing_info";
|
||||
Command = "command";
|
||||
Fields = New Structure;
|
||||
Command = "command";
|
||||
Fields = New Structure;
|
||||
|
||||
Fields.Insert(Command , "STATUS");
|
||||
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];
|
||||
Response = OPI_Tools.Get(URL, Fields, Authorization);
|
||||
Information = Response[ProcessingInfo];
|
||||
|
||||
If Not ValueIsFilled(Information) Then
|
||||
Return Response;
|
||||
@@ -527,15 +527,15 @@ Function GetStandardParameters(Val Parameters = "")
|
||||
|
||||
// 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("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);
|
||||
@@ -552,55 +552,55 @@ EndFunction
|
||||
|
||||
Function CreateAuthorizationHeaderV1(Val Parameters, Val Fields, Val RequestType, Val URL)
|
||||
|
||||
CurrentDate = OPI_Tools.GetCurrentDate();
|
||||
CurrentDate = OPI_Tools.GetCurrentDate();
|
||||
AuthorizationHeader = "";
|
||||
HashingMethod = "HMAC-SHA1";
|
||||
APIVersion = "1.0";
|
||||
SignatureString = "";
|
||||
Signature = "";
|
||||
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;
|
||||
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 = ParametersTable.Add();
|
||||
NewLine.Key = Field.Key;
|
||||
NewLine.Value = Field.Value;
|
||||
|
||||
EndDo;
|
||||
|
||||
NewLine = ParametersTable.Add();
|
||||
NewLine.Key = OCK;
|
||||
NewLine = ParametersTable.Add();
|
||||
NewLine.Key = OCK;
|
||||
NewLine.Value = Parameters[OCK];
|
||||
|
||||
NewLine = ParametersTable.Add();
|
||||
NewLine.Key = OTK;
|
||||
NewLine = ParametersTable.Add();
|
||||
NewLine.Key = OTK;
|
||||
NewLine.Value = Parameters[OTK];
|
||||
|
||||
NewLine = ParametersTable.Add();
|
||||
NewLine.Key = "oauth_version";
|
||||
NewLine = ParametersTable.Add();
|
||||
NewLine.Key = "oauth_version";
|
||||
NewLine.Value = APIVersion;
|
||||
|
||||
NewLine = ParametersTable.Add();
|
||||
NewLine.Key = "oauth_signature_method";
|
||||
NewLine = ParametersTable.Add();
|
||||
NewLine.Key = "oauth_signature_method";
|
||||
NewLine.Value = HashingMethod;
|
||||
|
||||
NewLine = ParametersTable.Add();
|
||||
NewLine.Key = "oauth_timestamp";
|
||||
NewLine = ParametersTable.Add();
|
||||
NewLine.Key = "oauth_timestamp";
|
||||
NewLine.Value = CurrentUNIXDate;
|
||||
|
||||
NewLine = ParametersTable.Add();
|
||||
NewLine.Key = "oauth_nonce";
|
||||
NewLine = ParametersTable.Add();
|
||||
NewLine.Key = "oauth_nonce";
|
||||
NewLine.Value = CurrentUNIXDate;
|
||||
|
||||
For Each TableRow In ParametersTable Do
|
||||
|
||||
TableRow.Key = EncodeString(TableRow.Key, StringEncodingMethod.URLencoding);
|
||||
TableRow.Key = EncodeString(TableRow.Key, StringEncodingMethod.URLencoding);
|
||||
TableRow.Value = EncodeString(TableRow.Value, StringEncodingMethod.URLencoding);
|
||||
|
||||
EndDo;
|
||||
@@ -611,7 +611,7 @@ Function CreateAuthorizationHeaderV1(Val Parameters, Val Fields, Val RequestType
|
||||
|
||||
SignatureString = SignatureString
|
||||
+ TableRow.Key
|
||||
+ "="
|
||||
+ " ="
|
||||
+ TableRow.Value
|
||||
+ "&";
|
||||
|
||||
@@ -620,7 +620,7 @@ Function CreateAuthorizationHeaderV1(Val Parameters, Val Fields, Val RequestType
|
||||
SignatureString = Left(SignatureString, StrLen(SignatureString) - 1);
|
||||
SignatureString = Upper(RequestType)
|
||||
+ "&"
|
||||
+ EncodeString(URL, StringEncodingMethod.URLencoding)
|
||||
+ EncodeString(URL , StringEncodingMethod.URLencoding)
|
||||
+ "&"
|
||||
+ EncodeString(SignatureString, StringEncodingMethod.URLencoding);
|
||||
|
||||
@@ -636,15 +636,15 @@ Function CreateAuthorizationHeaderV1(Val Parameters, Val Fields, Val RequestType
|
||||
Signature = EncodeString(Base64String(Signature), StringEncodingMethod.URLencoding);
|
||||
|
||||
Delimiter = """,";
|
||||
AuthorizationHeader = AuthorizationHeader
|
||||
AuthorizationHeader = AuthorizationHeader
|
||||
+ "OAuth "
|
||||
+ "oauth_consumer_key=""" + Parameters[OCK] + Delimiter
|
||||
+ "oauth_token=""" + Parameters[OTK] + Delimiter
|
||||
+ "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;
|
||||
+ "oauth_timestamp =""" + CurrentUNIXDate + Delimiter
|
||||
+ "oauth_nonce =""" + CurrentUNIXDate + Delimiter
|
||||
+ "oauth_version =""" + APIVersion + Delimiter
|
||||
+ "oauth_signature =""" + Signature;
|
||||
|
||||
HeaderMapping = New Map;
|
||||
HeaderMapping.Insert("authorization", AuthorizationHeader);
|
||||
@@ -664,10 +664,10 @@ EndFunction
|
||||
|
||||
Function GetProcessingStatus(Val Parameters, Val Fields, Val URL)
|
||||
|
||||
ProcessingInfo = "processing_info";
|
||||
ProcessingInfo = "processing_info";
|
||||
Authorization = CreateAuthorizationHeaderV1(Parameters, Fields, "POST", URL);
|
||||
|
||||
Response = OPI_Tools.Post(URL, Fields, Authorization, False);
|
||||
Response = OPI_Tools.Post(URL, Fields, Authorization, False);
|
||||
Information = Response[ProcessingInfo];
|
||||
|
||||
If Not ValueIsFilled(Information) Then
|
||||
|
@@ -109,12 +109,12 @@ Procedure GetCollection(Value) Export
|
||||
Else
|
||||
|
||||
If TypeOf(Value) = Type("BinaryData") Then
|
||||
Value = GetStringFromBinaryData(Value);
|
||||
Value = GetStringFromBinaryData(Value);
|
||||
Else
|
||||
Value = OPI_Tools.NumberToString(Value);
|
||||
Value = OPI_Tools.NumberToString(Value);
|
||||
EndIf;
|
||||
|
||||
File = New File(Value);
|
||||
File = New File(Value);
|
||||
JSONReader = New JSONReader;
|
||||
|
||||
If File.Exists() Then
|
||||
@@ -169,22 +169,22 @@ Procedure GetArray(Value) Export
|
||||
|
||||
CommaInQuotes = "','";
|
||||
|
||||
Value = StrReplace(Value, "['" , "");
|
||||
Value = StrReplace(Value, "']" , "");
|
||||
Value = StrReplace(Value, "['" , "");
|
||||
Value = StrReplace(Value, "']" , "");
|
||||
Value = StrReplace(Value, "', '" , CommaInQuotes);
|
||||
Value = StrReplace(Value, "' , '", CommaInQuotes);
|
||||
Value = StrReplace(Value, "' ,'" , CommaInQuotes);
|
||||
|
||||
Value = StrSplit(Value, CommaInQuotes, False);
|
||||
|
||||
For N = 0 To Value.UBound() Do
|
||||
For N = 0 To Value.UBound() Do
|
||||
Value[N] = TrimAll(Value[N]);
|
||||
EndDo;
|
||||
|
||||
Else
|
||||
|
||||
If TypeOf(Value) = Type("Number") Then
|
||||
Value = OPI_Tools.NumberToString(Value);
|
||||
Value = OPI_Tools.NumberToString(Value);
|
||||
EndIf;
|
||||
|
||||
OPI_Tools.ValueToArray(Value);
|
||||
@@ -204,7 +204,7 @@ Procedure GetBoolean(Value) Export
|
||||
If TypeOf(Value) = Type("Boolean") Then
|
||||
Return;
|
||||
Else
|
||||
Value = Boolean(Value);
|
||||
Value = Boolean(Value);
|
||||
EndIf;
|
||||
|
||||
Except
|
||||
@@ -229,12 +229,12 @@ Procedure GetLine(Value, Val FromSource = False) Export
|
||||
EndIf;
|
||||
|
||||
Value = OPI_Tools.NumberToString(Value);
|
||||
File = New File(Value);
|
||||
File = New File(Value);
|
||||
|
||||
If File.Exists() Then
|
||||
|
||||
TextReader = New TextReader(Value);
|
||||
Value = TextReader.Read();
|
||||
Value = TextReader.Read();
|
||||
TextReader.Close();
|
||||
|
||||
ElsIf StrStartsWith(Lower(Value), "http") Then
|
||||
@@ -243,7 +243,7 @@ Procedure GetLine(Value, Val FromSource = False) Export
|
||||
FileCopy(Value, TFN);
|
||||
|
||||
TextReader = New TextReader(TFN);
|
||||
Value = TextReader.Read();
|
||||
Value = TextReader.Read();
|
||||
TextReader.Close();
|
||||
|
||||
DeleteFiles(TFN);
|
||||
@@ -286,11 +286,11 @@ Procedure GetDate(Value) Export
|
||||
If TypeOf(Value) = Type(Date) Then
|
||||
Return;
|
||||
Else
|
||||
Value = XMLValue(Type(Date), Value);
|
||||
Value = XMLValue(Type(Date), Value);
|
||||
EndIf;
|
||||
|
||||
Except
|
||||
OOD = New TypeDescription(Date);
|
||||
OOD = New TypeDescription(Date);
|
||||
Value = OOD.AdjustValue(Value);
|
||||
EndTry;
|
||||
|
||||
@@ -299,7 +299,7 @@ EndProcedure
|
||||
Procedure GetNumber(Value) Export
|
||||
|
||||
TypeDescription = New TypeDescription("Number");
|
||||
Value = TypeDescription.AdjustValue(Value);
|
||||
Value = TypeDescription.AdjustValue(Value);
|
||||
|
||||
EndProcedure
|
||||
|
||||
@@ -309,7 +309,7 @@ EndProcedure
|
||||
|
||||
Function ThisIsCollection(Val Value)
|
||||
|
||||
Return TypeOf(Value) = Type("Array")
|
||||
Return TypeOf(Value) = Type("Array")
|
||||
Or TypeOf(Value) = Type("Structure")
|
||||
Or TypeOf(Value) = Type("Map");
|
||||
|
||||
@@ -317,7 +317,7 @@ EndFunction
|
||||
|
||||
Function ThisIsSymbolic(Val Value)
|
||||
|
||||
Return TypeOf(Value) = Type("String")
|
||||
Return TypeOf(Value) = Type("String")
|
||||
Or TypeOf(Value) = Type("Number")
|
||||
Or TypeOf(Value) = Type("Date");
|
||||
|
||||
|
@@ -92,7 +92,7 @@ Function CreatePost(Val Text
|
||||
|
||||
OPI_TypeConversion.GetCollection(ImageArray);
|
||||
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
AttachmentsArray = New Array;
|
||||
|
||||
For Each PostImage In ImageArray Do
|
||||
@@ -100,14 +100,14 @@ Function CreatePost(Val Text
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
ResponseMap = GetImageMap(PostImage, Parameters_, "Post");
|
||||
|
||||
OwnerId = ResponseMap.Get("owner_id");
|
||||
OwnerId = ResponseMap.Get("owner_id");
|
||||
ObjectId = ResponseMap.Get("id");
|
||||
|
||||
If Not ValueIsFilled(OwnerId) Or Not ValueIsFilled(ObjectId) Then
|
||||
Return ResponseMap;
|
||||
EndIf;
|
||||
|
||||
OwnerId = OPI_Tools.NumberToString(OwnerId);
|
||||
OwnerId = OPI_Tools.NumberToString(OwnerId);
|
||||
ObjectId = OPI_Tools.NumberToString(ObjectId);
|
||||
|
||||
PhotoID = "photo" + OwnerId + "_" + ObjectId;
|
||||
@@ -144,13 +144,13 @@ Function CreateCompositePost(Val Text
|
||||
OPI_TypeConversion.GetLine(LinkUnderPost);
|
||||
OPI_TypeConversion.GetBoolean(Advertisement);
|
||||
|
||||
Parameters = GetStandardParameters(Parameters);
|
||||
Parameters = GetStandardParameters(Parameters);
|
||||
AttachmentsString = StrConcat(Objects, ",");
|
||||
AttachmentsString = AttachmentsString + LinkUnderPost;
|
||||
|
||||
Parameters.Insert("message" , Text);
|
||||
Parameters.Insert("attachments" , AttachmentsString);
|
||||
Parameters.Insert("mark_as_ads" , ?(Advertisement, 1, 0));
|
||||
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);
|
||||
@@ -198,7 +198,7 @@ Function CreatePoll(Val Question, Val AnswersArray, Val Image = "", Val Paramete
|
||||
OPI_TypeConversion.GetCollection(AnswersArray);
|
||||
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
Response_ = "response";
|
||||
Response_ = "response";
|
||||
|
||||
If ValueIsFilled(Image) Then
|
||||
|
||||
@@ -227,17 +227,17 @@ Function CreatePoll(Val Question, Val AnswersArray, Val Image = "", Val Paramete
|
||||
Answers = "[""" + Answers + """]";
|
||||
|
||||
Parameters_.Insert("add_answers", Answers);
|
||||
Parameters_.Insert("photo_id" , OPI_Tools.NumberToString(PhotoID));
|
||||
Parameters_.Insert("question" , Question);
|
||||
Parameters_.Insert("photo_id" , OPI_Tools.NumberToString(PhotoID));
|
||||
Parameters_.Insert("question" , Question);
|
||||
|
||||
Poll = OPI_Tools.Get("api.vk.com/method/polls.create", Parameters_);
|
||||
Poll = OPI_Tools.Get("api.vk.com/method/polls.create", Parameters_);
|
||||
PollMap = Poll.Get(Response_);
|
||||
|
||||
If Not ValueIsFilled(PollMap) Then
|
||||
Return Poll;
|
||||
EndIf;
|
||||
|
||||
OwnerId = PollMap.Get("owner_id");
|
||||
OwnerId = PollMap.Get("owner_id");
|
||||
ObjectId = PollMap.Get("id");
|
||||
|
||||
If Not ValueIsFilled(OwnerId) Or Not ValueIsFilled(ObjectId) Then
|
||||
@@ -274,8 +274,8 @@ Function CreateAlbum(Val Name, Val Description = "", Val Parameters = "") Export
|
||||
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
|
||||
Parameters_.Insert("title" , Name);
|
||||
Parameters_.Insert("description" , Description);
|
||||
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_);
|
||||
@@ -321,8 +321,8 @@ 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("link_text" , "more");
|
||||
Parameters_.Insert("link_url" , URL);
|
||||
Parameters_.Insert("add_to_news", "1");
|
||||
|
||||
Response = UploadPhotoToServer(Image, Parameters_, "Story");
|
||||
@@ -395,12 +395,12 @@ Function UploadVideoToServer(Val Video
|
||||
, Val Album = ""
|
||||
, Val Parameters = "") Export
|
||||
|
||||
String_ = "String";
|
||||
String_ = "String";
|
||||
Parameters = GetStandardParameters(Parameters);
|
||||
|
||||
OPI_Tools.AddField("name" , Name, String_, Parameters);
|
||||
OPI_Tools.AddField("name" , Name , String_, Parameters);
|
||||
OPI_Tools.AddField("description", Description , String_, Parameters);
|
||||
OPI_Tools.AddField("album_id" , Album , String_, Parameters);
|
||||
OPI_Tools.AddField("album_id" , Album , String_, Parameters);
|
||||
|
||||
Response = OPI_Tools.Get("api.vk.com/method/video.save", Parameters);
|
||||
|
||||
@@ -441,19 +441,19 @@ EndFunction
|
||||
Function UploadPhotoToServer(Val Image, Val Parameters = "", Val View = "Post") Export
|
||||
|
||||
Parameters = GetStandardParameters(Parameters);
|
||||
Method = DetermineImageUploadMethod(View);
|
||||
Files = New Map;
|
||||
Method = DetermineImageUploadMethod(View);
|
||||
Files = New Map;
|
||||
|
||||
Response_ = "response";
|
||||
URL = "api.vk.com/method/";
|
||||
Upload = URL + Method["Upload"];
|
||||
Save = URL + Method["Save"];
|
||||
URL = "api.vk.com/method/";
|
||||
Upload = URL + Method["Upload"];
|
||||
Save = URL + Method["Save"];
|
||||
|
||||
If TypeOf(Image) = Type("String") Then
|
||||
ImageKey = StrReplace(Image, ".", "___");
|
||||
ImageKey = StrReplace(Image, ".", "___");
|
||||
OPI_TypeConversion.GetBinaryData(Image);
|
||||
Else
|
||||
ImageKey = "image___jpeg";
|
||||
ImageKey = "image___jpeg";
|
||||
EndIf;
|
||||
|
||||
Files.Insert(ImageKey, Image);
|
||||
@@ -461,7 +461,7 @@ Function UploadPhotoToServer(Val Image, Val Parameters = "", Val View = "Post")
|
||||
For N = 1 To 5 Do
|
||||
|
||||
Response = OPI_Tools.Get(Upload, Parameters);
|
||||
Result = Response[Response_];
|
||||
Result = Response[Response_];
|
||||
|
||||
If ValueIsFilled(Result) Then
|
||||
|
||||
@@ -543,7 +543,7 @@ Function CloseDiscussion(Val DiscussionID, Val DeleteCompletely = False, Val Par
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
Parameters_.Insert("topic_id", DiscussionID);
|
||||
|
||||
Method = ?(DeleteCompletely, "deleteTopic", "closeTopic");
|
||||
Method = ?(DeleteCompletely, "deleteTopic", "closeTopic");
|
||||
Response = OPI_Tools.Get("api.vk.com/method/board." + Method, Parameters_);
|
||||
|
||||
Return Response;
|
||||
@@ -617,13 +617,13 @@ Function LikePost(Val PostID, Val WallID = "", Val Parameters = "") Export
|
||||
OPI_TypeConversion.GetLine(WallID);
|
||||
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
WallID = ?(ValueIsFilled(WallID), WallID, Parameters_["owner_id"]);
|
||||
VKObject = "wall" + WallID + "_" + OPI_Tools.NumberToString(PostID);
|
||||
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("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_);
|
||||
@@ -651,7 +651,7 @@ Function MakeRepost(Val PostID
|
||||
, Val Parameters = "") Export
|
||||
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
GroupId = Parameters_["group_id"];
|
||||
GroupId = Parameters_["group_id"];
|
||||
|
||||
OPI_TypeConversion.GetLine(GroupId);
|
||||
OPI_TypeConversion.GetLine(PostID);
|
||||
@@ -659,12 +659,12 @@ Function MakeRepost(Val PostID
|
||||
OPI_TypeConversion.GetLine(TargetWall);
|
||||
OPI_TypeConversion.GetBoolean(Advertising);
|
||||
|
||||
Source = ?(ValueIsFilled(WallID), WallID, GroupId);
|
||||
Source = ?(ValueIsFilled(WallID), WallID, GroupId);
|
||||
Receiver = ?(ValueIsFilled(TargetWall), TargetWall, GroupId);
|
||||
|
||||
Parameters_.Insert("object" , "wall" + Source + "_" + OPI_Tools.NumberToString(PostID));
|
||||
Parameters_.Insert("group_id" , StrReplace(Receiver, "-", ""));
|
||||
Parameters_.Insert("mark_as_ads" , ?(Advertising, 1, 0));
|
||||
Parameters_.Insert("object" , "wall" + Source + "_" + OPI_Tools.NumberToString(PostID));
|
||||
Parameters_.Insert("group_id" , StrReplace(Receiver, "-", ""));
|
||||
Parameters_.Insert("mark_as_ads" , ?(Advertising , 1 , 0));
|
||||
|
||||
Response = OPI_Tools.Get("api.vk.com/method/wall.repost", Parameters_);
|
||||
|
||||
@@ -698,11 +698,11 @@ Function WriteMessage(Val Text
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
Parameters_.Insert("access_token", Communitytoken);
|
||||
|
||||
Parameters_.Insert("user_id" , UserID);
|
||||
Parameters_.Insert("peer_id" , UserID);
|
||||
Parameters_.Insert("user_id" , UserID);
|
||||
Parameters_.Insert("peer_id" , UserID);
|
||||
Parameters_.Insert("parse_mode" , "Markdown");
|
||||
Parameters_.Insert("random_id" , 0);
|
||||
Parameters_.Insert("message" , Text);
|
||||
Parameters_.Insert("random_id" , 0);
|
||||
Parameters_.Insert("message" , Text);
|
||||
|
||||
If ValueIsFilled(Keyboard) Then
|
||||
Parameters_.Insert("keyboard", Keyboard);
|
||||
@@ -728,17 +728,17 @@ EndFunction
|
||||
Function WriteComment(Val PostID, Val WallID, Val Text, Val Parameters = "") Export
|
||||
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
GroupId = Parameters_["group_id"];
|
||||
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("owner_id" , WallID);
|
||||
Parameters_.Insert("from_group" , GroupId);
|
||||
Parameters_.Insert("post_id" , PostID);
|
||||
Parameters_.Insert("message" , Text);
|
||||
Parameters_.Insert("post_id" , PostID);
|
||||
Parameters_.Insert("message" , Text);
|
||||
|
||||
Parameters_.Delete("group_id");
|
||||
|
||||
@@ -761,13 +761,13 @@ Function ShortenLink(Val URL, Val Parameters = "") Export
|
||||
|
||||
OPI_TypeConversion.GetLine(URL);
|
||||
|
||||
Response_ = "response";
|
||||
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_];
|
||||
Result = Response[Response_];
|
||||
|
||||
If ValueIsFilled(Result) Then
|
||||
|
||||
@@ -807,11 +807,11 @@ Function GetStatistics(Val StartDate, Val EndDate, Val Parameters = "") Export
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
|
||||
StartDate = OPI_Tools.UNIXTime(StartDate);
|
||||
EndDate = OPI_Tools.UNIXTime(EndDate);
|
||||
EndDate = OPI_Tools.UNIXTime(EndDate);
|
||||
|
||||
Parameters_.Insert("timestamp_from", StartDate);
|
||||
Parameters_.Insert("timestamp_to" , EndDate);
|
||||
Parameters_.Insert("stats_groups" , "visitors, reach, activity");
|
||||
Parameters_.Insert("timestamp_to" , EndDate);
|
||||
Parameters_.Insert("stats_groups" , "visitors, reach, activity");
|
||||
|
||||
Response = OPI_Tools.Get("api.vk.com/method/stats.get", Parameters_);
|
||||
|
||||
@@ -832,11 +832,11 @@ Function GetPostStatistics(Val PostIDsArray, Val Parameters = "") Export
|
||||
|
||||
OPI_TypeConversion.GetCollection(PostIDsArray);
|
||||
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
AnswersArray = New Array;
|
||||
SetsArray = New Array;
|
||||
SetsArray = New Array;
|
||||
MaximumPosts = 30;
|
||||
Response_ = "response";
|
||||
Response_ = "response";
|
||||
|
||||
For Each Post In PostIDsArray Do
|
||||
|
||||
@@ -847,7 +847,7 @@ Function GetPostStatistics(Val PostIDsArray, Val Parameters = "") Export
|
||||
NumbersString = StrConcat(SetsArray, ",");
|
||||
Parameters_.Insert("post_ids", NumbersString);
|
||||
|
||||
Statistics = OPI_Tools.Get("api.vk.com/method/stats.getPostReach", Parameters_);
|
||||
Statistics = OPI_Tools.Get("api.vk.com/method/stats.getPostReach", Parameters_);
|
||||
StatisticsArray = Statistics[Response_];
|
||||
|
||||
For Each StatisticsItem In StatisticsArray Do
|
||||
@@ -863,7 +863,7 @@ Function GetPostStatistics(Val PostIDsArray, Val Parameters = "") Export
|
||||
NumbersString = StrConcat(SetsArray, ",");
|
||||
Parameters_.Insert("post_ids", NumbersString);
|
||||
|
||||
Statistics = OPI_Tools.Get("api.vk.com/method/stats.getPostReach", Parameters_);
|
||||
Statistics = OPI_Tools.Get("api.vk.com/method/stats.getPostReach", Parameters_);
|
||||
StatisticsArray = Statistics[Response_];
|
||||
|
||||
If TypeOf(StatisticsArray) = Type("Array") Then
|
||||
@@ -896,23 +896,23 @@ Function CreateAdvertisingCampaign(Val AccountID, Val Name, Val Parameters = "")
|
||||
OPI_TypeConversion.GetLine(Name);
|
||||
|
||||
CurrentDate = OPI_Tools.GetCurrentDate();
|
||||
EndDate = AddMonth(CurrentDate, 24);
|
||||
EndDate = AddMonth(CurrentDate, 24);
|
||||
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
Parameters_.Insert("account_id", AccountID);
|
||||
|
||||
StructuresArray = New Array;
|
||||
StartDate = OPI_Tools.UNIXTime(CurrentDate);
|
||||
EndDate = OPI_Tools.UNIXTime(EndDate);
|
||||
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("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);
|
||||
CampaignStructure.Insert("stop_time" , EndDate);
|
||||
CampaignStructure.Insert("status" , 1);
|
||||
|
||||
StructuresArray.Add(CampaignStructure);
|
||||
|
||||
@@ -947,7 +947,7 @@ Function CreateAd(Val CampaignNumber
|
||||
, Val Parameters = "") Export
|
||||
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
GroupId = Parameters_["group_id"];
|
||||
GroupId = Parameters_["group_id"];
|
||||
|
||||
OPI_TypeConversion.GetLine(GroupId);
|
||||
OPI_TypeConversion.GetLine(CampaignNumber);
|
||||
@@ -958,30 +958,30 @@ Function CreateAd(Val CampaignNumber
|
||||
|
||||
Link = "https://vk.com/wall-" + GroupId + "_" + PostID;
|
||||
|
||||
StructuresArray = New Array;
|
||||
StructuresArray = 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("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);
|
||||
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);
|
||||
|
||||
StructuresArray.Add(CampaignStructure);
|
||||
|
||||
OPI_TypeConversion.GetLine(StructuresArray, True);
|
||||
|
||||
Parameters_.Insert("data" , StructuresArray);
|
||||
Parameters_.Insert("data" , StructuresArray);
|
||||
Parameters_.Insert("account_id" , AccountID);
|
||||
|
||||
Response = OPI_Tools.Get("api.vk.com/method/ads.createAds", Parameters_);
|
||||
@@ -1009,10 +1009,10 @@ Function PauseAdvertising(Val AccountID, Val AdID, Val Parameters = "") Export
|
||||
|
||||
Parameters_.Insert("account_id", AccountID);
|
||||
|
||||
StructuresArray = New Array;
|
||||
StructuresArray = New Array;
|
||||
CampaignStructure = New Structure;
|
||||
|
||||
CampaignStructure.Insert("ad_id" , AdID);
|
||||
CampaignStructure.Insert("ad_id" , AdID);
|
||||
CampaignStructure.Insert("status" , 0);
|
||||
|
||||
StructuresArray.Add(CampaignStructure);
|
||||
@@ -1038,7 +1038,7 @@ EndFunction
|
||||
Function GetAdvertisingCategoryList(Val Parameters = "") Export
|
||||
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
Response = OPI_Tools.Get("api.vk.com/method/ads.getCategories", Parameters_);
|
||||
Response = OPI_Tools.Get("api.vk.com/method/ads.getCategories", Parameters_);
|
||||
|
||||
Return Response;
|
||||
|
||||
@@ -1058,10 +1058,10 @@ EndFunction
|
||||
// Map Of String - Key - ID, Value - Name
|
||||
Function GetProductCategoryList(Val Parameters = "") Export
|
||||
|
||||
Response_ = "response";
|
||||
Response_ = "response";
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
Response = OPI_Tools.Get("api.vk.com/method/market.getCategories", Parameters_);
|
||||
Result = Response[Response_];
|
||||
Response = OPI_Tools.Get("api.vk.com/method/market.getCategories", Parameters_);
|
||||
Result = Response[Response_];
|
||||
|
||||
If ValueIsFilled(Result) Then
|
||||
|
||||
@@ -1077,7 +1077,7 @@ Function GetProductCategoryList(Val Parameters = "") Export
|
||||
|
||||
Parameters_.Insert("count", Count);
|
||||
Response = OPI_Tools.Get("api.vk.com/method/market.getCategories", Parameters_);
|
||||
Result = Response[Response_];
|
||||
Result = Response[Response_];
|
||||
|
||||
If ValueIsFilled(Result) Then
|
||||
|
||||
@@ -1115,8 +1115,8 @@ Function GetProductList(Val Selection = "", Val Parameters = "") Export
|
||||
OPI_TypeConversion.GetLine(Selection);
|
||||
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
Parameters_.Insert("count" , 200);
|
||||
Parameters_.Insert("extended" , 1);
|
||||
Parameters_.Insert("count" , 200);
|
||||
Parameters_.Insert("extended" , 1);
|
||||
Parameters_.Insert("with_disabled", 1);
|
||||
|
||||
If ValueIsFilled(Selection) Then
|
||||
@@ -1143,9 +1143,9 @@ Function GetProductsByID(Val Products, Val Parameters = "") Export
|
||||
|
||||
OPI_TypeConversion.GetCollection(Products);
|
||||
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
ProductsString = "";
|
||||
Owner = "owner_id";
|
||||
Owner = "owner_id";
|
||||
|
||||
For Each Product In Products Do
|
||||
CurrentProduct = Parameters_[Owner] + "_" + Product;
|
||||
@@ -1233,7 +1233,7 @@ Function GroupProducts(Val ProductsArray, Val ExistingGroup = "", Val Parameters
|
||||
OPI_TypeConversion.GetLine(ExistingGroup);
|
||||
OPI_TypeConversion.GetCollection(ProductsArray);
|
||||
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
ArrayOfProducts_ = New Array;
|
||||
|
||||
For Each Product In ProductsArray Do
|
||||
@@ -1277,21 +1277,21 @@ EndFunction
|
||||
Function GetProductDescription() Export
|
||||
|
||||
Product = New Map();
|
||||
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("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("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;
|
||||
@@ -1335,8 +1335,8 @@ Function GetSelectionsByID(Val Selections, Val Parameters = "") Export
|
||||
|
||||
OPI_TypeConversion.GetCollection(Selections);
|
||||
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
Selections_ = New Array;
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
Selections_ = New Array;
|
||||
SelectionsString = "";
|
||||
|
||||
For Each Selection In Selections Do
|
||||
@@ -1414,7 +1414,7 @@ Function AddProductToCollection(Val ProductsArray, Val Selection, Val Parameters
|
||||
OPI_TypeConversion.GetCollection(ProductsArray);
|
||||
OPI_TypeConversion.GetLine(Selection);
|
||||
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
ArrayOfProducts_ = New Array;
|
||||
|
||||
For Each Product In ProductsArray Do
|
||||
@@ -1449,7 +1449,7 @@ Function RemoveProductFromSelection(Val Product, Val Selection, Val Parameters =
|
||||
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
|
||||
Parameters_.Insert("item_id" , Product);
|
||||
Parameters_.Insert("item_id" , Product);
|
||||
Parameters_.Insert("album_ids", Selection);
|
||||
|
||||
Response = OPI_Tools.Get("api.vk.com/method/market.removeFromAlbum", Parameters_);
|
||||
@@ -1494,10 +1494,10 @@ EndFunction
|
||||
// Map Of KeyAndValue - Serialized JSON response from VK
|
||||
Function GetPropertyList(Val Parameters = "") Export
|
||||
|
||||
Response_ = "response";
|
||||
Response_ = "response";
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
|
||||
Response = OPI_Tools.Get("api.vk.com/method/market.getProperties", Parameters_);
|
||||
Response = OPI_Tools.Get("api.vk.com/method/market.getProperties", Parameters_);
|
||||
Properties = Response[Response_]["items"];
|
||||
|
||||
Return Properties;
|
||||
@@ -1542,9 +1542,9 @@ Function EditProductProperty(Val Name, Val Property, Val Parameters = "") Export
|
||||
OPI_TypeConversion.GetLine(Property);
|
||||
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
Parameters_.Insert("title" , Name);
|
||||
Parameters_.Insert("title" , Name);
|
||||
Parameters_.Insert("property_id", Property);
|
||||
Parameters_.Insert("type" , "text");
|
||||
Parameters_.Insert("type" , "text");
|
||||
|
||||
Response = OPI_Tools.Get("api.vk.com/method/market.editProperty", Parameters_);
|
||||
|
||||
@@ -1591,7 +1591,7 @@ Function AddProductPropertyVariant(Val Value, Val Property, Val Parameters = "")
|
||||
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
Parameters_.Insert("property_id", Property);
|
||||
Parameters_.Insert("title" , Value);
|
||||
Parameters_.Insert("title" , Value);
|
||||
|
||||
Response = OPI_Tools.Get("api.vk.com/method/market.addPropertyVariant", Parameters_);
|
||||
|
||||
@@ -1619,7 +1619,7 @@ Function EditProductPropertyVariant(Val Value, Val Property, Val Option, Val Par
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
Parameters_.Insert("property_id", Property);
|
||||
Parameters_.Insert("variant_id" , Option);
|
||||
Parameters_.Insert("title" , Value);
|
||||
Parameters_.Insert("title" , Value);
|
||||
|
||||
Response = OPI_Tools.Get("api.vk.com/method/market.editPropertyVariant", Parameters_);
|
||||
|
||||
@@ -1689,13 +1689,13 @@ Function FormKeyboard(Val ButtonArray) Export
|
||||
|
||||
OPI_TypeConversion.GetCollection(ButtonArray);
|
||||
|
||||
Keyboard = New Structure;
|
||||
Keyboard = New Structure;
|
||||
KeyboardArray = New Array;
|
||||
ArrayBlock = New Array;
|
||||
ArrayBlock = New Array;
|
||||
|
||||
For Each Action In ButtonArray Do
|
||||
|
||||
Button = New Structure;
|
||||
Button = New Structure;
|
||||
Expression = New Structure;
|
||||
|
||||
Expression.Insert("type" , "text");
|
||||
@@ -1737,11 +1737,11 @@ Function GetStandardParameters(Val Parameters = "")
|
||||
// group_id - owner_id, but 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" , "");
|
||||
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);
|
||||
|
||||
@@ -1757,9 +1757,9 @@ EndFunction
|
||||
|
||||
Function GetImageID(Val Image, Val Parameters, Val View)
|
||||
|
||||
Response_ = "response";
|
||||
Response_ = "response";
|
||||
Response = UploadPhotoToServer(Image, Parameters, View);
|
||||
Result = Response[Response_];
|
||||
Result = Response[Response_];
|
||||
|
||||
If ValueIsFilled(Result) Then
|
||||
PhotoID = Result["photo_id"];
|
||||
@@ -1779,7 +1779,7 @@ EndFunction
|
||||
|
||||
Function GetImageMap(Val Image, Val Parameters, Val View)
|
||||
|
||||
Response = UploadPhotoToServer(Image, Parameters, View);
|
||||
Response = UploadPhotoToServer(Image, Parameters, View);
|
||||
ResponseArray = Response.Get("response");
|
||||
|
||||
If Not ValueIsFilled(ResponseArray) Or Not TypeOf(ResponseArray) = Type("Array") Then
|
||||
@@ -1798,9 +1798,9 @@ EndFunction
|
||||
|
||||
Function GetSelectionArray(Val Selections, Val Parameters = "")
|
||||
|
||||
Response_ = "response";
|
||||
Response_ = "response";
|
||||
Selections = GetSelectionsByID(Selections, Parameters);
|
||||
Result = Selections[Response_];
|
||||
Result = Selections[Response_];
|
||||
|
||||
If ValueIsFilled(Result) Then
|
||||
|
||||
@@ -1821,43 +1821,43 @@ EndFunction
|
||||
Function DetermineImageUploadMethod(Val View)
|
||||
|
||||
MethodMap = New Map;
|
||||
Upload = "Upload";
|
||||
Save = "Save";
|
||||
Way = "Way";
|
||||
Photo = "Photo";
|
||||
Upload = "Upload";
|
||||
Save = "Save";
|
||||
Way = "Way";
|
||||
Photo = "Photo";
|
||||
|
||||
If View = "Post" Then
|
||||
|
||||
MethodMap.Insert(Upload , "photos.getWallUploadServer");
|
||||
MethodMap.Insert(Save, "photos.saveWallPhoto");
|
||||
MethodMap.Insert(Photo , "photo");
|
||||
MethodMap.Insert(Way , 1);
|
||||
MethodMap.Insert(Save , "photos.saveWallPhoto");
|
||||
MethodMap.Insert(Photo , "photo");
|
||||
MethodMap.Insert(Way , 1);
|
||||
|
||||
ElsIf View = "Product" Then
|
||||
|
||||
MethodMap.Insert(Upload , "market.getProductPhotoUploadServer");
|
||||
MethodMap.Insert(Save, "market.saveProductPhoto");
|
||||
MethodMap.Insert(Way , 2);
|
||||
MethodMap.Insert(Save , "market.saveProductPhoto");
|
||||
MethodMap.Insert(Way , 2);
|
||||
|
||||
ElsIf View = "Story" Then
|
||||
|
||||
MethodMap.Insert(Upload , "stories.getPhotoUploadServer");
|
||||
MethodMap.Insert(Save, "stories.save");
|
||||
MethodMap.Insert(Way , 3);
|
||||
MethodMap.Insert(Save , "stories.save");
|
||||
MethodMap.Insert(Way , 3);
|
||||
|
||||
ElsIf View = "Poll" Then
|
||||
|
||||
MethodMap.Insert(Upload , "polls.getPhotoUploadServer");
|
||||
MethodMap.Insert(Save, "polls.savePhoto");
|
||||
MethodMap.Insert(Photo , "photo");
|
||||
MethodMap.Insert(Way , 1);
|
||||
MethodMap.Insert(Save , "polls.savePhoto");
|
||||
MethodMap.Insert(Photo , "photo");
|
||||
MethodMap.Insert(Way , 1);
|
||||
|
||||
Else
|
||||
|
||||
MethodMap.Insert(Upload , "photos.getUploadServer");
|
||||
MethodMap.Insert(Save, "photos.save");
|
||||
MethodMap.Insert(Photo , "photos_list");
|
||||
MethodMap.Insert(Way , 1);
|
||||
MethodMap.Insert(Save , "photos.save");
|
||||
MethodMap.Insert(Photo , "photos_list");
|
||||
MethodMap.Insert(Way , 1);
|
||||
|
||||
EndIf;
|
||||
|
||||
@@ -1868,18 +1868,18 @@ EndFunction
|
||||
Function GetProductParameterMapping()
|
||||
|
||||
Fields = New Map();
|
||||
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("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;
|
||||
@@ -1907,7 +1907,7 @@ Function ProductManagement(Val ProductDescription, Val ProductID = "", Val Selec
|
||||
EndIf;
|
||||
|
||||
Response = OPI_Tools.Get("api.vk.com/method/market." + Method, Parameters_);
|
||||
Result = Response[Response_];
|
||||
Result = Response[Response_];
|
||||
|
||||
If Not ValueIsFilled(ProductID) And ValueIsFilled(Result) Then
|
||||
|
||||
@@ -1930,11 +1930,11 @@ Function ProductManagement(Val ProductDescription, Val ProductID = "", Val Selec
|
||||
EndFunction
|
||||
|
||||
Function SelectionManagement(Val Name
|
||||
, Val Image = ""
|
||||
, Val Image = ""
|
||||
, Val SelectionID = ""
|
||||
, Val Main = False
|
||||
, Val Hidden = False
|
||||
, Val Parameters = "")
|
||||
, Val Main = False
|
||||
, Val Hidden = False
|
||||
, Val Parameters = "")
|
||||
|
||||
OPI_TypeConversion.GetLine(Name);
|
||||
OPI_TypeConversion.GetLine(SelectionID);
|
||||
@@ -1942,15 +1942,15 @@ Function SelectionManagement(Val Name
|
||||
OPI_TypeConversion.GetBoolean(Hidden);
|
||||
|
||||
Parameters_ = GetStandardParameters(Parameters);
|
||||
Response = AddImageParameter(Image, SelectionID, 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));
|
||||
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);
|
||||
@@ -2005,19 +2005,19 @@ EndFunction
|
||||
|
||||
Procedure FillPhotoUploadParameters(Val Method, Val Response, Parameters)
|
||||
|
||||
Response_ = "response";
|
||||
Way = Method["Way"];
|
||||
Response_ = "response";
|
||||
Way = Method["Way"];
|
||||
StandardMethod = 1;
|
||||
NewMethod = 2;
|
||||
NewMethod = 2;
|
||||
|
||||
If Way = StandardMethod Then
|
||||
|
||||
Hash = "hash";
|
||||
Serv = "server";
|
||||
Aid = "aid";
|
||||
Hash = "hash";
|
||||
Serv = "server";
|
||||
Aid = "aid";
|
||||
Photo = Method["Photo"];
|
||||
|
||||
Parameters.Insert(Hash, Response[Hash]);
|
||||
Parameters.Insert(Hash , Response[Hash]);
|
||||
Parameters.Insert(Photo, Response[Photo]);
|
||||
|
||||
PhotoServer = Response.Get(Serv);
|
||||
@@ -2049,15 +2049,15 @@ EndProcedure
|
||||
|
||||
Procedure FillProductRequestFields(Val ProductDescription, Parameters)
|
||||
|
||||
Response_ = "response";
|
||||
MainPhoto = ProductDescription["MainPhoto"];
|
||||
Response_ = "response";
|
||||
MainPhoto = ProductDescription["MainPhoto"];
|
||||
AdditionalPhoto = ProductDescription["AdditionalPhotos"];
|
||||
Properties = ProductDescription["PropertyValues"];
|
||||
Properties = ProductDescription["PropertyValues"];
|
||||
|
||||
If ValueIsFilled(MainPhoto) Then
|
||||
|
||||
Response = UploadPhotoToServer(MainPhoto, Parameters, "Product");
|
||||
Result = Response[Response_];
|
||||
Result = Response[Response_];
|
||||
|
||||
If ValueIsFilled(Result) Then
|
||||
PhotoID = Result["photo_id"];
|
||||
@@ -2133,10 +2133,10 @@ EndProcedure
|
||||
|
||||
Procedure GetProductListRecursively(ProductsArray, Parameters, Shift = 0)
|
||||
|
||||
Response_ = "response";
|
||||
Response_ = "response";
|
||||
MaxInRequest = 200;
|
||||
Response = OPI_Tools.Get("api.vk.com/method/market.get", Parameters);
|
||||
Products = Response[Response_]["items"];
|
||||
Response = OPI_Tools.Get("api.vk.com/method/market.get", Parameters);
|
||||
Products = Response[Response_]["items"];
|
||||
|
||||
If Products.Count() = 0 Then
|
||||
Return;
|
||||
@@ -2154,10 +2154,10 @@ EndProcedure
|
||||
|
||||
Procedure GetAlbumListRecursively(ArrayOfAlbums, Parameters, Shift = 0)
|
||||
|
||||
Response_ = "response";
|
||||
Response_ = "response";
|
||||
MaxInRequest = 100;
|
||||
Response = OPI_Tools.Get("api.vk.com/method/market.getAlbums", Parameters);
|
||||
Albums = Response[Response_]["items"];
|
||||
Response = OPI_Tools.Get("api.vk.com/method/market.getAlbums", Parameters);
|
||||
Albums = Response[Response_]["items"];
|
||||
|
||||
If Albums.Count() = 0 Then
|
||||
Return;
|
||||
@@ -2175,10 +2175,10 @@ EndProcedure
|
||||
|
||||
Procedure GetOrderListRecursively(ArrayOfOrders, Parameters, Shift = 0)
|
||||
|
||||
Response_ = "response";
|
||||
Response_ = "response";
|
||||
MaxInRequest = 50;
|
||||
Response = OPI_Tools.Get("api.vk.com/method/market.getGroupOrders", Parameters);
|
||||
Orders = Response[Response_]["items"];
|
||||
Response = OPI_Tools.Get("api.vk.com/method/market.getGroupOrders", Parameters);
|
||||
Orders = Response[Response_]["items"];
|
||||
|
||||
If Orders.Count() = 0 Then
|
||||
Return;
|
||||
|
@@ -56,7 +56,7 @@
|
||||
Function SetWebhook(Val Token, Val URL) Export
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("url" , URL , "String", Parameters);
|
||||
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);
|
||||
@@ -190,16 +190,16 @@ Function SendFile(Val Token
|
||||
If Not ValueIsFilled(Size) Then
|
||||
|
||||
Response = OPI_Tools.Get(URL);
|
||||
Size = Response.Size();
|
||||
Size = Response.Size();
|
||||
|
||||
EndIf;
|
||||
|
||||
String_ = "String";
|
||||
String_ = "String";
|
||||
Extension = StrReplace(Extension, ".", "");
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("URL" , URL , String_, Parameters);
|
||||
OPI_Tools.AddField("Size" , Size , String_, Parameters);
|
||||
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);
|
||||
@@ -225,8 +225,8 @@ Function SendContact(Val Token
|
||||
, Val SendingToChannel) Export
|
||||
|
||||
Parameters = New Structure;
|
||||
OPI_Tools.AddField("name" , ContactName , "String", Parameters);
|
||||
OPI_Tools.AddField("phone_number", PhoneNumber, "String", Parameters);
|
||||
OPI_Tools.AddField("name" , ContactName , "String", Parameters);
|
||||
OPI_Tools.AddField("phone_number", PhoneNumber , "String", Parameters);
|
||||
|
||||
Return SendMessage(Token, "contact", UserID, SendingToChannel, Parameters);
|
||||
|
||||
@@ -288,23 +288,23 @@ Function CreateKeyboardFromArrayButton(Val ButtonArray, Val ButtonColor = "#2db9
|
||||
OPI_TypeConversion.GetCollection(ButtonArray);
|
||||
|
||||
ArrayOfButtonStructures = New Array;
|
||||
KeyboardStructure = New Structure;
|
||||
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);
|
||||
ButtonStructure.Insert("Text" , ButtonText);
|
||||
ButtonStructure.Insert("BgColor" , ButtonColor);
|
||||
ButtonStructure.Insert("Coloumns" , 3);
|
||||
|
||||
ArrayOfButtonStructures.Add(ButtonStructure);
|
||||
|
||||
EndDo;
|
||||
|
||||
KeyboardStructure.Insert("Buttons", ArrayOfButtonStructures);
|
||||
KeyboardStructure.Insert("Type" , "keyboard");
|
||||
KeyboardStructure.Insert("Type" , "keyboard");
|
||||
|
||||
Return KeyboardStructure;
|
||||
|
||||
@@ -360,22 +360,22 @@ Function SendMessage(Val Token
|
||||
|
||||
If ValueIsFilled(Value) Then
|
||||
|
||||
If Type = "file" Then
|
||||
ParametersStructure.Insert("media" , Value["URL"]);
|
||||
ParametersStructure.Insert("size" , Value["Size"]);
|
||||
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);
|
||||
ParametersStructure.Insert("contact" , Value);
|
||||
ElsIf Type = "location" Then
|
||||
ParametersStructure.Insert("location" , Value);
|
||||
Else
|
||||
ParametersStructure.Insert("media" , Value);
|
||||
ParametersStructure.Insert("media" , Value);
|
||||
EndIf;
|
||||
|
||||
EndIf;
|
||||
|
||||
If IsChannel Then
|
||||
ParametersStructure.Insert("from", UserID);
|
||||
ParametersStructure.Insert("from" , UserID);
|
||||
URL = "https://chatapi.viber.com/pa/post";
|
||||
Else
|
||||
ParametersStructure.Insert("receiver", UserID);
|
||||
@@ -395,11 +395,11 @@ EndFunction
|
||||
Function ReturnStandardParameters()
|
||||
|
||||
SenderStructure = New Structure;
|
||||
SenderStructure.Insert("name" , "Bot");
|
||||
SenderStructure.Insert("name" , "Bot");
|
||||
SenderStructure.Insert("avatar", "");
|
||||
|
||||
ParametersStructure = New Structure;
|
||||
ParametersStructure.Insert("sender", SenderStructure);
|
||||
ParametersStructure.Insert("sender" , SenderStructure);
|
||||
ParametersStructure.Insert("min_api_version", 1);
|
||||
|
||||
Return ParametersStructure;
|
||||
|
@@ -55,7 +55,7 @@ Function GetDiskInformation(Val Token) Export
|
||||
|
||||
OPI_TypeConversion.GetLine(Token);
|
||||
|
||||
Headers = AuthorizationHeader(Token);
|
||||
Headers = AuthorizationHeader(Token);
|
||||
Response = OPI_Tools.Get("https://cloud-api.yandex.net/v1/disk", , Headers);
|
||||
|
||||
Return Response;
|
||||
@@ -77,14 +77,14 @@ Function CreateFolder(Val Token, Val Path) Export
|
||||
OPI_TypeConversion.GetLine(Path);
|
||||
|
||||
Headers = AuthorizationHeader(Token);
|
||||
URL = "https://cloud-api.yandex.net/v1/disk/resources";
|
||||
Href = "href";
|
||||
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);
|
||||
Response = OPI_Tools.Put(URL + Parameters, , Headers, False);
|
||||
|
||||
ResponseURL = Response[Href];
|
||||
|
||||
@@ -112,7 +112,7 @@ Function GetObject(Val Token, Val Path) Export
|
||||
OPI_TypeConversion.GetLine(Token);
|
||||
OPI_TypeConversion.GetLine(Path);
|
||||
|
||||
Headers = AuthorizationHeader(Token);
|
||||
Headers = AuthorizationHeader(Token);
|
||||
Parameters = New Structure;
|
||||
Parameters.Insert("path", Path);
|
||||
|
||||
@@ -141,7 +141,7 @@ Function DeleteObject(Val Token, Val Path, Val ToCart = True) Export
|
||||
Headers = AuthorizationHeader(Token);
|
||||
|
||||
Parameters = New Structure;
|
||||
Parameters.Insert("path" , Path);
|
||||
Parameters.Insert("path" , Path);
|
||||
Parameters.Insert("permanently", Not ToCart);
|
||||
|
||||
Response = OPI_Tools.Delete("https://cloud-api.yandex.net/v1/disk/resources", Parameters, Headers);
|
||||
@@ -169,16 +169,16 @@ Function CreateObjectCopy(Val Token, Val Original, Val Path, Val Overwrite = Fal
|
||||
OPI_TypeConversion.GetBoolean(Overwrite);
|
||||
|
||||
Headers = AuthorizationHeader(Token);
|
||||
URL = "https://cloud-api.yandex.net/v1/disk/resources/copy";
|
||||
Href = "href";
|
||||
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("from" , Original);
|
||||
Parameters.Insert("path" , Path);
|
||||
Parameters.Insert("overwrite" , Overwrite);
|
||||
|
||||
Parameters = OPI_Tools.RequestParametersToString(Parameters);
|
||||
Response = OPI_Tools.Post(URL + Parameters, , Headers, False);
|
||||
Response = OPI_Tools.Post(URL + Parameters, , Headers, False);
|
||||
|
||||
ResponseURL = Response[Href];
|
||||
|
||||
@@ -231,7 +231,7 @@ Function DownloadFile(Val Token, Val Path, Val SavePath = "") Export
|
||||
|
||||
OPI_TypeConversion.GetLine(SavePath);
|
||||
Response = GetDownloadLink(Token, Path);
|
||||
URL = Response["href"];
|
||||
URL = Response["href"];
|
||||
|
||||
If Not ValueIsFilled(URL) Then
|
||||
Return Response;
|
||||
@@ -317,16 +317,16 @@ Function MoveObject(Val Token, Val Original, Val Path, Val Overwrite = False) Ex
|
||||
OPI_TypeConversion.GetBoolean(Overwrite);
|
||||
|
||||
Headers = AuthorizationHeader(Token);
|
||||
URL = "https://cloud-api.yandex.net/v1/disk/resources/move";
|
||||
Href = "href";
|
||||
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("from" , Original);
|
||||
Parameters.Insert("path" , Path);
|
||||
Parameters.Insert("overwrite" , Overwrite);
|
||||
|
||||
Parameters = OPI_Tools.RequestParametersToString(Parameters);
|
||||
Response = OPI_Tools.Post(URL + Parameters, , Headers, False);
|
||||
Parameters = OPI_Tools.RequestParametersToString(Parameters);
|
||||
Response = OPI_Tools.Post(URL + Parameters, , Headers, False);
|
||||
ResponseURL = Response[Href];
|
||||
|
||||
If Not ValueIsFilled(ResponseURL) Then
|
||||
@@ -358,15 +358,15 @@ Function UploadFile(Val Token, Val Path, Val File, Val Overwrite = False) Export
|
||||
OPI_TypeConversion.GetBinaryData(File);
|
||||
|
||||
Headers = AuthorizationHeader(Token);
|
||||
Href = "href";
|
||||
File = New Structure("file", File);
|
||||
Href = "href";
|
||||
File = New Structure("file", File);
|
||||
|
||||
Parameters = New Structure;
|
||||
Parameters.Insert("path" , Path);
|
||||
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];
|
||||
URL = Response[Href];
|
||||
|
||||
If Not ValueIsFilled(URL) Then
|
||||
Return Response;
|
||||
@@ -395,14 +395,14 @@ Function UploadFileByURL(Val Token, Val Path, Val Address) Export
|
||||
OPI_TypeConversion.GetLine(Address);
|
||||
|
||||
Headers = AuthorizationHeader(Token);
|
||||
URL = "https://cloud-api.yandex.net/v1/disk/resources/upload";
|
||||
URL = "https://cloud-api.yandex.net/v1/disk/resources/upload";
|
||||
|
||||
Parameters = New Structure;
|
||||
Parameters.Insert("url" , EncodeString(Address, StringEncodingMethod.URLencoding));
|
||||
Parameters.Insert("path", Path);
|
||||
|
||||
Parameters = OPI_Tools.RequestParametersToString(Parameters);
|
||||
Response = OPI_Tools.Post(URL + Parameters, , Headers, False);
|
||||
Response = OPI_Tools.Post(URL + Parameters, , Headers, False);
|
||||
|
||||
Return Response;
|
||||
|
||||
@@ -566,7 +566,7 @@ Function SavePublicObjectToDisk(Val Token, Val URL, From = "", Target = "") Expo
|
||||
|
||||
Headers = AuthorizationHeader(Token);
|
||||
Address = "https://cloud-api.yandex.net/v1/disk/public/resources/save-to-disk";
|
||||
Href = "href";
|
||||
Href = "href";
|
||||
|
||||
Parameters = New Structure;
|
||||
Parameters.Insert("public_key", EncodeString(URL, StringEncodingMethod.URLencoding));
|
||||
@@ -580,7 +580,7 @@ Function SavePublicObjectToDisk(Val Token, Val URL, From = "", Target = "") Expo
|
||||
EndIf;
|
||||
|
||||
Parameters = OPI_Tools.RequestParametersToString(Parameters);
|
||||
Response = OPI_Tools.Post(Address + Parameters, , Headers, False);
|
||||
Response = OPI_Tools.Post(Address + Parameters, , Headers, False);
|
||||
|
||||
ResponseURL = Response[Href];
|
||||
|
||||
@@ -615,9 +615,9 @@ Function TogglePublicAccess(Val Token, Val Path, Val PublicAccess)
|
||||
OPI_TypeConversion.GetLine(Path);
|
||||
OPI_TypeConversion.GetBoolean(PublicAccess);
|
||||
|
||||
Headers = AuthorizationHeader(Token);
|
||||
Headers = AuthorizationHeader(Token);
|
||||
Destination = ?(PublicAccess, "publish", "unpublish");
|
||||
Href = "href";
|
||||
Href = "href";
|
||||
|
||||
URL = "https://cloud-api.yandex.net/v1/disk/resources/" + Destination;
|
||||
|
||||
@@ -625,7 +625,7 @@ Function TogglePublicAccess(Val Token, Val Path, Val PublicAccess)
|
||||
Parameters.Insert("path", Path);
|
||||
|
||||
Parameters = OPI_Tools.RequestParametersToString(Parameters);
|
||||
Response = OPI_Tools.Put(URL + Parameters, , Headers, False);
|
||||
Response = OPI_Tools.Put(URL + Parameters, , Headers, False);
|
||||
|
||||
ResponseURL = Response[Href];
|
||||
|
||||
|
@@ -52,7 +52,7 @@ 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);
|
||||
Response = OPI_Tools.Post("https://oauth.yandex.ru/device/code", Parameters, , False);
|
||||
|
||||
Return Response;
|
||||
|
||||
@@ -75,9 +75,9 @@ Function ConvertCodeToToken(Val ClientId, Val ClientSecret, Val DeviceCode) Expo
|
||||
OPI_TypeConversion.GetLine(DeviceCode);
|
||||
|
||||
Parameters = New Structure;
|
||||
Parameters.Insert("grant_type" , "device_code");
|
||||
Parameters.Insert("code" , DeviceCode);
|
||||
Parameters.Insert("client_id" , ClientId);
|
||||
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);
|
||||
@@ -103,9 +103,9 @@ Function RefreshToken(Val ClientId, Val ClientSecret, Val RefreshToken) Export
|
||||
OPI_TypeConversion.GetLine(RefreshToken);
|
||||
|
||||
Parameters = New Structure;
|
||||
Parameters.Insert("grant_type" , "refresh_token");
|
||||
Parameters.Insert("grant_type" , "refresh_token");
|
||||
Parameters.Insert("refresh_token" , RefreshToken);
|
||||
Parameters.Insert("client_id" , ClientId);
|
||||
Parameters.Insert("client_id" , ClientId);
|
||||
Parameters.Insert("client_secret" , ClientSecret);
|
||||
|
||||
Response = OPI_Tools.Post("https://oauth.yandex.ru/token", Parameters, , False);
|
||||
|
@@ -102,7 +102,7 @@
|
||||
|
||||
OPI_ПреобразованиеТипов.ПолучитьКоллекцию(КоллекцияТаблиц);
|
||||
|
||||
Если Не ТипЗнч(КоллекцияТаблиц) = Тип("Структура")
|
||||
Если Не ТипЗнч(КоллекцияТаблиц) = Тип("Структура")
|
||||
И Не ТипЗнч(КоллекцияТаблиц) = Тип("Соответствие") Тогда
|
||||
|
||||
ВызватьИсключение "Ошибка в данных коллекции таблиц";
|
||||
@@ -212,7 +212,7 @@
|
||||
OPI_ПреобразованиеТипов.ПолучитьСтроку(Таблица);
|
||||
OPI_ПреобразованиеТипов.ПолучитьКоллекцию(СтруктураПоля);
|
||||
|
||||
Если Не ТипЗнч(СтруктураПоля) = Тип("Структура")
|
||||
Если Не ТипЗнч(СтруктураПоля) = Тип("Структура")
|
||||
И Не ТипЗнч(СтруктураПоля) = Тип("Соответствие") Тогда
|
||||
|
||||
ВызватьИсключение "Ошибка в данных описания поля";
|
||||
@@ -493,7 +493,7 @@
|
||||
СтрокаЗаписей = "";
|
||||
|
||||
Для Каждого Запись Из Записи Цикл
|
||||
СтрокаЗаписей = СтрокаЗаписей
|
||||
СтрокаЗаписей = СтрокаЗаписей
|
||||
+ ?(ЗначениеЗаполнено(СтрокаЗаписей), "&", "?")
|
||||
+ "records[]="
|
||||
+ OPI_Инструменты.ЧислоВСтроку(Запись);
|
||||
|
@@ -182,10 +182,10 @@
|
||||
Строка_ = "Строка";
|
||||
|
||||
Параметры = НормализоватьАвторизацию(URL, Токен, "log.blogpost.add");
|
||||
OPI_Инструменты.ДобавитьПоле("POST_MESSAGE", Текст , Строка_, Параметры);
|
||||
OPI_Инструменты.ДобавитьПоле("POST_TITLE" , Заголовок , Строка_, Параметры);
|
||||
OPI_Инструменты.ДобавитьПоле("POST_MESSAGE", Текст , Строка_ , Параметры);
|
||||
OPI_Инструменты.ДобавитьПоле("POST_TITLE" , Заголовок , Строка_ , Параметры);
|
||||
OPI_Инструменты.ДобавитьПоле("DEST" , Видимость , "Массив", Параметры);
|
||||
OPI_Инструменты.ДобавитьПоле("IMPORTANT" , Важное , Строка_, Параметры);
|
||||
OPI_Инструменты.ДобавитьПоле("IMPORTANT" , Важное , Строка_ , Параметры);
|
||||
|
||||
Если ЗначениеЗаполнено(Файлы) Тогда
|
||||
|
||||
@@ -233,10 +233,10 @@
|
||||
Строка_ = "Строка";
|
||||
|
||||
Параметры = НормализоватьАвторизацию(URL, Токен, "log.blogpost.update");
|
||||
OPI_Инструменты.ДобавитьПоле("POST_MESSAGE", Текст , Строка_, Параметры);
|
||||
OPI_Инструменты.ДобавитьПоле("POST_TITLE" , Заголовок , Строка_, Параметры);
|
||||
OPI_Инструменты.ДобавитьПоле("POST_MESSAGE", Текст , Строка_ , Параметры);
|
||||
OPI_Инструменты.ДобавитьПоле("POST_TITLE" , Заголовок , Строка_ , Параметры);
|
||||
OPI_Инструменты.ДобавитьПоле("DEST" , Видимость , "Массив", Параметры);
|
||||
OPI_Инструменты.ДобавитьПоле("POST_ID" , IDНовости , Строка_, Параметры);
|
||||
OPI_Инструменты.ДобавитьПоле("POST_ID" , IDНовости , Строка_ , Параметры);
|
||||
|
||||
Если ЗначениеЗаполнено(Файлы) Тогда
|
||||
|
||||
@@ -815,7 +815,7 @@
|
||||
|
||||
Параметры = НормализоватьАвторизацию(URL, Токен, "tasks.task.getaccess");
|
||||
OPI_Инструменты.ДобавитьПоле("taskId", IDЗадачи , "Строка" , Параметры);
|
||||
OPI_Инструменты.ДобавитьПоле("users" , Пользователи, "Массив", Параметры);
|
||||
OPI_Инструменты.ДобавитьПоле("users" , Пользователи, "Массив" , Параметры);
|
||||
|
||||
Ответ = OPI_Инструменты.Post(URL, Параметры);
|
||||
|
||||
@@ -964,7 +964,7 @@
|
||||
Функция ПолучитьСтруктуруЗадачи(Знач URL, Знач Токен = "") Экспорт
|
||||
|
||||
Параметры = НормализоватьАвторизацию(URL, Токен, "tasks.task.getFields");
|
||||
Ответ = OPI_Инструменты.Get(URL, Параметры);
|
||||
Ответ = OPI_Инструменты.Get(URL, Параметры);
|
||||
|
||||
Возврат Ответ;
|
||||
|
||||
@@ -1534,9 +1534,9 @@
|
||||
Параметры = НормализоватьАвторизацию(URL, Токен, "task.stages.update");
|
||||
Поля = Новый Структура;
|
||||
|
||||
OPI_Инструменты.ДобавитьПоле("TITLE" , Наименование , Строка_, Поля);
|
||||
OPI_Инструменты.ДобавитьПоле("COLOR" , Цвет , Строка_, Поля);
|
||||
OPI_Инструменты.ДобавитьПоле("AFTER_ID" , IDПредыдущей , Строка_, Поля);
|
||||
OPI_Инструменты.ДобавитьПоле("TITLE" , Наименование , Строка_ , Поля);
|
||||
OPI_Инструменты.ДобавитьПоле("COLOR" , Цвет , Строка_ , Поля);
|
||||
OPI_Инструменты.ДобавитьПоле("AFTER_ID" , IDПредыдущей , Строка_ , Поля);
|
||||
OPI_Инструменты.ДобавитьПоле("isAdmin" , КакАдминистратор, "Булево", Поля);
|
||||
|
||||
OPI_Инструменты.ДобавитьПоле("id" , IDСтадии, Строка_ , Параметры);
|
||||
@@ -1864,7 +1864,7 @@
|
||||
// Соответствие Из КлючИЗначение - сериализованный JSON ответа от Bitrxi24
|
||||
Функция ПолучитьХранилищеПриложения(Знач URL, Знач Токен = "") Экспорт
|
||||
|
||||
Параметры = НормализоватьАвторизацию(URL, Токен, "disk.storage.getforapp");
|
||||
Параметры = НормализоватьАвторизацию(URL, Токен, "disk.storage.getforapp");
|
||||
Ответ = OPI_Инструменты.Post(URL, Параметры);
|
||||
|
||||
Возврат Ответ;
|
||||
|
@@ -655,7 +655,7 @@
|
||||
КонецЦикла;
|
||||
|
||||
Параметры = Новый Структура;
|
||||
OPI_Инструменты.ДобавитьПоле("file" , IDФайла , Строка_, Параметры);
|
||||
OPI_Инструменты.ДобавитьПоле("file" , IDФайла , Строка_ , Параметры);
|
||||
OPI_Инструменты.ДобавитьПоле("members", МассивПользователей , "Массив", Параметры);
|
||||
|
||||
Режим = ?(ТолькоПросмотр, "viewer", "editor");
|
||||
@@ -706,7 +706,7 @@
|
||||
КонецЦикла;
|
||||
|
||||
Параметры = Новый Структура;
|
||||
OPI_Инструменты.ДобавитьПоле("shared_folder_id", IDПапки , Строка_, Параметры);
|
||||
OPI_Инструменты.ДобавитьПоле("shared_folder_id", IDПапки , Строка_ , Параметры);
|
||||
OPI_Инструменты.ДобавитьПоле("members" , МассивПользователей , "Массив", Параметры);
|
||||
|
||||
Заголовки = ПолучитьЗаголовкиЗапроса(Токен);
|
||||
@@ -920,7 +920,7 @@
|
||||
|
||||
Коммит = Новый Структура();
|
||||
OPI_Инструменты.ДобавитьПоле("mode", Режим, "Строка", Коммит);
|
||||
OPI_Инструменты.ДобавитьПоле("path", Путь, "Строка", Коммит);
|
||||
OPI_Инструменты.ДобавитьПоле("path", Путь , "Строка", Коммит);
|
||||
|
||||
Курсор = Новый Структура("offset,session_id", ОбщийРазмер, Сессия);
|
||||
|
||||
|
@@ -416,8 +416,8 @@
|
||||
OPI_ПреобразованиеТипов.ПолучитьСтроку(КалендарьПриемник);
|
||||
OPI_ПреобразованиеТипов.ПолучитьСтроку(Событие);
|
||||
|
||||
Заголовки = OPI_GoogleWorkspace.ПолучитьЗаголовокАвторизации(Токен);
|
||||
URL = "https://www.googleapis.com/calendar/v3/calendars/"
|
||||
Заголовки = OPI_GoogleWorkspace.ПолучитьЗаголовокАвторизации(Токен);
|
||||
URL = "https://www.googleapis.com/calendar/v3/calendars/"
|
||||
+ КалендарьИсточник
|
||||
+ "/events/"
|
||||
+ Событие
|
||||
@@ -491,7 +491,7 @@
|
||||
Возврат Неопределено;
|
||||
КонецЕсли;
|
||||
|
||||
Если Дата = НачалоДня(Дата) Тогда
|
||||
Если Дата = НачалоДня(Дата) Тогда
|
||||
ФорматДаты = "ДФ=yyyy-MM-dd";
|
||||
Поле = "date";
|
||||
Иначе
|
||||
@@ -566,7 +566,7 @@
|
||||
Параметры.Вставить("attachments", Вложения);
|
||||
|
||||
ПараметрыURL = Новый Структура;
|
||||
ПараметрыURL.Вставить("sendUpdates" , ?(Уведомления, "all", "none"));
|
||||
ПараметрыURL.Вставить("sendUpdates" , ?(Уведомления , "all" , "none"));
|
||||
ПараметрыURL.Вставить("supportsAttachments" , ?(ЗначениеЗаполнено(Вложения), "true", "false"));
|
||||
|
||||
URL = URL + OPI_Инструменты.ПараметрыЗапросаВСтроку(ПараметрыURL);
|
||||
|
@@ -539,7 +539,7 @@
|
||||
Описание = Новый Соответствие;
|
||||
КонецЕсли;
|
||||
|
||||
Заголовки = OPI_GoogleWorkspace.ПолучитьЗаголовокАвторизации(Токен);
|
||||
Заголовки = OPI_GoogleWorkspace.ПолучитьЗаголовокАвторизации(Токен);
|
||||
СформироватьПараметрыЗагрузкиФайла(Описание);
|
||||
ОписаниеJSON = OPI_Инструменты.JSONСтрокой(Описание);
|
||||
|
||||
@@ -614,9 +614,9 @@
|
||||
|
||||
Функция ЗагрузитьФайлЧастями(Знач Двоичные, Знач АдресЗагрузки)
|
||||
|
||||
Ответ = "";
|
||||
РазмерЧасти = 268435456;
|
||||
ПрочитаноБайт = 0;
|
||||
Ответ = "";
|
||||
РазмерЧасти = 268435456;
|
||||
ПрочитаноБайт = 0;
|
||||
ТекущаяПозиция = 0;
|
||||
ОбщийРазмер = Двоичные.Размер();
|
||||
СтрОбщийРазмер = OPI_Инструменты.ЧислоВСтроку(ОбщийРазмер);
|
||||
|
@@ -251,7 +251,7 @@
|
||||
OPI_ПреобразованиеТипов.ПолучитьСтроку(Книга);
|
||||
OPI_ПреобразованиеТипов.ПолучитьКоллекцию(СоответствиеЗначений);
|
||||
|
||||
Если Не ТипЗнч(СоответствиеЗначений) = Тип("Структура")
|
||||
Если Не ТипЗнч(СоответствиеЗначений) = Тип("Структура")
|
||||
И Не ТипЗнч(СоответствиеЗначений) = Тип("Соответствие") Тогда
|
||||
Возврат "Не удалось привести структуру значений к коллекции";
|
||||
КонецЕсли;
|
||||
@@ -317,14 +317,14 @@
|
||||
OPI_ПреобразованиеТипов.ПолучитьКоллекцию(МассивЯчеек);
|
||||
СформироватьМассивИменЯчеек(МассивЯчеек, Лист);
|
||||
|
||||
Первый = Истина;
|
||||
Первый = Истина;
|
||||
Для Каждого Ячейка Из МассивЯчеек Цикл
|
||||
Разделитель = ?(Первый, "?", "&");
|
||||
URL = URL + Разделитель + "ranges=" + Ячейка;
|
||||
Первый = Ложь;
|
||||
КонецЦикла;
|
||||
Иначе
|
||||
URL = URL + "?ranges='" + Лист + "'";
|
||||
URL = URL + "?ranges ='" + Лист + "'";
|
||||
КонецЕсли;
|
||||
|
||||
Ответ = OPI_Инструменты.Get(URL, , Заголовки);
|
||||
|
@@ -160,9 +160,9 @@
|
||||
|
||||
Если ЗначениеЗаполнено(Данные)
|
||||
И (ТипЗнч(Данные) = Тип("Соответствие") Или ТипЗнч(Данные) = Тип("Структура")) Тогда
|
||||
Свойства = ЗаполнитьДанныеПоСхеме(Страница, Данные, Токен, Ложь);
|
||||
Свойства = ЗаполнитьДанныеПоСхеме(Страница, Данные, Токен, Ложь);
|
||||
Иначе
|
||||
Свойства = Новый Соответствие;
|
||||
Свойства = Новый Соответствие;
|
||||
КонецЕсли;
|
||||
|
||||
Если ЗначениеЗаполнено(Иконка) Тогда
|
||||
@@ -235,7 +235,7 @@
|
||||
// Все страницы, которые будут созданы как дочерние, должны иметь свойства базы-родителя
|
||||
|
||||
Если Не ТипЗнч(Свойства) = Тип("Структура") И Не ТипЗнч(Свойства) = Тип("Соответствие") Тогда
|
||||
Свойства = Новый Структура("Наименование", "title");
|
||||
Свойства = Новый Структура("Наименование", "title");
|
||||
КонецЕсли;
|
||||
|
||||
Заголовки = СоздатьЗаголовкиЗапроса(Токен);
|
||||
@@ -339,7 +339,7 @@
|
||||
OPI_ПреобразованиеТипов.ПолучитьКоллекцию(Блок);
|
||||
|
||||
Если ТипЗнч(Блок) = Тип("Массив") Тогда
|
||||
Блок = Блок[0];
|
||||
Блок = Блок[0];
|
||||
КонецЕсли;
|
||||
|
||||
Заголовки = СоздатьЗаголовкиЗапроса(Токен);
|
||||
@@ -347,7 +347,7 @@
|
||||
|
||||
Если ТипЗнч(Блок) = Тип("Строка") Тогда
|
||||
ПреобразоватьИД(Блок);
|
||||
Блок = ВернутьБлок(Токен, Блок);
|
||||
Блок = ВернутьБлок(Токен, Блок);
|
||||
КонецЕсли;
|
||||
|
||||
МассивБлоков = Новый Массив;
|
||||
@@ -603,7 +603,7 @@
|
||||
СоответствиеПараметров.Вставить(Свойство.Ключ, Новый Структура(Свойство.Значение, Новый Структура));
|
||||
|
||||
ИначеЕсли ТипЗнч(Свойство.Значение) = Тип("Структура")
|
||||
Или ТипЗнч(Свойство.Значение) = Тип("Соответствие") Тогда
|
||||
Или ТипЗнч(Свойство.Значение) = Тип("Соответствие") Тогда
|
||||
|
||||
ВыборЗначения = СформироватьЗначенияВыбора(Свойство.Значение);
|
||||
СоответствиеПараметров.Вставить(Свойство.Ключ, Новый Структура("select", ВыборЗначения));
|
||||
@@ -705,7 +705,7 @@
|
||||
|
||||
Функция ПреобразоватьЗначениеПоТипу(Знач Тип, Знач Значение)
|
||||
|
||||
Если Тип = "title" Тогда
|
||||
Если Тип = "title" Тогда
|
||||
Возврат ПреобразоватьЗаголовок(Значение);
|
||||
ИначеЕсли Тип = "rich_text" Тогда
|
||||
Возврат ПреобразоватьТекст(Значение);
|
||||
@@ -809,7 +809,7 @@
|
||||
|
||||
СтруктураДаты = Новый Структура;
|
||||
|
||||
Если Дата = НачалоДня(Дата) Тогда
|
||||
Если Дата = НачалоДня(Дата) Тогда
|
||||
ФорматДаты = "ДФ=yyyy-MM-dd";
|
||||
Иначе
|
||||
ФорматДаты = "ДФ=yyyy-MM-ddThh:mm:ssZ";
|
||||
@@ -834,9 +834,9 @@
|
||||
Функция ПреобразоватьПользователей(Знач МассивИД)
|
||||
|
||||
Если Не ТипЗнч(МассивИД) = Тип("Массив") Тогда
|
||||
МассивИД_ = Новый Массив;
|
||||
МассивИД_ = Новый Массив;
|
||||
МассивИД_.Добавить(МассивИД);
|
||||
МассивИД = МассивИД_;
|
||||
МассивИД = МассивИД_;
|
||||
КонецЕсли;
|
||||
|
||||
МассивПользователей = Новый Массив;
|
||||
|
@@ -750,8 +750,8 @@
|
||||
ФайлСлак = Новый Структура("id, title", Идентификатор, Заголовок);
|
||||
|
||||
Параметры = Новый Структура;
|
||||
OPI_Инструменты.ДобавитьПоле("filename" , ИмяФайла, Строка_, Параметры);
|
||||
OPI_Инструменты.ДобавитьПоле("channel_id", Канал , Строка_, Параметры);
|
||||
OPI_Инструменты.ДобавитьПоле("filename" , ИмяФайла, Строка_ , Параметры);
|
||||
OPI_Инструменты.ДобавитьПоле("channel_id", Канал , Строка_ , Параметры);
|
||||
OPI_Инструменты.ДобавитьПоле("files" , ФайлСлак, "Массив", Параметры);
|
||||
|
||||
Ответ = OPI_Инструменты.Post(URL, Параметры, Заголовки);
|
||||
@@ -1004,9 +1004,9 @@
|
||||
OPI_Инструменты.ДобавитьПоле("channel", Канал, "Строка", Параметры);
|
||||
|
||||
Если ВидЗапроса = "POST" Тогда
|
||||
Ответ = OPI_Инструменты.Post(URL, Параметры, Заголовки);
|
||||
Ответ = OPI_Инструменты.Post(URL, Параметры, Заголовки);
|
||||
Иначе
|
||||
Ответ = OPI_Инструменты.Get(URL, Параметры, Заголовки);
|
||||
Ответ = OPI_Инструменты.Get(URL, Параметры, Заголовки);
|
||||
КонецЕсли;
|
||||
|
||||
Возврат Ответ;
|
||||
@@ -1015,16 +1015,16 @@
|
||||
|
||||
Функция УправлениеФайлом(Знач Токен, Знач ИдентификаторФайла, Знач URL, Знач ВидЗапроса = "POST")
|
||||
|
||||
Заголовки = ПолучитьЗаголовокАвторизации(Токен);
|
||||
Заголовки = ПолучитьЗаголовокАвторизации(Токен);
|
||||
ВидЗапроса = вРег(ВидЗапроса);
|
||||
|
||||
Параметры = Новый Структура;
|
||||
OPI_Инструменты.ДобавитьПоле("file", ИдентификаторФайла , "Строка", Параметры);
|
||||
|
||||
Если ВидЗапроса = "POST" Тогда
|
||||
Ответ = OPI_Инструменты.Post(URL, Параметры, Заголовки);
|
||||
Ответ = OPI_Инструменты.Post(URL, Параметры, Заголовки);
|
||||
Иначе
|
||||
Ответ = OPI_Инструменты.Get(URL, Параметры, Заголовки);
|
||||
Ответ = OPI_Инструменты.Get(URL, Параметры, Заголовки);
|
||||
КонецЕсли;
|
||||
|
||||
Возврат Ответ;
|
||||
|
@@ -221,9 +221,9 @@
|
||||
Финал = ПолучитьHexСтрокуИзДвоичныхДанных(Подпись);
|
||||
|
||||
Если Финал = вРег(Хэш) Тогда
|
||||
Ответ = Истина;
|
||||
Ответ = Истина;
|
||||
Иначе
|
||||
Ответ = Ложь;
|
||||
Ответ = Ложь;
|
||||
КонецЕсли;
|
||||
|
||||
СоответствиеВозврата.Вставить("passed", Ответ);
|
||||
@@ -615,7 +615,7 @@
|
||||
КонецЕсли;
|
||||
|
||||
Если ПодСообщением Тогда
|
||||
СтруктураПараметра = Новый Структура("inline_keyboard,rows", Строки, 1);
|
||||
СтруктураПараметра = Новый Структура("inline_keyboard,rows" , Строки, 1);
|
||||
Иначе
|
||||
СтруктураПараметра = Новый Структура("keyboard,resize_keyboard", Строки, Истина);
|
||||
КонецЕсли;
|
||||
@@ -1091,8 +1091,8 @@
|
||||
Функция УправлениеТемойФорума(Знач Токен
|
||||
, Знач IDЧата
|
||||
, Знач Заголовок = Неопределено
|
||||
, Знач IDИконки = Неопределено
|
||||
, Знач IDТемы = "")
|
||||
, Знач IDИконки = Неопределено
|
||||
, Знач IDТемы = "")
|
||||
|
||||
Строка_ = "Строка";
|
||||
OPI_ПреобразованиеТипов.ПолучитьСтроку(Токен);
|
||||
@@ -1106,7 +1106,7 @@
|
||||
Если ЗначениеЗаполнено(IDТемы) Тогда
|
||||
Метод = "/editForumTopic";
|
||||
Иначе
|
||||
Метод = "/createForumTopic";
|
||||
Метод = "/createForumTopic";
|
||||
КонецЕсли;
|
||||
|
||||
Ответ = OPI_Инструменты.Get("api.telegram.org/bot" + Токен + Метод, Параметры);
|
||||
@@ -1165,12 +1165,12 @@
|
||||
Закрыть = 2;
|
||||
Удалить = 3;
|
||||
|
||||
Если Статус = Открыть Тогда
|
||||
Метод = "/reopen" + Форум + "Topic";
|
||||
Если Статус = Открыть Тогда
|
||||
Метод = "/reopen" + Форум + "Topic";
|
||||
ИначеЕсли Статус = Закрыть Тогда
|
||||
Метод = "/close" + Форум + "Topic";
|
||||
Метод = "/close" + Форум + "Topic";
|
||||
ИначеЕсли Статус = Удалить Тогда
|
||||
Метод = "/deleteForumTopic";
|
||||
Метод = "/deleteForumTopic";
|
||||
Иначе
|
||||
ВызватьИсключение "Некорректный статус управления форумом";
|
||||
КонецЕсли;
|
||||
@@ -1212,16 +1212,16 @@
|
||||
|
||||
Функция ОпределитьМетодОтправки(Знач Вид)
|
||||
|
||||
Если Вид = "photo" Тогда
|
||||
Метод = "/sendPhoto";
|
||||
Если Вид = "photo" Тогда
|
||||
Метод = "/sendPhoto";
|
||||
ИначеЕсли Вид = "video" Тогда
|
||||
Метод = "/sendVideo";
|
||||
Метод = "/sendVideo";
|
||||
ИначеЕсли Вид = "audio" Тогда
|
||||
Метод = "/sendAudio";
|
||||
Метод = "/sendAudio";
|
||||
ИначеЕсли Вид = "animation" Тогда
|
||||
Метод = "/sendAnimation";
|
||||
Метод = "/sendAnimation";
|
||||
Иначе
|
||||
Метод = "/sendDocument";
|
||||
Метод = "/sendDocument";
|
||||
КонецЕсли;
|
||||
|
||||
Возврат Метод;
|
||||
@@ -1242,7 +1242,7 @@
|
||||
Если Не ЗначениеЗаполнено(ИмяФайла) Тогда
|
||||
ИмяФайла = Вид + Строка(Счетчик);
|
||||
|
||||
Если Вид = "animation" Тогда
|
||||
Если Вид = "animation" Тогда
|
||||
ИмяФайла = ИмяФайла + ".gif";
|
||||
КонецЕсли;
|
||||
|
||||
|
@@ -69,7 +69,7 @@
|
||||
ПараметрыURL.Вставить("code_challenge_method", "plain");
|
||||
|
||||
ПараметрыURL = OPI_Инструменты.ПараметрыЗапросаВСтроку(ПараметрыURL);
|
||||
Линк = "https://twitter.com/i/oauth2/authorize" + ПараметрыURL;
|
||||
Линк = "https://twitter.com/i/oauth2/authorize" + ПараметрыURL;
|
||||
|
||||
Возврат Линк;
|
||||
|
||||
@@ -568,33 +568,33 @@
|
||||
|
||||
Для Каждого Поле Из Поля Цикл
|
||||
|
||||
НоваяСтрока = ТаблицаПараметров.Добавить();
|
||||
НоваяСтрока = ТаблицаПараметров.Добавить();
|
||||
НоваяСтрока.Ключ = Поле.Ключ;
|
||||
НоваяСтрока.Значение = Поле.Значение;
|
||||
|
||||
КонецЦикла;
|
||||
|
||||
НоваяСтрока = ТаблицаПараметров.Добавить();
|
||||
НоваяСтрока = ТаблицаПараметров.Добавить();
|
||||
НоваяСтрока.Ключ = OCK;
|
||||
НоваяСтрока.Значение = Параметры[OCK];
|
||||
|
||||
НоваяСтрока = ТаблицаПараметров.Добавить();
|
||||
НоваяСтрока = ТаблицаПараметров.Добавить();
|
||||
НоваяСтрока.Ключ = OTK;
|
||||
НоваяСтрока.Значение = Параметры[OTK];
|
||||
|
||||
НоваяСтрока = ТаблицаПараметров.Добавить();
|
||||
НоваяСтрока = ТаблицаПараметров.Добавить();
|
||||
НоваяСтрока.Ключ = "oauth_version";
|
||||
НоваяСтрока.Значение = ВерсияАпи;
|
||||
|
||||
НоваяСтрока = ТаблицаПараметров.Добавить();
|
||||
НоваяСтрока = ТаблицаПараметров.Добавить();
|
||||
НоваяСтрока.Ключ = "oauth_signature_method";
|
||||
НоваяСтрока.Значение = МетодХэширования;
|
||||
|
||||
НоваяСтрока = ТаблицаПараметров.Добавить();
|
||||
НоваяСтрока = ТаблицаПараметров.Добавить();
|
||||
НоваяСтрока.Ключ = "oauth_timestamp";
|
||||
НоваяСтрока.Значение = ТекущаяДатаUNIX;
|
||||
|
||||
НоваяСтрока = ТаблицаПараметров.Добавить();
|
||||
НоваяСтрока = ТаблицаПараметров.Добавить();
|
||||
НоваяСтрока.Ключ = "oauth_nonce";
|
||||
НоваяСтрока.Значение = ТекущаяДатаUNIX;
|
||||
|
||||
@@ -611,7 +611,7 @@
|
||||
|
||||
СтрокаСигнатуры = СтрокаСигнатуры
|
||||
+ СтрокаТаблицы.Ключ
|
||||
+ "="
|
||||
+ " ="
|
||||
+ СтрокаТаблицы.Значение
|
||||
+ "&";
|
||||
|
||||
@@ -620,7 +620,7 @@
|
||||
СтрокаСигнатуры = Лев(СтрокаСигнатуры, СтрДлина(СтрокаСигнатуры) - 1);
|
||||
СтрокаСигнатуры = вРег(ВидЗапроса)
|
||||
+ "&"
|
||||
+ КодироватьСтроку(URL, СпособКодированияСтроки.КодировкаURL)
|
||||
+ КодироватьСтроку(URL , СпособКодированияСтроки.КодировкаURL)
|
||||
+ "&"
|
||||
+ КодироватьСтроку(СтрокаСигнатуры, СпособКодированияСтроки.КодировкаURL);
|
||||
|
||||
@@ -635,16 +635,16 @@
|
||||
|
||||
Сигнатура = КодироватьСтроку(Base64Строка(Сигнатура), СпособКодированияСтроки.КодировкаURL);
|
||||
|
||||
Разделитель = """,";
|
||||
ЗаголовокАвторизации = ЗаголовокАвторизации
|
||||
Разделитель = """,";
|
||||
ЗаголовокАвторизации = ЗаголовокАвторизации
|
||||
+ "OAuth "
|
||||
+ "oauth_consumer_key=""" + Параметры[OCK] + Разделитель
|
||||
+ "oauth_token=""" + Параметры[OTK] + Разделитель
|
||||
+ "oauth_consumer_key =""" + Параметры[OCK] + Разделитель
|
||||
+ "oauth_token =""" + Параметры[OTK] + Разделитель
|
||||
+ "oauth_signature_method=""" + МетодХэширования + Разделитель
|
||||
+ "oauth_timestamp=""" + ТекущаяДатаUNIX + Разделитель
|
||||
+ "oauth_nonce=""" + ТекущаяДатаUNIX + Разделитель
|
||||
+ "oauth_version=""" + ВерсияАпи + Разделитель
|
||||
+ "oauth_signature=""" + Сигнатура;
|
||||
+ "oauth_timestamp =""" + ТекущаяДатаUNIX + Разделитель
|
||||
+ "oauth_nonce =""" + ТекущаяДатаUNIX + Разделитель
|
||||
+ "oauth_version =""" + ВерсияАпи + Разделитель
|
||||
+ "oauth_signature =""" + Сигнатура;
|
||||
|
||||
СоответствиеЗаголовка = Новый Соответствие;
|
||||
СоответствиеЗаголовка.Вставить("authorization", ЗаголовокАвторизации);
|
||||
@@ -665,7 +665,7 @@
|
||||
Функция ПолучитьСтатусОбработки(Знач Параметры, Знач Поля, Знач URL)
|
||||
|
||||
ProcessingInfo = "processing_info";
|
||||
Авторизация = СоздатьЗаголовокАвторизацииV1(Параметры, Поля, "POST", URL);
|
||||
Авторизация = СоздатьЗаголовокАвторизацииV1(Параметры, Поля, "POST", URL);
|
||||
|
||||
Ответ = OPI_Инструменты.Post(URL, Поля, Авторизация, Ложь);
|
||||
Информация = Ответ[ProcessingInfo];
|
||||
|
@@ -449,7 +449,7 @@
|
||||
Загрузка = URL + Метод["Загрузка"];
|
||||
Сохранение = URL + Метод["Сохранение"];
|
||||
|
||||
Если ТипЗнч(Картинка) = Тип("Строка") Тогда
|
||||
Если ТипЗнч(Картинка) = Тип("Строка") Тогда
|
||||
КлючКартинка = СтрЗаменить(Картинка, ".", "___");
|
||||
OPI_ПреобразованиеТипов.ПолучитьДвоичныеДанные(Картинка);
|
||||
Иначе
|
||||
@@ -664,7 +664,7 @@
|
||||
|
||||
Параметры_.Вставить("object" , "wall" + Источник + "_" + OPI_Инструменты.ЧислоВСтроку(IDПоста));
|
||||
Параметры_.Вставить("group_id" , СтрЗаменить(Приемник, "-", ""));
|
||||
Параметры_.Вставить("mark_as_ads" , ?(Рекламный, 1, 0));
|
||||
Параметры_.Вставить("mark_as_ads" , ?(Рекламный , 1 , 0));
|
||||
|
||||
Ответ = OPI_Инструменты.Get("api.vk.com/method/wall.repost", Параметры_);
|
||||
|
||||
@@ -1757,7 +1757,7 @@
|
||||
|
||||
Функция ПолучитьИДКартинки(Знач Картинка, Знач Параметры, Знач Вид)
|
||||
|
||||
Response_ = "response";
|
||||
Response_ = "response";
|
||||
Ответ = ЗагрузитьФотоНаСервер(Картинка, Параметры, Вид);
|
||||
Результат = Ответ[Response_];
|
||||
|
||||
@@ -1779,7 +1779,7 @@
|
||||
|
||||
Функция ПолучитьСоответствиеКартинки(Знач Картинка, Знач Параметры, Знач Вид)
|
||||
|
||||
Ответ = ЗагрузитьФотоНаСервер(Картинка, Параметры, Вид);
|
||||
Ответ = ЗагрузитьФотоНаСервер(Картинка, Параметры, Вид);
|
||||
ОтветМассив = Ответ.Получить("response");
|
||||
|
||||
Если Не ЗначениеЗаполнено(ОтветМассив) Или Не ТипЗнч(ОтветМассив) = Тип("Массив") Тогда
|
||||
@@ -1798,8 +1798,8 @@
|
||||
|
||||
Функция ПолучитьМассивПодборок(Знач Подборки, Знач Параметры = "")
|
||||
|
||||
Response_ = "response";
|
||||
Подборки = ПолучитьПодборкиПоИД(Подборки, Параметры);
|
||||
Response_ = "response";
|
||||
Подборки = ПолучитьПодборкиПоИД(Подборки, Параметры);
|
||||
Результат = Подборки[Response_];
|
||||
|
||||
Если ЗначениеЗаполнено(Результат) Тогда
|
||||
@@ -1950,7 +1950,7 @@
|
||||
|
||||
Параметры_.Вставить("title" , Название);
|
||||
Параметры_.Вставить("main_album" , ?(Основная, 1, 0));
|
||||
Параметры_.Вставить("is_hidden" , ?(Скрытая, 1, 0));
|
||||
Параметры_.Вставить("is_hidden" , ?(Скрытая , 1, 0));
|
||||
|
||||
Если ЗначениеЗаполнено(ИДПодборки) Тогда
|
||||
Параметры_.Вставить("album_id", ИДПодборки);
|
||||
|
@@ -360,7 +360,7 @@
|
||||
|
||||
Если ЗначениеЗаполнено(Значение) Тогда
|
||||
|
||||
Если Тип = "file" Тогда
|
||||
Если Тип = "file" Тогда
|
||||
СтруктураПараметров.Вставить("media" , Значение["URL"]);
|
||||
СтруктураПараметров.Вставить("size" , Значение["Размер"]);
|
||||
СтруктураПараметров.Вставить("file_name", "Файл." + Значение["Расширение"]);
|
||||
@@ -375,7 +375,7 @@
|
||||
КонецЕсли;
|
||||
|
||||
Если ЭтоКанал Тогда
|
||||
СтруктураПараметров.Вставить("from", IDПользователя);
|
||||
СтруктураПараметров.Вставить("from" , IDПользователя);
|
||||
URL = "https://chatapi.viber.com/pa/post";
|
||||
Иначе
|
||||
СтруктураПараметров.Вставить("receiver", IDПользователя);
|
||||
@@ -399,7 +399,7 @@
|
||||
СтруктураОтправителя.Вставить("avatar", "");
|
||||
|
||||
СтруктураПараметров = Новый Структура;
|
||||
СтруктураПараметров.Вставить("sender", СтруктураОтправителя);
|
||||
СтруктураПараметров.Вставить("sender" , СтруктураОтправителя);
|
||||
СтруктураПараметров.Вставить("min_api_version", 1);
|
||||
|
||||
Возврат СтруктураПараметров;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#Использовать "./internal"
|
||||
#Использовать "./internal"
|
||||
#Использовать "../../tools"
|
||||
|
||||
Тесты = OPI_ПолучениеДанныхТестов.СформироватьТестыАссертс();
|
||||
|
@@ -426,7 +426,7 @@
|
||||
VK_СделатьРепост(ПараметрыТеста);
|
||||
VK_НаписатьКомментарий(ПараметрыТеста);
|
||||
|
||||
OPI_VK.УдалитьПост(ИДПоста, Параметры);
|
||||
OPI_VK.УдалитьПост(ИДПоста , Параметры);
|
||||
OPI_VK.УдалитьПост(ПараметрыТеста["Repost"], Параметры);
|
||||
|
||||
OPI_Инструменты.Пауза(5);
|
||||
@@ -481,7 +481,7 @@
|
||||
|
||||
ПараметрыТеста = Новый Структура;
|
||||
|
||||
OPI_ПолучениеДанныхТестов.ПараметрВКоллекцию("VK_UserID", ПараметрыТеста);
|
||||
OPI_ПолучениеДанныхТестов.ПараметрВКоллекцию("VK_UserID" , ПараметрыТеста);
|
||||
OPI_ПолучениеДанныхТестов.ПараметрВКоллекцию("VK_CommunityToken", ПараметрыТеста);
|
||||
|
||||
VK_СформироватьКлавиатуру(ПараметрыТеста);
|
||||
@@ -504,7 +504,7 @@
|
||||
Процедура ВК_СоздатьТоварПодборку() Экспорт
|
||||
|
||||
ПараметрыТеста = Новый Структура;
|
||||
OPI_ПолучениеДанныхТестов.ПараметрВКоллекцию("Picture", ПараметрыТеста);
|
||||
OPI_ПолучениеДанныхТестов.ПараметрВКоллекцию("Picture" , ПараметрыТеста);
|
||||
OPI_ПолучениеДанныхТестов.ПараметрВКоллекцию("Picture2", ПараметрыТеста);
|
||||
|
||||
VK_СоздатьПодборкуТоваров(ПараметрыТеста);
|
||||
@@ -525,7 +525,7 @@
|
||||
Параметры = ПолучитьПараметрыВК();
|
||||
|
||||
ПараметрыТеста = Новый Структура;
|
||||
OPI_ПолучениеДанныхТестов.ПараметрВКоллекцию("Picture", ПараметрыТеста);
|
||||
OPI_ПолучениеДанныхТестов.ПараметрВКоллекцию("Picture" , ПараметрыТеста);
|
||||
OPI_ПолучениеДанныхТестов.ПараметрВКоллекцию("Picture2", ПараметрыТеста);
|
||||
|
||||
VK_СоздатьСвойствоТовара(ПараметрыТеста);
|
||||
@@ -692,7 +692,7 @@
|
||||
OPI_ПолучениеДанныхТестов.ОжидаетЧто(Результат["path"]).Равно("disk:" + ПутьКопии);
|
||||
|
||||
OPI_YandexDisk.УдалитьОбъект(Токен, ПутьОригинала, Ложь);
|
||||
OPI_YandexDisk.УдалитьОбъект(Токен, ПутьКопии, Ложь);
|
||||
OPI_YandexDisk.УдалитьОбъект(Токен, ПутьКопии , Ложь);
|
||||
|
||||
OPI_Инструменты.Пауза(5);
|
||||
|
||||
@@ -727,7 +727,7 @@
|
||||
|
||||
Процедура ЯДиск_ПолучитьСписокФайлов() Экспорт
|
||||
|
||||
Токен = OPI_ПолучениеДанныхТестов.ПолучитьПараметр("YandexDisk_Token");
|
||||
Токен = OPI_ПолучениеДанныхТестов.ПолучитьПараметр("YandexDisk_Token");
|
||||
Количество = 2;
|
||||
Отступ = 1;
|
||||
|
||||
@@ -767,7 +767,7 @@
|
||||
OPI_ПолучениеДанныхТестов.ОжидаетЧто(Результат["path"]).Равно("disk:" + ПутьКопии);
|
||||
|
||||
OPI_YandexDisk.УдалитьОбъект(Токен, ПутьОригинала, Ложь);
|
||||
OPI_YandexDisk.УдалитьОбъект(Токен, ПутьКопии, Ложь);
|
||||
OPI_YandexDisk.УдалитьОбъект(Токен, ПутьКопии , Ложь);
|
||||
|
||||
OPI_Инструменты.Пауза(5);
|
||||
|
||||
@@ -836,7 +836,7 @@
|
||||
|
||||
Процедура ЯДиск_ПолучитьСписокОпубликованных() Экспорт
|
||||
|
||||
Токен = OPI_ПолучениеДанныхТестов.ПолучитьПараметр("YandexDisk_Token");
|
||||
Токен = OPI_ПолучениеДанныхТестов.ПолучитьПараметр("YandexDisk_Token");
|
||||
Количество = 2;
|
||||
Отступ = 1;
|
||||
|
||||
@@ -1526,8 +1526,8 @@
|
||||
|
||||
ИмяЛиста = Результат["sheets"][Н]["properties"]["title"];
|
||||
OPI_ПолучениеДанныхТестов.ОжидаетЧто(ИмяЛиста).Равно(МассивЛистов[Н]);
|
||||
Лист = Результат["sheets"][Н]["properties"]["sheetId"];
|
||||
Лист = OPI_Инструменты.ЧислоВСтроку(Лист);
|
||||
Лист = Результат["sheets"][Н]["properties"]["sheetId"];
|
||||
Лист = OPI_Инструменты.ЧислоВСтроку(Лист);
|
||||
|
||||
КонецЦикла;
|
||||
|
||||
@@ -1838,8 +1838,8 @@
|
||||
Свойства.Вставить("Пользователь" , "people");
|
||||
|
||||
ВыборЗначения = Новый Соответствие;
|
||||
ВыборЗначения.Вставить("Новый", "green");
|
||||
ВыборЗначения.Вставить("В работе", "yellow");
|
||||
ВыборЗначения.Вставить("Новый" , "green");
|
||||
ВыборЗначения.Вставить("В работе" , "yellow");
|
||||
ВыборЗначения.Вставить("Удаленный", "red");
|
||||
Свойства.Вставить("Статус", ВыборЗначения);
|
||||
|
||||
@@ -1851,7 +1851,7 @@
|
||||
|
||||
База = Результат["id"];
|
||||
Заголовок = "Тестовый заголовок";
|
||||
Описание = "Тестовое описание";
|
||||
Описание = "Тестовое описание";
|
||||
|
||||
Свойства = Новый Соответствие;
|
||||
Свойства.Вставить("Почта", "rich_text"); // Тип поля "Почта" будет изменен с email на текст
|
||||
@@ -1910,7 +1910,7 @@
|
||||
Свойства.Вставить("Сайт" , "https://vector.ru");
|
||||
Свойства.Вставить("Почта" , "mail@vector.ru");
|
||||
Свойства.Вставить("Телефон" , "88005553535");
|
||||
Свойства.Вставить("Статус" , "Новый");
|
||||
Свойства.Вставить("Статус" , "Новый");
|
||||
|
||||
Результат = OPI_Notion.СоздатьСтраницуВБазу(Токен, База, Свойства);
|
||||
|
||||
@@ -1967,7 +1967,7 @@
|
||||
Проверка_НоушнОбъект(Результат, "list");
|
||||
|
||||
Блок = Результат["results"][0]["id"];
|
||||
Результат = OPI_Notion.ВернутьДочерниеБлоки(Токен, Блок);
|
||||
Результат = OPI_Notion.ВернутьДочерниеБлоки(Токен, Блок);
|
||||
|
||||
OPI_ПолучениеДанныхТестов.ЗаписатьЛог(Результат, "ВернутьДочерниеБлоки");
|
||||
|
||||
@@ -2105,7 +2105,7 @@
|
||||
|
||||
Отметки.Добавить(Результат["ts"]);
|
||||
|
||||
Блок = OPI_Slack.СформироватьБлокКартинку(Картинка, "Yo");
|
||||
Блок = OPI_Slack.СформироватьБлокКартинку(Картинка, "Yo");
|
||||
БлокJSON = OPI_Инструменты.JSONСтрокой(Блок);
|
||||
|
||||
ИВФ = ПолучитьИмяВременногоФайла("json");
|
||||
@@ -2124,7 +2124,7 @@
|
||||
|
||||
Отметки.Добавить(Результат["ts"]);
|
||||
|
||||
Блоки = "['" + ИВФ + "','" + ИВФ + "']";
|
||||
Блоки = "['" + ИВФ + "','" + ИВФ + "']";
|
||||
Результат = OPI_Slack.ОтправитьСообщение(Токен, Канал, Текст, , Блоки);
|
||||
|
||||
OPI_ПолучениеДанныхТестов.ЗаписатьЛог(Результат, "ОтправитьСообщение (json массив)");
|
||||
@@ -2750,7 +2750,7 @@
|
||||
|
||||
ПараметрыТеста = Новый Структура;
|
||||
OPI_ПолучениеДанныхТестов.ПараметрВКоллекцию("Dropbox_Token", ПараметрыТеста);
|
||||
OPI_ПолучениеДанныхТестов.ПараметрВКоллекцию("Picture", ПараметрыТеста);
|
||||
OPI_ПолучениеДанныхТестов.ПараметрВКоллекцию("Picture" , ПараметрыТеста);
|
||||
|
||||
Dropbox_ЗагрузитьФайл(ПараметрыТеста);
|
||||
Dropbox_ПолучитьИнформациюОбОбъекте(ПараметрыТеста);
|
||||
@@ -2787,7 +2787,7 @@
|
||||
|
||||
ПараметрыТеста = Новый Структура;
|
||||
OPI_ПолучениеДанныхТестов.ПараметрВКоллекцию("Dropbox_Token", ПараметрыТеста);
|
||||
OPI_ПолучениеДанныхТестов.ПараметрВКоллекцию("Document", ПараметрыТеста);
|
||||
OPI_ПолучениеДанныхТестов.ПараметрВКоллекцию("Document" , ПараметрыТеста);
|
||||
|
||||
Dropbox_ЗагрузитьФайлПоURL(ПараметрыТеста);
|
||||
Dropbox_ПолучитьСтатусЗагрузкиПоURL(ПараметрыТеста);
|
||||
@@ -3852,7 +3852,7 @@
|
||||
|
||||
Процедура Telegram_ПолучитьОбновления(ПараметрыФункции)
|
||||
|
||||
Токен = ПараметрыФункции["Telegram_Token"];
|
||||
Токен = ПараметрыФункции["Telegram_Token"];
|
||||
Результат = OPI_Telegram.ПолучитьОбновления(Токен);
|
||||
|
||||
// END
|
||||
@@ -4322,7 +4322,7 @@
|
||||
|
||||
Процедура Telegram_Бан(ПараметрыФункции)
|
||||
|
||||
Токен = ПараметрыФункции["Telegram_Token"];
|
||||
Токен = ПараметрыФункции["Telegram_Token"];
|
||||
IDПользователя = ПараметрыФункции["Telegram_ChatID"];
|
||||
IDКанала = ПараметрыФункции["Telegram_ChannelID"];
|
||||
|
||||
@@ -4447,7 +4447,7 @@
|
||||
|
||||
Процедура Telegram_СоздатьТемуФорума(ПараметрыФункции)
|
||||
|
||||
Токен = ПараметрыФункции["Telegram_Token"];
|
||||
Токен = ПараметрыФункции["Telegram_Token"];
|
||||
Чат = ПараметрыФункции["Telegram_ForumID"];
|
||||
Иконка = "5357419403325481346";
|
||||
Имя = "Тестовая тема " + Строка(Новый УникальныйИдентификатор);
|
||||
@@ -4466,8 +4466,8 @@
|
||||
|
||||
Проверка_ТелеграмСозданиеТемы(Результат, Имя, Иконка);
|
||||
|
||||
ЧатТема = Чат + "*" + Тема;
|
||||
Текст = ПараметрыФункции["String"];
|
||||
ЧатТема = Чат + "*" + Тема;
|
||||
Текст = ПараметрыФункции["String"];
|
||||
Результат = OPI_Telegram.ОтправитьТекстовоеСообщение(Токен, ЧатТема, Текст);
|
||||
|
||||
OPI_ПолучениеДанныхТестов.ЗаписатьЛог(Результат, "ОтправитьТекстовоеСообщение (форум)");
|
||||
@@ -4478,7 +4478,7 @@
|
||||
|
||||
Процедура Telegram_ИзменитьТемуФорума(ПараметрыФункции)
|
||||
|
||||
Токен = ПараметрыФункции["Telegram_Token"];
|
||||
Токен = ПараметрыФункции["Telegram_Token"];
|
||||
Чат = ПараметрыФункции["Telegram_ForumID"];
|
||||
Тема = ПараметрыФункции["Telegram_TopicID"];
|
||||
НовоеИмя = "Новый тестовый заголовок";
|
||||
@@ -4498,7 +4498,7 @@
|
||||
|
||||
Процедура Telegram_ЗакрытьТемуФорума(ПараметрыФункции)
|
||||
|
||||
Токен = ПараметрыФункции["Telegram_Token"];
|
||||
Токен = ПараметрыФункции["Telegram_Token"];
|
||||
Чат = ПараметрыФункции["Telegram_ForumID"];
|
||||
Тема = ПараметрыФункции["Telegram_TopicID"];
|
||||
|
||||
@@ -4524,7 +4524,7 @@
|
||||
|
||||
Процедура Telegram_ОткрытьТемуФорума(ПараметрыФункции)
|
||||
|
||||
Токен = ПараметрыФункции["Telegram_Token"];
|
||||
Токен = ПараметрыФункции["Telegram_Token"];
|
||||
Чат = ПараметрыФункции["Telegram_ForumID"];
|
||||
Тема = ПараметрыФункции["Telegram_TopicID"];
|
||||
|
||||
@@ -4548,7 +4548,7 @@
|
||||
|
||||
Процедура Telegram_УдалитьТемуФорума(ПараметрыФункции)
|
||||
|
||||
Токен = ПараметрыФункции["Telegram_Token"];
|
||||
Токен = ПараметрыФункции["Telegram_Token"];
|
||||
Чат = ПараметрыФункции["Telegram_ForumID"];
|
||||
Тема = ПараметрыФункции["Telegram_TopicID"];
|
||||
|
||||
@@ -4566,7 +4566,7 @@
|
||||
|
||||
Процедура Telegram_ОчиститьСписокЗакрепленныхСообщенийТемы(ПараметрыФункции)
|
||||
|
||||
Токен = ПараметрыФункции["Telegram_Token"];
|
||||
Токен = ПараметрыФункции["Telegram_Token"];
|
||||
Чат = ПараметрыФункции["Telegram_ForumID"];
|
||||
Тема = ПараметрыФункции["Telegram_TopicID"];
|
||||
|
||||
@@ -4590,7 +4590,7 @@
|
||||
|
||||
Процедура Telegram_СкрытьГлавнуюТемуФорума(ПараметрыФункции)
|
||||
|
||||
Токен = ПараметрыФункции["Telegram_Token"];
|
||||
Токен = ПараметрыФункции["Telegram_Token"];
|
||||
Чат = ПараметрыФункции["Telegram_ForumID"];
|
||||
|
||||
Результат = OPI_Telegram.СкрытьГлавнуюТемуФорума(Токен, Чат);
|
||||
@@ -4607,7 +4607,7 @@
|
||||
|
||||
Процедура Telegram_ПоказатьГлавнуюТемуФорума(ПараметрыФункции)
|
||||
|
||||
Токен = ПараметрыФункции["Telegram_Token"];
|
||||
Токен = ПараметрыФункции["Telegram_Token"];
|
||||
Чат = ПараметрыФункции["Telegram_ForumID"];
|
||||
|
||||
Результат = OPI_Telegram.ПоказатьГлавнуюТемуФорума(Токен, Чат);
|
||||
@@ -4624,8 +4624,8 @@
|
||||
|
||||
Процедура Telegram_ИзменитьИмяГлавнойТемыФорума(ПараметрыФункции)
|
||||
|
||||
Заголовок = "Новое имя главной темы " + Строка(Новый УникальныйИдентификатор);
|
||||
Токен = ПараметрыФункции["Telegram_Token"];
|
||||
Заголовок = "Новое имя главной темы " + Строка(Новый УникальныйИдентификатор);
|
||||
Токен = ПараметрыФункции["Telegram_Token"];
|
||||
Чат = ПараметрыФункции["Telegram_ForumID"];
|
||||
|
||||
Результат = OPI_Telegram.ИзменитьИмяГлавнойТемыФорума(Токен, Чат, Заголовок);
|
||||
@@ -4845,7 +4845,7 @@
|
||||
|
||||
Проверка_ВККартинкаАльбома(Результат, ОписаниеКартинки, ИДАльбома); // SKIP
|
||||
|
||||
ИДКартинки = Результат["response"][0]["id"]; // SKIP
|
||||
ИДКартинки = Результат["response"][0]["id"]; // SKIP
|
||||
Результат = OPI_VK.УдалитьКартинку(ИДКартинки, Параметры); // SKIP
|
||||
|
||||
Результат = OPI_VK.СохранитьКартинкуВАльбом(ИДАльбома, ИВФ, ОписаниеКартинки, Параметры);
|
||||
@@ -6073,7 +6073,7 @@
|
||||
|
||||
Для Каждого Тег Из Результат["paths_to_tags"][0]["tags"] Цикл
|
||||
Если Тег["tag_text"] = "важное" Тогда
|
||||
ЕстьТег = Истина;
|
||||
ЕстьТег = Истина;
|
||||
КонецЕсли;
|
||||
КонецЦикла;
|
||||
|
||||
@@ -6212,8 +6212,8 @@
|
||||
IDРаботы = Результат["async_job_id"];
|
||||
|
||||
Пока ТекущийСтатус = "in_progress" Цикл
|
||||
Результат = OPI_Dropbox.ПолучитьСтатусАсинхронногоИзменения(Токен, IDРаботы);
|
||||
ТекущийСтатус = Результат[".tag"];
|
||||
Результат = OPI_Dropbox.ПолучитьСтатусАсинхронногоИзменения(Токен, IDРаботы);
|
||||
ТекущийСтатус = Результат[".tag"];
|
||||
OPI_Инструменты.Пауза(3);
|
||||
КонецЦикла;
|
||||
|
||||
@@ -6252,7 +6252,7 @@
|
||||
|
||||
Процедура Dropbox_ОтменитьПубликациюФайла(ПараметрыФункции)
|
||||
|
||||
Токен = ПараметрыФункции["Dropbox_Token"];
|
||||
Токен = ПараметрыФункции["Dropbox_Token"];
|
||||
Файл = ПараметрыФункции["Dropbox_FileID"];
|
||||
|
||||
Результат = OPI_Dropbox.ОтменитьПубликациюФайла(Токен, Файл);
|
||||
@@ -6623,9 +6623,9 @@
|
||||
// Полную структуру полей можно получить функцией ПолучитьСтруктуруЗадачи()
|
||||
|
||||
СтруктураЗадачи = Новый Структура;
|
||||
СтруктураЗадачи.Вставить("TITLE", "Другой заголовок задачи");
|
||||
СтруктураЗадачи.Вставить("TITLE" , "Другой заголовок задачи");
|
||||
СтруктураЗадачи.Вставить("DESCRIPTION", "Другое описание задачи");
|
||||
СтруктураЗадачи.Вставить("PRIORITY", "1");
|
||||
СтруктураЗадачи.Вставить("PRIORITY" , "1");
|
||||
|
||||
URL = ПараметрыФункции["Bitrix24_URL"];
|
||||
IDЗадачи = ПараметрыФункции["Bitrix24_HookTaskID"];
|
||||
@@ -7222,7 +7222,7 @@
|
||||
|
||||
Процедура Bitrix24_ПолучитьХранилище(ПараметрыФункции)
|
||||
|
||||
URL = ПараметрыФункции["Bitrix24_URL"];
|
||||
URL = ПараметрыФункции["Bitrix24_URL"];
|
||||
IDХранилища = 3;
|
||||
|
||||
Результат = OPI_Bitrix24.ПолучитьХранилище(URL, IDХранилища);
|
||||
@@ -7373,7 +7373,7 @@
|
||||
|
||||
Процедура Bitrix24_ПолучитьВнешнююСсылкуКаталога(ПараметрыФункции)
|
||||
|
||||
URL = ПараметрыФункции["Bitrix24_URL"];
|
||||
URL = ПараметрыФункции["Bitrix24_URL"];
|
||||
IDКаталога = ПараметрыФункции["Bitrix24_FolderID"];
|
||||
|
||||
Результат = OPI_Bitrix24.ПолучитьВнешнююСсылкуКаталога(URL, IDКаталога);
|
||||
@@ -7420,7 +7420,7 @@
|
||||
|
||||
Процедура Bitrix24_ПолучитьДочерниеЭлементыКаталога(ПараметрыФункции)
|
||||
|
||||
URL = ПараметрыФункции["Bitrix24_URL"];
|
||||
URL = ПараметрыФункции["Bitrix24_URL"];
|
||||
IDКаталога = ПараметрыФункции["Bitrix24_FolderID"];
|
||||
|
||||
Результат = OPI_Bitrix24.ПолучитьДочерниеЭлементыКаталога(URL, IDКаталога);
|
||||
@@ -7444,7 +7444,7 @@
|
||||
|
||||
Процедура Bitrix24_ПоместитьКаталогВКорзину(ПараметрыФункции)
|
||||
|
||||
URL = ПараметрыФункции["Bitrix24_URL"];
|
||||
URL = ПараметрыФункции["Bitrix24_URL"];
|
||||
IDКаталога = ПараметрыФункции["Bitrix24_FolderID"];
|
||||
|
||||
Результат = OPI_Bitrix24.ПоместитьКаталогВКорзину(URL, IDКаталога);
|
||||
@@ -9171,7 +9171,7 @@
|
||||
|
||||
Вложения = Новый Массив;
|
||||
Вложения.Добавить(OPI_Bitrix24.ПолучитьБлокКартинки("Картинка1", Картинка));
|
||||
Вложения.Добавить(OPI_Bitrix24.ПолучитьБлокФайла("Файл1.docx", Файл));
|
||||
Вложения.Добавить(OPI_Bitrix24.ПолучитьБлокФайла("Файл1.docx" , Файл));
|
||||
|
||||
Результат = OPI_Bitrix24.ОтправитьСообщение(URL, IDЧата, Текст, Вложения);
|
||||
|
||||
@@ -9223,7 +9223,7 @@
|
||||
|
||||
Вложения = Новый Массив;
|
||||
Вложения.Добавить(OPI_Bitrix24.ПолучитьБлокКартинки("Картинка1", Картинка));
|
||||
Вложения.Добавить(OPI_Bitrix24.ПолучитьБлокФайла("Файл1.docx", Файл));
|
||||
Вложения.Добавить(OPI_Bitrix24.ПолучитьБлокФайла("Файл1.docx" , Файл));
|
||||
|
||||
Результат = OPI_Bitrix24.ИзменитьСообщение(URL, IDСообщения, Текст, Вложения, Токен);
|
||||
|
||||
@@ -9436,7 +9436,7 @@
|
||||
|
||||
Вложения = Новый Массив;
|
||||
Вложения.Добавить(OPI_Bitrix24.ПолучитьБлокКартинки("Картинка1", Картинка));
|
||||
Вложения.Добавить(OPI_Bitrix24.ПолучитьБлокФайла("Файл1.docx", Файл));
|
||||
Вложения.Добавить(OPI_Bitrix24.ПолучитьБлокФайла("Файл1.docx" , Файл));
|
||||
|
||||
Результат = OPI_Bitrix24.СоздатьПерсональноеУведомление(URL, IDПользователя, Текст, ,Вложения);
|
||||
|
||||
@@ -9478,7 +9478,7 @@
|
||||
|
||||
Вложения = Новый Массив;
|
||||
Вложения.Добавить(OPI_Bitrix24.ПолучитьБлокКартинки("Картинка1", Картинка));
|
||||
Вложения.Добавить(OPI_Bitrix24.ПолучитьБлокФайла("Файл1.docx", Файл));
|
||||
Вложения.Добавить(OPI_Bitrix24.ПолучитьБлокФайла("Файл1.docx" , Файл));
|
||||
|
||||
Результат = OPI_Bitrix24.СоздатьСистемноеУведомление(URL, IDПользователя, Текст, ,Вложения);
|
||||
|
||||
|
@@ -310,7 +310,7 @@
|
||||
КонецЕсли;
|
||||
|
||||
Если ТипЗнч(Значение) = Тип("Строка") Тогда
|
||||
Значение = ПолучитьФайлПути(Значение, ПараметрЛокальный);
|
||||
Значение = ПолучитьФайлПути(Значение, ПараметрЛокальный);
|
||||
КонецЕсли;
|
||||
|
||||
Возврат Значение;
|
||||
@@ -322,9 +322,9 @@
|
||||
Если СтрНайти(Путь, "http") > 0
|
||||
Или СтрНайти(Путь, "www") > 0 Тогда
|
||||
|
||||
ИВФ = ПолучитьИмяВременногоФайла();
|
||||
ИВФ = ПолучитьИмяВременногоФайла();
|
||||
КопироватьФайл(Путь, ИВФ);
|
||||
Путь = ИВФ;
|
||||
Путь = ИВФ;
|
||||
Двоичные = Новый ДвоичныеДанные(Путь);
|
||||
|
||||
Если СохранятьЛокально Тогда
|
||||
@@ -402,7 +402,7 @@
|
||||
|
||||
Функция ПутьКФайлуДанных()
|
||||
|
||||
Путь = "";
|
||||
Путь = "";
|
||||
ВозможныеПути = Новый Массив;
|
||||
ВозможныеПути.Добавить("./data.json");
|
||||
ВозможныеПути.Добавить("C:\GDrive\Мой диск\data.json");
|
||||
@@ -431,7 +431,7 @@
|
||||
|
||||
Процедура НовыйТест(ТаблицаЗначений, Знач Метод, Знач Синоним, Знач Раздел)
|
||||
|
||||
НовыйТест = ТаблицаЗначений.Добавить();
|
||||
НовыйТест = ТаблицаЗначений.Добавить();
|
||||
НовыйТест.Метод = Метод;
|
||||
НовыйТест.Синоним = Синоним;
|
||||
НовыйТест.Раздел = Раздел;
|
||||
|
@@ -109,9 +109,9 @@
|
||||
Иначе
|
||||
|
||||
Если ТипЗнч(Значение) = Тип("ДвоичныеДанные") Тогда
|
||||
Значение = ПолучитьСтрокуИзДвоичныхДанных(Значение);
|
||||
Значение = ПолучитьСтрокуИзДвоичныхДанных(Значение);
|
||||
Иначе
|
||||
Значение = OPI_Инструменты.ЧислоВСтроку(Значение);
|
||||
Значение = OPI_Инструменты.ЧислоВСтроку(Значение);
|
||||
КонецЕсли;
|
||||
|
||||
Файл = Новый Файл(Значение);
|
||||
@@ -177,14 +177,14 @@
|
||||
|
||||
Значение = СтрРазделить(Значение, ЗапятаяВКавычках, Ложь);
|
||||
|
||||
Для Н = 0 По Значение.ВГраница() Цикл
|
||||
Для Н = 0 По Значение.ВГраница() Цикл
|
||||
Значение[Н] = СокрЛП(Значение[Н]);
|
||||
КонецЦикла;
|
||||
|
||||
Иначе
|
||||
|
||||
Если ТипЗнч(Значение) = Тип("Число") Тогда
|
||||
Значение = OPI_Инструменты.ЧислоВСтроку(Значение);
|
||||
Значение = OPI_Инструменты.ЧислоВСтроку(Значение);
|
||||
КонецЕсли;
|
||||
|
||||
OPI_Инструменты.ЗначениеВМассив(Значение);
|
||||
@@ -204,7 +204,7 @@
|
||||
Если ТипЗнч(Значение) = Тип("Булево") Тогда
|
||||
Возврат;
|
||||
Иначе
|
||||
Значение = Булево(Значение);
|
||||
Значение = Булево(Значение);
|
||||
КонецЕсли;
|
||||
|
||||
Исключение
|
||||
@@ -286,11 +286,11 @@
|
||||
Если ТипЗнч(Значение) = Тип(Дата) Тогда
|
||||
Возврат;
|
||||
Иначе
|
||||
Значение = XMLЗначение(Тип(Дата), Значение);
|
||||
Значение = XMLЗначение(Тип(Дата), Значение);
|
||||
КонецЕсли;
|
||||
|
||||
Исключение
|
||||
ООД = Новый ОписаниеТипов(Дата);
|
||||
ООД = Новый ОписаниеТипов(Дата);
|
||||
Значение = ООД.ПривестиЗначение(Значение);
|
||||
КонецПопытки;
|
||||
|
||||
@@ -299,7 +299,7 @@
|
||||
Процедура ПолучитьЧисло(Значение) Экспорт
|
||||
|
||||
ОписаниеТипа = Новый ОписаниеТипов("Число");
|
||||
Значение = ОписаниеТипа.ПривестиЗначение(Значение);
|
||||
Значение = ОписаниеТипа.ПривестиЗначение(Значение);
|
||||
|
||||
КонецПроцедуры
|
||||
|
||||
@@ -309,7 +309,7 @@
|
||||
|
||||
Функция ЭтоКоллекция(Знач Значение)
|
||||
|
||||
Возврат ТипЗнч(Значение) = Тип("Массив")
|
||||
Возврат ТипЗнч(Значение) = Тип("Массив")
|
||||
Или ТипЗнч(Значение) = Тип("Структура")
|
||||
Или ТипЗнч(Значение) = Тип("Соответствие");
|
||||
|
||||
@@ -317,7 +317,7 @@
|
||||
|
||||
Функция ЭтоСимвольное(Знач Значение)
|
||||
|
||||
Возврат ТипЗнч(Значение) = Тип("Строка")
|
||||
Возврат ТипЗнч(Значение) = Тип("Строка")
|
||||
Или ТипЗнч(Значение) = Тип("Число")
|
||||
Или ТипЗнч(Значение) = Тип("Дата");
|
||||
|
||||
|
@@ -56,33 +56,33 @@
|
||||
#Область ЗапросыСТелом
|
||||
|
||||
Функция Post(Знач URL
|
||||
, Знач Параметры = ""
|
||||
, Знач Параметры = ""
|
||||
, Знач ДопЗаголовки = ""
|
||||
, Знач JSON = Истина
|
||||
, Знач ПолныйОтвет = Ложь
|
||||
, Знач ФайлОтвета = Неопределено) Экспорт
|
||||
, Знач JSON = Истина
|
||||
, Знач ПолныйОтвет = Ложь
|
||||
, Знач ФайлОтвета = Неопределено) Экспорт
|
||||
|
||||
Возврат ВыполнитьЗапросСТелом(URL, "POST", Параметры, ДопЗаголовки, JSON, ПолныйОтвет, ФайлОтвета);
|
||||
|
||||
КонецФункции
|
||||
|
||||
Функция Patch(Знач URL
|
||||
, Знач Параметры = ""
|
||||
, Знач Параметры = ""
|
||||
, Знач ДопЗаголовки = ""
|
||||
, Знач JSON = Истина
|
||||
, Знач ПолныйОтвет = Ложь
|
||||
, Знач ФайлОтвета = Неопределено) Экспорт
|
||||
, Знач JSON = Истина
|
||||
, Знач ПолныйОтвет = Ложь
|
||||
, Знач ФайлОтвета = Неопределено) Экспорт
|
||||
|
||||
Возврат ВыполнитьЗапросСТелом(URL, "PATCH", Параметры, ДопЗаголовки, JSON, ПолныйОтвет, ФайлОтвета);
|
||||
|
||||
КонецФункции
|
||||
|
||||
Функция Put(Знач URL
|
||||
, Знач Параметры = ""
|
||||
, Знач Параметры = ""
|
||||
, Знач ДопЗаголовки = ""
|
||||
, Знач JSON = Истина
|
||||
, Знач ПолныйОтвет = Ложь
|
||||
, Знач ФайлОтвета = Неопределено) Экспорт
|
||||
, Знач JSON = Истина
|
||||
, Знач ПолныйОтвет = Ложь
|
||||
, Знач ФайлОтвета = Неопределено) Экспорт
|
||||
|
||||
Возврат ВыполнитьЗапросСТелом(URL, "PUT", Параметры, ДопЗаголовки, JSON, ПолныйОтвет, ФайлОтвета);
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
, Знач Тело
|
||||
, Знач ДопЗаголовки
|
||||
, Знач ПолныйОтвет = Ложь
|
||||
, Знач ТипДанных = "application/octet-stream") Экспорт
|
||||
, Знач ТипДанных = "application/octet-stream") Экспорт
|
||||
|
||||
Возврат ВыполнитьЗапросСДвоичнымиДанными(URL, "POST", Тело, ДопЗаголовки, ПолныйОтвет, ТипДанных);
|
||||
|
||||
@@ -103,42 +103,42 @@
|
||||
#Область ЗапросыMultipart
|
||||
|
||||
Функция PostMultipart(Знач URL
|
||||
, Знач Параметры = ""
|
||||
, Знач Файлы = ""
|
||||
, Знач ТипКонтента = "image/jpeg"
|
||||
, Знач Параметры = ""
|
||||
, Знач Файлы = ""
|
||||
, Знач ТипКонтента = "image/jpeg"
|
||||
, Знач ДопЗаголовки = ""
|
||||
, Знач ФайлОтвета = Неопределено) Экспорт
|
||||
, Знач ФайлОтвета = Неопределено) Экспорт
|
||||
|
||||
Возврат ВыполнитьЗапросМультипарт(URL, "POST", Параметры, Файлы, ТипКонтента, ДопЗаголовки, ФайлОтвета);
|
||||
|
||||
КонецФункции
|
||||
|
||||
Функция PutMultipart(Знач URL
|
||||
, Знач Параметры = ""
|
||||
, Знач Файлы = ""
|
||||
, Знач ТипКонтента = "image/jpeg"
|
||||
, Знач Параметры = ""
|
||||
, Знач Файлы = ""
|
||||
, Знач ТипКонтента = "image/jpeg"
|
||||
, Знач ДопЗаголовки = ""
|
||||
, Знач ФайлОтвета = Неопределено) Экспорт
|
||||
, Знач ФайлОтвета = Неопределено) Экспорт
|
||||
|
||||
Возврат ВыполнитьЗапросМультипарт(URL, "PUT", Параметры, Файлы, ТипКонтента, ДопЗаголовки, ФайлОтвета);
|
||||
|
||||
КонецФункции
|
||||
|
||||
Функция PostMultipartRelated(Знач URL
|
||||
, Знач JSON = ""
|
||||
, Знач Файлы = ""
|
||||
, Знач JSON = ""
|
||||
, Знач Файлы = ""
|
||||
, Знач ДопЗаголовки = ""
|
||||
, Знач ФайлОтвета = Неопределено) Экспорт
|
||||
, Знач ФайлОтвета = Неопределено) Экспорт
|
||||
|
||||
Возврат ВыполнитьЗапросМультипартРелэйтед(URL, "POST", JSON, Файлы, ДопЗаголовки, ФайлОтвета);
|
||||
|
||||
КонецФункции
|
||||
|
||||
Функция PatchMultipartRelated(Знач URL
|
||||
, Знач JSON = ""
|
||||
, Знач Файлы = ""
|
||||
, Знач JSON = ""
|
||||
, Знач Файлы = ""
|
||||
, Знач ДопЗаголовки = ""
|
||||
, Знач ФайлОтвета = Неопределено) Экспорт
|
||||
, Знач ФайлОтвета = Неопределено) Экспорт
|
||||
|
||||
Возврат ВыполнитьЗапросМультипартРелэйтед(URL, "PATCH", JSON, Файлы, ДопЗаголовки, ФайлОтвета);
|
||||
|
||||
@@ -157,13 +157,13 @@
|
||||
ФайлТела = Ответ.ПолучитьИмяФайлаТела();
|
||||
|
||||
Если Не ФайлТела = Неопределено Тогда
|
||||
Ответ = ФайлТела;
|
||||
Ответ = ФайлТела;
|
||||
Возврат;
|
||||
КонецЕсли;
|
||||
|
||||
GZip = "gzip";
|
||||
НужнаРаспаковка =
|
||||
Ответ.Заголовки.Получить("Content-Encoding") = GZip
|
||||
Ответ.Заголовки.Получить("Content-Encoding") = GZip
|
||||
Или Ответ.Заголовки.Получить("content-encoding") = GZip;
|
||||
|
||||
Если НужнаРаспаковка Тогда
|
||||
@@ -241,7 +241,7 @@
|
||||
|
||||
СтрокаПараметров = СтрокаПараметров
|
||||
+ Параметр.Ключ
|
||||
+ "="
|
||||
+ " ="
|
||||
+ ЗначениеПараметра
|
||||
+ "&";
|
||||
КонецЦикла;
|
||||
@@ -255,14 +255,14 @@
|
||||
Функция РазбитьURL(Знач URL) Экспорт
|
||||
|
||||
URL = СтрЗаменить(URL, "https://", "");
|
||||
URL = СтрЗаменить(URL, "http://", "");
|
||||
URL = СтрЗаменить(URL, ":443", "");
|
||||
URL = СтрЗаменить(URL, "http://" , "");
|
||||
URL = СтрЗаменить(URL, ":443" , "");
|
||||
|
||||
Адрес = Прав(URL, СтрДлина(URL) - СтрНайти(URL, "/", НаправлениеПоиска.СНачала) + 1);
|
||||
Сервер = Лев(URL, СтрНайти(URL, "/", НаправлениеПоиска.СНачала) - 1);
|
||||
|
||||
Попытка
|
||||
SSL = Новый ЗащищенноеСоединениеOpenSSL;
|
||||
SSL = Новый ЗащищенноеСоединениеOpenSSL;
|
||||
Исключение
|
||||
Сервер = "https://" + Сервер;
|
||||
КонецПопытки;
|
||||
@@ -326,7 +326,7 @@
|
||||
|
||||
ЧтениеJSON = Новый ЧтениеJSON;
|
||||
ЧтениеJSON.ОткрытьФайл(Путь);
|
||||
Значения = ПрочитатьJSON(ЧтениеJSON);
|
||||
Значения = ПрочитатьJSON(ЧтениеJSON);
|
||||
|
||||
ЧтениеJSON.Закрыть();
|
||||
|
||||
@@ -364,9 +364,9 @@
|
||||
Дата = ОТД.ПривестиЗначение(Дата);
|
||||
|
||||
UNIX = Формат(Дата - Дата(1970, 1, 1, 1, 0, 0), "ЧЦ=10; ЧДЦ=0; ЧГ=0");
|
||||
UNIX = СтрЗаменить(UNIX, ",", "");
|
||||
UNIX = СтрЗаменить(UNIX, "," , "");
|
||||
UNIX = СтрЗаменить(UNIX, Символы.НПП, "");
|
||||
UNIX = СтрЗаменить(UNIX, " ", "");
|
||||
UNIX = СтрЗаменить(UNIX, " " , "");
|
||||
UNIX = Лев(UNIX, 10);
|
||||
|
||||
Возврат UNIX;
|
||||
@@ -428,7 +428,7 @@
|
||||
|
||||
Значение_ = Новый Массив;
|
||||
Значение_.Добавить(Значение);
|
||||
Значение = Значение_;
|
||||
Значение = Значение_;
|
||||
|
||||
КонецПроцедуры
|
||||
|
||||
@@ -502,13 +502,13 @@
|
||||
Возврат;
|
||||
КонецЕсли;
|
||||
|
||||
Если Тип = "Дата" Тогда
|
||||
Если Тип = "Дата" Тогда
|
||||
OPI_ПреобразованиеТипов.ПолучитьДату(Значение);
|
||||
Значение = UNIXTime(Значение);
|
||||
|
||||
ИначеЕсли Тип = "ДатаISO" Тогда
|
||||
OPI_ПреобразованиеТипов.ПолучитьДату(Значение);
|
||||
Значение = XMLСтрока(Значение);
|
||||
Значение = XMLСтрока(Значение);
|
||||
|
||||
ИначеЕсли Тип = "Коллекция" Тогда
|
||||
OPI_ПреобразованиеТипов.ПолучитьКоллекцию(Значение);
|
||||
@@ -545,11 +545,11 @@
|
||||
|
||||
Функция ВыполнитьЗапросСТелом(Знач URL
|
||||
, Знач Вид
|
||||
, Знач Параметры = ""
|
||||
, Знач Параметры = ""
|
||||
, Знач ДопЗаголовки = ""
|
||||
, Знач JSON = Истина
|
||||
, Знач ПолныйОтвет = Ложь
|
||||
, Знач ФайлОтвета = Неопределено)
|
||||
, Знач JSON = Истина
|
||||
, Знач ПолныйОтвет = Ложь
|
||||
, Знач ФайлОтвета = Неопределено)
|
||||
|
||||
Если Не ЗначениеЗаполнено(Параметры) Тогда
|
||||
Параметры = Новый Структура;
|
||||
@@ -624,9 +624,9 @@
|
||||
|
||||
Функция ВыполнитьЗапросБезТела(Знач URL
|
||||
, Знач Вид
|
||||
, Знач Параметры = ""
|
||||
, Знач Параметры = ""
|
||||
, Знач ДопЗаголовки = ""
|
||||
, Знач ФайлОтвета = Неопределено)
|
||||
, Знач ФайлОтвета = Неопределено)
|
||||
|
||||
Если Не ЗначениеЗаполнено(Параметры) Тогда
|
||||
Параметры = Новый Структура;
|
||||
@@ -657,11 +657,11 @@
|
||||
|
||||
Функция ВыполнитьЗапросМультипарт(Знач URL
|
||||
, Знач Вид
|
||||
, Знач Параметры = ""
|
||||
, Знач Файлы = ""
|
||||
, Знач ТипКонтента = "image/jpeg"
|
||||
, Знач Параметры = ""
|
||||
, Знач Файлы = ""
|
||||
, Знач ТипКонтента = "image/jpeg"
|
||||
, Знач ДопЗаголовки = ""
|
||||
, Знач ФайлОтвета = Неопределено)
|
||||
, Знач ФайлОтвета = Неопределено)
|
||||
|
||||
Если Не ЗначениеЗаполнено(Параметры) Тогда
|
||||
Параметры = Новый Структура;
|
||||
@@ -730,10 +730,10 @@
|
||||
|
||||
Функция ВыполнитьЗапросМультипартРелэйтед(Знач URL
|
||||
, Знач Вид
|
||||
, Знач JSON = ""
|
||||
, Знач Файлы = ""
|
||||
, Знач JSON = ""
|
||||
, Знач Файлы = ""
|
||||
, Знач ДопЗаголовки = ""
|
||||
, Знач ФайлОтвета = Неопределено)
|
||||
, Знач ФайлОтвета = Неопределено)
|
||||
|
||||
Переадресация = 300;
|
||||
Ошибка = 400;
|
||||
@@ -809,12 +809,12 @@
|
||||
Функция ПреобразоватьПараметрВСтроку(Знач Значение)
|
||||
|
||||
Если ТипЗнч(Значение) = Тип("Массив") Тогда
|
||||
Значение = СтрСоединить(Значение, ",");
|
||||
Значение = КодироватьСтроку(Значение, СпособКодированияСтроки.URLВКодировкеURL);
|
||||
Значение = "[" + Значение + "]";
|
||||
Значение = СтрСоединить(Значение, ",");
|
||||
Значение = КодироватьСтроку(Значение, СпособКодированияСтроки.URLВКодировкеURL);
|
||||
Значение = "[" + Значение + "]";
|
||||
Иначе
|
||||
Значение = ЧислоВСтроку(Значение);
|
||||
Значение = КодироватьСтроку(Значение, СпособКодированияСтроки.URLВКодировкеURL);
|
||||
Значение = ЧислоВСтроку(Значение);
|
||||
Значение = КодироватьСтроку(Значение, СпособКодированияСтроки.URLВКодировкеURL);
|
||||
КонецЕсли;
|
||||
|
||||
Возврат Значение;
|
||||
@@ -834,10 +834,10 @@
|
||||
Иначе
|
||||
|
||||
Если ТипКонтента = "image/jpeg" Тогда
|
||||
ИмяПоля = "photo";
|
||||
ИмяПоля = "photo";
|
||||
Иначе
|
||||
ИмяПоля = Лев(ИмяФайла, СтрНайти(ИмяФайла, ".") - 1);
|
||||
ИмяПоля = ?(ЗначениеЗаполнено(ИмяПоля), ИмяПоля, СтрЗаменить(ДанныеФайла,
|
||||
ИмяПоля = Лев(ИмяФайла, СтрНайти(ИмяФайла, ".") - 1);
|
||||
ИмяПоля = ?(ЗначениеЗаполнено(ИмяПоля), ИмяПоля, СтрЗаменить(ДанныеФайла,
|
||||
ЗаменаТочки, "."));
|
||||
КонецЕсли;
|
||||
|
||||
@@ -858,7 +858,7 @@
|
||||
Если JSON Тогда
|
||||
Данные = JSONСтрокой(Параметры);
|
||||
ИначеЕсли Не Коллекция Тогда
|
||||
Данные = Параметры;
|
||||
Данные = Параметры;
|
||||
Иначе
|
||||
СтрокаПараметров = ПараметрыЗапросаВСтроку(Параметры);
|
||||
Данные = Прав(СтрокаПараметров, СтрДлина(СтрокаПараметров) - 1);
|
||||
@@ -879,7 +879,7 @@
|
||||
|
||||
Для Каждого Параметр Из Параметры Цикл
|
||||
|
||||
Если Параметр.Значение = Неопределено
|
||||
Если Параметр.Значение = Неопределено
|
||||
Или Параметр.Значение = NULL Тогда
|
||||
Продолжить;
|
||||
КонецЕсли;
|
||||
@@ -889,7 +889,7 @@
|
||||
ЗаписьТекста.ЗаписатьСтроку(РазделительСтрок);
|
||||
ЗаписьТекста.ЗаписатьСтроку(РазделительСтрок);
|
||||
|
||||
Если ТипЗнч(Параметр.Значение) = Тип("Строка")
|
||||
Если ТипЗнч(Параметр.Значение) = Тип("Строка")
|
||||
Или ТипЗнч(Параметр.Значение) = Тип("Число") Тогда
|
||||
|
||||
ЗначениеСтрокой = ЧислоВСтроку(Параметр.Значение);
|
||||
@@ -1102,7 +1102,7 @@
|
||||
РазмерЕСД = ZipРазмерEOCD();
|
||||
РазмерЛФХ = ZipРазмерLFH();
|
||||
|
||||
ЧтениеДанных = Новый ЧтениеДанных(СжатыеДанные);
|
||||
ЧтениеДанных = Новый ЧтениеДанных(СжатыеДанные);
|
||||
ЧтениеДанных.Пропустить(РазмерПрефиксаGZip);
|
||||
РазмерСжатыхДанных = ЧтениеДанных.ИсходныйПоток().Размер() - РазмерПрефиксаGZip - РазмерПостфиксаGZip;
|
||||
|
||||
@@ -1123,7 +1123,7 @@
|
||||
РазмерНесжатыхДанных = ЧтениеДанных.ПрочитатьЦелое32();
|
||||
ЧтениеДанных.Закрыть();
|
||||
|
||||
ЗаписьДанных.ЗаписатьБуферДвоичныхДанных(ZipDD(CRC32, РазмерСжатыхДанных, РазмерНесжатыхДанных));
|
||||
ЗаписьДанных.ЗаписатьБуферДвоичныхДанных(ZipDD(CRC32 , РазмерСжатыхДанных, РазмерНесжатыхДанных));
|
||||
ЗаписьДанных.ЗаписатьБуферДвоичныхДанных(ZipCDH(CRC32, РазмерСжатыхДанных, РазмерНесжатыхДанных));
|
||||
ЗаписьДанных.ЗаписатьБуферДвоичныхДанных(ZipEOCD(РазмерСжатыхДанных));
|
||||
ЗаписьДанных.Закрыть();
|
||||
@@ -1134,9 +1134,9 @@
|
||||
|
||||
Функция ПрочитатьZip(СжатыеДанные, ТекстОшибки = Неопределено)
|
||||
|
||||
Каталог = ПолучитьИмяВременногоФайла();
|
||||
ЧтениеZip = Новый ЧтениеZipФайла(СжатыеДанные);
|
||||
ИмяФайла = ЧтениеZip.Элементы[0].Имя;
|
||||
Каталог = ПолучитьИмяВременногоФайла();
|
||||
ЧтениеZip = Новый ЧтениеZipФайла(СжатыеДанные);
|
||||
ИмяФайла = ЧтениеZip.Элементы[0].Имя;
|
||||
Попытка
|
||||
ЧтениеZip.Извлечь(ЧтениеZip.Элементы[0], Каталог, РежимВосстановленияПутейФайловZIP.НеВосстанавливать);
|
||||
Исключение
|
||||
|
@@ -69,8 +69,8 @@
|
||||
КонецЕсли;
|
||||
|
||||
Если Ключ.Размер() <= РазмерБлока Тогда
|
||||
Ключ = ПолучитьHexСтрокуИзДвоичныхДанных(Ключ);
|
||||
Ключ = Лев(Ключ + ПовторитьСтроку("00", РазмерБлока), РазмерБлока * Дважды);
|
||||
Ключ = ПолучитьHexСтрокуИзДвоичныхДанных(Ключ);
|
||||
Ключ = Лев(Ключ + ПовторитьСтроку("00", РазмерБлока), РазмерБлока * Дважды);
|
||||
КонецЕсли;
|
||||
|
||||
Ключ = ПолучитьБуферДвоичныхДанныхИзДвоичныхДанных(ПолучитьДвоичныеДанныеИзHexСтроки(Ключ));
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// OneScript: ./OInt/core/Modules/OPI_Airtable.os
|
||||
// OneScript: ./OInt/core/Modules/OPI_Airtable.os
|
||||
// Lib: Airtable
|
||||
// CLI: airtable
|
||||
|
||||
@@ -102,7 +102,7 @@
|
||||
|
||||
OPI_ПреобразованиеТипов.ПолучитьКоллекцию(КоллекцияТаблиц);
|
||||
|
||||
Если Не ТипЗнч(КоллекцияТаблиц) = Тип("Структура")
|
||||
Если Не ТипЗнч(КоллекцияТаблиц) = Тип("Структура")
|
||||
И Не ТипЗнч(КоллекцияТаблиц) = Тип("Соответствие") Тогда
|
||||
|
||||
ВызватьИсключение "Ошибка в данных коллекции таблиц";
|
||||
@@ -212,7 +212,7 @@
|
||||
OPI_ПреобразованиеТипов.ПолучитьСтроку(Таблица);
|
||||
OPI_ПреобразованиеТипов.ПолучитьКоллекцию(СтруктураПоля);
|
||||
|
||||
Если Не ТипЗнч(СтруктураПоля) = Тип("Структура")
|
||||
Если Не ТипЗнч(СтруктураПоля) = Тип("Структура")
|
||||
И Не ТипЗнч(СтруктураПоля) = Тип("Соответствие") Тогда
|
||||
|
||||
ВызватьИсключение "Ошибка в данных описания поля";
|
||||
@@ -493,7 +493,7 @@
|
||||
СтрокаЗаписей = "";
|
||||
|
||||
Для Каждого Запись Из Записи Цикл
|
||||
СтрокаЗаписей = СтрокаЗаписей
|
||||
СтрокаЗаписей = СтрокаЗаписей
|
||||
+ ?(ЗначениеЗаполнено(СтрокаЗаписей), "&", "?")
|
||||
+ "records[]="
|
||||
+ OPI_Инструменты.ЧислоВСтроку(Запись);
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// OneScript: ./OInt/core/Modules/OPI_Bitrix24.os
|
||||
// OneScript: ./OInt/core/Modules/OPI_Bitrix24.os
|
||||
// Lib: Bitrix24
|
||||
// CLI: bitrix24
|
||||
|
||||
@@ -182,10 +182,10 @@
|
||||
Строка_ = "Строка";
|
||||
|
||||
Параметры = НормализоватьАвторизацию(URL, Токен, "log.blogpost.add");
|
||||
OPI_Инструменты.ДобавитьПоле("POST_MESSAGE", Текст , Строка_, Параметры);
|
||||
OPI_Инструменты.ДобавитьПоле("POST_TITLE" , Заголовок , Строка_, Параметры);
|
||||
OPI_Инструменты.ДобавитьПоле("POST_MESSAGE", Текст , Строка_ , Параметры);
|
||||
OPI_Инструменты.ДобавитьПоле("POST_TITLE" , Заголовок , Строка_ , Параметры);
|
||||
OPI_Инструменты.ДобавитьПоле("DEST" , Видимость , "Массив", Параметры);
|
||||
OPI_Инструменты.ДобавитьПоле("IMPORTANT" , Важное , Строка_, Параметры);
|
||||
OPI_Инструменты.ДобавитьПоле("IMPORTANT" , Важное , Строка_ , Параметры);
|
||||
|
||||
Если ЗначениеЗаполнено(Файлы) Тогда
|
||||
|
||||
@@ -233,10 +233,10 @@
|
||||
Строка_ = "Строка";
|
||||
|
||||
Параметры = НормализоватьАвторизацию(URL, Токен, "log.blogpost.update");
|
||||
OPI_Инструменты.ДобавитьПоле("POST_MESSAGE", Текст , Строка_, Параметры);
|
||||
OPI_Инструменты.ДобавитьПоле("POST_TITLE" , Заголовок , Строка_, Параметры);
|
||||
OPI_Инструменты.ДобавитьПоле("POST_MESSAGE", Текст , Строка_ , Параметры);
|
||||
OPI_Инструменты.ДобавитьПоле("POST_TITLE" , Заголовок , Строка_ , Параметры);
|
||||
OPI_Инструменты.ДобавитьПоле("DEST" , Видимость , "Массив", Параметры);
|
||||
OPI_Инструменты.ДобавитьПоле("POST_ID" , IDНовости , Строка_, Параметры);
|
||||
OPI_Инструменты.ДобавитьПоле("POST_ID" , IDНовости , Строка_ , Параметры);
|
||||
|
||||
Если ЗначениеЗаполнено(Файлы) Тогда
|
||||
|
||||
@@ -815,7 +815,7 @@
|
||||
|
||||
Параметры = НормализоватьАвторизацию(URL, Токен, "tasks.task.getaccess");
|
||||
OPI_Инструменты.ДобавитьПоле("taskId", IDЗадачи , "Строка" , Параметры);
|
||||
OPI_Инструменты.ДобавитьПоле("users" , Пользователи, "Массив", Параметры);
|
||||
OPI_Инструменты.ДобавитьПоле("users" , Пользователи, "Массив" , Параметры);
|
||||
|
||||
Ответ = OPI_Инструменты.Post(URL, Параметры);
|
||||
|
||||
@@ -964,7 +964,7 @@
|
||||
Функция ПолучитьСтруктуруЗадачи(Знач URL, Знач Токен = "") Экспорт
|
||||
|
||||
Параметры = НормализоватьАвторизацию(URL, Токен, "tasks.task.getFields");
|
||||
Ответ = OPI_Инструменты.Get(URL, Параметры);
|
||||
Ответ = OPI_Инструменты.Get(URL, Параметры);
|
||||
|
||||
Возврат Ответ;
|
||||
|
||||
@@ -1534,9 +1534,9 @@
|
||||
Параметры = НормализоватьАвторизацию(URL, Токен, "task.stages.update");
|
||||
Поля = Новый Структура;
|
||||
|
||||
OPI_Инструменты.ДобавитьПоле("TITLE" , Наименование , Строка_, Поля);
|
||||
OPI_Инструменты.ДобавитьПоле("COLOR" , Цвет , Строка_, Поля);
|
||||
OPI_Инструменты.ДобавитьПоле("AFTER_ID" , IDПредыдущей , Строка_, Поля);
|
||||
OPI_Инструменты.ДобавитьПоле("TITLE" , Наименование , Строка_ , Поля);
|
||||
OPI_Инструменты.ДобавитьПоле("COLOR" , Цвет , Строка_ , Поля);
|
||||
OPI_Инструменты.ДобавитьПоле("AFTER_ID" , IDПредыдущей , Строка_ , Поля);
|
||||
OPI_Инструменты.ДобавитьПоле("isAdmin" , КакАдминистратор, "Булево", Поля);
|
||||
|
||||
OPI_Инструменты.ДобавитьПоле("id" , IDСтадии, Строка_ , Параметры);
|
||||
@@ -1864,7 +1864,7 @@
|
||||
// Соответствие Из КлючИЗначение - сериализованный JSON ответа от Bitrxi24
|
||||
Функция ПолучитьХранилищеПриложения(Знач URL, Знач Токен = "") Экспорт
|
||||
|
||||
Параметры = НормализоватьАвторизацию(URL, Токен, "disk.storage.getforapp");
|
||||
Параметры = НормализоватьАвторизацию(URL, Токен, "disk.storage.getforapp");
|
||||
Ответ = OPI_Инструменты.Post(URL, Параметры);
|
||||
|
||||
Возврат Ответ;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// OneScript: ./OInt/core/Modules/OPI_Dropbox.os
|
||||
// OneScript: ./OInt/core/Modules/OPI_Dropbox.os
|
||||
// Lib: Dropbox
|
||||
// CLI: dropbox
|
||||
|
||||
@@ -655,7 +655,7 @@
|
||||
КонецЦикла;
|
||||
|
||||
Параметры = Новый Структура;
|
||||
OPI_Инструменты.ДобавитьПоле("file" , IDФайла , Строка_, Параметры);
|
||||
OPI_Инструменты.ДобавитьПоле("file" , IDФайла , Строка_ , Параметры);
|
||||
OPI_Инструменты.ДобавитьПоле("members", МассивПользователей , "Массив", Параметры);
|
||||
|
||||
Режим = ?(ТолькоПросмотр, "viewer", "editor");
|
||||
@@ -706,7 +706,7 @@
|
||||
КонецЦикла;
|
||||
|
||||
Параметры = Новый Структура;
|
||||
OPI_Инструменты.ДобавитьПоле("shared_folder_id", IDПапки , Строка_, Параметры);
|
||||
OPI_Инструменты.ДобавитьПоле("shared_folder_id", IDПапки , Строка_ , Параметры);
|
||||
OPI_Инструменты.ДобавитьПоле("members" , МассивПользователей , "Массив", Параметры);
|
||||
|
||||
Заголовки = ПолучитьЗаголовкиЗапроса(Токен);
|
||||
@@ -920,7 +920,7 @@
|
||||
|
||||
Коммит = Новый Структура();
|
||||
OPI_Инструменты.ДобавитьПоле("mode", Режим, "Строка", Коммит);
|
||||
OPI_Инструменты.ДобавитьПоле("path", Путь, "Строка", Коммит);
|
||||
OPI_Инструменты.ДобавитьПоле("path", Путь , "Строка", Коммит);
|
||||
|
||||
Курсор = Новый Структура("offset,session_id", ОбщийРазмер, Сессия);
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// OneScript: ./OInt/core/Modules/OPI_GoogleCalendar.os
|
||||
// OneScript: ./OInt/core/Modules/OPI_GoogleCalendar.os
|
||||
// Lib: Google Calendar
|
||||
// CLI: gcalendar
|
||||
|
||||
@@ -416,8 +416,8 @@
|
||||
OPI_ПреобразованиеТипов.ПолучитьСтроку(КалендарьПриемник);
|
||||
OPI_ПреобразованиеТипов.ПолучитьСтроку(Событие);
|
||||
|
||||
Заголовки = OPI_GoogleWorkspace.ПолучитьЗаголовокАвторизации(Токен);
|
||||
URL = "https://www.googleapis.com/calendar/v3/calendars/"
|
||||
Заголовки = OPI_GoogleWorkspace.ПолучитьЗаголовокАвторизации(Токен);
|
||||
URL = "https://www.googleapis.com/calendar/v3/calendars/"
|
||||
+ КалендарьИсточник
|
||||
+ "/events/"
|
||||
+ Событие
|
||||
@@ -491,7 +491,7 @@
|
||||
Возврат Неопределено;
|
||||
КонецЕсли;
|
||||
|
||||
Если Дата = НачалоДня(Дата) Тогда
|
||||
Если Дата = НачалоДня(Дата) Тогда
|
||||
ФорматДаты = "ДФ=yyyy-MM-dd";
|
||||
Поле = "date";
|
||||
Иначе
|
||||
@@ -566,7 +566,7 @@
|
||||
Параметры.Вставить("attachments", Вложения);
|
||||
|
||||
ПараметрыURL = Новый Структура;
|
||||
ПараметрыURL.Вставить("sendUpdates" , ?(Уведомления, "all", "none"));
|
||||
ПараметрыURL.Вставить("sendUpdates" , ?(Уведомления , "all" , "none"));
|
||||
ПараметрыURL.Вставить("supportsAttachments" , ?(ЗначениеЗаполнено(Вложения), "true", "false"));
|
||||
|
||||
URL = URL + OPI_Инструменты.ПараметрыЗапросаВСтроку(ПараметрыURL);
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// OneScript: ./OInt/core/Modules/OPI_GoogleDrive.os
|
||||
// OneScript: ./OInt/core/Modules/OPI_GoogleDrive.os
|
||||
// Lib: Google Drive
|
||||
// CLI: gdrive
|
||||
|
||||
@@ -539,7 +539,7 @@
|
||||
Описание = Новый Соответствие;
|
||||
КонецЕсли;
|
||||
|
||||
Заголовки = OPI_GoogleWorkspace.ПолучитьЗаголовокАвторизации(Токен);
|
||||
Заголовки = OPI_GoogleWorkspace.ПолучитьЗаголовокАвторизации(Токен);
|
||||
СформироватьПараметрыЗагрузкиФайла(Описание);
|
||||
ОписаниеJSON = OPI_Инструменты.JSONСтрокой(Описание);
|
||||
|
||||
@@ -614,9 +614,9 @@
|
||||
|
||||
Функция ЗагрузитьФайлЧастями(Знач Двоичные, Знач АдресЗагрузки)
|
||||
|
||||
Ответ = "";
|
||||
РазмерЧасти = 268435456;
|
||||
ПрочитаноБайт = 0;
|
||||
Ответ = "";
|
||||
РазмерЧасти = 268435456;
|
||||
ПрочитаноБайт = 0;
|
||||
ТекущаяПозиция = 0;
|
||||
ОбщийРазмер = Двоичные.Размер();
|
||||
СтрОбщийРазмер = OPI_Инструменты.ЧислоВСтроку(ОбщийРазмер);
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// OneScript: ./OInt/core/Modules/OPI_GoogleSheets.os
|
||||
// OneScript: ./OInt/core/Modules/OPI_GoogleSheets.os
|
||||
// Lib: Google Sheets
|
||||
// CLI: gsheets
|
||||
|
||||
@@ -251,7 +251,7 @@
|
||||
OPI_ПреобразованиеТипов.ПолучитьСтроку(Книга);
|
||||
OPI_ПреобразованиеТипов.ПолучитьКоллекцию(СоответствиеЗначений);
|
||||
|
||||
Если Не ТипЗнч(СоответствиеЗначений) = Тип("Структура")
|
||||
Если Не ТипЗнч(СоответствиеЗначений) = Тип("Структура")
|
||||
И Не ТипЗнч(СоответствиеЗначений) = Тип("Соответствие") Тогда
|
||||
Возврат "Не удалось привести структуру значений к коллекции";
|
||||
КонецЕсли;
|
||||
@@ -317,14 +317,14 @@
|
||||
OPI_ПреобразованиеТипов.ПолучитьКоллекцию(МассивЯчеек);
|
||||
СформироватьМассивИменЯчеек(МассивЯчеек, Лист);
|
||||
|
||||
Первый = Истина;
|
||||
Первый = Истина;
|
||||
Для Каждого Ячейка Из МассивЯчеек Цикл
|
||||
Разделитель = ?(Первый, "?", "&");
|
||||
URL = URL + Разделитель + "ranges=" + Ячейка;
|
||||
Первый = Ложь;
|
||||
КонецЦикла;
|
||||
Иначе
|
||||
URL = URL + "?ranges='" + Лист + "'";
|
||||
URL = URL + "?ranges ='" + Лист + "'";
|
||||
КонецЕсли;
|
||||
|
||||
Ответ = OPI_Инструменты.Get(URL, , Заголовки);
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// OneScript: ./OInt/core/Modules/OPI_GoogleWorkspace.os
|
||||
// OneScript: ./OInt/core/Modules/OPI_GoogleWorkspace.os
|
||||
// Lib: Google Workspace
|
||||
// CLI: google
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// OneScript: ./OInt/core/Modules/OPI_Notion.os
|
||||
// OneScript: ./OInt/core/Modules/OPI_Notion.os
|
||||
// Lib: Notion
|
||||
// CLI: notion
|
||||
|
||||
@@ -160,9 +160,9 @@
|
||||
|
||||
Если ЗначениеЗаполнено(Данные)
|
||||
И (ТипЗнч(Данные) = Тип("Соответствие") Или ТипЗнч(Данные) = Тип("Структура")) Тогда
|
||||
Свойства = ЗаполнитьДанныеПоСхеме(Страница, Данные, Токен, Ложь);
|
||||
Свойства = ЗаполнитьДанныеПоСхеме(Страница, Данные, Токен, Ложь);
|
||||
Иначе
|
||||
Свойства = Новый Соответствие;
|
||||
Свойства = Новый Соответствие;
|
||||
КонецЕсли;
|
||||
|
||||
Если ЗначениеЗаполнено(Иконка) Тогда
|
||||
@@ -235,7 +235,7 @@
|
||||
// Все страницы, которые будут созданы как дочерние, должны иметь свойства базы-родителя
|
||||
|
||||
Если Не ТипЗнч(Свойства) = Тип("Структура") И Не ТипЗнч(Свойства) = Тип("Соответствие") Тогда
|
||||
Свойства = Новый Структура("Наименование", "title");
|
||||
Свойства = Новый Структура("Наименование", "title");
|
||||
КонецЕсли;
|
||||
|
||||
Заголовки = СоздатьЗаголовкиЗапроса(Токен);
|
||||
@@ -339,7 +339,7 @@
|
||||
OPI_ПреобразованиеТипов.ПолучитьКоллекцию(Блок);
|
||||
|
||||
Если ТипЗнч(Блок) = Тип("Массив") Тогда
|
||||
Блок = Блок[0];
|
||||
Блок = Блок[0];
|
||||
КонецЕсли;
|
||||
|
||||
Заголовки = СоздатьЗаголовкиЗапроса(Токен);
|
||||
@@ -347,7 +347,7 @@
|
||||
|
||||
Если ТипЗнч(Блок) = Тип("Строка") Тогда
|
||||
ПреобразоватьИД(Блок);
|
||||
Блок = ВернутьБлок(Токен, Блок);
|
||||
Блок = ВернутьБлок(Токен, Блок);
|
||||
КонецЕсли;
|
||||
|
||||
МассивБлоков = Новый Массив;
|
||||
@@ -603,7 +603,7 @@
|
||||
СоответствиеПараметров.Вставить(Свойство.Ключ, Новый Структура(Свойство.Значение, Новый Структура));
|
||||
|
||||
ИначеЕсли ТипЗнч(Свойство.Значение) = Тип("Структура")
|
||||
Или ТипЗнч(Свойство.Значение) = Тип("Соответствие") Тогда
|
||||
Или ТипЗнч(Свойство.Значение) = Тип("Соответствие") Тогда
|
||||
|
||||
ВыборЗначения = СформироватьЗначенияВыбора(Свойство.Значение);
|
||||
СоответствиеПараметров.Вставить(Свойство.Ключ, Новый Структура("select", ВыборЗначения));
|
||||
@@ -705,7 +705,7 @@
|
||||
|
||||
Функция ПреобразоватьЗначениеПоТипу(Знач Тип, Знач Значение)
|
||||
|
||||
Если Тип = "title" Тогда
|
||||
Если Тип = "title" Тогда
|
||||
Возврат ПреобразоватьЗаголовок(Значение);
|
||||
ИначеЕсли Тип = "rich_text" Тогда
|
||||
Возврат ПреобразоватьТекст(Значение);
|
||||
@@ -809,7 +809,7 @@
|
||||
|
||||
СтруктураДаты = Новый Структура;
|
||||
|
||||
Если Дата = НачалоДня(Дата) Тогда
|
||||
Если Дата = НачалоДня(Дата) Тогда
|
||||
ФорматДаты = "ДФ=yyyy-MM-dd";
|
||||
Иначе
|
||||
ФорматДаты = "ДФ=yyyy-MM-ddThh:mm:ssZ";
|
||||
@@ -834,9 +834,9 @@
|
||||
Функция ПреобразоватьПользователей(Знач МассивИД)
|
||||
|
||||
Если Не ТипЗнч(МассивИД) = Тип("Массив") Тогда
|
||||
МассивИД_ = Новый Массив;
|
||||
МассивИД_ = Новый Массив;
|
||||
МассивИД_.Добавить(МассивИД);
|
||||
МассивИД = МассивИД_;
|
||||
МассивИД = МассивИД_;
|
||||
КонецЕсли;
|
||||
|
||||
МассивПользователей = Новый Массив;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// OneScript: ./OInt/core/Modules/OPI_Slack.os
|
||||
// OneScript: ./OInt/core/Modules/OPI_Slack.os
|
||||
// Lib: Slack
|
||||
// CLI: slack
|
||||
|
||||
@@ -750,8 +750,8 @@
|
||||
ФайлСлак = Новый Структура("id, title", Идентификатор, Заголовок);
|
||||
|
||||
Параметры = Новый Структура;
|
||||
OPI_Инструменты.ДобавитьПоле("filename" , ИмяФайла, Строка_, Параметры);
|
||||
OPI_Инструменты.ДобавитьПоле("channel_id", Канал , Строка_, Параметры);
|
||||
OPI_Инструменты.ДобавитьПоле("filename" , ИмяФайла, Строка_ , Параметры);
|
||||
OPI_Инструменты.ДобавитьПоле("channel_id", Канал , Строка_ , Параметры);
|
||||
OPI_Инструменты.ДобавитьПоле("files" , ФайлСлак, "Массив", Параметры);
|
||||
|
||||
Ответ = OPI_Инструменты.Post(URL, Параметры, Заголовки);
|
||||
@@ -1004,9 +1004,9 @@
|
||||
OPI_Инструменты.ДобавитьПоле("channel", Канал, "Строка", Параметры);
|
||||
|
||||
Если ВидЗапроса = "POST" Тогда
|
||||
Ответ = OPI_Инструменты.Post(URL, Параметры, Заголовки);
|
||||
Ответ = OPI_Инструменты.Post(URL, Параметры, Заголовки);
|
||||
Иначе
|
||||
Ответ = OPI_Инструменты.Get(URL, Параметры, Заголовки);
|
||||
Ответ = OPI_Инструменты.Get(URL, Параметры, Заголовки);
|
||||
КонецЕсли;
|
||||
|
||||
Возврат Ответ;
|
||||
@@ -1015,16 +1015,16 @@
|
||||
|
||||
Функция УправлениеФайлом(Знач Токен, Знач ИдентификаторФайла, Знач URL, Знач ВидЗапроса = "POST")
|
||||
|
||||
Заголовки = ПолучитьЗаголовокАвторизации(Токен);
|
||||
Заголовки = ПолучитьЗаголовокАвторизации(Токен);
|
||||
ВидЗапроса = вРег(ВидЗапроса);
|
||||
|
||||
Параметры = Новый Структура;
|
||||
OPI_Инструменты.ДобавитьПоле("file", ИдентификаторФайла , "Строка", Параметры);
|
||||
|
||||
Если ВидЗапроса = "POST" Тогда
|
||||
Ответ = OPI_Инструменты.Post(URL, Параметры, Заголовки);
|
||||
Ответ = OPI_Инструменты.Post(URL, Параметры, Заголовки);
|
||||
Иначе
|
||||
Ответ = OPI_Инструменты.Get(URL, Параметры, Заголовки);
|
||||
Ответ = OPI_Инструменты.Get(URL, Параметры, Заголовки);
|
||||
КонецЕсли;
|
||||
|
||||
Возврат Ответ;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// OneScript: ./OInt/core/Modules/OPI_Telegram.os
|
||||
// OneScript: ./OInt/core/Modules/OPI_Telegram.os
|
||||
// Lib: Telegram
|
||||
// CLI: telegram
|
||||
|
||||
@@ -221,9 +221,9 @@
|
||||
Финал = ПолучитьHexСтрокуИзДвоичныхДанных(Подпись);
|
||||
|
||||
Если Финал = вРег(Хэш) Тогда
|
||||
Ответ = Истина;
|
||||
Ответ = Истина;
|
||||
Иначе
|
||||
Ответ = Ложь;
|
||||
Ответ = Ложь;
|
||||
КонецЕсли;
|
||||
|
||||
СоответствиеВозврата.Вставить("passed", Ответ);
|
||||
@@ -615,7 +615,7 @@
|
||||
КонецЕсли;
|
||||
|
||||
Если ПодСообщением Тогда
|
||||
СтруктураПараметра = Новый Структура("inline_keyboard,rows", Строки, 1);
|
||||
СтруктураПараметра = Новый Структура("inline_keyboard,rows" , Строки, 1);
|
||||
Иначе
|
||||
СтруктураПараметра = Новый Структура("keyboard,resize_keyboard", Строки, Истина);
|
||||
КонецЕсли;
|
||||
@@ -1091,8 +1091,8 @@
|
||||
Функция УправлениеТемойФорума(Знач Токен
|
||||
, Знач IDЧата
|
||||
, Знач Заголовок = Неопределено
|
||||
, Знач IDИконки = Неопределено
|
||||
, Знач IDТемы = "")
|
||||
, Знач IDИконки = Неопределено
|
||||
, Знач IDТемы = "")
|
||||
|
||||
Строка_ = "Строка";
|
||||
OPI_ПреобразованиеТипов.ПолучитьСтроку(Токен);
|
||||
@@ -1106,7 +1106,7 @@
|
||||
Если ЗначениеЗаполнено(IDТемы) Тогда
|
||||
Метод = "/editForumTopic";
|
||||
Иначе
|
||||
Метод = "/createForumTopic";
|
||||
Метод = "/createForumTopic";
|
||||
КонецЕсли;
|
||||
|
||||
Ответ = OPI_Инструменты.Get("api.telegram.org/bot" + Токен + Метод, Параметры);
|
||||
@@ -1165,12 +1165,12 @@
|
||||
Закрыть = 2;
|
||||
Удалить = 3;
|
||||
|
||||
Если Статус = Открыть Тогда
|
||||
Метод = "/reopen" + Форум + "Topic";
|
||||
Если Статус = Открыть Тогда
|
||||
Метод = "/reopen" + Форум + "Topic";
|
||||
ИначеЕсли Статус = Закрыть Тогда
|
||||
Метод = "/close" + Форум + "Topic";
|
||||
Метод = "/close" + Форум + "Topic";
|
||||
ИначеЕсли Статус = Удалить Тогда
|
||||
Метод = "/deleteForumTopic";
|
||||
Метод = "/deleteForumTopic";
|
||||
Иначе
|
||||
ВызватьИсключение "Некорректный статус управления форумом";
|
||||
КонецЕсли;
|
||||
@@ -1212,16 +1212,16 @@
|
||||
|
||||
Функция ОпределитьМетодОтправки(Знач Вид)
|
||||
|
||||
Если Вид = "photo" Тогда
|
||||
Метод = "/sendPhoto";
|
||||
Если Вид = "photo" Тогда
|
||||
Метод = "/sendPhoto";
|
||||
ИначеЕсли Вид = "video" Тогда
|
||||
Метод = "/sendVideo";
|
||||
Метод = "/sendVideo";
|
||||
ИначеЕсли Вид = "audio" Тогда
|
||||
Метод = "/sendAudio";
|
||||
Метод = "/sendAudio";
|
||||
ИначеЕсли Вид = "animation" Тогда
|
||||
Метод = "/sendAnimation";
|
||||
Метод = "/sendAnimation";
|
||||
Иначе
|
||||
Метод = "/sendDocument";
|
||||
Метод = "/sendDocument";
|
||||
КонецЕсли;
|
||||
|
||||
Возврат Метод;
|
||||
@@ -1242,7 +1242,7 @@
|
||||
Если Не ЗначениеЗаполнено(ИмяФайла) Тогда
|
||||
ИмяФайла = Вид + Строка(Счетчик);
|
||||
|
||||
Если Вид = "animation" Тогда
|
||||
Если Вид = "animation" Тогда
|
||||
ИмяФайла = ИмяФайла + ".gif";
|
||||
КонецЕсли;
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// OneScript: ./OInt/core/Modules/OPI_Twitter.os
|
||||
// OneScript: ./OInt/core/Modules/OPI_Twitter.os
|
||||
// Lib: Twitter
|
||||
// CLI: twitter
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
ПараметрыURL.Вставить("code_challenge_method", "plain");
|
||||
|
||||
ПараметрыURL = OPI_Инструменты.ПараметрыЗапросаВСтроку(ПараметрыURL);
|
||||
Линк = "https://twitter.com/i/oauth2/authorize" + ПараметрыURL;
|
||||
Линк = "https://twitter.com/i/oauth2/authorize" + ПараметрыURL;
|
||||
|
||||
Возврат Линк;
|
||||
|
||||
@@ -568,33 +568,33 @@
|
||||
|
||||
Для Каждого Поле Из Поля Цикл
|
||||
|
||||
НоваяСтрока = ТаблицаПараметров.Добавить();
|
||||
НоваяСтрока = ТаблицаПараметров.Добавить();
|
||||
НоваяСтрока.Ключ = Поле.Ключ;
|
||||
НоваяСтрока.Значение = Поле.Значение;
|
||||
|
||||
КонецЦикла;
|
||||
|
||||
НоваяСтрока = ТаблицаПараметров.Добавить();
|
||||
НоваяСтрока = ТаблицаПараметров.Добавить();
|
||||
НоваяСтрока.Ключ = OCK;
|
||||
НоваяСтрока.Значение = Параметры[OCK];
|
||||
|
||||
НоваяСтрока = ТаблицаПараметров.Добавить();
|
||||
НоваяСтрока = ТаблицаПараметров.Добавить();
|
||||
НоваяСтрока.Ключ = OTK;
|
||||
НоваяСтрока.Значение = Параметры[OTK];
|
||||
|
||||
НоваяСтрока = ТаблицаПараметров.Добавить();
|
||||
НоваяСтрока = ТаблицаПараметров.Добавить();
|
||||
НоваяСтрока.Ключ = "oauth_version";
|
||||
НоваяСтрока.Значение = ВерсияАпи;
|
||||
|
||||
НоваяСтрока = ТаблицаПараметров.Добавить();
|
||||
НоваяСтрока = ТаблицаПараметров.Добавить();
|
||||
НоваяСтрока.Ключ = "oauth_signature_method";
|
||||
НоваяСтрока.Значение = МетодХэширования;
|
||||
|
||||
НоваяСтрока = ТаблицаПараметров.Добавить();
|
||||
НоваяСтрока = ТаблицаПараметров.Добавить();
|
||||
НоваяСтрока.Ключ = "oauth_timestamp";
|
||||
НоваяСтрока.Значение = ТекущаяДатаUNIX;
|
||||
|
||||
НоваяСтрока = ТаблицаПараметров.Добавить();
|
||||
НоваяСтрока = ТаблицаПараметров.Добавить();
|
||||
НоваяСтрока.Ключ = "oauth_nonce";
|
||||
НоваяСтрока.Значение = ТекущаяДатаUNIX;
|
||||
|
||||
@@ -611,7 +611,7 @@
|
||||
|
||||
СтрокаСигнатуры = СтрокаСигнатуры
|
||||
+ СтрокаТаблицы.Ключ
|
||||
+ "="
|
||||
+ " ="
|
||||
+ СтрокаТаблицы.Значение
|
||||
+ "&";
|
||||
|
||||
@@ -620,7 +620,7 @@
|
||||
СтрокаСигнатуры = Лев(СтрокаСигнатуры, СтрДлина(СтрокаСигнатуры) - 1);
|
||||
СтрокаСигнатуры = вРег(ВидЗапроса)
|
||||
+ "&"
|
||||
+ КодироватьСтроку(URL, СпособКодированияСтроки.КодировкаURL)
|
||||
+ КодироватьСтроку(URL , СпособКодированияСтроки.КодировкаURL)
|
||||
+ "&"
|
||||
+ КодироватьСтроку(СтрокаСигнатуры, СпособКодированияСтроки.КодировкаURL);
|
||||
|
||||
@@ -635,16 +635,16 @@
|
||||
|
||||
Сигнатура = КодироватьСтроку(Base64Строка(Сигнатура), СпособКодированияСтроки.КодировкаURL);
|
||||
|
||||
Разделитель = """,";
|
||||
ЗаголовокАвторизации = ЗаголовокАвторизации
|
||||
Разделитель = """,";
|
||||
ЗаголовокАвторизации = ЗаголовокАвторизации
|
||||
+ "OAuth "
|
||||
+ "oauth_consumer_key=""" + Параметры[OCK] + Разделитель
|
||||
+ "oauth_token=""" + Параметры[OTK] + Разделитель
|
||||
+ "oauth_consumer_key =""" + Параметры[OCK] + Разделитель
|
||||
+ "oauth_token =""" + Параметры[OTK] + Разделитель
|
||||
+ "oauth_signature_method=""" + МетодХэширования + Разделитель
|
||||
+ "oauth_timestamp=""" + ТекущаяДатаUNIX + Разделитель
|
||||
+ "oauth_nonce=""" + ТекущаяДатаUNIX + Разделитель
|
||||
+ "oauth_version=""" + ВерсияАпи + Разделитель
|
||||
+ "oauth_signature=""" + Сигнатура;
|
||||
+ "oauth_timestamp =""" + ТекущаяДатаUNIX + Разделитель
|
||||
+ "oauth_nonce =""" + ТекущаяДатаUNIX + Разделитель
|
||||
+ "oauth_version =""" + ВерсияАпи + Разделитель
|
||||
+ "oauth_signature =""" + Сигнатура;
|
||||
|
||||
СоответствиеЗаголовка = Новый Соответствие;
|
||||
СоответствиеЗаголовка.Вставить("authorization", ЗаголовокАвторизации);
|
||||
@@ -665,7 +665,7 @@
|
||||
Функция ПолучитьСтатусОбработки(Знач Параметры, Знач Поля, Знач URL)
|
||||
|
||||
ProcessingInfo = "processing_info";
|
||||
Авторизация = СоздатьЗаголовокАвторизацииV1(Параметры, Поля, "POST", URL);
|
||||
Авторизация = СоздатьЗаголовокАвторизацииV1(Параметры, Поля, "POST", URL);
|
||||
|
||||
Ответ = OPI_Инструменты.Post(URL, Поля, Авторизация, Ложь);
|
||||
Информация = Ответ[ProcessingInfo];
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// OneScript: ./OInt/core/Modules/OPI_VK.os
|
||||
// OneScript: ./OInt/core/Modules/OPI_VK.os
|
||||
// Lib: VK
|
||||
// CLI: vk
|
||||
|
||||
@@ -449,7 +449,7 @@
|
||||
Загрузка = URL + Метод["Загрузка"];
|
||||
Сохранение = URL + Метод["Сохранение"];
|
||||
|
||||
Если ТипЗнч(Картинка) = Тип("Строка") Тогда
|
||||
Если ТипЗнч(Картинка) = Тип("Строка") Тогда
|
||||
КлючКартинка = СтрЗаменить(Картинка, ".", "___");
|
||||
OPI_ПреобразованиеТипов.ПолучитьДвоичныеДанные(Картинка);
|
||||
Иначе
|
||||
@@ -664,7 +664,7 @@
|
||||
|
||||
Параметры_.Вставить("object" , "wall" + Источник + "_" + OPI_Инструменты.ЧислоВСтроку(IDПоста));
|
||||
Параметры_.Вставить("group_id" , СтрЗаменить(Приемник, "-", ""));
|
||||
Параметры_.Вставить("mark_as_ads" , ?(Рекламный, 1, 0));
|
||||
Параметры_.Вставить("mark_as_ads" , ?(Рекламный , 1 , 0));
|
||||
|
||||
Ответ = OPI_Инструменты.Get("api.vk.com/method/wall.repost", Параметры_);
|
||||
|
||||
@@ -1757,7 +1757,7 @@
|
||||
|
||||
Функция ПолучитьИДКартинки(Знач Картинка, Знач Параметры, Знач Вид)
|
||||
|
||||
Response_ = "response";
|
||||
Response_ = "response";
|
||||
Ответ = ЗагрузитьФотоНаСервер(Картинка, Параметры, Вид);
|
||||
Результат = Ответ[Response_];
|
||||
|
||||
@@ -1779,7 +1779,7 @@
|
||||
|
||||
Функция ПолучитьСоответствиеКартинки(Знач Картинка, Знач Параметры, Знач Вид)
|
||||
|
||||
Ответ = ЗагрузитьФотоНаСервер(Картинка, Параметры, Вид);
|
||||
Ответ = ЗагрузитьФотоНаСервер(Картинка, Параметры, Вид);
|
||||
ОтветМассив = Ответ.Получить("response");
|
||||
|
||||
Если Не ЗначениеЗаполнено(ОтветМассив) Или Не ТипЗнч(ОтветМассив) = Тип("Массив") Тогда
|
||||
@@ -1798,8 +1798,8 @@
|
||||
|
||||
Функция ПолучитьМассивПодборок(Знач Подборки, Знач Параметры = "")
|
||||
|
||||
Response_ = "response";
|
||||
Подборки = ПолучитьПодборкиПоИД(Подборки, Параметры);
|
||||
Response_ = "response";
|
||||
Подборки = ПолучитьПодборкиПоИД(Подборки, Параметры);
|
||||
Результат = Подборки[Response_];
|
||||
|
||||
Если ЗначениеЗаполнено(Результат) Тогда
|
||||
@@ -1950,7 +1950,7 @@
|
||||
|
||||
Параметры_.Вставить("title" , Название);
|
||||
Параметры_.Вставить("main_album" , ?(Основная, 1, 0));
|
||||
Параметры_.Вставить("is_hidden" , ?(Скрытая, 1, 0));
|
||||
Параметры_.Вставить("is_hidden" , ?(Скрытая , 1, 0));
|
||||
|
||||
Если ЗначениеЗаполнено(ИДПодборки) Тогда
|
||||
Параметры_.Вставить("album_id", ИДПодборки);
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// OneScript: ./OInt/core/Modules/OPI_Viber.os
|
||||
// OneScript: ./OInt/core/Modules/OPI_Viber.os
|
||||
// Lib: Viber
|
||||
// CLI: viber
|
||||
|
||||
@@ -360,7 +360,7 @@
|
||||
|
||||
Если ЗначениеЗаполнено(Значение) Тогда
|
||||
|
||||
Если Тип = "file" Тогда
|
||||
Если Тип = "file" Тогда
|
||||
СтруктураПараметров.Вставить("media" , Значение["URL"]);
|
||||
СтруктураПараметров.Вставить("size" , Значение["Размер"]);
|
||||
СтруктураПараметров.Вставить("file_name", "Файл." + Значение["Расширение"]);
|
||||
@@ -375,7 +375,7 @@
|
||||
КонецЕсли;
|
||||
|
||||
Если ЭтоКанал Тогда
|
||||
СтруктураПараметров.Вставить("from", IDПользователя);
|
||||
СтруктураПараметров.Вставить("from" , IDПользователя);
|
||||
URL = "https://chatapi.viber.com/pa/post";
|
||||
Иначе
|
||||
СтруктураПараметров.Вставить("receiver", IDПользователя);
|
||||
@@ -399,7 +399,7 @@
|
||||
СтруктураОтправителя.Вставить("avatar", "");
|
||||
|
||||
СтруктураПараметров = Новый Структура;
|
||||
СтруктураПараметров.Вставить("sender", СтруктураОтправителя);
|
||||
СтруктураПараметров.Вставить("sender" , СтруктураОтправителя);
|
||||
СтруктураПараметров.Вставить("min_api_version", 1);
|
||||
|
||||
Возврат СтруктураПараметров;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// OneScript: ./OInt/core/Modules/OPI_YandexDisk.os
|
||||
// OneScript: ./OInt/core/Modules/OPI_YandexDisk.os
|
||||
// Lib: Yandex Disk
|
||||
// CLI: yadisk
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// OneScript: ./OInt/core/Modules/OPI_YandexID.os
|
||||
// OneScript: ./OInt/core/Modules/OPI_YandexID.os
|
||||
// Lib: Yandex ID
|
||||
// CLI: yandex
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// OneScript: ./OInt/tools/Modules/internal/Modules/OPI_Инструменты.os
|
||||
// OneScript: ./OInt/tools/Modules/internal/Modules/OPI_Инструменты.os
|
||||
|
||||
// MIT License
|
||||
|
||||
@@ -56,33 +56,33 @@
|
||||
#Область ЗапросыСТелом
|
||||
|
||||
Функция Post(Знач URL
|
||||
, Знач Параметры = ""
|
||||
, Знач Параметры = ""
|
||||
, Знач ДопЗаголовки = ""
|
||||
, Знач JSON = Истина
|
||||
, Знач ПолныйОтвет = Ложь
|
||||
, Знач ФайлОтвета = Неопределено) Экспорт
|
||||
, Знач JSON = Истина
|
||||
, Знач ПолныйОтвет = Ложь
|
||||
, Знач ФайлОтвета = Неопределено) Экспорт
|
||||
|
||||
Возврат ВыполнитьЗапросСТелом(URL, "POST", Параметры, ДопЗаголовки, JSON, ПолныйОтвет, ФайлОтвета);
|
||||
|
||||
КонецФункции
|
||||
|
||||
Функция Patch(Знач URL
|
||||
, Знач Параметры = ""
|
||||
, Знач Параметры = ""
|
||||
, Знач ДопЗаголовки = ""
|
||||
, Знач JSON = Истина
|
||||
, Знач ПолныйОтвет = Ложь
|
||||
, Знач ФайлОтвета = Неопределено) Экспорт
|
||||
, Знач JSON = Истина
|
||||
, Знач ПолныйОтвет = Ложь
|
||||
, Знач ФайлОтвета = Неопределено) Экспорт
|
||||
|
||||
Возврат ВыполнитьЗапросСТелом(URL, "PATCH", Параметры, ДопЗаголовки, JSON, ПолныйОтвет, ФайлОтвета);
|
||||
|
||||
КонецФункции
|
||||
|
||||
Функция Put(Знач URL
|
||||
, Знач Параметры = ""
|
||||
, Знач Параметры = ""
|
||||
, Знач ДопЗаголовки = ""
|
||||
, Знач JSON = Истина
|
||||
, Знач ПолныйОтвет = Ложь
|
||||
, Знач ФайлОтвета = Неопределено) Экспорт
|
||||
, Знач JSON = Истина
|
||||
, Знач ПолныйОтвет = Ложь
|
||||
, Знач ФайлОтвета = Неопределено) Экспорт
|
||||
|
||||
Возврат ВыполнитьЗапросСТелом(URL, "PUT", Параметры, ДопЗаголовки, JSON, ПолныйОтвет, ФайлОтвета);
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
, Знач Тело
|
||||
, Знач ДопЗаголовки
|
||||
, Знач ПолныйОтвет = Ложь
|
||||
, Знач ТипДанных = "application/octet-stream") Экспорт
|
||||
, Знач ТипДанных = "application/octet-stream") Экспорт
|
||||
|
||||
Возврат ВыполнитьЗапросСДвоичнымиДанными(URL, "POST", Тело, ДопЗаголовки, ПолныйОтвет, ТипДанных);
|
||||
|
||||
@@ -103,42 +103,42 @@
|
||||
#Область ЗапросыMultipart
|
||||
|
||||
Функция PostMultipart(Знач URL
|
||||
, Знач Параметры = ""
|
||||
, Знач Файлы = ""
|
||||
, Знач ТипКонтента = "image/jpeg"
|
||||
, Знач Параметры = ""
|
||||
, Знач Файлы = ""
|
||||
, Знач ТипКонтента = "image/jpeg"
|
||||
, Знач ДопЗаголовки = ""
|
||||
, Знач ФайлОтвета = Неопределено) Экспорт
|
||||
, Знач ФайлОтвета = Неопределено) Экспорт
|
||||
|
||||
Возврат ВыполнитьЗапросМультипарт(URL, "POST", Параметры, Файлы, ТипКонтента, ДопЗаголовки, ФайлОтвета);
|
||||
|
||||
КонецФункции
|
||||
|
||||
Функция PutMultipart(Знач URL
|
||||
, Знач Параметры = ""
|
||||
, Знач Файлы = ""
|
||||
, Знач ТипКонтента = "image/jpeg"
|
||||
, Знач Параметры = ""
|
||||
, Знач Файлы = ""
|
||||
, Знач ТипКонтента = "image/jpeg"
|
||||
, Знач ДопЗаголовки = ""
|
||||
, Знач ФайлОтвета = Неопределено) Экспорт
|
||||
, Знач ФайлОтвета = Неопределено) Экспорт
|
||||
|
||||
Возврат ВыполнитьЗапросМультипарт(URL, "PUT", Параметры, Файлы, ТипКонтента, ДопЗаголовки, ФайлОтвета);
|
||||
|
||||
КонецФункции
|
||||
|
||||
Функция PostMultipartRelated(Знач URL
|
||||
, Знач JSON = ""
|
||||
, Знач Файлы = ""
|
||||
, Знач JSON = ""
|
||||
, Знач Файлы = ""
|
||||
, Знач ДопЗаголовки = ""
|
||||
, Знач ФайлОтвета = Неопределено) Экспорт
|
||||
, Знач ФайлОтвета = Неопределено) Экспорт
|
||||
|
||||
Возврат ВыполнитьЗапросМультипартРелэйтед(URL, "POST", JSON, Файлы, ДопЗаголовки, ФайлОтвета);
|
||||
|
||||
КонецФункции
|
||||
|
||||
Функция PatchMultipartRelated(Знач URL
|
||||
, Знач JSON = ""
|
||||
, Знач Файлы = ""
|
||||
, Знач JSON = ""
|
||||
, Знач Файлы = ""
|
||||
, Знач ДопЗаголовки = ""
|
||||
, Знач ФайлОтвета = Неопределено) Экспорт
|
||||
, Знач ФайлОтвета = Неопределено) Экспорт
|
||||
|
||||
Возврат ВыполнитьЗапросМультипартРелэйтед(URL, "PATCH", JSON, Файлы, ДопЗаголовки, ФайлОтвета);
|
||||
|
||||
@@ -157,13 +157,13 @@
|
||||
ФайлТела = Ответ.ПолучитьИмяФайлаТела();
|
||||
|
||||
Если Не ФайлТела = Неопределено Тогда
|
||||
Ответ = ФайлТела;
|
||||
Ответ = ФайлТела;
|
||||
Возврат;
|
||||
КонецЕсли;
|
||||
|
||||
GZip = "gzip";
|
||||
НужнаРаспаковка =
|
||||
Ответ.Заголовки.Получить("Content-Encoding") = GZip
|
||||
Ответ.Заголовки.Получить("Content-Encoding") = GZip
|
||||
Или Ответ.Заголовки.Получить("content-encoding") = GZip;
|
||||
|
||||
Если НужнаРаспаковка Тогда
|
||||
@@ -241,7 +241,7 @@
|
||||
|
||||
СтрокаПараметров = СтрокаПараметров
|
||||
+ Параметр.Ключ
|
||||
+ "="
|
||||
+ " ="
|
||||
+ ЗначениеПараметра
|
||||
+ "&";
|
||||
КонецЦикла;
|
||||
@@ -255,14 +255,14 @@
|
||||
Функция РазбитьURL(Знач URL) Экспорт
|
||||
|
||||
URL = СтрЗаменить(URL, "https://", "");
|
||||
URL = СтрЗаменить(URL, "http://", "");
|
||||
URL = СтрЗаменить(URL, ":443", "");
|
||||
URL = СтрЗаменить(URL, "http://" , "");
|
||||
URL = СтрЗаменить(URL, ":443" , "");
|
||||
|
||||
Адрес = Прав(URL, СтрДлина(URL) - СтрНайти(URL, "/", НаправлениеПоиска.СНачала) + 1);
|
||||
Сервер = Лев(URL, СтрНайти(URL, "/", НаправлениеПоиска.СНачала) - 1);
|
||||
|
||||
Попытка
|
||||
SSL = Новый ЗащищенноеСоединениеOpenSSL;
|
||||
SSL = Новый ЗащищенноеСоединениеOpenSSL;
|
||||
Исключение
|
||||
Сервер = "https://" + Сервер;
|
||||
КонецПопытки;
|
||||
@@ -326,7 +326,7 @@
|
||||
|
||||
ЧтениеJSON = Новый ЧтениеJSON;
|
||||
ЧтениеJSON.ОткрытьФайл(Путь);
|
||||
Значения = ПрочитатьJSON(ЧтениеJSON);
|
||||
Значения = ПрочитатьJSON(ЧтениеJSON);
|
||||
|
||||
ЧтениеJSON.Закрыть();
|
||||
|
||||
@@ -364,9 +364,9 @@
|
||||
Дата = ОТД.ПривестиЗначение(Дата);
|
||||
|
||||
UNIX = Формат(Дата - Дата(1970, 1, 1, 1, 0, 0), "ЧЦ=10; ЧДЦ=0; ЧГ=0");
|
||||
UNIX = СтрЗаменить(UNIX, ",", "");
|
||||
UNIX = СтрЗаменить(UNIX, "," , "");
|
||||
UNIX = СтрЗаменить(UNIX, Символы.НПП, "");
|
||||
UNIX = СтрЗаменить(UNIX, " ", "");
|
||||
UNIX = СтрЗаменить(UNIX, " " , "");
|
||||
UNIX = Лев(UNIX, 10);
|
||||
|
||||
Возврат UNIX;
|
||||
@@ -428,7 +428,7 @@
|
||||
|
||||
Значение_ = Новый Массив;
|
||||
Значение_.Добавить(Значение);
|
||||
Значение = Значение_;
|
||||
Значение = Значение_;
|
||||
|
||||
КонецПроцедуры
|
||||
|
||||
@@ -502,13 +502,13 @@
|
||||
Возврат;
|
||||
КонецЕсли;
|
||||
|
||||
Если Тип = "Дата" Тогда
|
||||
Если Тип = "Дата" Тогда
|
||||
OPI_ПреобразованиеТипов.ПолучитьДату(Значение);
|
||||
Значение = UNIXTime(Значение);
|
||||
|
||||
ИначеЕсли Тип = "ДатаISO" Тогда
|
||||
OPI_ПреобразованиеТипов.ПолучитьДату(Значение);
|
||||
Значение = XMLСтрока(Значение);
|
||||
Значение = XMLСтрока(Значение);
|
||||
|
||||
ИначеЕсли Тип = "Коллекция" Тогда
|
||||
OPI_ПреобразованиеТипов.ПолучитьКоллекцию(Значение);
|
||||
@@ -545,11 +545,11 @@
|
||||
|
||||
Функция ВыполнитьЗапросСТелом(Знач URL
|
||||
, Знач Вид
|
||||
, Знач Параметры = ""
|
||||
, Знач Параметры = ""
|
||||
, Знач ДопЗаголовки = ""
|
||||
, Знач JSON = Истина
|
||||
, Знач ПолныйОтвет = Ложь
|
||||
, Знач ФайлОтвета = Неопределено)
|
||||
, Знач JSON = Истина
|
||||
, Знач ПолныйОтвет = Ложь
|
||||
, Знач ФайлОтвета = Неопределено)
|
||||
|
||||
Если Не ЗначениеЗаполнено(Параметры) Тогда
|
||||
Параметры = Новый Структура;
|
||||
@@ -624,9 +624,9 @@
|
||||
|
||||
Функция ВыполнитьЗапросБезТела(Знач URL
|
||||
, Знач Вид
|
||||
, Знач Параметры = ""
|
||||
, Знач Параметры = ""
|
||||
, Знач ДопЗаголовки = ""
|
||||
, Знач ФайлОтвета = Неопределено)
|
||||
, Знач ФайлОтвета = Неопределено)
|
||||
|
||||
Если Не ЗначениеЗаполнено(Параметры) Тогда
|
||||
Параметры = Новый Структура;
|
||||
@@ -657,11 +657,11 @@
|
||||
|
||||
Функция ВыполнитьЗапросМультипарт(Знач URL
|
||||
, Знач Вид
|
||||
, Знач Параметры = ""
|
||||
, Знач Файлы = ""
|
||||
, Знач ТипКонтента = "image/jpeg"
|
||||
, Знач Параметры = ""
|
||||
, Знач Файлы = ""
|
||||
, Знач ТипКонтента = "image/jpeg"
|
||||
, Знач ДопЗаголовки = ""
|
||||
, Знач ФайлОтвета = Неопределено)
|
||||
, Знач ФайлОтвета = Неопределено)
|
||||
|
||||
Если Не ЗначениеЗаполнено(Параметры) Тогда
|
||||
Параметры = Новый Структура;
|
||||
@@ -730,10 +730,10 @@
|
||||
|
||||
Функция ВыполнитьЗапросМультипартРелэйтед(Знач URL
|
||||
, Знач Вид
|
||||
, Знач JSON = ""
|
||||
, Знач Файлы = ""
|
||||
, Знач JSON = ""
|
||||
, Знач Файлы = ""
|
||||
, Знач ДопЗаголовки = ""
|
||||
, Знач ФайлОтвета = Неопределено)
|
||||
, Знач ФайлОтвета = Неопределено)
|
||||
|
||||
Переадресация = 300;
|
||||
Ошибка = 400;
|
||||
@@ -809,12 +809,12 @@
|
||||
Функция ПреобразоватьПараметрВСтроку(Знач Значение)
|
||||
|
||||
Если ТипЗнч(Значение) = Тип("Массив") Тогда
|
||||
Значение = СтрСоединить(Значение, ",");
|
||||
Значение = КодироватьСтроку(Значение, СпособКодированияСтроки.URLВКодировкеURL);
|
||||
Значение = "[" + Значение + "]";
|
||||
Значение = СтрСоединить(Значение, ",");
|
||||
Значение = КодироватьСтроку(Значение, СпособКодированияСтроки.URLВКодировкеURL);
|
||||
Значение = "[" + Значение + "]";
|
||||
Иначе
|
||||
Значение = ЧислоВСтроку(Значение);
|
||||
Значение = КодироватьСтроку(Значение, СпособКодированияСтроки.URLВКодировкеURL);
|
||||
Значение = ЧислоВСтроку(Значение);
|
||||
Значение = КодироватьСтроку(Значение, СпособКодированияСтроки.URLВКодировкеURL);
|
||||
КонецЕсли;
|
||||
|
||||
Возврат Значение;
|
||||
@@ -834,10 +834,10 @@
|
||||
Иначе
|
||||
|
||||
Если ТипКонтента = "image/jpeg" Тогда
|
||||
ИмяПоля = "photo";
|
||||
ИмяПоля = "photo";
|
||||
Иначе
|
||||
ИмяПоля = Лев(ИмяФайла, СтрНайти(ИмяФайла, ".") - 1);
|
||||
ИмяПоля = ?(ЗначениеЗаполнено(ИмяПоля), ИмяПоля, СтрЗаменить(ДанныеФайла,
|
||||
ИмяПоля = Лев(ИмяФайла, СтрНайти(ИмяФайла, ".") - 1);
|
||||
ИмяПоля = ?(ЗначениеЗаполнено(ИмяПоля), ИмяПоля, СтрЗаменить(ДанныеФайла,
|
||||
ЗаменаТочки, "."));
|
||||
КонецЕсли;
|
||||
|
||||
@@ -858,7 +858,7 @@
|
||||
Если JSON Тогда
|
||||
Данные = JSONСтрокой(Параметры);
|
||||
ИначеЕсли Не Коллекция Тогда
|
||||
Данные = Параметры;
|
||||
Данные = Параметры;
|
||||
Иначе
|
||||
СтрокаПараметров = ПараметрыЗапросаВСтроку(Параметры);
|
||||
Данные = Прав(СтрокаПараметров, СтрДлина(СтрокаПараметров) - 1);
|
||||
@@ -879,7 +879,7 @@
|
||||
|
||||
Для Каждого Параметр Из Параметры Цикл
|
||||
|
||||
Если Параметр.Значение = Неопределено
|
||||
Если Параметр.Значение = Неопределено
|
||||
Или Параметр.Значение = NULL Тогда
|
||||
Продолжить;
|
||||
КонецЕсли;
|
||||
@@ -889,7 +889,7 @@
|
||||
ЗаписьТекста.ЗаписатьСтроку(РазделительСтрок);
|
||||
ЗаписьТекста.ЗаписатьСтроку(РазделительСтрок);
|
||||
|
||||
Если ТипЗнч(Параметр.Значение) = Тип("Строка")
|
||||
Если ТипЗнч(Параметр.Значение) = Тип("Строка")
|
||||
Или ТипЗнч(Параметр.Значение) = Тип("Число") Тогда
|
||||
|
||||
ЗначениеСтрокой = ЧислоВСтроку(Параметр.Значение);
|
||||
@@ -1102,7 +1102,7 @@
|
||||
РазмерЕСД = ZipРазмерEOCD();
|
||||
РазмерЛФХ = ZipРазмерLFH();
|
||||
|
||||
ЧтениеДанных = Новый ЧтениеДанных(СжатыеДанные);
|
||||
ЧтениеДанных = Новый ЧтениеДанных(СжатыеДанные);
|
||||
ЧтениеДанных.Пропустить(РазмерПрефиксаGZip);
|
||||
РазмерСжатыхДанных = ЧтениеДанных.ИсходныйПоток().Размер() - РазмерПрефиксаGZip - РазмерПостфиксаGZip;
|
||||
|
||||
@@ -1123,7 +1123,7 @@
|
||||
РазмерНесжатыхДанных = ЧтениеДанных.ПрочитатьЦелое32();
|
||||
ЧтениеДанных.Закрыть();
|
||||
|
||||
ЗаписьДанных.ЗаписатьБуферДвоичныхДанных(ZipDD(CRC32, РазмерСжатыхДанных, РазмерНесжатыхДанных));
|
||||
ЗаписьДанных.ЗаписатьБуферДвоичныхДанных(ZipDD(CRC32 , РазмерСжатыхДанных, РазмерНесжатыхДанных));
|
||||
ЗаписьДанных.ЗаписатьБуферДвоичныхДанных(ZipCDH(CRC32, РазмерСжатыхДанных, РазмерНесжатыхДанных));
|
||||
ЗаписьДанных.ЗаписатьБуферДвоичныхДанных(ZipEOCD(РазмерСжатыхДанных));
|
||||
ЗаписьДанных.Закрыть();
|
||||
@@ -1134,9 +1134,9 @@
|
||||
|
||||
Функция ПрочитатьZip(СжатыеДанные, ТекстОшибки = Неопределено)
|
||||
|
||||
Каталог = ПолучитьИмяВременногоФайла();
|
||||
ЧтениеZip = Новый ЧтениеZipФайла(СжатыеДанные);
|
||||
ИмяФайла = ЧтениеZip.Элементы[0].Имя;
|
||||
Каталог = ПолучитьИмяВременногоФайла();
|
||||
ЧтениеZip = Новый ЧтениеZipФайла(СжатыеДанные);
|
||||
ИмяФайла = ЧтениеZip.Элементы[0].Имя;
|
||||
Попытка
|
||||
ЧтениеZip.Извлечь(ЧтениеZip.Элементы[0], Каталог, РежимВосстановленияПутейФайловZIP.НеВосстанавливать);
|
||||
Исключение
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// OneScript: ./OInt/tools/Modules/internal/Modules/OPI_Криптография.os
|
||||
// OneScript: ./OInt/tools/Modules/internal/Modules/OPI_Криптография.os
|
||||
|
||||
// MIT License
|
||||
|
||||
@@ -69,8 +69,8 @@
|
||||
КонецЕсли;
|
||||
|
||||
Если Ключ.Размер() <= РазмерБлока Тогда
|
||||
Ключ = ПолучитьHexСтрокуИзДвоичныхДанных(Ключ);
|
||||
Ключ = Лев(Ключ + ПовторитьСтроку("00", РазмерБлока), РазмерБлока * Дважды);
|
||||
Ключ = ПолучитьHexСтрокуИзДвоичныхДанных(Ключ);
|
||||
Ключ = Лев(Ключ + ПовторитьСтроку("00", РазмерБлока), РазмерБлока * Дважды);
|
||||
КонецЕсли;
|
||||
|
||||
Ключ = ПолучитьБуферДвоичныхДанныхИзДвоичныхДанных(ПолучитьДвоичныеДанныеИзHexСтроки(Ключ));
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// OneScript: ./OInt/tools/Modules/OPI_ПолучениеДанныхТестов.os
|
||||
// OneScript: ./OInt/tools/Modules/OPI_ПолучениеДанныхТестов.os
|
||||
|
||||
// MIT License
|
||||
|
||||
@@ -310,7 +310,7 @@
|
||||
КонецЕсли;
|
||||
|
||||
Если ТипЗнч(Значение) = Тип("Строка") Тогда
|
||||
Значение = ПолучитьФайлПути(Значение, ПараметрЛокальный);
|
||||
Значение = ПолучитьФайлПути(Значение, ПараметрЛокальный);
|
||||
КонецЕсли;
|
||||
|
||||
Возврат Значение;
|
||||
@@ -322,9 +322,9 @@
|
||||
Если СтрНайти(Путь, "http") > 0
|
||||
Или СтрНайти(Путь, "www") > 0 Тогда
|
||||
|
||||
ИВФ = ПолучитьИмяВременногоФайла();
|
||||
ИВФ = ПолучитьИмяВременногоФайла();
|
||||
КопироватьФайл(Путь, ИВФ);
|
||||
Путь = ИВФ;
|
||||
Путь = ИВФ;
|
||||
Двоичные = Новый ДвоичныеДанные(Путь);
|
||||
|
||||
Если СохранятьЛокально Тогда
|
||||
@@ -402,7 +402,7 @@
|
||||
|
||||
Функция ПутьКФайлуДанных()
|
||||
|
||||
Путь = "";
|
||||
Путь = "";
|
||||
ВозможныеПути = Новый Массив;
|
||||
ВозможныеПути.Добавить("./data.json");
|
||||
ВозможныеПути.Добавить("C:\GDrive\Мой диск\data.json");
|
||||
@@ -431,7 +431,7 @@
|
||||
|
||||
Процедура НовыйТест(ТаблицаЗначений, Знач Метод, Знач Синоним, Знач Раздел)
|
||||
|
||||
НовыйТест = ТаблицаЗначений.Добавить();
|
||||
НовыйТест = ТаблицаЗначений.Добавить();
|
||||
НовыйТест.Метод = Метод;
|
||||
НовыйТест.Синоним = Синоним;
|
||||
НовыйТест.Раздел = Раздел;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// OneScript: ./OInt/tools/Modules/OPI_ПреобразованиеТипов.os
|
||||
// OneScript: ./OInt/tools/Modules/OPI_ПреобразованиеТипов.os
|
||||
|
||||
// MIT License
|
||||
|
||||
@@ -109,9 +109,9 @@
|
||||
Иначе
|
||||
|
||||
Если ТипЗнч(Значение) = Тип("ДвоичныеДанные") Тогда
|
||||
Значение = ПолучитьСтрокуИзДвоичныхДанных(Значение);
|
||||
Значение = ПолучитьСтрокуИзДвоичныхДанных(Значение);
|
||||
Иначе
|
||||
Значение = OPI_Инструменты.ЧислоВСтроку(Значение);
|
||||
Значение = OPI_Инструменты.ЧислоВСтроку(Значение);
|
||||
КонецЕсли;
|
||||
|
||||
Файл = Новый Файл(Значение);
|
||||
@@ -177,14 +177,14 @@
|
||||
|
||||
Значение = СтрРазделить(Значение, ЗапятаяВКавычках, Ложь);
|
||||
|
||||
Для Н = 0 По Значение.ВГраница() Цикл
|
||||
Для Н = 0 По Значение.ВГраница() Цикл
|
||||
Значение[Н] = СокрЛП(Значение[Н]);
|
||||
КонецЦикла;
|
||||
|
||||
Иначе
|
||||
|
||||
Если ТипЗнч(Значение) = Тип("Число") Тогда
|
||||
Значение = OPI_Инструменты.ЧислоВСтроку(Значение);
|
||||
Значение = OPI_Инструменты.ЧислоВСтроку(Значение);
|
||||
КонецЕсли;
|
||||
|
||||
OPI_Инструменты.ЗначениеВМассив(Значение);
|
||||
@@ -204,7 +204,7 @@
|
||||
Если ТипЗнч(Значение) = Тип("Булево") Тогда
|
||||
Возврат;
|
||||
Иначе
|
||||
Значение = Булево(Значение);
|
||||
Значение = Булево(Значение);
|
||||
КонецЕсли;
|
||||
|
||||
Исключение
|
||||
@@ -286,11 +286,11 @@
|
||||
Если ТипЗнч(Значение) = Тип(Дата) Тогда
|
||||
Возврат;
|
||||
Иначе
|
||||
Значение = XMLЗначение(Тип(Дата), Значение);
|
||||
Значение = XMLЗначение(Тип(Дата), Значение);
|
||||
КонецЕсли;
|
||||
|
||||
Исключение
|
||||
ООД = Новый ОписаниеТипов(Дата);
|
||||
ООД = Новый ОписаниеТипов(Дата);
|
||||
Значение = ООД.ПривестиЗначение(Значение);
|
||||
КонецПопытки;
|
||||
|
||||
@@ -299,7 +299,7 @@
|
||||
Процедура ПолучитьЧисло(Значение) Экспорт
|
||||
|
||||
ОписаниеТипа = Новый ОписаниеТипов("Число");
|
||||
Значение = ОписаниеТипа.ПривестиЗначение(Значение);
|
||||
Значение = ОписаниеТипа.ПривестиЗначение(Значение);
|
||||
|
||||
КонецПроцедуры
|
||||
|
||||
@@ -309,7 +309,7 @@
|
||||
|
||||
Функция ЭтоКоллекция(Знач Значение)
|
||||
|
||||
Возврат ТипЗнч(Значение) = Тип("Массив")
|
||||
Возврат ТипЗнч(Значение) = Тип("Массив")
|
||||
Или ТипЗнч(Значение) = Тип("Структура")
|
||||
Или ТипЗнч(Значение) = Тип("Соответствие");
|
||||
|
||||
@@ -317,7 +317,7 @@
|
||||
|
||||
Функция ЭтоСимвольное(Знач Значение)
|
||||
|
||||
Возврат ТипЗнч(Значение) = Тип("Строка")
|
||||
Возврат ТипЗнч(Значение) = Тип("Строка")
|
||||
Или ТипЗнч(Значение) = Тип("Число")
|
||||
Или ТипЗнч(Значение) = Тип("Дата");
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// OneScript: ./OInt/tests/Modules/internal/OPI_Тесты.os
|
||||
// OneScript: ./OInt/tests/Modules/internal/OPI_Тесты.os
|
||||
|
||||
// MIT License
|
||||
|
||||
@@ -426,7 +426,7 @@
|
||||
VK_СделатьРепост(ПараметрыТеста);
|
||||
VK_НаписатьКомментарий(ПараметрыТеста);
|
||||
|
||||
OPI_VK.УдалитьПост(ИДПоста, Параметры);
|
||||
OPI_VK.УдалитьПост(ИДПоста , Параметры);
|
||||
OPI_VK.УдалитьПост(ПараметрыТеста["Repost"], Параметры);
|
||||
|
||||
OPI_Инструменты.Пауза(5);
|
||||
@@ -481,7 +481,7 @@
|
||||
|
||||
ПараметрыТеста = Новый Структура;
|
||||
|
||||
OPI_ПолучениеДанныхТестов.ПараметрВКоллекцию("VK_UserID", ПараметрыТеста);
|
||||
OPI_ПолучениеДанныхТестов.ПараметрВКоллекцию("VK_UserID" , ПараметрыТеста);
|
||||
OPI_ПолучениеДанныхТестов.ПараметрВКоллекцию("VK_CommunityToken", ПараметрыТеста);
|
||||
|
||||
VK_СформироватьКлавиатуру(ПараметрыТеста);
|
||||
@@ -504,7 +504,7 @@
|
||||
Процедура ВК_СоздатьТоварПодборку() Экспорт
|
||||
|
||||
ПараметрыТеста = Новый Структура;
|
||||
OPI_ПолучениеДанныхТестов.ПараметрВКоллекцию("Picture", ПараметрыТеста);
|
||||
OPI_ПолучениеДанныхТестов.ПараметрВКоллекцию("Picture" , ПараметрыТеста);
|
||||
OPI_ПолучениеДанныхТестов.ПараметрВКоллекцию("Picture2", ПараметрыТеста);
|
||||
|
||||
VK_СоздатьПодборкуТоваров(ПараметрыТеста);
|
||||
@@ -525,7 +525,7 @@
|
||||
Параметры = ПолучитьПараметрыВК();
|
||||
|
||||
ПараметрыТеста = Новый Структура;
|
||||
OPI_ПолучениеДанныхТестов.ПараметрВКоллекцию("Picture", ПараметрыТеста);
|
||||
OPI_ПолучениеДанныхТестов.ПараметрВКоллекцию("Picture" , ПараметрыТеста);
|
||||
OPI_ПолучениеДанныхТестов.ПараметрВКоллекцию("Picture2", ПараметрыТеста);
|
||||
|
||||
VK_СоздатьСвойствоТовара(ПараметрыТеста);
|
||||
@@ -692,7 +692,7 @@
|
||||
OPI_ПолучениеДанныхТестов.ОжидаетЧто(Результат["path"]).Равно("disk:" + ПутьКопии);
|
||||
|
||||
OPI_YandexDisk.УдалитьОбъект(Токен, ПутьОригинала, Ложь);
|
||||
OPI_YandexDisk.УдалитьОбъект(Токен, ПутьКопии, Ложь);
|
||||
OPI_YandexDisk.УдалитьОбъект(Токен, ПутьКопии , Ложь);
|
||||
|
||||
OPI_Инструменты.Пауза(5);
|
||||
|
||||
@@ -727,7 +727,7 @@
|
||||
|
||||
Процедура ЯДиск_ПолучитьСписокФайлов() Экспорт
|
||||
|
||||
Токен = OPI_ПолучениеДанныхТестов.ПолучитьПараметр("YandexDisk_Token");
|
||||
Токен = OPI_ПолучениеДанныхТестов.ПолучитьПараметр("YandexDisk_Token");
|
||||
Количество = 2;
|
||||
Отступ = 1;
|
||||
|
||||
@@ -767,7 +767,7 @@
|
||||
OPI_ПолучениеДанныхТестов.ОжидаетЧто(Результат["path"]).Равно("disk:" + ПутьКопии);
|
||||
|
||||
OPI_YandexDisk.УдалитьОбъект(Токен, ПутьОригинала, Ложь);
|
||||
OPI_YandexDisk.УдалитьОбъект(Токен, ПутьКопии, Ложь);
|
||||
OPI_YandexDisk.УдалитьОбъект(Токен, ПутьКопии , Ложь);
|
||||
|
||||
OPI_Инструменты.Пауза(5);
|
||||
|
||||
@@ -836,7 +836,7 @@
|
||||
|
||||
Процедура ЯДиск_ПолучитьСписокОпубликованных() Экспорт
|
||||
|
||||
Токен = OPI_ПолучениеДанныхТестов.ПолучитьПараметр("YandexDisk_Token");
|
||||
Токен = OPI_ПолучениеДанныхТестов.ПолучитьПараметр("YandexDisk_Token");
|
||||
Количество = 2;
|
||||
Отступ = 1;
|
||||
|
||||
@@ -1526,8 +1526,8 @@
|
||||
|
||||
ИмяЛиста = Результат["sheets"][Н]["properties"]["title"];
|
||||
OPI_ПолучениеДанныхТестов.ОжидаетЧто(ИмяЛиста).Равно(МассивЛистов[Н]);
|
||||
Лист = Результат["sheets"][Н]["properties"]["sheetId"];
|
||||
Лист = OPI_Инструменты.ЧислоВСтроку(Лист);
|
||||
Лист = Результат["sheets"][Н]["properties"]["sheetId"];
|
||||
Лист = OPI_Инструменты.ЧислоВСтроку(Лист);
|
||||
|
||||
КонецЦикла;
|
||||
|
||||
@@ -1838,8 +1838,8 @@
|
||||
Свойства.Вставить("Пользователь" , "people");
|
||||
|
||||
ВыборЗначения = Новый Соответствие;
|
||||
ВыборЗначения.Вставить("Новый", "green");
|
||||
ВыборЗначения.Вставить("В работе", "yellow");
|
||||
ВыборЗначения.Вставить("Новый" , "green");
|
||||
ВыборЗначения.Вставить("В работе" , "yellow");
|
||||
ВыборЗначения.Вставить("Удаленный", "red");
|
||||
Свойства.Вставить("Статус", ВыборЗначения);
|
||||
|
||||
@@ -1851,7 +1851,7 @@
|
||||
|
||||
База = Результат["id"];
|
||||
Заголовок = "Тестовый заголовок";
|
||||
Описание = "Тестовое описание";
|
||||
Описание = "Тестовое описание";
|
||||
|
||||
Свойства = Новый Соответствие;
|
||||
Свойства.Вставить("Почта", "rich_text"); // Тип поля "Почта" будет изменен с email на текст
|
||||
@@ -1910,7 +1910,7 @@
|
||||
Свойства.Вставить("Сайт" , "https://vector.ru");
|
||||
Свойства.Вставить("Почта" , "mail@vector.ru");
|
||||
Свойства.Вставить("Телефон" , "88005553535");
|
||||
Свойства.Вставить("Статус" , "Новый");
|
||||
Свойства.Вставить("Статус" , "Новый");
|
||||
|
||||
Результат = OPI_Notion.СоздатьСтраницуВБазу(Токен, База, Свойства);
|
||||
|
||||
@@ -1967,7 +1967,7 @@
|
||||
Проверка_НоушнОбъект(Результат, "list");
|
||||
|
||||
Блок = Результат["results"][0]["id"];
|
||||
Результат = OPI_Notion.ВернутьДочерниеБлоки(Токен, Блок);
|
||||
Результат = OPI_Notion.ВернутьДочерниеБлоки(Токен, Блок);
|
||||
|
||||
// !OInt OPI_ПолучениеДанныхТестов.ЗаписатьЛог(Результат, "ВернутьДочерниеБлоки");
|
||||
|
||||
@@ -2105,7 +2105,7 @@
|
||||
|
||||
Отметки.Добавить(Результат["ts"]);
|
||||
|
||||
Блок = OPI_Slack.СформироватьБлокКартинку(Картинка, "Yo");
|
||||
Блок = OPI_Slack.СформироватьБлокКартинку(Картинка, "Yo");
|
||||
БлокJSON = OPI_Инструменты.JSONСтрокой(Блок);
|
||||
|
||||
ИВФ = ПолучитьИмяВременногоФайла("json");
|
||||
@@ -2124,7 +2124,7 @@
|
||||
|
||||
Отметки.Добавить(Результат["ts"]);
|
||||
|
||||
Блоки = "['" + ИВФ + "','" + ИВФ + "']";
|
||||
Блоки = "['" + ИВФ + "','" + ИВФ + "']";
|
||||
Результат = OPI_Slack.ОтправитьСообщение(Токен, Канал, Текст, , Блоки);
|
||||
|
||||
// !OInt OPI_ПолучениеДанныхТестов.ЗаписатьЛог(Результат, "ОтправитьСообщение (json массив)");
|
||||
@@ -2750,7 +2750,7 @@
|
||||
|
||||
ПараметрыТеста = Новый Структура;
|
||||
OPI_ПолучениеДанныхТестов.ПараметрВКоллекцию("Dropbox_Token", ПараметрыТеста);
|
||||
OPI_ПолучениеДанныхТестов.ПараметрВКоллекцию("Picture", ПараметрыТеста);
|
||||
OPI_ПолучениеДанныхТестов.ПараметрВКоллекцию("Picture" , ПараметрыТеста);
|
||||
|
||||
Dropbox_ЗагрузитьФайл(ПараметрыТеста);
|
||||
Dropbox_ПолучитьИнформациюОбОбъекте(ПараметрыТеста);
|
||||
@@ -2787,7 +2787,7 @@
|
||||
|
||||
ПараметрыТеста = Новый Структура;
|
||||
OPI_ПолучениеДанныхТестов.ПараметрВКоллекцию("Dropbox_Token", ПараметрыТеста);
|
||||
OPI_ПолучениеДанныхТестов.ПараметрВКоллекцию("Document", ПараметрыТеста);
|
||||
OPI_ПолучениеДанныхТестов.ПараметрВКоллекцию("Document" , ПараметрыТеста);
|
||||
|
||||
Dropbox_ЗагрузитьФайлПоURL(ПараметрыТеста);
|
||||
Dropbox_ПолучитьСтатусЗагрузкиПоURL(ПараметрыТеста);
|
||||
@@ -3852,7 +3852,7 @@
|
||||
|
||||
Процедура Telegram_ПолучитьОбновления(ПараметрыФункции)
|
||||
|
||||
Токен = ПараметрыФункции["Telegram_Token"];
|
||||
Токен = ПараметрыФункции["Telegram_Token"];
|
||||
Результат = OPI_Telegram.ПолучитьОбновления(Токен);
|
||||
|
||||
// END
|
||||
@@ -4322,7 +4322,7 @@
|
||||
|
||||
Процедура Telegram_Бан(ПараметрыФункции)
|
||||
|
||||
Токен = ПараметрыФункции["Telegram_Token"];
|
||||
Токен = ПараметрыФункции["Telegram_Token"];
|
||||
IDПользователя = ПараметрыФункции["Telegram_ChatID"];
|
||||
IDКанала = ПараметрыФункции["Telegram_ChannelID"];
|
||||
|
||||
@@ -4447,7 +4447,7 @@
|
||||
|
||||
Процедура Telegram_СоздатьТемуФорума(ПараметрыФункции)
|
||||
|
||||
Токен = ПараметрыФункции["Telegram_Token"];
|
||||
Токен = ПараметрыФункции["Telegram_Token"];
|
||||
Чат = ПараметрыФункции["Telegram_ForumID"];
|
||||
Иконка = "5357419403325481346";
|
||||
Имя = "Тестовая тема " + Строка(Новый УникальныйИдентификатор);
|
||||
@@ -4466,8 +4466,8 @@
|
||||
|
||||
Проверка_ТелеграмСозданиеТемы(Результат, Имя, Иконка);
|
||||
|
||||
ЧатТема = Чат + "*" + Тема;
|
||||
Текст = ПараметрыФункции["String"];
|
||||
ЧатТема = Чат + "*" + Тема;
|
||||
Текст = ПараметрыФункции["String"];
|
||||
Результат = OPI_Telegram.ОтправитьТекстовоеСообщение(Токен, ЧатТема, Текст);
|
||||
|
||||
// !OInt OPI_ПолучениеДанныхТестов.ЗаписатьЛог(Результат, "ОтправитьТекстовоеСообщение (форум)");
|
||||
@@ -4478,7 +4478,7 @@
|
||||
|
||||
Процедура Telegram_ИзменитьТемуФорума(ПараметрыФункции)
|
||||
|
||||
Токен = ПараметрыФункции["Telegram_Token"];
|
||||
Токен = ПараметрыФункции["Telegram_Token"];
|
||||
Чат = ПараметрыФункции["Telegram_ForumID"];
|
||||
Тема = ПараметрыФункции["Telegram_TopicID"];
|
||||
НовоеИмя = "Новый тестовый заголовок";
|
||||
@@ -4498,7 +4498,7 @@
|
||||
|
||||
Процедура Telegram_ЗакрытьТемуФорума(ПараметрыФункции)
|
||||
|
||||
Токен = ПараметрыФункции["Telegram_Token"];
|
||||
Токен = ПараметрыФункции["Telegram_Token"];
|
||||
Чат = ПараметрыФункции["Telegram_ForumID"];
|
||||
Тема = ПараметрыФункции["Telegram_TopicID"];
|
||||
|
||||
@@ -4524,7 +4524,7 @@
|
||||
|
||||
Процедура Telegram_ОткрытьТемуФорума(ПараметрыФункции)
|
||||
|
||||
Токен = ПараметрыФункции["Telegram_Token"];
|
||||
Токен = ПараметрыФункции["Telegram_Token"];
|
||||
Чат = ПараметрыФункции["Telegram_ForumID"];
|
||||
Тема = ПараметрыФункции["Telegram_TopicID"];
|
||||
|
||||
@@ -4548,7 +4548,7 @@
|
||||
|
||||
Процедура Telegram_УдалитьТемуФорума(ПараметрыФункции)
|
||||
|
||||
Токен = ПараметрыФункции["Telegram_Token"];
|
||||
Токен = ПараметрыФункции["Telegram_Token"];
|
||||
Чат = ПараметрыФункции["Telegram_ForumID"];
|
||||
Тема = ПараметрыФункции["Telegram_TopicID"];
|
||||
|
||||
@@ -4566,7 +4566,7 @@
|
||||
|
||||
Процедура Telegram_ОчиститьСписокЗакрепленныхСообщенийТемы(ПараметрыФункции)
|
||||
|
||||
Токен = ПараметрыФункции["Telegram_Token"];
|
||||
Токен = ПараметрыФункции["Telegram_Token"];
|
||||
Чат = ПараметрыФункции["Telegram_ForumID"];
|
||||
Тема = ПараметрыФункции["Telegram_TopicID"];
|
||||
|
||||
@@ -4590,7 +4590,7 @@
|
||||
|
||||
Процедура Telegram_СкрытьГлавнуюТемуФорума(ПараметрыФункции)
|
||||
|
||||
Токен = ПараметрыФункции["Telegram_Token"];
|
||||
Токен = ПараметрыФункции["Telegram_Token"];
|
||||
Чат = ПараметрыФункции["Telegram_ForumID"];
|
||||
|
||||
Результат = OPI_Telegram.СкрытьГлавнуюТемуФорума(Токен, Чат);
|
||||
@@ -4607,7 +4607,7 @@
|
||||
|
||||
Процедура Telegram_ПоказатьГлавнуюТемуФорума(ПараметрыФункции)
|
||||
|
||||
Токен = ПараметрыФункции["Telegram_Token"];
|
||||
Токен = ПараметрыФункции["Telegram_Token"];
|
||||
Чат = ПараметрыФункции["Telegram_ForumID"];
|
||||
|
||||
Результат = OPI_Telegram.ПоказатьГлавнуюТемуФорума(Токен, Чат);
|
||||
@@ -4624,8 +4624,8 @@
|
||||
|
||||
Процедура Telegram_ИзменитьИмяГлавнойТемыФорума(ПараметрыФункции)
|
||||
|
||||
Заголовок = "Новое имя главной темы " + Строка(Новый УникальныйИдентификатор);
|
||||
Токен = ПараметрыФункции["Telegram_Token"];
|
||||
Заголовок = "Новое имя главной темы " + Строка(Новый УникальныйИдентификатор);
|
||||
Токен = ПараметрыФункции["Telegram_Token"];
|
||||
Чат = ПараметрыФункции["Telegram_ForumID"];
|
||||
|
||||
Результат = OPI_Telegram.ИзменитьИмяГлавнойТемыФорума(Токен, Чат, Заголовок);
|
||||
@@ -4845,7 +4845,7 @@
|
||||
|
||||
Проверка_ВККартинкаАльбома(Результат, ОписаниеКартинки, ИДАльбома); // SKIP
|
||||
|
||||
ИДКартинки = Результат["response"][0]["id"]; // SKIP
|
||||
ИДКартинки = Результат["response"][0]["id"]; // SKIP
|
||||
Результат = OPI_VK.УдалитьКартинку(ИДКартинки, Параметры); // SKIP
|
||||
|
||||
Результат = OPI_VK.СохранитьКартинкуВАльбом(ИДАльбома, ИВФ, ОписаниеКартинки, Параметры);
|
||||
@@ -6073,7 +6073,7 @@
|
||||
|
||||
Для Каждого Тег Из Результат["paths_to_tags"][0]["tags"] Цикл
|
||||
Если Тег["tag_text"] = "важное" Тогда
|
||||
ЕстьТег = Истина;
|
||||
ЕстьТег = Истина;
|
||||
КонецЕсли;
|
||||
КонецЦикла;
|
||||
|
||||
@@ -6212,8 +6212,8 @@
|
||||
IDРаботы = Результат["async_job_id"];
|
||||
|
||||
Пока ТекущийСтатус = "in_progress" Цикл
|
||||
Результат = OPI_Dropbox.ПолучитьСтатусАсинхронногоИзменения(Токен, IDРаботы);
|
||||
ТекущийСтатус = Результат[".tag"];
|
||||
Результат = OPI_Dropbox.ПолучитьСтатусАсинхронногоИзменения(Токен, IDРаботы);
|
||||
ТекущийСтатус = Результат[".tag"];
|
||||
OPI_Инструменты.Пауза(3);
|
||||
КонецЦикла;
|
||||
|
||||
@@ -6252,7 +6252,7 @@
|
||||
|
||||
Процедура Dropbox_ОтменитьПубликациюФайла(ПараметрыФункции)
|
||||
|
||||
Токен = ПараметрыФункции["Dropbox_Token"];
|
||||
Токен = ПараметрыФункции["Dropbox_Token"];
|
||||
Файл = ПараметрыФункции["Dropbox_FileID"];
|
||||
|
||||
Результат = OPI_Dropbox.ОтменитьПубликациюФайла(Токен, Файл);
|
||||
@@ -6623,9 +6623,9 @@
|
||||
// Полную структуру полей можно получить функцией ПолучитьСтруктуруЗадачи()
|
||||
|
||||
СтруктураЗадачи = Новый Структура;
|
||||
СтруктураЗадачи.Вставить("TITLE", "Другой заголовок задачи");
|
||||
СтруктураЗадачи.Вставить("TITLE" , "Другой заголовок задачи");
|
||||
СтруктураЗадачи.Вставить("DESCRIPTION", "Другое описание задачи");
|
||||
СтруктураЗадачи.Вставить("PRIORITY", "1");
|
||||
СтруктураЗадачи.Вставить("PRIORITY" , "1");
|
||||
|
||||
URL = ПараметрыФункции["Bitrix24_URL"];
|
||||
IDЗадачи = ПараметрыФункции["Bitrix24_HookTaskID"];
|
||||
@@ -7222,7 +7222,7 @@
|
||||
|
||||
Процедура Bitrix24_ПолучитьХранилище(ПараметрыФункции)
|
||||
|
||||
URL = ПараметрыФункции["Bitrix24_URL"];
|
||||
URL = ПараметрыФункции["Bitrix24_URL"];
|
||||
IDХранилища = 3;
|
||||
|
||||
Результат = OPI_Bitrix24.ПолучитьХранилище(URL, IDХранилища);
|
||||
@@ -7373,7 +7373,7 @@
|
||||
|
||||
Процедура Bitrix24_ПолучитьВнешнююСсылкуКаталога(ПараметрыФункции)
|
||||
|
||||
URL = ПараметрыФункции["Bitrix24_URL"];
|
||||
URL = ПараметрыФункции["Bitrix24_URL"];
|
||||
IDКаталога = ПараметрыФункции["Bitrix24_FolderID"];
|
||||
|
||||
Результат = OPI_Bitrix24.ПолучитьВнешнююСсылкуКаталога(URL, IDКаталога);
|
||||
@@ -7420,7 +7420,7 @@
|
||||
|
||||
Процедура Bitrix24_ПолучитьДочерниеЭлементыКаталога(ПараметрыФункции)
|
||||
|
||||
URL = ПараметрыФункции["Bitrix24_URL"];
|
||||
URL = ПараметрыФункции["Bitrix24_URL"];
|
||||
IDКаталога = ПараметрыФункции["Bitrix24_FolderID"];
|
||||
|
||||
Результат = OPI_Bitrix24.ПолучитьДочерниеЭлементыКаталога(URL, IDКаталога);
|
||||
@@ -7444,7 +7444,7 @@
|
||||
|
||||
Процедура Bitrix24_ПоместитьКаталогВКорзину(ПараметрыФункции)
|
||||
|
||||
URL = ПараметрыФункции["Bitrix24_URL"];
|
||||
URL = ПараметрыФункции["Bitrix24_URL"];
|
||||
IDКаталога = ПараметрыФункции["Bitrix24_FolderID"];
|
||||
|
||||
Результат = OPI_Bitrix24.ПоместитьКаталогВКорзину(URL, IDКаталога);
|
||||
@@ -9171,7 +9171,7 @@
|
||||
|
||||
Вложения = Новый Массив;
|
||||
Вложения.Добавить(OPI_Bitrix24.ПолучитьБлокКартинки("Картинка1", Картинка));
|
||||
Вложения.Добавить(OPI_Bitrix24.ПолучитьБлокФайла("Файл1.docx", Файл));
|
||||
Вложения.Добавить(OPI_Bitrix24.ПолучитьБлокФайла("Файл1.docx" , Файл));
|
||||
|
||||
Результат = OPI_Bitrix24.ОтправитьСообщение(URL, IDЧата, Текст, Вложения);
|
||||
|
||||
@@ -9223,7 +9223,7 @@
|
||||
|
||||
Вложения = Новый Массив;
|
||||
Вложения.Добавить(OPI_Bitrix24.ПолучитьБлокКартинки("Картинка1", Картинка));
|
||||
Вложения.Добавить(OPI_Bitrix24.ПолучитьБлокФайла("Файл1.docx", Файл));
|
||||
Вложения.Добавить(OPI_Bitrix24.ПолучитьБлокФайла("Файл1.docx" , Файл));
|
||||
|
||||
Результат = OPI_Bitrix24.ИзменитьСообщение(URL, IDСообщения, Текст, Вложения, Токен);
|
||||
|
||||
@@ -9436,7 +9436,7 @@
|
||||
|
||||
Вложения = Новый Массив;
|
||||
Вложения.Добавить(OPI_Bitrix24.ПолучитьБлокКартинки("Картинка1", Картинка));
|
||||
Вложения.Добавить(OPI_Bitrix24.ПолучитьБлокФайла("Файл1.docx", Файл));
|
||||
Вложения.Добавить(OPI_Bitrix24.ПолучитьБлокФайла("Файл1.docx" , Файл));
|
||||
|
||||
Результат = OPI_Bitrix24.СоздатьПерсональноеУведомление(URL, IDПользователя, Текст, ,Вложения);
|
||||
|
||||
@@ -9478,7 +9478,7 @@
|
||||
|
||||
Вложения = Новый Массив;
|
||||
Вложения.Добавить(OPI_Bitrix24.ПолучитьБлокКартинки("Картинка1", Картинка));
|
||||
Вложения.Добавить(OPI_Bitrix24.ПолучитьБлокФайла("Файл1.docx", Файл));
|
||||
Вложения.Добавить(OPI_Bitrix24.ПолучитьБлокФайла("Файл1.docx" , Файл));
|
||||
|
||||
Результат = OPI_Bitrix24.СоздатьСистемноеУведомление(URL, IDПользователя, Текст, ,Вложения);
|
||||
|
||||
|
Reference in New Issue
Block a user