Skip to content

Commit

Permalink
Преобразование OPI -> OInt (workflow)
Browse files Browse the repository at this point in the history
  • Loading branch information
VitalyTheAlpaca committed Jun 26, 2024
1 parent 64e8c9b commit ec1b3f2
Show file tree
Hide file tree
Showing 8 changed files with 3,946 additions and 3,404 deletions.
6,784 changes: 3,392 additions & 3,392 deletions service/dictionaries/en.json

Large diffs are not rendered by default.

69 changes: 69 additions & 0 deletions src/en/OInt/core/Modules/OPI_Bitrix24.os
Original file line number Diff line number Diff line change
Expand Up @@ -984,6 +984,75 @@ Function CreateStorageFolder(Val URL, Val StorageID, Val Name, Val Token = "") E

EndFunction

// Get folder information
// Get folder information
//
// Parameters:
// URL - String - URL of webhook or a Bitrix24 domain, when token used - url
// FolderID - String, Number - Folder identifier - folderid
// Token - String - Access token, when not-webhook method used - token
//
// Returns:
// Map Of KeyAndValue - serialized JSON of answer from Bitrix24 API
Function GetFolder(Val URL, Val FolderID, Val Token = "") Export

Response = FileManagement(URL, FolderID, "disk.folder.get", Token);
Return Response;

EndFunction

// Create new subfolder
// Create new folder inside another folder
//
// Parameters:
// URL - String - URL of webhook or a Bitrix24 domain, when token used - url
// FolderID - String, Number - Parent folder identifier - folderid
// Name - String - Name of new folder - title
// Token - String - Access token, when not-webhook method used - token
//
// Returns:
// Map Of KeyAndValue - serialized JSON of answer from Bitrix24 API
Function CreateSubfolder(Val URL, Val FolderID, Val Name, Val Token = "") Export

OPI_TypeConversion.GetLine(Name);

FolderStructure = New Structure("NAME", Name);

Parameters = NormalizeAuth(URL, Token, "disk.folder.addsubfolder");

OPI_Tools.AddField("id" , FolderID , "String" , Parameters);
OPI_Tools.AddField("data", FolderStructure, "Collection", Parameters);

Response = OPI_Tools.Post(URL, Parameters);

Return Response;

EndFunction

// Copy folder
// Copy one folder to another
//
// Parameters:
// URL - String - URL of webhook or a Bitrix24 domain, when token used - url
// FolderID - String, Number - Parent folder identifier - folderid
// DestinationID - String, Number - ID of target folder - tagetid
// Token - String - Access token, when not-webhook method used - token
//
// Returns:
// Map Of KeyAndValue - serialized JSON of answer from Bitrix24 API
Function CopyFolder(Val URL, Val FolderID, Val DestinationID, Val Token = "") Export

Parameters = NormalizeAuth(URL, Token, "disk.folder.copyto");

OPI_Tools.AddField("id" , FolderID , "String", Parameters);
OPI_Tools.AddField("targetFolderId", DestinationID, "String", Parameters);

Response = OPI_Tools.Post(URL, Parameters);

Return Response;

EndFunction

// Delete file
// Delete file by ID
//
Expand Down
89 changes: 89 additions & 0 deletions src/en/OInt/tests/Modules/internal/OPI_Tests.os
Original file line number Diff line number Diff line change
Expand Up @@ -2929,6 +2929,9 @@ Procedure B24_WorkingWithDrive() Export
Bitrix24_GetStorageObjects(TestParameters);
Bitrix24_DeleteFile(TestParameters);
Bitrix24_CreateStorageFolder(TestParameters);
Bitrix24_GetFolder(TestParameters);
Bitrix24_CreateSubfolder(TestParameters);
Bitrix24_CopyFolder(TestParameters);
Bitrix24_DeleteFolder(TestParameters);

EndProcedure
Expand Down Expand Up @@ -6965,6 +6968,92 @@ Procedure Bitrix24_RenameStorage(FunctionParameters)

EndProcedure

Procedure Bitrix24_GetFolder(FunctionParameters)

URL = FunctionParameters["Bitrix24_URL"];
FolderID = FunctionParameters["Bitrix24_FolderID"];

Result = OPI_Bitrix24.GetFolder(URL, FolderID);

OPI_TestDataRetrieval.WriteLog(Result, "GetFolder (wh)", "Bitrix24");

Check_BitrixFile(Result); // SKIP

URL = FunctionParameters["Bitrix24_Domain"];
Token = FunctionParameters["Bitrix24_Token"];

Result = OPI_Bitrix24.GetFolder(URL, FolderID, Token);

// END

OPI_TestDataRetrieval.WriteLog(Result, "GetFolder", "Bitrix24");

Check_BitrixFile(Result);

EndProcedure

Procedure Bitrix24_CreateSubfolder(FunctionParameters)

FolderID = FunctionParameters["Bitrix24_FolderID"];
Name = "New subfolder";
Filename2 = "New subfolder 2";

URL = FunctionParameters["Bitrix24_URL"];

Result = OPI_Bitrix24.CreateSubfolder(URL, FolderID, Filename2);

OPI_TestDataRetrieval.WriteLog(Result, "CreateSubfolder (wh)", "Bitrix24");

Check_BitrixFile(Result); // SKIP

SubfolderID = Result["result"]["ID"]; // SKIP
OPI_TestDataRetrieval.WriteParameter("Bitrix24_HookSubfolderID", SubfolderID); // SKIP
FunctionParameters.Insert("Bitrix24_HookSubfolderID", SubfolderID); // SKIP

URL = FunctionParameters["Bitrix24_Domain"];
Token = FunctionParameters["Bitrix24_Token"];

Result = OPI_Bitrix24.CreateSubfolder(URL, FolderID, Name, Token);

// END

OPI_TestDataRetrieval.WriteLog(Result, "CreateSubfolder", "Bitrix24");

Check_BitrixFile(Result);

SubfolderID = Result["result"]["ID"]; // SKIP
OPI_TestDataRetrieval.WriteParameter("Bitrix24_SubfolderID", SubfolderID); // SKIP
FunctionParameters.Insert("Bitrix24_SubfolderID", SubfolderID); // SKIP

EndProcedure

Procedure Bitrix24_CopyFolder(FunctionParameters)

DestinationID = FunctionParameters["Bitrix24_HookSubfolderID"];
FolderID = FunctionParameters["Bitrix24_SubfolderID"];

URL = FunctionParameters["Bitrix24_URL"];

Result = OPI_Bitrix24.CopyFolder(URL, FolderID, DestinationID);

OPI_TestDataRetrieval.WriteLog(Result, "CopyFolder (wh)", "Bitrix24");

Check_BitrixFile(Result); // SKIP

DestinationID = FunctionParameters["Bitrix24_SubfolderID"];
FolderID = FunctionParameters["Bitrix24_HookSubfolderID"];

URL = FunctionParameters["Bitrix24_Domain"];
Token = FunctionParameters["Bitrix24_Token"];

Result = OPI_Bitrix24.CopyFolder(URL, FolderID, DestinationID, Token);

OPI_TestDataRetrieval.WriteLog(Result, "CopyFolder", "Bitrix24");

Check_BitrixFile(Result);

EndProcedure

#EndRegion

#Region YandexDisk
Expand Down
69 changes: 69 additions & 0 deletions src/en/OPI/src/CommonModules/OPI_Bitrix24/Module.bsl
Original file line number Diff line number Diff line change
Expand Up @@ -984,6 +984,75 @@ Function CreateStorageFolder(Val URL, Val StorageID, Val Name, Val Token = "") E

EndFunction

// Get folder information
// Get folder information
//
// Parameters:
// URL - String - URL of webhook or a Bitrix24 domain, when token used - url
// FolderID - String, Number - Folder identifier - folderid
// Token - String - Access token, when not-webhook method used - token
//
// Returns:
// Map Of KeyAndValue - serialized JSON of answer from Bitrix24 API
Function GetFolder(Val URL, Val FolderID, Val Token = "") Export

Response = FileManagement(URL, FolderID, "disk.folder.get", Token);
Return Response;

EndFunction

// Create new subfolder
// Create new folder inside another folder
//
// Parameters:
// URL - String - URL of webhook or a Bitrix24 domain, when token used - url
// FolderID - String, Number - Parent folder identifier - folderid
// Name - String - Name of new folder - title
// Token - String - Access token, when not-webhook method used - token
//
// Returns:
// Map Of KeyAndValue - serialized JSON of answer from Bitrix24 API
Function CreateSubfolder(Val URL, Val FolderID, Val Name, Val Token = "") Export

OPI_TypeConversion.GetLine(Name);

FolderStructure = New Structure("NAME", Name);

Parameters = NormalizeAuth(URL, Token, "disk.folder.addsubfolder");

OPI_Tools.AddField("id" , FolderID , "String" , Parameters);
OPI_Tools.AddField("data", FolderStructure, "Collection", Parameters);

Response = OPI_Tools.Post(URL, Parameters);

Return Response;

EndFunction

// Copy folder
// Copy one folder to another
//
// Parameters:
// URL - String - URL of webhook or a Bitrix24 domain, when token used - url
// FolderID - String, Number - Parent folder identifier - folderid
// DestinationID - String, Number - ID of target folder - tagetid
// Token - String - Access token, when not-webhook method used - token
//
// Returns:
// Map Of KeyAndValue - serialized JSON of answer from Bitrix24 API
Function CopyFolder(Val URL, Val FolderID, Val DestinationID, Val Token = "") Export

Parameters = NormalizeAuth(URL, Token, "disk.folder.copyto");

OPI_Tools.AddField("id" , FolderID , "String", Parameters);
OPI_Tools.AddField("targetFolderId", DestinationID, "String", Parameters);

Response = OPI_Tools.Post(URL, Parameters);

Return Response;

EndFunction

// Delete file
// Delete file by ID
//
Expand Down
89 changes: 89 additions & 0 deletions src/en/OPI/src/CommonModules/OPI_Tests/Module.bsl
Original file line number Diff line number Diff line change
Expand Up @@ -2929,6 +2929,9 @@ Procedure B24_WorkingWithDrive() Export
Bitrix24_GetStorageObjects(TestParameters);
Bitrix24_DeleteFile(TestParameters);
Bitrix24_CreateStorageFolder(TestParameters);
Bitrix24_GetFolder(TestParameters);
Bitrix24_CreateSubfolder(TestParameters);
Bitrix24_CopyFolder(TestParameters);
Bitrix24_DeleteFolder(TestParameters);

EndProcedure
Expand Down Expand Up @@ -6965,6 +6968,92 @@ Procedure Bitrix24_RenameStorage(FunctionParameters)

EndProcedure

Procedure Bitrix24_GetFolder(FunctionParameters)

URL = FunctionParameters["Bitrix24_URL"];
FolderID = FunctionParameters["Bitrix24_FolderID"];

Result = OPI_Bitrix24.GetFolder(URL, FolderID);

// !OInt OPI_TestDataRetrieval.WriteLog(Result, "GetFolder (wh)", "Bitrix24");

Check_BitrixFile(Result); // SKIP

URL = FunctionParameters["Bitrix24_Domain"];
Token = FunctionParameters["Bitrix24_Token"];

Result = OPI_Bitrix24.GetFolder(URL, FolderID, Token);

// END

// !OInt OPI_TestDataRetrieval.WriteLog(Result, "GetFolder", "Bitrix24");

Check_BitrixFile(Result);

EndProcedure

Procedure Bitrix24_CreateSubfolder(FunctionParameters)

FolderID = FunctionParameters["Bitrix24_FolderID"];
Name = "New subfolder";
Filename2 = "New subfolder 2";

URL = FunctionParameters["Bitrix24_URL"];

Result = OPI_Bitrix24.CreateSubfolder(URL, FolderID, Filename2);

// !OInt OPI_TestDataRetrieval.WriteLog(Result, "CreateSubfolder (wh)", "Bitrix24");

Check_BitrixFile(Result); // SKIP

SubfolderID = Result["result"]["ID"]; // SKIP
OPI_TestDataRetrieval.WriteParameter("Bitrix24_HookSubfolderID", SubfolderID); // SKIP
FunctionParameters.Insert("Bitrix24_HookSubfolderID", SubfolderID); // SKIP

URL = FunctionParameters["Bitrix24_Domain"];
Token = FunctionParameters["Bitrix24_Token"];

Result = OPI_Bitrix24.CreateSubfolder(URL, FolderID, Name, Token);

// END

// !OInt OPI_TestDataRetrieval.WriteLog(Result, "CreateSubfolder", "Bitrix24");

Check_BitrixFile(Result);

SubfolderID = Result["result"]["ID"]; // SKIP
OPI_TestDataRetrieval.WriteParameter("Bitrix24_SubfolderID", SubfolderID); // SKIP
FunctionParameters.Insert("Bitrix24_SubfolderID", SubfolderID); // SKIP

EndProcedure

Procedure Bitrix24_CopyFolder(FunctionParameters)

DestinationID = FunctionParameters["Bitrix24_HookSubfolderID"];
FolderID = FunctionParameters["Bitrix24_SubfolderID"];

URL = FunctionParameters["Bitrix24_URL"];

Result = OPI_Bitrix24.CopyFolder(URL, FolderID, DestinationID);

// !OInt OPI_TestDataRetrieval.WriteLog(Result, "CopyFolder (wh)", "Bitrix24");

Check_BitrixFile(Result); // SKIP

DestinationID = FunctionParameters["Bitrix24_SubfolderID"];
FolderID = FunctionParameters["Bitrix24_HookSubfolderID"];

URL = FunctionParameters["Bitrix24_Domain"];
Token = FunctionParameters["Bitrix24_Token"];

Result = OPI_Bitrix24.CopyFolder(URL, FolderID, DestinationID, Token);

// !OInt OPI_TestDataRetrieval.WriteLog(Result, "CopyFolder", "Bitrix24");

Check_BitrixFile(Result);

EndProcedure

#EndRegion

#Region YandexDisk
Expand Down
Loading

0 comments on commit ec1b3f2

Please sign in to comment.