1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2025-03-17 21:08:03 +02:00

Main build (Jenkins)

This commit is contained in:
Vitaly the Alpaca (bot) 2025-02-23 12:59:52 +03:00
parent 53cc8022d1
commit bdd10ff91c
109 changed files with 8442 additions and 6725 deletions

View File

@ -1451,9 +1451,51 @@ jobs:
key: logs-TCP
path: ./docs/ru/results/TCP
Testing-GreenAPI:
runs-on: ubuntu-latest
needs: [Decode, Build]
steps:
- uses: actions/checkout@v2
- uses: otymko/setup-onescript@v1.4
with:
version: 1.9.1
- name: Получить тестовые данные из кэша
uses: actions/cache/restore@v3
with:
key: test-data
path: ./data.json
- name: Установить asserts и 1testrunner
run: |
opm install asserts
opm install 1testrunner
- name: Установить OInt
run: |
TEMP_DEB="$(mktemp)" &&
wget -O "$TEMP_DEB" 'https://api.athenaeum.digital/tc/job/Release/lastSuccessfulBuild/artifact/1.20.0/oint_1.20.0_all_ru.deb' &&
sudo dpkg -i "$TEMP_DEB"
rm -f "$TEMP_DEB"
- name: Аккаунт
if: ${{ cancelled() }} == false
run: oscript /home/runner/.local/share/ovm/current/lib/1testrunner/src/main.os -run ./src/ru/OInt/tests/Modules/internal/OPI_ТестыCLI.os "CLI_GAPI_Аккаунт"
- name: Записать логи
if: ${{ cancelled() }} == false
uses: actions/cache/save@v3
with:
key: logs-GreenAPI
path: ./docs/ru/results/GreenAPI
Encode:
runs-on: ubuntu-latest
needs: [Testing-Telegram,Testing-VK,Testing-Viber,Testing-Twitter,Testing-PostgreSQL,Testing-SQLite,Testing-YandexDisk,Testing-GoogleWorkspace,Testing-GoogleCalendar,Testing-GoogleDrive,Testing-GoogleSheets,Testing-Notion,Testing-Slack,Testing-Airtable,Testing-Dropbox,Testing-Bitrix24,Testing-VkTeams,Testing-Ozon,Testing-Neocities,Testing-CDEK,Testing-YandexMetrika,Testing-S3,Testing-TCP]
needs: [Testing-Telegram,Testing-VK,Testing-Viber,Testing-Twitter,Testing-PostgreSQL,Testing-SQLite,Testing-YandexDisk,Testing-GoogleWorkspace,Testing-GoogleCalendar,Testing-GoogleDrive,Testing-GoogleSheets,Testing-Notion,Testing-Slack,Testing-Airtable,Testing-Dropbox,Testing-Bitrix24,Testing-VkTeams,Testing-Ozon,Testing-Neocities,Testing-CDEK,Testing-YandexMetrika,Testing-S3,Testing-TCP,Testing-GreenAPI]
if: ${{ always() }}
permissions:
contents: write
@ -1849,6 +1891,22 @@ jobs:
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/repos/Bayselonarrend/OpenIntegrations/actions/caches?key=logs-TCP"
- name: Получить логи GreenAPI
uses: actions/cache/restore@v3
with:
key: logs-GreenAPI
path: ./docs/ru/results/GreenAPI
- name: Очистка логов GreenAPI
run: |
curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/repos/Bayselonarrend/OpenIntegrations/actions/caches?key=logs-GreenAPI"
- name: Записать данные
uses: stefanzweifel/git-auto-commit-action@v5
@ -1861,7 +1919,7 @@ jobs:
Clear-Cache:
runs-on: ubuntu-latest
needs: [Testing-Telegram, Testing-VK, Testing-Viber, Testing-Twitter, Testing-PostgreSQL, Testing-SQLite, Testing-YandexDisk, Testing-GoogleWorkspace, Testing-GoogleCalendar, Testing-GoogleDrive, Testing-GoogleSheets, Testing-Notion, Testing-Slack, Testing-Airtable, Testing-Dropbox, Testing-Bitrix24, Testing-VkTeams, Testing-Ozon, Testing-Neocities, Testing-CDEK, Testing-YandexMetrika, Testing-S3, Testing-TCP, Encode]
needs: [Testing-Telegram, Testing-VK, Testing-Viber, Testing-Twitter, Testing-PostgreSQL, Testing-SQLite, Testing-YandexDisk, Testing-GoogleWorkspace, Testing-GoogleCalendar, Testing-GoogleDrive, Testing-GoogleSheets, Testing-Notion, Testing-Slack, Testing-Airtable, Testing-Dropbox, Testing-Bitrix24, Testing-VkTeams, Testing-Ozon, Testing-Neocities, Testing-CDEK, Testing-YandexMetrika, Testing-S3, Testing-TCP, Testing-GreenAPI, Encode]
if: ${{ always() }}
steps:
- name: Очистка основного кэша

11
ci/cli_ostestru vendored
View File

@ -709,6 +709,17 @@ pipeline {
}
}
stage('Testing-GreenAPI') {
steps {
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
powershell encoding: 'UTF-8', script:'1testrunner -run "./src/ru/OInt/tests/Modules/internal/OPI_ТестыCLI.os" "CLI_GAPI_Аккаунт"'
}
}
}
}
post{
always{

28
ci/clitesten vendored
View File

@ -56,6 +56,11 @@ pipeline {
test_google()
}
}
stage('greenapi'){
steps{
test_greenapi()
}
}
stage('neocities'){
steps{
test_neocities()
@ -1425,6 +1430,28 @@ def test_google(){
}
def test_greenapi(){
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
powershell encoding: 'UTF-8', script:'./oint.exe greenapi FormAccessParameters --api "test" --media "test" --id "test" --token "test" --debug --test '
}
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
powershell encoding: 'UTF-8', script:'./oint.exe greenapi GetInstanceSettings --access "test" --debug --test '
}
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
powershell encoding: 'UTF-8', script:'./oint.exe greenapi SetInstanceSettings --settings "test" --access "test" --debug --test '
}
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
powershell encoding: 'UTF-8', script:'./oint.exe greenapi GetInstanceSettingsStructure --empty "test" --debug --test '
}
}
def test_neocities(){
@ -2933,6 +2960,7 @@ test_gcalendar()
test_gdrive()
test_gsheets()
test_google()
test_greenapi()
test_neocities()
test_notion()
test_ozon()

28
ci/clitestru vendored
View File

@ -56,6 +56,11 @@ pipeline {
test_google()
}
}
stage('greenapi'){
steps{
test_greenapi()
}
}
stage('neocities'){
steps{
test_neocities()
@ -1425,6 +1430,28 @@ def test_google(){
}
def test_greenapi(){
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
powershell encoding: 'UTF-8', script:'./oint.exe greenapi СформироватьПараметрыДоступа --api "test" --media "test" --id "test" --token "test" --debug --test '
}
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
powershell encoding: 'UTF-8', script:'./oint.exe greenapi ПолучитьНастройкиИнстанса --access "test" --debug --test '
}
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
powershell encoding: 'UTF-8', script:'./oint.exe greenapi УстановитьНастройкиИнстанса --settings "test" --access "test" --debug --test '
}
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
powershell encoding: 'UTF-8', script:'./oint.exe greenapi ПолучитьСтруктуруНастроекИнстанса --empty "test" --debug --test '
}
}
def test_neocities(){
@ -2933,6 +2960,7 @@ test_gcalendar()
test_gdrive()
test_gsheets()
test_google()
test_greenapi()
test_neocities()
test_notion()
test_ozon()

11
ci/ostestru vendored
View File

@ -709,6 +709,17 @@ pipeline {
}
}
stage('Testing-GreenAPI') {
steps {
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
powershell encoding: 'UTF-8', script:'1testrunner -run "./src/ru/OInt/tests/Modules/internal/OPI_Тесты.os" "GAPI_Аккаунт"'
}
}
}
}
post{
always{

View File

@ -0,0 +1,6 @@
{
"ApiUrl": "https://7105.api.greenapi.com",
"MediaUrl": "https://7105.media.greenapi.com",
"IdInstance": "71051...",
"ApiTokenInstance": "425010d90e114aa6b78f0969e..."
}

View File

@ -0,0 +1,6 @@
{
"ApiUrl": "https://7105.api.greenapi.com",
"MediaUrl": "https://7105.media.greenapi.com",
"IdInstance": "71051...",
"ApiTokenInstance": "425010d90e114aa6b78f0969e..."
}

View File

@ -0,0 +1,6 @@
{
"ApiUrl": "https://7105.api.greenapi.com",
"MediaUrl": "https://7105.media.greenapi.com",
"IdInstance": "71051...",
"ApiTokenInstance": "425010d90e114aa6b78f0969e..."
}

View File

@ -0,0 +1,6 @@
 ApiUrl = "https://7105.api.greenapi.com";
MediaUrl = "https://7105.media.greenapi.com";
IdInstance = "71051...";
ApiTokenInstance = "425010d90e114aa6b78f0969e...";
Result = OPI_GreenAPI.FormAccessParameters(ApiUrl, MediaUrl, IdInstance, ApiTokenInstance);

View File

@ -0,0 +1,7 @@
 ApiUrl = "https://7105.api.greenapi.com";
MediaUrl = "https://7105.media.greenapi.com";
IdInstance = "71051...";
ApiTokenInstance = "425010d90e114aa6b78f0969e...";
AccessParameters = OPI_GreenAPI.FormAccessParameters(ApiUrl, MediaUrl, IdInstance, ApiTokenInstance);
Result = OPI_GreenAPI.GetInstanceSettings(AccessParameters);

View File

@ -0,0 +1 @@
 Result = OPI_GreenAPI.GetInstanceSettingsStructure();

View File

@ -0,0 +1,15 @@
 ApiUrl = "https://7105.api.greenapi.com";
MediaUrl = "https://7105.media.greenapi.com";
IdInstance = "71051...";
ApiTokenInstance = "425010d90e114aa6b78f0969e...";
AccessParameters = OPI_GreenAPI.FormAccessParameters(ApiUrl, MediaUrl, IdInstance, ApiTokenInstance);
SettingsStructure = New Structure;
SettingsStructure.Insert("pollMessageWebhook" , "yes");
SettingsStructure.Insert("incomingBlockWebhook" , "no");
SettingsStructure.Insert("incomingCallWebhook" , "no");
SettingsStructure.Insert("editedMessageWebhook" , "yes");
SettingsStructure.Insert("deletedMessageWebhook", "yes");
Result = OPI_GreenAPI.SetInstanceSettings(SettingsStructure, AccessParameters);

View File

@ -1,5 +1,5 @@
 ClientID = "2479669";
APIKey = "09f65e9f-262d-4aca...";
ProductID = "1413992764";
ProductID = "1414559567";
Result = OPI_Ozon.ArchiveProducts(ClientID, APIKey, ProductID);

View File

@ -1,5 +1,5 @@
 ClientID = "2479669";
APIKey = "09f65e9f-262d-4aca...";
ProductID = "1413992764";
ProductID = "1414559567";
Result = OPI_Ozon.CheckProductsImagesUpload(ClientID, APIKey, ProductID);

View File

@ -1,5 +1,5 @@
 ClientID = "2479669";
APIKey = "09f65e9f-262d-4aca...";
ProductID = "1413992764";
ProductID = "1414559567";
Result = OPI_Ozon.CreateBarcodes(ClientID, APIKey, ProductID);

View File

@ -2,7 +2,7 @@
ClientID = "2479669";
APIKey = "09f65e9f-262d-4aca...";
ProductID = "1413992764";
ProductID = "1414559567";
Result = OPI_Ozon.ArchiveProducts(ClientID, APIKey, ProductID);

View File

@ -1,6 +1,6 @@
 ClientID = "2479669";
APIKey = "09f65e9f-262d-4aca...";
OperationID = "019517c5-816e-7783-9ce5-da15225ac12a";
OperationID = "01952a10-2733-76d4-b46f-2391148e6052";
Status = "CALCULATION_STATUS_IN_PROGRESS";

View File

@ -4,7 +4,7 @@
DateFrom = OPI_Tools.GetCurrentDate();
DateTo = DateFrom + Day;
Draft = "43155779";
Draft = "43555575";
Warehouse = "1020000759116000";
Result = OPI_Ozon.GetFBOTimeslots(ClientID, APIKey, DateFrom, DateTo, Draft, Warehouse);

View File

@ -1,5 +1,5 @@
 ClientID = "2479669";
APIKey = "09f65e9f-262d-4aca...";
TaskID = "1683494652";
TaskID = "1688263517";
Result = OPI_Ozon.GetProductCreationStatus(ClientID, APIKey, TaskID);

View File

@ -1,5 +1,5 @@
 ClientID = "2479669";
APIKey = "09f65e9f-262d-4aca...";
ProductID = "1413992764";
ProductID = "1414559567";
Result = OPI_Ozon.UnarchiveProducts(ClientID, APIKey, ProductID);

View File

@ -1,6 +1,6 @@
 ClientID = "2479669";
APIKey = "09f65e9f-262d-4aca...";
ProductID = "1413992764";
ProductID = "1414559567";
Image1 = "https://api.athenaeum.digital/test_data/picture.jpg";
Image2 = "https://api.athenaeum.digital/test_data/picture2.jpg";

View File

@ -1,6 +1,6 @@
 ClientID = "2479669";
APIKey = "09f65e9f-262d-4aca...";
ProductID = "1413992764";
ProductID = "1414559567";
Prices = New Structure;
Prices.Insert("auto_action_enabled" , "DISABLED");

View File

@ -1,6 +1,6 @@
 ClientID = "2479669";
APIKey = "09f65e9f-262d-4aca...";
ProductID = "1413992764";
ProductID = "1414559567";
Stocks = New Structure;
Stocks.Insert("offer_id" , "143210610");

View File

@ -1,6 +1,6 @@
 ClientID = "2479669";
APIKey = "09f65e9f-262d-4aca...";
ProductID = "1413992764";
ProductID = "1414559567";
Codes = New Array;
Codes.Add("11111111");

View File

@ -0,0 +1,46 @@
---
sidebar_position: 1
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Form access parameters
Forms the structure of basic authorization data
`Function FormAccessParameters(Val ApiUrl, Val MediaUrl, Val IdInstance, Val ApiTokenInstance) Export`
| Parameter | CLI option | Type | Required | Description |
|-|-|-|-|-|
| ApiUrl | --api | String | ✔ | API host link |
| MediaUrl | --media | String | ✔ | Link to host API for sending files |
| IdInstance | --id | String | ✔ | Unique instance number |
| ApiTokenInstance | --token | String | ✔ | Instance access key |
Returns: Structure - Structure of access parameters
<br/>
:::tip
More details in the API documentation: [Get access parameters to instance](https://green-api.com/en/docs/before-start/#parameters)
:::
<br/>
```bsl title="1C:Enterprise/OneScript code example"
ApiUrl = "https://7105.api.greenapi.com";
MediaUrl = "https://7105.media.greenapi.com";
IdInstance = "71051...";
ApiTokenInstance = "425010d90e114aa6b78f0969e...";
Result = OPI_GreenAPI.FormAccessParameters(ApiUrl, MediaUrl, IdInstance, ApiTokenInstance);
```

View File

@ -0,0 +1,34 @@
---
sidebar_position: 4
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Get instance settings structure
Gets the structure template for instance settings
`Function GetInstanceSettingsStructure(Val Clear = False) Export`
| Parameter | CLI option | Type | Required | Description |
|-|-|-|-|-|
| Clear | --empty | Boolean | &#x2716; | True > structure with empty valuse, False > field descriptions at values |
Returns: Structure Of KeyAndValue - Structure of instance settings
<br/>
```bsl title="1C:Enterprise/OneScript code example"
Result = OPI_GreenAPI.GetInstanceSettingsStructure();
```

View File

@ -0,0 +1,44 @@
---
sidebar_position: 2
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Get instance settings
Gets the current instance settings
`Function GetInstanceSettings(Val AccessParameters) Export`
| Parameter | CLI option | Type | Required | Description |
|-|-|-|-|-|
| AccessParameters | --access | Structure Of KeyAndValue | &#x2714; | Access parameters. See FormAccessParameters |
Returns: Map Of KeyAndValue - serialized JSON response from Green API
<br/>
:::tip
Method at API documentation: [GetSettings](https://green-api.com/docs/api/account/GetSettings/)
:::
<br/>
```bsl title="1C:Enterprise/OneScript code example"
ApiUrl = "https://7105.api.greenapi.com";
MediaUrl = "https://7105.media.greenapi.com";
IdInstance = "71051...";
ApiTokenInstance = "425010d90e114aa6b78f0969e...";
AccessParameters = OPI_GreenAPI.FormAccessParameters(ApiUrl, MediaUrl, IdInstance, ApiTokenInstance);
Result = OPI_GreenAPI.GetInstanceSettings(AccessParameters);
```

View File

@ -0,0 +1,53 @@
---
sidebar_position: 3
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Set instance settings
Sets the instance settings
`Function SetInstanceSettings(Val Settings, Val AccessParameters) Export`
| Parameter | CLI option | Type | Required | Description |
|-|-|-|-|-|
| Settings | --settings | Structure Of KeyAndValue | &#x2714; | Instance settings. See GetInstanceSettingsStructure |
| AccessParameters | --access | Structure Of KeyAndValue | &#x2714; | Access parameters. See FormAccessParameters |
Returns: Map Of KeyAndValue - serialized JSON response from Green API
<br/>
:::tip
Method at API documentation: [GetSettings](https://green-api.com/docs/api/account/SetSettings/)
:::
<br/>
```bsl title="1C:Enterprise/OneScript code example"
ApiUrl = "https://7105.api.greenapi.com";
MediaUrl = "https://7105.media.greenapi.com";
IdInstance = "71051...";
ApiTokenInstance = "425010d90e114aa6b78f0969e...";
AccessParameters = OPI_GreenAPI.FormAccessParameters(ApiUrl, MediaUrl, IdInstance, ApiTokenInstance);
SettingsStructure = New Structure;
SettingsStructure.Insert("pollMessageWebhook" , "yes");
SettingsStructure.Insert("incomingBlockWebhook" , "no");
SettingsStructure.Insert("incomingCallWebhook" , "no");
SettingsStructure.Insert("editedMessageWebhook" , "yes");
SettingsStructure.Insert("deletedMessageWebhook", "yes");
Result = OPI_GreenAPI.SetInstanceSettings(SettingsStructure, AccessParameters);
```

View File

@ -0,0 +1,4 @@
{
"label": "Account",
"position": "2"
}

View File

@ -37,7 +37,7 @@ Method at API documentation: [post /v1/barcode/generate](https://docs.ozon.ru/ap
```bsl title="1C:Enterprise/OneScript code example"
ClientID = "2479669";
APIKey = "09f65e9f-262d-4aca...";
ProductID = "1413992764";
ProductID = "1414559567";
Result = OPI_Ozon.CreateBarcodes(ClientID, APIKey, ProductID);
```

View File

@ -33,7 +33,7 @@ Method at API documentation: [post /v1/draft/create/info](https://docs.ozon.ru/a
```bsl title="1C:Enterprise/OneScript code example"
ClientID = "2479669";
APIKey = "09f65e9f-262d-4aca...";
OperationID = "019517c5-816e-7783-9ce5-da15225ac12a";
OperationID = "01952a10-2733-76d4-b46f-2391148e6052";
Status = "CALCULATION_STATUS_IN_PROGRESS";

View File

@ -40,7 +40,7 @@ Method at API documentation: [post /v1/draft/timeslot/info](https://docs.ozon.ru
DateFrom = OPI_Tools.GetCurrentDate();
DateTo = DateFrom + Day;
Draft = "43155779";
Draft = "43555575";
Warehouse = "1020000759116000";
Result = OPI_Ozon.GetFBOTimeslots(ClientID, APIKey, DateFrom, DateTo, Draft, Warehouse);

View File

@ -33,7 +33,7 @@ Method at API documentation: [post /v1/product/import/prices](https://docs.ozon.
```bsl title="1C:Enterprise/OneScript code example"
ClientID = "2479669";
APIKey = "09f65e9f-262d-4aca...";
ProductID = "1413992764";
ProductID = "1414559567";
Prices = New Structure;
Prices.Insert("auto_action_enabled" , "DISABLED");

View File

@ -39,7 +39,7 @@ Method at API documentation: [post /v2/products/stocks](https://docs.ozon.ru/api
```bsl title="1C:Enterprise/OneScript code example"
ClientID = "2479669";
APIKey = "09f65e9f-262d-4aca...";
ProductID = "1413992764";
ProductID = "1414559567";
Stocks = New Structure;
Stocks.Insert("offer_id" , "143210610");

View File

@ -35,7 +35,7 @@ Method at API documentation: [post /v1/product/archive](https://docs.ozon.ru/api
```bsl title="1C:Enterprise/OneScript code example"
ClientID = "2479669";
APIKey = "09f65e9f-262d-4aca...";
ProductID = "1413992764";
ProductID = "1414559567";
Result = OPI_Ozon.ArchiveProducts(ClientID, APIKey, ProductID);
```

View File

@ -33,7 +33,7 @@ Method at API documentation: [post /v2/product/pictures/info](https://docs.ozon.
```bsl title="1C:Enterprise/OneScript code example"
ClientID = "2479669";
APIKey = "09f65e9f-262d-4aca...";
ProductID = "1413992764";
ProductID = "1414559567";
Result = OPI_Ozon.CheckProductsImagesUpload(ClientID, APIKey, ProductID);
```

View File

@ -39,7 +39,7 @@ Method at API documentation: [post /v2/products/delete](https://docs.ozon.ru/api
ClientID = "2479669";
APIKey = "09f65e9f-262d-4aca...";
ProductID = "1413992764";
ProductID = "1414559567";
Result = OPI_Ozon.ArchiveProducts(ClientID, APIKey, ProductID);

View File

@ -33,7 +33,7 @@ Method at API documentation: [post /v1/product/import/info](https://docs.ozon.ru
```bsl title="1C:Enterprise/OneScript code example"
ClientID = "2479669";
APIKey = "09f65e9f-262d-4aca...";
TaskID = "1683494652";
TaskID = "1688263517";
Result = OPI_Ozon.GetProductCreationStatus(ClientID, APIKey, TaskID);
```

View File

@ -35,7 +35,7 @@ Method at API documentation: [post /v1/product/unarchive](https://docs.ozon.ru/a
```bsl title="1C:Enterprise/OneScript code example"
ClientID = "2479669";
APIKey = "09f65e9f-262d-4aca...";
ProductID = "1413992764";
ProductID = "1414559567";
Result = OPI_Ozon.UnarchiveProducts(ClientID, APIKey, ProductID);
```

View File

@ -42,7 +42,7 @@ Method at API documentation: [post /v1/product/pictures/import](https://docs.ozo
```bsl title="1C:Enterprise/OneScript code example"
ClientID = "2479669";
APIKey = "09f65e9f-262d-4aca...";
ProductID = "1413992764";
ProductID = "1414559567";
Image1 = "https://api.athenaeum.digital/test_data/picture.jpg";
Image2 = "https://api.athenaeum.digital/test_data/picture2.jpg";

View File

@ -38,7 +38,7 @@ Method at API documentation: [post /v1/product/upload_digital_codes](https://doc
```bsl title="1C:Enterprise/OneScript code example"
ClientID = "2479669";
APIKey = "09f65e9f-262d-4aca...";
ProductID = "1413992764";
ProductID = "1414559567";
Codes = New Array;
Codes.Add("11111111");

View File

@ -0,0 +1,6 @@
{
"ApiUrl": "https://7105.api.greenapi.com",
"MediaUrl": "https://7105.media.greenapi.com",
"IdInstance": "71051...",
"ApiTokenInstance": "425010d90e114aa6b78f0969e..."
}

View File

@ -0,0 +1,6 @@
{
"ApiUrl": "https://7105.api.greenapi.com",
"MediaUrl": "https://7105.media.greenapi.com",
"IdInstance": "71051...",
"ApiTokenInstance": "425010d90e114aa6b78f0969e..."
}

View File

@ -0,0 +1,6 @@
{
"ApiUrl": "https://7105.api.greenapi.com",
"MediaUrl": "https://7105.media.greenapi.com",
"IdInstance": "71051...",
"ApiTokenInstance": "425010d90e114aa6b78f0969e..."
}

View File

@ -0,0 +1,7 @@
 ApiUrl = "https://7105.api.greenapi.com";
MediaUrl = "https://7105.media.greenapi.com";
IdInstance = "71051...";
ApiTokenInstance = "425010d90e114aa6b78f0969e...";
ПараметрыДоступа = OPI_GreenAPI.СформироватьПараметрыДоступа(ApiUrl, MediaUrl, IdInstance, ApiTokenInstance);
Результат = OPI_GreenAPI.ПолучитьНастройкиИнстанса(ПараметрыДоступа);

View File

@ -0,0 +1 @@
 Результат = OPI_GreenAPI.ПолучитьСтруктуруНастроекИнстанса();

View File

@ -0,0 +1,6 @@
 ApiUrl = "https://7105.api.greenapi.com";
MediaUrl = "https://7105.media.greenapi.com";
IdInstance = "71051...";
ApiTokenInstance = "425010d90e114aa6b78f0969e...";
Результат = OPI_GreenAPI.СформироватьПараметрыДоступа(ApiUrl, MediaUrl, IdInstance, ApiTokenInstance);

View File

@ -0,0 +1,15 @@
 ApiUrl = "https://7105.api.greenapi.com";
MediaUrl = "https://7105.media.greenapi.com";
IdInstance = "71051...";
ApiTokenInstance = "425010d90e114aa6b78f0969e...";
ПараметрыДоступа = OPI_GreenAPI.СформироватьПараметрыДоступа(ApiUrl, MediaUrl, IdInstance, ApiTokenInstance);
СтруктураНастроек = Новый Структура;
СтруктураНастроек.Вставить("pollMessageWebhook" , "yes");
СтруктураНастроек.Вставить("incomingBlockWebhook" , "no");
СтруктураНастроек.Вставить("incomingCallWebhook" , "no");
СтруктураНастроек.Вставить("editedMessageWebhook" , "yes");
СтруктураНастроек.Вставить("deletedMessageWebhook", "yes");
Результат = OPI_GreenAPI.УстановитьНастройкиИнстанса(СтруктураНастроек, ПараметрыДоступа);

View File

@ -1,5 +1,5 @@
 IDКлиента = "2479669";
КлючAPI = "09f65e9f-262d-4aca...";
IDТовара = "1413992764";
IDТовара = "1414559567";
Результат = OPI_Ozon.АрхивироватьТовары(IDКлиента, КлючAPI, IDТовара);

View File

@ -1,6 +1,6 @@
 IDКлиента = "2479669";
КлючAPI = "09f65e9f-262d-4aca...";
IDТовара = "1413992764";
IDТовара = "1414559567";
Коды = Новый Массив;
Коды.Добавить("11111111");

View File

@ -1,6 +1,6 @@
 IDКлиента = "2479669";
КлючAPI = "09f65e9f-262d-4aca...";
IDТовара = "1413992764";
IDТовара = "1414559567";
Картинка1 = "https://api.athenaeum.digital/test_data/picture.jpg";
Картинка2 = "https://api.athenaeum.digital/test_data/picture2.jpg";

View File

@ -1,6 +1,6 @@
 IDКлиента = "2479669";
КлючAPI = "09f65e9f-262d-4aca...";
IDТовара = "1413992764";
IDТовара = "1414559567";
Остатки = Новый Структура;
Остатки.Вставить("offer_id" , "143210610");

View File

@ -1,6 +1,6 @@
 IDКлиента = "2479669";
КлючAPI = "09f65e9f-262d-4aca...";
IDТовара = "1413992764";
IDТовара = "1414559567";
Цены = Новый Структура;
Цены.Вставить("auto_action_enabled" , "DISABLED");

View File

@ -1,5 +1,5 @@
 IDКлиента = "2479669";
КлючAPI = "09f65e9f-262d-4aca...";
IDЗадачи = "1683494652";
IDЗадачи = "1688263517";
Результат = OPI_Ozon.ПолучитьСтатусДобавленияТовара(IDКлиента, КлючAPI, IDЗадачи);

View File

@ -4,7 +4,7 @@
ДатаОт = OPI_Инструменты.ПолучитьТекущуюДату();
ДатаПо = ДатаОт + Сутки;
Черновик = "43155779";
Черновик = "43555575";
Склад = "1020000759116000";
Результат = OPI_Ozon.ПолучитьТаймслотыFBO(IDКлиента, КлючAPI, ДатаОт, ДатаПо, Черновик, Склад);

View File

@ -1,6 +1,6 @@
 IDКлиента = "2479669";
КлючAPI = "09f65e9f-262d-4aca...";
IDОперации = "019517c5-816e-7783-9ce5-da15225ac12a";
IDОперации = "01952a10-2733-76d4-b46f-2391148e6052";
Статус = "CALCULATION_STATUS_IN_PROGRESS";

View File

@ -1,5 +1,5 @@
 IDКлиента = "2479669";
КлючAPI = "09f65e9f-262d-4aca...";
IDТовара = "1413992764";
IDТовара = "1414559567";
Результат = OPI_Ozon.ПроверитьЗагрузкуИзображенийТоваров(IDКлиента, КлючAPI, IDТовара);

View File

@ -1,5 +1,5 @@
 IDКлиента = "2479669";
КлючAPI = "09f65e9f-262d-4aca...";
IDТовара = "1413992764";
IDТовара = "1414559567";
Результат = OPI_Ozon.РазархивироватьТовары(IDКлиента, КлючAPI, IDТовара);

View File

@ -1,5 +1,5 @@
 IDКлиента = "2479669";
КлючAPI = "09f65e9f-262d-4aca...";
IDТовара = "1413992764";
IDТовара = "1414559567";
Результат = OPI_Ozon.СоздатьШтрихкоды(IDКлиента, КлючAPI, IDТовара);

View File

@ -2,7 +2,7 @@
IDКлиента = "2479669";
КлючAPI = "09f65e9f-262d-4aca...";
IDТовара = "1413992764";
IDТовара = "1414559567";
Результат = OPI_Ozon.АрхивироватьТовары(IDКлиента, КлючAPI, IDТовара);

View File

@ -0,0 +1,46 @@
---
sidebar_position: 1
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Сформировать параметры доступа
Формирует структуру основных авторизационных данных
`Функция СформироватьПараметрыДоступа(Знач ApiUrl, Знач MediaUrl, Знач IdInstance, Знач ApiTokenInstance) Экспорт`
| Параметр | CLI опция | Тип | Обяз. | Назначение |
|-|-|-|-|-|
| ApiUrl | --api | Строка | &#x2714; | Ссылка на хост API |
| MediaUrl | --media | Строка | &#x2714; | Ссылка на хост API для отправки файлов |
| IdInstance | --id | Строка | &#x2714; | Уникальный номер инстанса |
| ApiTokenInstance | --token | Строка | &#x2714; | Ключ доступа инстанса |
Возвращаемое значение: Структура - Структура параметров доступа
<br/>
:::tip
Подробнее в документации API: [Получить параметры доступа к инстансу](https://green-api.com/docs/before-start/#parameters)
:::
<br/>
```bsl title="Пример использования для 1С:Предприятие/OneScript"
ApiUrl = "https://7105.api.greenapi.com";
MediaUrl = "https://7105.media.greenapi.com";
IdInstance = "71051...";
ApiTokenInstance = "425010d90e114aa6b78f0969e...";
Результат = OPI_GreenAPI.СформироватьПараметрыДоступа(ApiUrl, MediaUrl, IdInstance, ApiTokenInstance);
```

View File

@ -0,0 +1,34 @@
---
sidebar_position: 4
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Получить структуру настроек инстанса
Получает шаблон структуры для установки настроек инстанса
`Функция ПолучитьСтруктуруНастроекИнстанса(Знач Пустая = Ложь) Экспорт`
| Параметр | CLI опция | Тип | Обяз. | Назначение |
|-|-|-|-|-|
| Пустая | --empty | Булево | &#x2716; | Истина > структура с пустыми значениями, Ложь > в значениях будут описания полей |
Возвращаемое значение: Структура Из КлючИЗначение - Структура настроек инстанса
<br/>
```bsl title="Пример использования для 1С:Предприятие/OneScript"
Результат = OPI_GreenAPI.ПолучитьСтруктуруНастроекИнстанса();
```

View File

@ -0,0 +1,44 @@
---
sidebar_position: 2
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Получить настройки инстанса
Получает текущие настройки инстанса
`Функция ПолучитьНастройкиИнстанса(Знач ПараметрыДоступа) Экспорт`
| Параметр | CLI опция | Тип | Обяз. | Назначение |
|-|-|-|-|-|
| ПараметрыДоступа | --access | Структура Из КлючИЗначение | &#x2714; | Параметры доступа. См. СформироватьПараметрыДоступа |
Возвращаемое значение: Соответствие Из КлючИЗначение - сериализованный JSON ответа от Green API
<br/>
:::tip
Метод в документации API: [GetSettings](https://green-api.com/docs/api/account/GetSettings/)
:::
<br/>
```bsl title="Пример использования для 1С:Предприятие/OneScript"
ApiUrl = "https://7105.api.greenapi.com";
MediaUrl = "https://7105.media.greenapi.com";
IdInstance = "71051...";
ApiTokenInstance = "425010d90e114aa6b78f0969e...";
ПараметрыДоступа = OPI_GreenAPI.СформироватьПараметрыДоступа(ApiUrl, MediaUrl, IdInstance, ApiTokenInstance);
Результат = OPI_GreenAPI.ПолучитьНастройкиИнстанса(ПараметрыДоступа);
```

View File

@ -0,0 +1,49 @@
---
sidebar_position: 3
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Установить настройки инстанса
Устанавливает настройки инстанса
`Функция УстановитьНастройкиИнстанса(Знач Настройки, Знач ПараметрыДоступа) Экспорт`
| Параметр | CLI опция | Тип | Обяз. | Назначение |
|-|-|-|-|-|
| Настройки | --settings | Структура Из КлючИЗначение | &#x2714; | Настройки инстанса. См. ПолучитьСтруктуруНастроекИнстанса |
| ПараметрыДоступа | --access | Структура Из КлючИЗначение | &#x2714; | Параметры доступа. См. СформироватьПараметрыДоступа |
Возвращаемое значение: Соответствие Из КлючИЗначение - сериализованный JSON ответа от Green API
<br/>
```bsl title="Пример использования для 1С:Предприятие/OneScript"
ApiUrl = "https://7105.api.greenapi.com";
MediaUrl = "https://7105.media.greenapi.com";
IdInstance = "71051...";
ApiTokenInstance = "425010d90e114aa6b78f0969e...";
ПараметрыДоступа = OPI_GreenAPI.СформироватьПараметрыДоступа(ApiUrl, MediaUrl, IdInstance, ApiTokenInstance);
СтруктураНастроек = Новый Структура;
СтруктураНастроек.Вставить("pollMessageWebhook" , "yes");
СтруктураНастроек.Вставить("incomingBlockWebhook" , "no");
СтруктураНастроек.Вставить("incomingCallWebhook" , "no");
СтруктураНастроек.Вставить("editedMessageWebhook" , "yes");
СтруктураНастроек.Вставить("deletedMessageWebhook", "yes");
Результат = OPI_GreenAPI.УстановитьНастройкиИнстанса(СтруктураНастроек, ПараметрыДоступа);
```

View File

@ -0,0 +1,4 @@
{
"label": "Аккаунт",
"position": "2"
}

View File

@ -37,7 +37,7 @@ import TabItem from '@theme/TabItem';
```bsl title="Пример использования для 1С:Предприятие/OneScript"
IDКлиента = "2479669";
КлючAPI = "09f65e9f-262d-4aca...";
IDТовара = "1413992764";
IDТовара = "1414559567";
Результат = OPI_Ozon.СоздатьШтрихкоды(IDКлиента, КлючAPI, IDТовара);
```

View File

@ -33,7 +33,7 @@ import TabItem from '@theme/TabItem';
```bsl title="Пример использования для 1С:Предприятие/OneScript"
IDКлиента = "2479669";
КлючAPI = "09f65e9f-262d-4aca...";
IDОперации = "019517c5-816e-7783-9ce5-da15225ac12a";
IDОперации = "01952a10-2733-76d4-b46f-2391148e6052";
Статус = "CALCULATION_STATUS_IN_PROGRESS";

View File

@ -40,7 +40,7 @@ import TabItem from '@theme/TabItem';
ДатаОт = OPI_Инструменты.ПолучитьТекущуюДату();
ДатаПо = ДатаОт + Сутки;
Черновик = "43155779";
Черновик = "43555575";
Склад = "1020000759116000";
Результат = OPI_Ozon.ПолучитьТаймслотыFBO(IDКлиента, КлючAPI, ДатаОт, ДатаПо, Черновик, Склад);

View File

@ -33,7 +33,7 @@ import TabItem from '@theme/TabItem';
```bsl title="Пример использования для 1С:Предприятие/OneScript"
IDКлиента = "2479669";
КлючAPI = "09f65e9f-262d-4aca...";
IDТовара = "1413992764";
IDТовара = "1414559567";
Цены = Новый Структура;
Цены.Вставить("auto_action_enabled" , "DISABLED");

View File

@ -39,7 +39,7 @@ import TabItem from '@theme/TabItem';
```bsl title="Пример использования для 1С:Предприятие/OneScript"
IDКлиента = "2479669";
КлючAPI = "09f65e9f-262d-4aca...";
IDТовара = "1413992764";
IDТовара = "1414559567";
Остатки = Новый Структура;
Остатки.Вставить("offer_id" , "143210610");

View File

@ -35,7 +35,7 @@ import TabItem from '@theme/TabItem';
```bsl title="Пример использования для 1С:Предприятие/OneScript"
IDКлиента = "2479669";
КлючAPI = "09f65e9f-262d-4aca...";
IDТовара = "1413992764";
IDТовара = "1414559567";
Результат = OPI_Ozon.АрхивироватьТовары(IDКлиента, КлючAPI, IDТовара);
```

View File

@ -33,7 +33,7 @@ import TabItem from '@theme/TabItem';
```bsl title="Пример использования для 1С:Предприятие/OneScript"
IDКлиента = "2479669";
КлючAPI = "09f65e9f-262d-4aca...";
IDТовара = "1413992764";
IDТовара = "1414559567";
Результат = OPI_Ozon.ПроверитьЗагрузкуИзображенийТоваров(IDКлиента, КлючAPI, IDТовара);
```

View File

@ -39,7 +39,7 @@ import TabItem from '@theme/TabItem';
IDКлиента = "2479669";
КлючAPI = "09f65e9f-262d-4aca...";
IDТовара = "1413992764";
IDТовара = "1414559567";
Результат = OPI_Ozon.АрхивироватьТовары(IDКлиента, КлючAPI, IDТовара);

View File

@ -33,7 +33,7 @@ import TabItem from '@theme/TabItem';
```bsl title="Пример использования для 1С:Предприятие/OneScript"
IDКлиента = "2479669";
КлючAPI = "09f65e9f-262d-4aca...";
IDЗадачи = "1683494652";
IDЗадачи = "1688263517";
Результат = OPI_Ozon.ПолучитьСтатусДобавленияТовара(IDКлиента, КлючAPI, IDЗадачи);
```

View File

@ -35,7 +35,7 @@ import TabItem from '@theme/TabItem';
```bsl title="Пример использования для 1С:Предприятие/OneScript"
IDКлиента = "2479669";
КлючAPI = "09f65e9f-262d-4aca...";
IDТовара = "1413992764";
IDТовара = "1414559567";
Результат = OPI_Ozon.РазархивироватьТовары(IDКлиента, КлючAPI, IDТовара);
```

View File

@ -42,7 +42,7 @@ import TabItem from '@theme/TabItem';
```bsl title="Пример использования для 1С:Предприятие/OneScript"
IDКлиента = "2479669";
КлючAPI = "09f65e9f-262d-4aca...";
IDТовара = "1413992764";
IDТовара = "1414559567";
Картинка1 = "https://api.athenaeum.digital/test_data/picture.jpg";
Картинка2 = "https://api.athenaeum.digital/test_data/picture2.jpg";

View File

@ -38,7 +38,7 @@ import TabItem from '@theme/TabItem';
```bsl title="Пример использования для 1С:Предприятие/OneScript"
IDКлиента = "2479669";
КлючAPI = "09f65e9f-262d-4aca...";
IDТовара = "1413992764";
IDТовара = "1414559567";
Коды = Новый Массив;
Коды.Добавить("11111111");

File diff suppressed because it is too large Load Diff

View File

@ -4723,6 +4723,8 @@ EndFunction
// Structure Of KeyAndValue - Fields structure
Function GetCalednarCustomSettingsStructure(Val Clear = False) Export
OPI_TypeConversion.GetBoolean(Clear);
SettingsStructure = New Structure;
SettingsStructure.Insert("view" , "<standard presentation: day, week, month, list>");
@ -4773,6 +4775,8 @@ EndFunction
// Structure Of KeyAndValue - Fields structure
Function GetCalendarStructure(Val Clear = False) Export
OPI_TypeConversion.GetBoolean(Clear);
CalendarsStructure = New Structure;
CalendarsStructure.Insert("type" , "<calendar type: user, group)>");
@ -5016,6 +5020,8 @@ EndFunction
// Structure Of KeyAndValue - Fields structure
Function GetCalendarEventsStructure(Val Clear = False) Export
OPI_TypeConversion.GetBoolean(Clear);
EventStucture = New Structure;
EventStucture.Insert("type" , "<calendar type: user, group, company_calendar>");
@ -5090,6 +5096,8 @@ EndFunction
// Structure Of KeyAndValue - Fields structure
Function GetCalendarEventsFilterStructure(Val Clear = False) Export
OPI_TypeConversion.GetBoolean(Clear);
FilterStructure = New Structure;
FilterStructure.Insert("from" , "<selection start date. 3 months before the current default>");

189
src/en/OInt/core/Modules/OPI_GreenAPI.os vendored Normal file
View File

@ -0,0 +1,189 @@
// OneScript: ./OInt/core/Modules/OPI_GreenAPI.os
// Lib: Green API
// CLI: greenapi
// MIT License
// Copyright (c) 2023 Anton Tsitavets
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
// https://github.com/Bayselonarrend/OpenIntegrations
// BSLLS:Typo-off
// BSLLS:LatinAndCyrillicSymbolInWord-off
// BSLLS:IncorrectLineBreak-off
// BSLLS:NumberOfOptionalParams-off
// BSLLS:UsingServiceTag-off
// BSLLS:LineLength-off
//@skip-check module-structure-top-region
//@skip-check module-structure-method-in-regions
//@skip-check wrong-string-literal-content
//@skip-check method-too-many-params
// Uncomment if OneScript is executed
#Use "../../tools"
#Region Public
#Region Account
// Form access parameters
// Forms the structure of basic authorization data
//
// Note
// More details in the API documentation: [Get access parameters to instance](@green-api.com/en/docs/before-start/#parameters)
//
// Parameters:
// ApiUrl - String - API host link - api
// MediaUrl - String - Link to host API for sending files - media
// IdInstance - String - Unique instance number - id
// ApiTokenInstance - String - Instance access key - token
//
// Returns:
// Structure - Structure of access parameters
Function FormAccessParameters(Val ApiUrl, Val MediaUrl, Val IdInstance, Val ApiTokenInstance) Export
String_ = "String";
Parameters = New Structure;
OPI_Tools.AddField("apiUrl" , ApiUrl , String_, Parameters);
OPI_Tools.AddField("mediaUrl" , MediaUrl , String_, Parameters);
OPI_Tools.AddField("idInstance" , IdInstance , String_, Parameters);
OPI_Tools.AddField("apiTokenInstance", ApiTokenInstance, String_, Parameters);
Return Parameters;
EndFunction
// Get instance settings
// Gets the current instance settings
//
// Note
// Method at API documentation: [GetSettings](@green-api.com/docs/api/account/GetSettings/)
//
// Parameters:
// AccessParameters - Structure Of KeyAndValue - Access parameters. See FormAccessParameters - access
//
// Returns:
// Map Of KeyAndValue - serialized JSON response from Green API
Function GetInstanceSettings(Val AccessParameters) Export
URL = FormPrimaryURL(AccessParameters, "getSettings");
Response = OPI_Tools.Get(URL);
Return Response;
EndFunction
// Set instance settings
// Sets the instance settings
//
// Note
// Method at API documentation: [GetSettings](@green-api.com/docs/api/account/SetSettings/)
//
// Parameters:
// Settings - Structure Of KeyAndValue - Instance settings. See GetInstanceSettingsStructure - settings
// AccessParameters - Structure Of KeyAndValue - Access parameters. See FormAccessParameters - access
//
// Returns:
// Map Of KeyAndValue - serialized JSON response from Green API
Function SetInstanceSettings(Val Settings, Val AccessParameters) Export
OPI_TypeConversion.GetKeyValueCollection(AccessParameters);
URL = FormPrimaryURL(AccessParameters, "setSettings");
Response = OPI_Tools.Post(URL, Settings);
Return Response;
EndFunction
// Get instance settings structure
// Gets the structure template for instance settings
//
// Parameters:
// Clear - Boolean - True > structure with empty valuse, False > field descriptions at values - empty
//
// Returns:
// Structure Of KeyAndValue - Structure of instance settings
Function GetInstanceSettingsStructure(Val Clear = False) Export
OPI_TypeConversion.GetBoolean(Clear);
SettingsStructure = New Structure;
SettingsStructure.Insert("webhookUrl" , "<URL for notification sending>");
SettingsStructure.Insert("webhookUrlToken" , "<a token to access your notification server, if required>");
SettingsStructure.Insert("delaySendMessagesMilliseconds" , "<message sending interval in milliseconds>");
SettingsStructure.Insert("markIncomingMessagesReaded" , "<mark incoming messages as read: yes, no>");
SettingsStructure.Insert("markIncomingMessagesReadedOnReply", "<mark incoming messages as read when sending a message to chat: yes, no>");
SettingsStructure.Insert("outgoingWebhook" , "<receive notifications about the send/deliver/read status of outgoing messages: yes, no>");
SettingsStructure.Insert("outgoingMessageWebhook" , "<receive notifications of messages sent from phone: yes, no>");
SettingsStructure.Insert("outgoingAPIMessageWebhook" , "<receive notifications about messages sent via API: yes, no>");
SettingsStructure.Insert("stateWebhook" , "<receive notifications about changes in the authorization state of the instance: yes, no>");
SettingsStructure.Insert("incomingWebhook" , "<receive notifications of incoming messages and files: yes, no>");
SettingsStructure.Insert("deviceWebhook" , "<receive notifications about the device (phone) and battery level: yes, no>");
SettingsStructure.Insert("keepOnlineStatus" , "<sets the 'Online' status for your account>");
SettingsStructure.Insert("pollMessageWebhook" , "<receive notifications when a poll is created and voted on: yes, no>");
SettingsStructure.Insert("incomingBlockWebhook" , "<receive notifications when a chat is added to the blocked contacts list: yes, no>");
SettingsStructure.Insert("incomingCallWebhook" , "<receive notifications about incoming call statuses: yes, no>");
SettingsStructure.Insert("editedMessageWebhook" , "<to be notified when a message has been edited: yes, no>");
SettingsStructure.Insert("deletedMessageWebhook" , "<receive notifications when a message has been deleted: yes, no>");
If Clear Then
SettingsStructure = OPI_Tools.ClearCollectionRecursively(SettingsStructure);
EndIf;
//@skip-check constructor-function-return-section
Return SettingsStructure;
EndFunction
#EndRegion
#EndRegion
#Region Private
Function FormPrimaryURL(Val AccessParameters, Val Method)
OPI_TypeConversion.GetKeyValueCollection(AccessParameters);
OPI_TypeConversion.GetLine(Method);
RequiredFields = StrSplit("apiUrl,idInstance,apiTokenInstance", ",");
MissingFields = OPI_Tools.FindMissingCollectionFields(AccessParameters, RequiredFields);
If MissingFields.Count() > 0 Then
Raise "Missing mandatory fields in access parameters!";
EndIf;
ApiUrl = AccessParameters["apiUrl"];
IdInstance = AccessParameters["idInstance"];
ApiTokenInstance = AccessParameters["apiTokenInstance"];
URL = StrTemplate("%1/waInstance%2/%3/%4", ApiUrl, IdInstance, Method, ApiTokenInstance);
Return URL;
EndFunction
#EndRegion

View File

@ -7,6 +7,7 @@
<module name="OPI_GoogleDrive" file="core/Modules/OPI_GoogleDrive.os"/>
<module name="OPI_GoogleSheets" file="core/Modules/OPI_GoogleSheets.os"/>
<module name="OPI_GoogleWorkspace" file="core/Modules/OPI_GoogleWorkspace.os"/>
<module name="OPI_GreenAPI" file="core/Modules/OPI_GreenAPI.os"/>
<module name="OPI_Neocities" file="core/Modules/OPI_Neocities.os"/>
<module name="OPI_Notion" file="core/Modules/OPI_Notion.os"/>
<module name="OPI_Ozon" file="core/Modules/OPI_Ozon.os"/>

View File

@ -2361,6 +2361,25 @@ EndProcedure
#EndRegion
#Region GreenAPI
Procedure GAPI_Account() Export
TestParameters = New Structure;
OPI_TestDataRetrieval.ParameterToCollection("GreenAPI_ApiURL" , TestParameters);
OPI_TestDataRetrieval.ParameterToCollection("GreenAPI_MediaURL" , TestParameters);
OPI_TestDataRetrieval.ParameterToCollection("GreenAPI_IdInstance", TestParameters);
OPI_TestDataRetrieval.ParameterToCollection("GreenAPI_Token" , TestParameters);
GreenAPI_FormAccessParameters(TestParameters);
GreenAPI_GetInstanceSettings(TestParameters);
GreenAPI_GetInstanceSettingsStructure(TestParameters);
GreenAPI_SetInstanceSettings(TestParameters);
EndProcedure
#EndRegion
#EndRegion
#EndRegion
@ -18068,6 +18087,90 @@ EndProcedure
#EndRegion
#Region GreenAPI
Procedure GreenAPI_FormAccessParameters(FunctionParameters)
ApiUrl = FunctionParameters["GreenAPI_ApiURL"];
MediaUrl = FunctionParameters["GreenAPI_MediaURL"];
IdInstance = FunctionParameters["GreenAPI_IdInstance"];
ApiTokenInstance = FunctionParameters["GreenAPI_Token"];
Result = OPI_GreenAPI.FormAccessParameters(ApiUrl, MediaUrl, IdInstance, ApiTokenInstance);
// END
OPI_TestDataRetrieval.WriteLog(Result, "FormAccessParameters", "GreenAPI");
OPI_TestDataRetrieval.Check_Structure(Result);
EndProcedure
Procedure GreenAPI_GetInstanceSettings(FunctionParameters)
ApiUrl = FunctionParameters["GreenAPI_ApiURL"];
MediaUrl = FunctionParameters["GreenAPI_MediaURL"];
IdInstance = FunctionParameters["GreenAPI_IdInstance"];
ApiTokenInstance = FunctionParameters["GreenAPI_Token"];
AccessParameters = OPI_GreenAPI.FormAccessParameters(ApiUrl, MediaUrl, IdInstance, ApiTokenInstance);
Result = OPI_GreenAPI.GetInstanceSettings(AccessParameters);
// END
OPI_TestDataRetrieval.WriteLog(Result, "GetInstanceSettings", "GreenAPI");
OPI_TestDataRetrieval.Check_GreenInstance(Result);
EndProcedure
Procedure GreenAPI_GetInstanceSettingsStructure(FunctionParameters)
Result = OPI_GreenAPI.GetInstanceSettingsStructure();
// END
OPI_TestDataRetrieval.WriteLog(Result, "GetInstanceSettingsStructure", "GreenAPI");
OPI_TestDataRetrieval.Check_Structure(Result);
Result = OPI_GreenAPI.GetInstanceSettingsStructure(True);
OPI_TestDataRetrieval.WriteLog(Result, "GetInstanceSettingsStructure (empty)", "GreenAPI");
For Each Element In Result Do
If OPI_Tools.IsPrimitiveType(Element.Value) Then
OPI_TestDataRetrieval.Check_Empty(Element.Value);
EndIf;
EndDo;
EndProcedure
Procedure GreenAPI_SetInstanceSettings(FunctionParameters)
ApiUrl = FunctionParameters["GreenAPI_ApiURL"];
MediaUrl = FunctionParameters["GreenAPI_MediaURL"];
IdInstance = FunctionParameters["GreenAPI_IdInstance"];
ApiTokenInstance = FunctionParameters["GreenAPI_Token"];
AccessParameters = OPI_GreenAPI.FormAccessParameters(ApiUrl, MediaUrl, IdInstance, ApiTokenInstance);
SettingsStructure = New Structure;
SettingsStructure.Insert("pollMessageWebhook" , "yes");
SettingsStructure.Insert("incomingBlockWebhook" , "no");
SettingsStructure.Insert("incomingCallWebhook" , "no");
SettingsStructure.Insert("editedMessageWebhook" , "yes");
SettingsStructure.Insert("deletedMessageWebhook", "yes");
Result = OPI_GreenAPI.SetInstanceSettings(SettingsStructure, AccessParameters);
// END
OPI_TestDataRetrieval.WriteLog(Result, "GetInstanceSettings", "GreenAPI");
OPI_TestDataRetrieval.Check_GreenSettingsSaving(Result);
EndProcedure
#EndRegion
#EndRegion
#EndRegion

View File

@ -2329,6 +2329,25 @@ EndProcedure
#EndRegion
#Region GreenAPI
Procedure CLI_GAPI_Account() Export
TestParameters = New Structure;
OPI_TestDataRetrieval.ParameterToCollection("GreenAPI_ApiURL" , TestParameters);
OPI_TestDataRetrieval.ParameterToCollection("GreenAPI_MediaURL" , TestParameters);
OPI_TestDataRetrieval.ParameterToCollection("GreenAPI_IdInstance", TestParameters);
OPI_TestDataRetrieval.ParameterToCollection("GreenAPI_Token" , TestParameters);
CLI_GreenAPI_FormAccessParameters(TestParameters);
CLI_GreenAPI_GetInstanceSettings(TestParameters);
CLI_GreenAPI_GetInstanceSettingsStructure(TestParameters);
CLI_GreenAPI_SetInstanceSettings(TestParameters);
EndProcedure
#EndRegion
#EndRegion
#EndRegion
@ -20241,6 +20260,123 @@ EndProcedure
#EndRegion
#Region GreenAPI
Procedure CLI_GreenAPI_FormAccessParameters(FunctionParameters)
ApiUrl = FunctionParameters["GreenAPI_ApiURL"];
MediaUrl = FunctionParameters["GreenAPI_MediaURL"];
IdInstance = FunctionParameters["GreenAPI_IdInstance"];
ApiTokenInstance = FunctionParameters["GreenAPI_Token"];
Options = New Structure;
Options.Insert("api" , ApiUrl);
Options.Insert("media", MediaUrl);
Options.Insert("id" , IdInstance);
Options.Insert("token", ApiTokenInstance);
Result = OPI_TestDataRetrieval.ExecuteTestCLI("greenapi", "FormAccessParameters", Options);
// END
OPI_TestDataRetrieval.WriteLog(Result, "FormAccessParameters", "GreenAPI");
OPI_TestDataRetrieval.Check_Map(Result);
EndProcedure
Procedure CLI_GreenAPI_GetInstanceSettings(FunctionParameters)
ApiUrl = FunctionParameters["GreenAPI_ApiURL"];
MediaUrl = FunctionParameters["GreenAPI_MediaURL"];
IdInstance = FunctionParameters["GreenAPI_IdInstance"];
ApiTokenInstance = FunctionParameters["GreenAPI_Token"];
Options = New Structure;
Options.Insert("api" , ApiUrl);
Options.Insert("media", MediaUrl);
Options.Insert("id" , IdInstance);
Options.Insert("token", ApiTokenInstance);
AccessParameters = OPI_TestDataRetrieval.ExecuteTestCLI("greenapi", "FormAccessParameters", Options);
Options = New Structure;
Options.Insert("access", AccessParameters);
Result = OPI_TestDataRetrieval.ExecuteTestCLI("greenapi", "GetInstanceSettings", Options);
// END
OPI_TestDataRetrieval.WriteLog(Result, "GetInstanceSettings", "GreenAPI");
OPI_TestDataRetrieval.Check_GreenInstance(Result);
EndProcedure
Procedure CLI_GreenAPI_GetInstanceSettingsStructure(FunctionParameters)
Options = New Structure;
Options.Insert("empty", False);
Result = OPI_TestDataRetrieval.ExecuteTestCLI("greenapi", "GetInstanceSettingsStructure", Options);
// END
OPI_TestDataRetrieval.WriteLog(Result, "GetInstanceSettingsStructure", "GreenAPI");
OPI_TestDataRetrieval.Check_Structure(Result);
Options = New Structure;
Options.Insert("empty", True);
Result = OPI_TestDataRetrieval.ExecuteTestCLI("greenapi", "GetInstanceSettingsStructure", Options);
OPI_TestDataRetrieval.WriteLog(Result, "GetInstanceSettingsStructure (empty)", "GreenAPI");
For Each Element In Result Do
If OPI_Tools.IsPrimitiveType(Element.Value) Then
OPI_TestDataRetrieval.Check_Empty(Element.Value);
EndIf;
EndDo;
EndProcedure
Procedure CLI_GreenAPI_SetInstanceSettings(FunctionParameters)
ApiUrl = FunctionParameters["GreenAPI_ApiURL"];
MediaUrl = FunctionParameters["GreenAPI_MediaURL"];
IdInstance = FunctionParameters["GreenAPI_IdInstance"];
ApiTokenInstance = FunctionParameters["GreenAPI_Token"];
Options = New Structure;
Options.Insert("api" , ApiUrl);
Options.Insert("media", MediaUrl);
Options.Insert("id" , IdInstance);
Options.Insert("token", ApiTokenInstance);
AccessParameters = OPI_TestDataRetrieval.ExecuteTestCLI("greenapi", "FormAccessParameters", Options);
SettingsStructure = New Structure;
SettingsStructure.Insert("pollMessageWebhook" , "yes");
SettingsStructure.Insert("incomingBlockWebhook" , "no");
SettingsStructure.Insert("incomingCallWebhook" , "no");
SettingsStructure.Insert("editedMessageWebhook" , "yes");
SettingsStructure.Insert("deletedMessageWebhook", "yes");
Options = New Structure;
Options.Insert("settings", SettingsStructure);
Options.Insert("access" , AccessParameters);
Result = OPI_TestDataRetrieval.ExecuteTestCLI("greenapi", "SetInstanceSettings", Options);
// END
OPI_TestDataRetrieval.WriteLog(Result, "SetInstanceSettings", "GreenAPI");
OPI_TestDataRetrieval.Check_GreenSettingsSaving(Result);
EndProcedure
#EndRegion
#EndRegion
#EndRegion

View File

@ -73,6 +73,7 @@ Function GetTestingSectionMapping() Export
Sections.Insert("YandexMetrika" , 5);
Sections.Insert("S3" , 5);
Sections.Insert("TCP" , 5);
Sections.Insert("GreenAPI" , 5);
Return Sections;
@ -107,6 +108,7 @@ Function GetTestingSectionMappingGA() Export
Sections.Insert("YandexMetrika" , StandardDependencies);
Sections.Insert("S3" , StandardDependencies);
Sections.Insert("TCP" , StandardDependencies);
Sections.Insert("GreenAPI" , StandardDependencies);
Return Sections;
@ -137,6 +139,7 @@ Function GetTestTable() Export
TCP = "TCP";
SQLite = "SQLite";
Postgres = "PostgreSQL";
GreenAPI = "GreenAPI";
TestTable = New ValueTable;
TestTable.Columns.Add("Method");
@ -276,6 +279,7 @@ Function GetTestTable() Export
NewTest(TestTable, "SQLL_ORM" , "ORM" , SQLite);
NewTest(TestTable, "Postgres_CommonMethods" , "Common methods" , Postgres);
NewTest(TestTable, "Postgres_ORM" , "ORM" , Postgres);
NewTest(TestTable, "GAPI_Account" , "Account" , GreenAPI);
Return TestTable;
@ -2126,6 +2130,18 @@ Procedure Check_ResultFalse(Val Result) Export
EndProcedure
Procedure Check_GreenInstance(Val Result) Export
ExpectsThat(Result["wid"]).Заполнено();
EndProcedure
Procedure Check_GreenSettingsSaving(Val Result) Export
ExpectsThat(Result["saveSettings"]).Равно(True);
EndProcedure
#EndRegion
#EndRegion

View File

@ -1461,8 +1461,12 @@ Function ExecuteRequestWithBody(Val URL, Val View, Val Parameters = "", Val Addi
EndFunction
Function ExecuteRequestWithBinaryData(Val URL, Val View, Val Data, Val AdditionalHeaders, Val FullResponse,
Val DataType)
Function ExecuteRequestWithBinaryData(Val URL
, Val View
, Val Data
, Val AdditionalHeaders
, Val FullResponse
, Val DataType)
URLStructure = SplitURL(URL);
Host = URLStructure["Host"];
@ -1483,8 +1487,11 @@ Function ExecuteRequestWithBinaryData(Val URL, Val View, Val Data, Val Additiona
EndFunction
Function ExecuteRequestWithoutBody(Val URL, Val View, Val Parameters = "", Val AdditionalHeaders = "",
Val ResponseFile = Undefined)
Function ExecuteRequestWithoutBody(Val URL
, Val View
, Val Parameters = ""
, Val AdditionalHeaders = ""
, Val ResponseFile = Undefined)
If Not ValueIsFilled(Parameters) Then
Parameters = New Structure;

View File

@ -4723,6 +4723,8 @@ EndFunction
// Structure Of KeyAndValue - Fields structure
Function GetCalednarCustomSettingsStructure(Val Clear = False) Export
OPI_TypeConversion.GetBoolean(Clear);
SettingsStructure = New Structure;
SettingsStructure.Insert("view" , "<standard presentation: day, week, month, list>");
@ -4773,6 +4775,8 @@ EndFunction
// Structure Of KeyAndValue - Fields structure
Function GetCalendarStructure(Val Clear = False) Export
OPI_TypeConversion.GetBoolean(Clear);
CalendarsStructure = New Structure;
CalendarsStructure.Insert("type" , "<calendar type: user, group)>");
@ -5016,6 +5020,8 @@ EndFunction
// Structure Of KeyAndValue - Fields structure
Function GetCalendarEventsStructure(Val Clear = False) Export
OPI_TypeConversion.GetBoolean(Clear);
EventStucture = New Structure;
EventStucture.Insert("type" , "<calendar type: user, group, company_calendar>");
@ -5090,6 +5096,8 @@ EndFunction
// Structure Of KeyAndValue - Fields structure
Function GetCalendarEventsFilterStructure(Val Clear = False) Export
OPI_TypeConversion.GetBoolean(Clear);
FilterStructure = New Structure;
FilterStructure.Insert("from" , "<selection start date. 3 months before the current default>");

View File

@ -0,0 +1,189 @@
// OneScript: ./OInt/core/Modules/OPI_GreenAPI.os
// Lib: Green API
// CLI: greenapi
// MIT License
// Copyright (c) 2023 Anton Tsitavets
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
// https://github.com/Bayselonarrend/OpenIntegrations
// BSLLS:Typo-off
// BSLLS:LatinAndCyrillicSymbolInWord-off
// BSLLS:IncorrectLineBreak-off
// BSLLS:NumberOfOptionalParams-off
// BSLLS:UsingServiceTag-off
// BSLLS:LineLength-off
//@skip-check module-structure-top-region
//@skip-check module-structure-method-in-regions
//@skip-check wrong-string-literal-content
//@skip-check method-too-many-params
// Uncomment if OneScript is executed
// #Use "../../tools"
#Region Public
#Region Account
// Form access parameters
// Forms the structure of basic authorization data
//
// Note
// More details in the API documentation: [Get access parameters to instance](@green-api.com/en/docs/before-start/#parameters)
//
// Parameters:
// ApiUrl - String - API host link - api
// MediaUrl - String - Link to host API for sending files - media
// IdInstance - String - Unique instance number - id
// ApiTokenInstance - String - Instance access key - token
//
// Returns:
// Structure - Structure of access parameters
Function FormAccessParameters(Val ApiUrl, Val MediaUrl, Val IdInstance, Val ApiTokenInstance) Export
String_ = "String";
Parameters = New Structure;
OPI_Tools.AddField("apiUrl" , ApiUrl , String_, Parameters);
OPI_Tools.AddField("mediaUrl" , MediaUrl , String_, Parameters);
OPI_Tools.AddField("idInstance" , IdInstance , String_, Parameters);
OPI_Tools.AddField("apiTokenInstance", ApiTokenInstance, String_, Parameters);
Return Parameters;
EndFunction
// Get instance settings
// Gets the current instance settings
//
// Note
// Method at API documentation: [GetSettings](@green-api.com/docs/api/account/GetSettings/)
//
// Parameters:
// AccessParameters - Structure Of KeyAndValue - Access parameters. See FormAccessParameters - access
//
// Returns:
// Map Of KeyAndValue - serialized JSON response from Green API
Function GetInstanceSettings(Val AccessParameters) Export
URL = FormPrimaryURL(AccessParameters, "getSettings");
Response = OPI_Tools.Get(URL);
Return Response;
EndFunction
// Set instance settings
// Sets the instance settings
//
// Note
// Method at API documentation: [GetSettings](@green-api.com/docs/api/account/SetSettings/)
//
// Parameters:
// Settings - Structure Of KeyAndValue - Instance settings. See GetInstanceSettingsStructure - settings
// AccessParameters - Structure Of KeyAndValue - Access parameters. See FormAccessParameters - access
//
// Returns:
// Map Of KeyAndValue - serialized JSON response from Green API
Function SetInstanceSettings(Val Settings, Val AccessParameters) Export
OPI_TypeConversion.GetKeyValueCollection(AccessParameters);
URL = FormPrimaryURL(AccessParameters, "setSettings");
Response = OPI_Tools.Post(URL, Settings);
Return Response;
EndFunction
// Get instance settings structure
// Gets the structure template for instance settings
//
// Parameters:
// Clear - Boolean - True > structure with empty valuse, False > field descriptions at values - empty
//
// Returns:
// Structure Of KeyAndValue - Structure of instance settings
Function GetInstanceSettingsStructure(Val Clear = False) Export
OPI_TypeConversion.GetBoolean(Clear);
SettingsStructure = New Structure;
SettingsStructure.Insert("webhookUrl" , "<URL for notification sending>");
SettingsStructure.Insert("webhookUrlToken" , "<a token to access your notification server, if required>");
SettingsStructure.Insert("delaySendMessagesMilliseconds" , "<message sending interval in milliseconds>");
SettingsStructure.Insert("markIncomingMessagesReaded" , "<mark incoming messages as read: yes, no>");
SettingsStructure.Insert("markIncomingMessagesReadedOnReply", "<mark incoming messages as read when sending a message to chat: yes, no>");
SettingsStructure.Insert("outgoingWebhook" , "<receive notifications about the send/deliver/read status of outgoing messages: yes, no>");
SettingsStructure.Insert("outgoingMessageWebhook" , "<receive notifications of messages sent from phone: yes, no>");
SettingsStructure.Insert("outgoingAPIMessageWebhook" , "<receive notifications about messages sent via API: yes, no>");
SettingsStructure.Insert("stateWebhook" , "<receive notifications about changes in the authorization state of the instance: yes, no>");
SettingsStructure.Insert("incomingWebhook" , "<receive notifications of incoming messages and files: yes, no>");
SettingsStructure.Insert("deviceWebhook" , "<receive notifications about the device (phone) and battery level: yes, no>");
SettingsStructure.Insert("keepOnlineStatus" , "<sets the 'Online' status for your account>");
SettingsStructure.Insert("pollMessageWebhook" , "<receive notifications when a poll is created and voted on: yes, no>");
SettingsStructure.Insert("incomingBlockWebhook" , "<receive notifications when a chat is added to the blocked contacts list: yes, no>");
SettingsStructure.Insert("incomingCallWebhook" , "<receive notifications about incoming call statuses: yes, no>");
SettingsStructure.Insert("editedMessageWebhook" , "<to be notified when a message has been edited: yes, no>");
SettingsStructure.Insert("deletedMessageWebhook" , "<receive notifications when a message has been deleted: yes, no>");
If Clear Then
SettingsStructure = OPI_Tools.ClearCollectionRecursively(SettingsStructure);
EndIf;
//@skip-check constructor-function-return-section
Return SettingsStructure;
EndFunction
#EndRegion
#EndRegion
#Region Private
Function FormPrimaryURL(Val AccessParameters, Val Method)
OPI_TypeConversion.GetKeyValueCollection(AccessParameters);
OPI_TypeConversion.GetLine(Method);
RequiredFields = StrSplit("apiUrl,idInstance,apiTokenInstance", ",");
MissingFields = OPI_Tools.FindMissingCollectionFields(AccessParameters, RequiredFields);
If MissingFields.Count() > 0 Then
Raise "Missing mandatory fields in access parameters!";
EndIf;
ApiUrl = AccessParameters["apiUrl"];
IdInstance = AccessParameters["idInstance"];
ApiTokenInstance = AccessParameters["apiTokenInstance"];
URL = StrTemplate("%1/waInstance%2/%3/%4", ApiUrl, IdInstance, Method, ApiTokenInstance);
Return URL;
EndFunction
#EndRegion

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<mdclass:CommonModule xmlns:mdclass="http://g5.1c.ru/v8/dt/metadata/mdclass" uuid="9a796a27-ce46-4b3f-b763-7b3acd9edd0d">
<name>OPI_GreenAPI</name>
<synonym>
<key>en</key>
<value>Green API (OpenIntegrations)</value>
</synonym>
<server>true</server>
<externalConnection>true</externalConnection>
<clientOrdinaryApplication>true</clientOrdinaryApplication>
</mdclass:CommonModule>

View File

@ -73,6 +73,7 @@ Function GetTestingSectionMapping() Export
Sections.Insert("YandexMetrika" , 5);
Sections.Insert("S3" , 5);
Sections.Insert("TCP" , 5);
Sections.Insert("GreenAPI" , 5);
Return Sections;
@ -107,6 +108,7 @@ Function GetTestingSectionMappingGA() Export
Sections.Insert("YandexMetrika" , StandardDependencies);
Sections.Insert("S3" , StandardDependencies);
Sections.Insert("TCP" , StandardDependencies);
Sections.Insert("GreenAPI" , StandardDependencies);
Return Sections;
@ -137,6 +139,7 @@ Function GetTestTable() Export
TCP = "TCP";
SQLite = "SQLite";
Postgres = "PostgreSQL";
GreenAPI = "GreenAPI";
TestTable = New ValueTable;
TestTable.Columns.Add("Method");
@ -276,6 +279,7 @@ Function GetTestTable() Export
NewTest(TestTable, "SQLL_ORM" , "ORM" , SQLite);
NewTest(TestTable, "Postgres_CommonMethods" , "Common methods" , Postgres);
NewTest(TestTable, "Postgres_ORM" , "ORM" , Postgres);
NewTest(TestTable, "GAPI_Account" , "Account" , GreenAPI);
Return TestTable;
@ -2126,6 +2130,18 @@ Procedure Check_ResultFalse(Val Result) Export
EndProcedure
Procedure Check_GreenInstance(Val Result) Export
ExpectsThat(Result["wid"]).Заполнено();
EndProcedure
Procedure Check_GreenSettingsSaving(Val Result) Export
ExpectsThat(Result["saveSettings"]).Равно(True);
EndProcedure
#EndRegion
#EndRegion

View File

@ -2361,6 +2361,25 @@ EndProcedure
#EndRegion
#Region GreenAPI
Procedure GAPI_Account() Export
TestParameters = New Structure;
OPI_TestDataRetrieval.ParameterToCollection("GreenAPI_ApiURL" , TestParameters);
OPI_TestDataRetrieval.ParameterToCollection("GreenAPI_MediaURL" , TestParameters);
OPI_TestDataRetrieval.ParameterToCollection("GreenAPI_IdInstance", TestParameters);
OPI_TestDataRetrieval.ParameterToCollection("GreenAPI_Token" , TestParameters);
GreenAPI_FormAccessParameters(TestParameters);
GreenAPI_GetInstanceSettings(TestParameters);
GreenAPI_GetInstanceSettingsStructure(TestParameters);
GreenAPI_SetInstanceSettings(TestParameters);
EndProcedure
#EndRegion
#EndRegion
#EndRegion
@ -18068,6 +18087,90 @@ EndProcedure
#EndRegion
#Region GreenAPI
Procedure GreenAPI_FormAccessParameters(FunctionParameters)
ApiUrl = FunctionParameters["GreenAPI_ApiURL"];
MediaUrl = FunctionParameters["GreenAPI_MediaURL"];
IdInstance = FunctionParameters["GreenAPI_IdInstance"];
ApiTokenInstance = FunctionParameters["GreenAPI_Token"];
Result = OPI_GreenAPI.FormAccessParameters(ApiUrl, MediaUrl, IdInstance, ApiTokenInstance);
// END
OPI_TestDataRetrieval.WriteLog(Result, "FormAccessParameters", "GreenAPI");
OPI_TestDataRetrieval.Check_Structure(Result);
EndProcedure
Procedure GreenAPI_GetInstanceSettings(FunctionParameters)
ApiUrl = FunctionParameters["GreenAPI_ApiURL"];
MediaUrl = FunctionParameters["GreenAPI_MediaURL"];
IdInstance = FunctionParameters["GreenAPI_IdInstance"];
ApiTokenInstance = FunctionParameters["GreenAPI_Token"];
AccessParameters = OPI_GreenAPI.FormAccessParameters(ApiUrl, MediaUrl, IdInstance, ApiTokenInstance);
Result = OPI_GreenAPI.GetInstanceSettings(AccessParameters);
// END
OPI_TestDataRetrieval.WriteLog(Result, "GetInstanceSettings", "GreenAPI");
OPI_TestDataRetrieval.Check_GreenInstance(Result);
EndProcedure
Procedure GreenAPI_GetInstanceSettingsStructure(FunctionParameters)
Result = OPI_GreenAPI.GetInstanceSettingsStructure();
// END
OPI_TestDataRetrieval.WriteLog(Result, "GetInstanceSettingsStructure", "GreenAPI");
OPI_TestDataRetrieval.Check_Structure(Result);
Result = OPI_GreenAPI.GetInstanceSettingsStructure(True);
OPI_TestDataRetrieval.WriteLog(Result, "GetInstanceSettingsStructure (empty)", "GreenAPI");
For Each Element In Result Do
If OPI_Tools.IsPrimitiveType(Element.Value) Then
OPI_TestDataRetrieval.Check_Empty(Element.Value);
EndIf;
EndDo;
EndProcedure
Procedure GreenAPI_SetInstanceSettings(FunctionParameters)
ApiUrl = FunctionParameters["GreenAPI_ApiURL"];
MediaUrl = FunctionParameters["GreenAPI_MediaURL"];
IdInstance = FunctionParameters["GreenAPI_IdInstance"];
ApiTokenInstance = FunctionParameters["GreenAPI_Token"];
AccessParameters = OPI_GreenAPI.FormAccessParameters(ApiUrl, MediaUrl, IdInstance, ApiTokenInstance);
SettingsStructure = New Structure;
SettingsStructure.Insert("pollMessageWebhook" , "yes");
SettingsStructure.Insert("incomingBlockWebhook" , "no");
SettingsStructure.Insert("incomingCallWebhook" , "no");
SettingsStructure.Insert("editedMessageWebhook" , "yes");
SettingsStructure.Insert("deletedMessageWebhook", "yes");
Result = OPI_GreenAPI.SetInstanceSettings(SettingsStructure, AccessParameters);
// END
OPI_TestDataRetrieval.WriteLog(Result, "GetInstanceSettings", "GreenAPI");
OPI_TestDataRetrieval.Check_GreenSettingsSaving(Result);
EndProcedure
#EndRegion
#EndRegion
#EndRegion

View File

@ -2329,6 +2329,25 @@ EndProcedure
#EndRegion
#Region GreenAPI
Procedure CLI_GAPI_Account() Export
TestParameters = New Structure;
OPI_TestDataRetrieval.ParameterToCollection("GreenAPI_ApiURL" , TestParameters);
OPI_TestDataRetrieval.ParameterToCollection("GreenAPI_MediaURL" , TestParameters);
OPI_TestDataRetrieval.ParameterToCollection("GreenAPI_IdInstance", TestParameters);
OPI_TestDataRetrieval.ParameterToCollection("GreenAPI_Token" , TestParameters);
CLI_GreenAPI_FormAccessParameters(TestParameters);
CLI_GreenAPI_GetInstanceSettings(TestParameters);
CLI_GreenAPI_GetInstanceSettingsStructure(TestParameters);
CLI_GreenAPI_SetInstanceSettings(TestParameters);
EndProcedure
#EndRegion
#EndRegion
#EndRegion
@ -20241,6 +20260,123 @@ EndProcedure
#EndRegion
#Region GreenAPI
Procedure CLI_GreenAPI_FormAccessParameters(FunctionParameters)
ApiUrl = FunctionParameters["GreenAPI_ApiURL"];
MediaUrl = FunctionParameters["GreenAPI_MediaURL"];
IdInstance = FunctionParameters["GreenAPI_IdInstance"];
ApiTokenInstance = FunctionParameters["GreenAPI_Token"];
Options = New Structure;
Options.Insert("api" , ApiUrl);
Options.Insert("media", MediaUrl);
Options.Insert("id" , IdInstance);
Options.Insert("token", ApiTokenInstance);
Result = OPI_TestDataRetrieval.ExecuteTestCLI("greenapi", "FormAccessParameters", Options);
// END
OPI_TestDataRetrieval.WriteLog(Result, "FormAccessParameters", "GreenAPI");
OPI_TestDataRetrieval.Check_Map(Result);
EndProcedure
Procedure CLI_GreenAPI_GetInstanceSettings(FunctionParameters)
ApiUrl = FunctionParameters["GreenAPI_ApiURL"];
MediaUrl = FunctionParameters["GreenAPI_MediaURL"];
IdInstance = FunctionParameters["GreenAPI_IdInstance"];
ApiTokenInstance = FunctionParameters["GreenAPI_Token"];
Options = New Structure;
Options.Insert("api" , ApiUrl);
Options.Insert("media", MediaUrl);
Options.Insert("id" , IdInstance);
Options.Insert("token", ApiTokenInstance);
AccessParameters = OPI_TestDataRetrieval.ExecuteTestCLI("greenapi", "FormAccessParameters", Options);
Options = New Structure;
Options.Insert("access", AccessParameters);
Result = OPI_TestDataRetrieval.ExecuteTestCLI("greenapi", "GetInstanceSettings", Options);
// END
OPI_TestDataRetrieval.WriteLog(Result, "GetInstanceSettings", "GreenAPI");
OPI_TestDataRetrieval.Check_GreenInstance(Result);
EndProcedure
Procedure CLI_GreenAPI_GetInstanceSettingsStructure(FunctionParameters)
Options = New Structure;
Options.Insert("empty", False);
Result = OPI_TestDataRetrieval.ExecuteTestCLI("greenapi", "GetInstanceSettingsStructure", Options);
// END
OPI_TestDataRetrieval.WriteLog(Result, "GetInstanceSettingsStructure", "GreenAPI");
OPI_TestDataRetrieval.Check_Structure(Result);
Options = New Structure;
Options.Insert("empty", True);
Result = OPI_TestDataRetrieval.ExecuteTestCLI("greenapi", "GetInstanceSettingsStructure", Options);
OPI_TestDataRetrieval.WriteLog(Result, "GetInstanceSettingsStructure (empty)", "GreenAPI");
For Each Element In Result Do
If OPI_Tools.IsPrimitiveType(Element.Value) Then
OPI_TestDataRetrieval.Check_Empty(Element.Value);
EndIf;
EndDo;
EndProcedure
Procedure CLI_GreenAPI_SetInstanceSettings(FunctionParameters)
ApiUrl = FunctionParameters["GreenAPI_ApiURL"];
MediaUrl = FunctionParameters["GreenAPI_MediaURL"];
IdInstance = FunctionParameters["GreenAPI_IdInstance"];
ApiTokenInstance = FunctionParameters["GreenAPI_Token"];
Options = New Structure;
Options.Insert("api" , ApiUrl);
Options.Insert("media", MediaUrl);
Options.Insert("id" , IdInstance);
Options.Insert("token", ApiTokenInstance);
AccessParameters = OPI_TestDataRetrieval.ExecuteTestCLI("greenapi", "FormAccessParameters", Options);
SettingsStructure = New Structure;
SettingsStructure.Insert("pollMessageWebhook" , "yes");
SettingsStructure.Insert("incomingBlockWebhook" , "no");
SettingsStructure.Insert("incomingCallWebhook" , "no");
SettingsStructure.Insert("editedMessageWebhook" , "yes");
SettingsStructure.Insert("deletedMessageWebhook", "yes");
Options = New Structure;
Options.Insert("settings", SettingsStructure);
Options.Insert("access" , AccessParameters);
Result = OPI_TestDataRetrieval.ExecuteTestCLI("greenapi", "SetInstanceSettings", Options);
// END
OPI_TestDataRetrieval.WriteLog(Result, "SetInstanceSettings", "GreenAPI");
OPI_TestDataRetrieval.Check_GreenSettingsSaving(Result);
EndProcedure
#EndRegion
#EndRegion
#EndRegion

View File

@ -1461,8 +1461,12 @@ Function ExecuteRequestWithBody(Val URL, Val View, Val Parameters = "", Val Addi
EndFunction
Function ExecuteRequestWithBinaryData(Val URL, Val View, Val Data, Val AdditionalHeaders, Val FullResponse,
Val DataType)
Function ExecuteRequestWithBinaryData(Val URL
, Val View
, Val Data
, Val AdditionalHeaders
, Val FullResponse
, Val DataType)
URLStructure = SplitURL(URL);
Host = URLStructure["Host"];
@ -1483,8 +1487,11 @@ Function ExecuteRequestWithBinaryData(Val URL, Val View, Val Data, Val Additiona
EndFunction
Function ExecuteRequestWithoutBody(Val URL, Val View, Val Parameters = "", Val AdditionalHeaders = "",
Val ResponseFile = Undefined)
Function ExecuteRequestWithoutBody(Val URL
, Val View
, Val Parameters = ""
, Val AdditionalHeaders = ""
, Val ResponseFile = Undefined)
If Not ValueIsFilled(Parameters) Then
Parameters = New Structure;

View File

@ -46,6 +46,7 @@
<commonModules>CommonModule.OPI_Bitrix24</commonModules>
<commonModules>CommonModule.OPI_CDEK</commonModules>
<commonModules>CommonModule.OPI_Dropbox</commonModules>
<commonModules>CommonModule.OPI_GreenAPI</commonModules>
<commonModules>CommonModule.OPI_GoogleCalendar</commonModules>
<commonModules>CommonModule.OPI_GoogleDrive</commonModules>
<commonModules>CommonModule.OPI_GoogleSheets</commonModules>

View File

@ -0,0 +1,98 @@
Function ПолучитьСостав() Export
CompositionTable = New ValueTable();
CompositionTable.Columns.Add("Библиотека");
CompositionTable.Columns.Add("Модуль");
CompositionTable.Columns.Add("Метод");
CompositionTable.Columns.Add("МетодПоиска");
CompositionTable.Columns.Add("Параметр");
CompositionTable.Columns.Add("Описание");
CompositionTable.Columns.Add("ОписаниеМетода");
CompositionTable.Columns.Add("Область");
NewLine = CompositionTable.Add();
NewLine.Библиотека = "greenapi";
NewLine.Модуль = "OPI_GreenAPI";
NewLine.Метод = "FormAccessParameters";
NewLine.МетодПоиска = "FORMACCESSPARAMETERS";
NewLine.Параметр = "--api";
NewLine.Описание = "API host link";
NewLine.Область = "Account";
NewLine.ОписаниеМетода = "Forms the structure of basic authorization data";
NewLine = CompositionTable.Add();
NewLine.Библиотека = "greenapi";
NewLine.Модуль = "OPI_GreenAPI";
NewLine.Метод = "FormAccessParameters";
NewLine.МетодПоиска = "FORMACCESSPARAMETERS";
NewLine.Параметр = "--media";
NewLine.Описание = "Link to host API for sending files";
NewLine.Область = "Account";
NewLine = CompositionTable.Add();
NewLine.Библиотека = "greenapi";
NewLine.Модуль = "OPI_GreenAPI";
NewLine.Метод = "FormAccessParameters";
NewLine.МетодПоиска = "FORMACCESSPARAMETERS";
NewLine.Параметр = "--id";
NewLine.Описание = "Unique instance number";
NewLine.Область = "Account";
NewLine = CompositionTable.Add();
NewLine.Библиотека = "greenapi";
NewLine.Модуль = "OPI_GreenAPI";
NewLine.Метод = "FormAccessParameters";
NewLine.МетодПоиска = "FORMACCESSPARAMETERS";
NewLine.Параметр = "--token";
NewLine.Описание = "Instance access key";
NewLine.Область = "Account";
NewLine = CompositionTable.Add();
NewLine.Библиотека = "greenapi";
NewLine.Модуль = "OPI_GreenAPI";
NewLine.Метод = "GetInstanceSettings";
NewLine.МетодПоиска = "GETINSTANCESETTINGS";
NewLine.Параметр = "--access";
NewLine.Описание = "Access parameters. See FormAccessParameters";
NewLine.Область = "Account";
NewLine.ОписаниеМетода = "Gets the current instance settings";
NewLine = CompositionTable.Add();
NewLine.Библиотека = "greenapi";
NewLine.Модуль = "OPI_GreenAPI";
NewLine.Метод = "SetInstanceSettings";
NewLine.МетодПоиска = "SETINSTANCESETTINGS";
NewLine.Параметр = "--settings";
NewLine.Описание = "Instance settings. See GetInstanceSettingsStructure";
NewLine.Область = "Account";
NewLine.ОписаниеМетода = "Sets the instance settings";
NewLine = CompositionTable.Add();
NewLine.Библиотека = "greenapi";
NewLine.Модуль = "OPI_GreenAPI";
NewLine.Метод = "SetInstanceSettings";
NewLine.МетодПоиска = "SETINSTANCESETTINGS";
NewLine.Параметр = "--access";
NewLine.Описание = "Access parameters. See FormAccessParameters";
NewLine.Область = "Account";
NewLine = CompositionTable.Add();
NewLine.Библиотека = "greenapi";
NewLine.Модуль = "OPI_GreenAPI";
NewLine.Метод = "GetInstanceSettingsStructure";
NewLine.МетодПоиска = "GETINSTANCESETTINGSSTRUCTURE";
NewLine.Параметр = "--empty";
NewLine.Описание = "True > structure with empty valuse, False > field descriptions at values (optional, def. val. - No)";
NewLine.Область = "Account";
NewLine.ОписаниеМетода = "Gets the structure template for instance settings";
Return CompositionTable;
EndFunction

View File

@ -15,6 +15,7 @@
СоответствиеКомандМодулей.Вставить("gdrive", "OPI_GoogleDrive");
СоответствиеКомандМодулей.Вставить("gsheets", "OPI_GoogleSheets");
СоответствиеКомандМодулей.Вставить("google", "OPI_GoogleWorkspace");
СоответствиеКомандМодулей.Вставить("greenapi", "OPI_GreenAPI");
СоответствиеКомандМодулей.Вставить("neocities", "OPI_Neocities");
СоответствиеКомандМодулей.Вставить("notion", "OPI_Notion");
СоответствиеКомандМодулей.Вставить("ozon", "OPI_Ozon");

View File

@ -4724,7 +4724,7 @@
Функция ПолучитьСтруктуруПользовательскихНастроекКаледнаря(Знач Пустая = Ложь) Экспорт
OPI_ПреобразованиеТипов.ПолучитьБулево(Пустая);
СтруктураНастроек = Новый Структура;
СтруктураНастроек.Вставить("view" , "<стандартное представление: day, week, month, list>");
@ -4776,7 +4776,7 @@
Функция ПолучитьСтруктуруКалендаря(Знач Пустая = Ложь) Экспорт
OPI_ПреобразованиеТипов.ПолучитьБулево(Пустая);
СтруктураКалендаря = Новый Структура;
СтруктураКалендаря.Вставить("type" , "<тип календаря: user (пользователя), group (группы)>");
@ -5021,7 +5021,7 @@
Функция ПолучитьСтруктуруСобытияКалендаря(Знач Пустая = Ложь) Экспорт
OPI_ПреобразованиеТипов.ПолучитьБулево(Пустая);
СтруктураСобытия = Новый Структура;
СтруктураСобытия.Вставить("type" , "<тип календаря: user, group, company_calendar>");
@ -5097,7 +5097,7 @@
Функция ПолучитьСтруктуруФильтраСобытийКалендарей(Знач Пустая = Ложь) Экспорт
OPI_ПреобразованиеТипов.ПолучитьБулево(Пустая);
СтруктураФильтра = Новый Структура;
СтруктураФильтра.Вставить("from" , "<дата начала выборки. 3 месяца до текущепо умолчанию>");

View File

@ -47,87 +47,87 @@
// Сформировать параметры доступа
// Формирует структуру основных авторизационных данных
//
//
// Примечание:
// Подробнее в документации API: [Получить параметры доступа к инстансу](@green-api.com/docs/before-start/#parameters)
//
//
// Параметры:
// ApiUrl - Строка - Ссылка на хост API - api
// MediaUrl - Строка - Ссылка на хост API для отправки файлов - media
// IdInstance - Строка - Уникальный номер инстанса - id
// ApiTokenInstance - Строка - Ключ доступа инстанса - token
//
//
// Возвращаемое значение:
// Структура - Структура параметров доступа
Функция СформироватьПараметрыДоступа(Знач ApiUrl, Знач MediaUrl, Знач IdInstance, Знач ApiTokenInstance) Экспорт
Строка_ = "Строка";
Параметры = Новый Структура;
OPI_Инструменты.ДобавитьПоле("apiUrl" , ApiUrl , Строка_, Параметры);
OPI_Инструменты.ДобавитьПоле("mediaUrl" , MediaUrl , Строка_, Параметры);
OPI_Инструменты.ДобавитьПоле("idInstance" , IdInstance , Строка_, Параметры);
OPI_Инструменты.ДобавитьПоле("apiTokenInstance", ApiTokenInstance, Строка_, Параметры);
Возврат Параметры;
КонецФункции
// Получить настройки инстанса
// Получает текущие настройки инстанса
//
//
// Примечание:
// Метод в документации API: [GetSettings](@green-api.com/docs/api/account/GetSettings/)
//
//
// Параметры:
// ПараметрыДоступа - Структура Из КлючИЗначение - Параметры доступа. См. СформироватьПараметрыДоступа - access
//
//
// Возвращаемое значение:
// Соответствие Из КлючИЗначение - сериализованный JSON ответа от Green API
Функция ПолучитьНастройкиИнстанса(Знач ПараметрыДоступа) Экспорт
URL = СформироватьОсновнойURL(ПараметрыДоступа, "getSettings");
Ответ = OPI_Инструменты.Get(URL);
Возврат Ответ;
КонецФункции
// Установить настройки инстанса
// Устанавливает настройки инстанса
//
//
// Примечание
// Метод в документации API: [GetSettings](@green-api.com/docs/api/account/SetSettings/)
//
//
// Параметры:
// Настройки - Структура Из КлючИЗначение - Настройки инстанса. См. ПолучитьСтруктуруНастроекИнстанса - settings
// ПараметрыДоступа - Структура Из КлючИЗначение - Параметры доступа. См. СформироватьПараметрыДоступа - access
//
//
// Возвращаемое значение:
// Соответствие Из КлючИЗначение - сериализованный JSON ответа от Green API
Функция УстановитьНастройкиИнстанса(Знач Настройки, Знач ПараметрыДоступа) Экспорт
OPI_ПреобразованиеТипов.ПолучитьКоллекциюКлючИЗначение(ПараметрыДоступа);
URL = СформироватьОсновнойURL(ПараметрыДоступа, "setSettings");
Ответ = OPI_Инструменты.Post(URL, Настройки);
Возврат Ответ;
КонецФункции
// Получить структуру настроек инстанса
// Получает шаблон структуры для установки настроек инстанса
//
//
// Параметры:
// Пустая - Булево - Истина > структура с пустыми значениями, Ложь > в значениях будут описания полей - empty
//
//
// Возвращаемое значение:
// Структура Из КлючИЗначение - Структура настроек инстанса
Функция ПолучитьСтруктуруНастроекИнстанса(Знач Пустая = Ложь) Экспорт
OPI_ПреобразованиеТипов.ПолучитьБулево(Пустая);
СтруктураНастроек = Новый Структура;
СтруктураНастроек.Вставить("webhookUrl" , "<URL для отправки уведомлений>");
@ -144,10 +144,10 @@
СтруктураНастроек.Вставить("keepOnlineStatus" , "<выставляет статус 'В сети' для вашего аккаунта>");
СтруктураНастроек.Вставить("pollMessageWebhook" , "<получать уведомления о создании опроса и голосовании в опросе: yes, no>");
СтруктураНастроек.Вставить("incomingBlockWebhook" , "<получать уведомления о добавлении чата в список заблокированных контактов: yes, no>");
СтруктураНастроек.Вставить("incomingCallWebhook" , "<получать уведомления о статусах входящего звонка: yes, no>");
СтруктураНастроек.Вставить("incomingCallWebhook" , "<получать уведомления о статусах входящего звонка: yes, no>");
СтруктураНастроек.Вставить("editedMessageWebhook" , "<получать уведомления о факте того, что сообщение было отредактировано: yes, no>");
СтруктураНастроек.Вставить("deletedMessageWebhook" , "<получать уведомления о факте того, что сообщение было удалено: yes, no>");
Если Пустая Тогда
СтруктураНастроек = OPI_Инструменты.ОчиститьКоллекциюРекурсивно(СтруктураНастроек);
@ -155,7 +155,7 @@
//@skip-check constructor-function-return-section
Возврат СтруктураНастроек;
КонецФункции
#КонецОбласти
@ -165,25 +165,25 @@
#Область СлужебныеПроцедурыИФункции
Функция СформироватьОсновнойURL(Знач ПараметрыДоступа, Знач Метод)
OPI_ПреобразованиеТипов.ПолучитьКоллекциюКлючИЗначение(ПараметрыДоступа);
OPI_ПреобразованиеТипов.ПолучитьСтроку(Метод);
ОбязательныеПоля = СтрРазделить("apiUrl,idInstance,apiTokenInstance", ",");
ОбязательныеПоля = СтрРазделить("apiUrl,idInstance,apiTokenInstance", ",");
ОтсутствующиеПоля = OPI_Инструменты.НайтиОтсутствующиеПоляКоллекции(ПараметрыДоступа, ОбязательныеПоля);
Если ОтсутствующиеПоля.Количество() > 0 Тогда
ВызватьИсключение "Отсутствуют обязательные поля в параметрах доступа!";
КонецЕсли;
ApiUrl = ПараметрыДоступа["apiUrl"];
IdInstance = ПараметрыДоступа["idInstance"];
ApiTokenInstance = ПараметрыДоступа["apiTokenInstance"];
URL = СтрШаблон("%1/waInstance%2/%3/%4", ApiUrl, IdInstance, Метод, ApiTokenInstance);
Возврат URL;
КонецФункции
#КонецОбласти

View File

@ -2364,18 +2364,18 @@
#Область GreenAPI
Процедура GAPI_Аккаунт() Экспорт
ПараметрыТеста = Новый Структура;
OPI_ПолучениеДанныхТестов.ПараметрВКоллекцию("GreenAPI_ApiURL" , ПараметрыТеста);
OPI_ПолучениеДанныхТестов.ПараметрВКоллекцию("GreenAPI_MediaURL" , ПараметрыТеста);
OPI_ПолучениеДанныхТестов.ПараметрВКоллекцию("GreenAPI_IdInstance", ПараметрыТеста);
OPI_ПолучениеДанныхТестов.ПараметрВКоллекцию("GreenAPI_Token" , ПараметрыТеста);
GreenAPI_СформироватьПараметрыДоступа(ПараметрыТеста);
GreenAPI_ПолучитьНастройкиИнстанса(ПараметрыТеста);
GreenAPI_ПолучитьСтруктуруНастроекИнстанса(ПараметрыТеста);
GreenAPI_УстановитьНастройкиИнстанса(ПараметрыТеста);
КонецПроцедуры
#КонецОбласти
@ -18090,36 +18090,36 @@
#Область GreenAPI
Процедура GreenAPI_СформироватьПараметрыДоступа(ПараметрыФункции)
ApiUrl = ПараметрыФункции["GreenAPI_ApiURL"];
MediaUrl = ПараметрыФункции["GreenAPI_MediaURL"];
IdInstance = ПараметрыФункции["GreenAPI_IdInstance"];
ApiTokenInstance = ПараметрыФункции["GreenAPI_Token"];
Результат = OPI_GreenAPI.СформироватьПараметрыДоступа(ApiUrl, MediaUrl, IdInstance, ApiTokenInstance);
// END
OPI_ПолучениеДанныхТестов.ЗаписатьЛог(Результат, "СформироватьПараметрыДоступа", "GreenAPI");
OPI_ПолучениеДанныхТестов.Проверка_Структура(Результат);
КонецПроцедуры
Процедура GreenAPI_ПолучитьНастройкиИнстанса(ПараметрыФункции)
ApiUrl = ПараметрыФункции["GreenAPI_ApiURL"];
MediaUrl = ПараметрыФункции["GreenAPI_MediaURL"];
IdInstance = ПараметрыФункции["GreenAPI_IdInstance"];
ApiTokenInstance = ПараметрыФункции["GreenAPI_Token"];
ПараметрыДоступа = OPI_GreenAPI.СформироватьПараметрыДоступа(ApiUrl, MediaUrl, IdInstance, ApiTokenInstance);
Результат = OPI_GreenAPI.ПолучитьНастройкиИнстанса(ПараметрыДоступа);
// END
OPI_ПолучениеДанныхТестов.ЗаписатьЛог(Результат, "ПолучитьНастройкиИнстанса", "GreenAPI");
OPI_ПолучениеДанныхТестов.Проверка_ГринИнстанс(Результат);
КонецПроцедуры
Процедура GreenAPI_ПолучитьСтруктуруНастроекИнстанса(ПараметрыФункции)
@ -18141,32 +18141,32 @@
КонецЕсли;
КонецЦикла;
КонецПроцедуры
Процедура GreenAPI_УстановитьНастройкиИнстанса(ПараметрыФункции)
ApiUrl = ПараметрыФункции["GreenAPI_ApiURL"];
MediaUrl = ПараметрыФункции["GreenAPI_MediaURL"];
IdInstance = ПараметрыФункции["GreenAPI_IdInstance"];
ApiTokenInstance = ПараметрыФункции["GreenAPI_Token"];
ПараметрыДоступа = OPI_GreenAPI.СформироватьПараметрыДоступа(ApiUrl, MediaUrl, IdInstance, ApiTokenInstance);
СтруктураНастроек = Новый Структура;
СтруктураНастроек.Вставить("pollMessageWebhook" , "yes");
СтруктураНастроек.Вставить("incomingBlockWebhook" , "no");
СтруктураНастроек.Вставить("incomingCallWebhook" , "no");
СтруктураНастроек.Вставить("incomingCallWebhook" , "no");
СтруктураНастроек.Вставить("editedMessageWebhook" , "yes");
СтруктураНастроек.Вставить("deletedMessageWebhook", "yes");
Результат = OPI_GreenAPI.УстановитьНастройкиИнстанса(СтруктураНастроек, ПараметрыДоступа);
// END
OPI_ПолучениеДанныхТестов.ЗаписатьЛог(Результат, "ПолучитьНастройкиИнстанса", "GreenAPI");
OPI_ПолучениеДанныхТестов.Проверка_ГринСохранениеНастроек(Результат);
КонецПроцедуры
#КонецОбласти

View File

@ -2332,18 +2332,18 @@
#Область GreenAPI
Процедура CLI_GAPI_Аккаунт() Экспорт
ПараметрыТеста = Новый Структура;
OPI_ПолучениеДанныхТестов.ПараметрВКоллекцию("GreenAPI_ApiURL" , ПараметрыТеста);
OPI_ПолучениеДанныхТестов.ПараметрВКоллекцию("GreenAPI_MediaURL" , ПараметрыТеста);
OPI_ПолучениеДанныхТестов.ПараметрВКоллекцию("GreenAPI_IdInstance", ПараметрыТеста);
OPI_ПолучениеДанныхТестов.ПараметрВКоллекцию("GreenAPI_Token" , ПараметрыТеста);
CLI_GreenAPI_СформироватьПараметрыДоступа(ПараметрыТеста);
CLI_GreenAPI_ПолучитьНастройкиИнстанса(ПараметрыТеста);
CLI_GreenAPI_ПолучитьСтруктуруНастроекИнстанса(ПараметрыТеста);
CLI_GreenAPI_УстановитьНастройкиИнстанса(ПараметрыТеста);
КонецПроцедуры
#КонецОбласти
@ -20263,7 +20263,7 @@
#Область GreenAPI
Процедура CLI_GreenAPI_СформироватьПараметрыДоступа(ПараметрыФункции)
ApiUrl = ПараметрыФункции["GreenAPI_ApiURL"];
MediaUrl = ПараметрыФункции["GreenAPI_MediaURL"];
IdInstance = ПараметрыФункции["GreenAPI_IdInstance"];
@ -20276,21 +20276,21 @@
Опции.Вставить("token", ApiTokenInstance);
Результат = OPI_ПолучениеДанныхТестов.ВыполнитьТестCLI("greenapi", "СформироватьПараметрыДоступа", Опции);
// END
OPI_ПолучениеДанныхТестов.ЗаписатьЛог(Результат, "СформироватьПараметрыДоступа", "GreenAPI");
OPI_ПолучениеДанныхТестов.Проверка_Соответствие(Результат);
КонецПроцедуры
Процедура CLI_GreenAPI_ПолучитьНастройкиИнстанса(ПараметрыФункции)
ApiUrl = ПараметрыФункции["GreenAPI_ApiURL"];
MediaUrl = ПараметрыФункции["GreenAPI_MediaURL"];
IdInstance = ПараметрыФункции["GreenAPI_IdInstance"];
ApiTokenInstance = ПараметрыФункции["GreenAPI_Token"];
Опции = Новый Структура;
Опции.Вставить("api" , ApiUrl);
Опции.Вставить("media", MediaUrl);
@ -20302,13 +20302,13 @@
Опции = Новый Структура;
Опции.Вставить("access", ПараметрыДоступа);
Результат = OPI_ПолучениеДанныхТестов.ВыполнитьТестCLI("greenapi", "ПолучитьНастройкиИнстанса", Опции);
Результат = OPI_ПолучениеДанныхТестов.ВыполнитьТестCLI("greenapi", "ПолучитьНастройкиИнстанса", Опции);
// END
OPI_ПолучениеДанныхТестов.ЗаписатьЛог(Результат, "ПолучитьНастройкиИнстанса", "GreenAPI");
OPI_ПолучениеДанныхТестов.Проверка_ГринИнстанс(Результат);
КонецПроцедуры
Процедура CLI_GreenAPI_ПолучитьСтруктуруНастроекИнстанса(ПараметрыФункции)
@ -20327,7 +20327,7 @@
Опции.Вставить("empty", Истина);
Результат = OPI_ПолучениеДанныхТестов.ВыполнитьТестCLI("greenapi", "ПолучитьСтруктуруНастроекИнстанса", Опции);
OPI_ПолучениеДанныхТестов.ЗаписатьЛог(Результат, "ПолучитьСтруктуруНастроекИнстанса (пустая)", "GreenAPI");
Для Каждого Элемент Из Результат Цикл
@ -20337,16 +20337,16 @@
КонецЕсли;
КонецЦикла;
КонецПроцедуры
Процедура CLI_GreenAPI_УстановитьНастройкиИнстанса(ПараметрыФункции)
ApiUrl = ПараметрыФункции["GreenAPI_ApiURL"];
MediaUrl = ПараметрыФункции["GreenAPI_MediaURL"];
IdInstance = ПараметрыФункции["GreenAPI_IdInstance"];
ApiTokenInstance = ПараметрыФункции["GreenAPI_Token"];
Опции = Новый Структура;
Опции.Вставить("api" , ApiUrl);
Опции.Вставить("media", MediaUrl);
@ -20354,11 +20354,11 @@
Опции.Вставить("token", ApiTokenInstance);
ПараметрыДоступа = OPI_ПолучениеДанныхТестов.ВыполнитьТестCLI("greenapi", "СформироватьПараметрыДоступа", Опции);
СтруктураНастроек = Новый Структура;
СтруктураНастроек.Вставить("pollMessageWebhook" , "yes");
СтруктураНастроек.Вставить("incomingBlockWebhook" , "no");
СтруктураНастроек.Вставить("incomingCallWebhook" , "no");
СтруктураНастроек.Вставить("incomingCallWebhook" , "no");
СтруктураНастроек.Вставить("editedMessageWebhook" , "yes");
СтруктураНастроек.Вставить("deletedMessageWebhook", "yes");
@ -20366,13 +20366,13 @@
Опции.Вставить("settings", СтруктураНастроек);
Опции.Вставить("access" , ПараметрыДоступа);
Результат = OPI_ПолучениеДанныхТестов.ВыполнитьТестCLI("greenapi", "УстановитьНастройкиИнстанса", Опции);
Результат = OPI_ПолучениеДанныхТестов.ВыполнитьТестCLI("greenapi", "УстановитьНастройкиИнстанса", Опции);
// END
OPI_ПолучениеДанныхТестов.ЗаписатьЛог(Результат, "УстановитьНастройкиИнстанса", "GreenAPI");
OPI_ПолучениеДанныхТестов.Проверка_ГринСохранениеНастроек(Результат);
КонецПроцедуры
#КонецОбласти

View File

@ -2131,15 +2131,15 @@
КонецПроцедуры
Процедура Проверка_ГринИнстанс(Знач Результат) Экспорт
ОжидаетЧто(Результат["wid"]).Заполнено();
ОжидаетЧто(Результат["wid"]).Заполнено();
КонецПроцедуры
Процедура Проверка_ГринСохранениеНастроек(Знач Результат) Экспорт
ОжидаетЧто(Результат["saveSettings"]).Равно(Истина);
ОжидаетЧто(Результат["saveSettings"]).Равно(Истина);
КонецПроцедуры
#КонецОбласти
@ -2178,9 +2178,9 @@
КонецФункции
Функция ПолучитьОбщийМодуль(Знач Имя)
Модуль = Вычислить(Имя);
Возврат Модуль;
КонецФункции

Some files were not shown because too many files have changed in this diff Show More