1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2025-06-02 23:27:50 +02:00
Vitaly the Alpaca (bot) efdb3f63ac Main build (Jenkins)
2024-12-25 11:43:34 +03:00

131 lines
4.9 KiB
Plaintext
Vendored

---
sidebar_position: 4
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Create event
Creates a new event
`Function CreateEvent(Val Token, Val Calendar, Val EventDescription) Export`
| Parameter | CLI option | Type | Required | Description |
|-|-|-|-|-|
| Token | --token | String | ✔ | Token |
| Calendar | --calendar | String | ✔ | Calendar ID |
| EventDescription | --props | Map Of KeyAndValue | ✔ | Event description |
Returns: String, Arbitrary, HTTPResponse, BinaryData, Undefined - Google server response
<br/>
```bsl title="1C:Enterprise/OneScript code example"
CurrentDate = OPI_Tools.GetCurrentDate();
Token = "ya29.a0ARW5m77a_UJFBB7n_sa8IAV8ycWLvz55tDaGZ7CsG1xiFYCSMm_kCJknxrGekLItp4p6eF054EBz7apAKFGnuUYhTJMy2lu6N7NTFAvHM...";
Calendar = "d5b99f918ddb915db60bfaef45db5e1f403c459fb421f43c87c4e9ad25509814@group.calendar.google.com";
Name = "New event";
Description = "TestEventDescription";
Hour = 3600;
Image1 = "https://api.athenaeum.digital/test_data/picture.jpg"; // URL, Binary or Path to file
Image2 = "https://api.athenaeum.digital/test_data/picture2.jpg"; // URL, Binary or Path to file
Attachments = New Map;
Attachments.Insert("Image1", Image1);
Attachments.Insert("Image2", Image2);
EventDescription = New Map;
EventDescription.Insert("Description" , Description);
EventDescription.Insert("Title" , Name);
EventDescription.Insert("Venue" , "InOffice");
EventDescription.Insert("StartDate" , CurrentDate);
EventDescription.Insert("EndDate" , EventDescription["StartDate"] + Hour);
EventDescription.Insert("ArrayOfAttachmentURLs" , Attachments);
EventDescription.Insert("SendNotifications" , True);
Result = OPI_GoogleCalendar.CreateEvent(Token, Calendar, EventDescription);
```
<Tabs>
<TabItem value="bash" label="Bash" default>
```bash
# JSON data can also be passed as a path to a .json file
oint gcalendar CreateEvent \
--token "***" \
--calendar "400819c270236f2f313cbcc8615612cee91fbbc95e31773bcd84ab5d9763e318@group.calendar.google.com" \
--props "{'Description':'TestEventDescription','Title':'New event','Venue':'InOffice','StartDate':'2024-12-25T10:45:50.7545647Z','EndDate':'2024-12-25T11:45:50.7545647Z','ArrayOfAttachmentURLs':{'Image1':'https://github.com/Bayselonarrend/OpenIntegrations/raw/main/service/test_data/picture.jpg','Image2':'https://github.com/Bayselonarrend/OpenIntegrations/raw/main/service/test_data/picture2.jpg'},'SendNotifications':true}"
```
</TabItem>
<TabItem value="bat" label="CMD/Bat" default>
```batch
:: JSON data can also be passed as a path to a .json file
oint gcalendar CreateEvent ^
--token "***" ^
--calendar "400819c270236f2f313cbcc8615612cee91fbbc95e31773bcd84ab5d9763e318@group.calendar.google.com" ^
--props "{'Description':'TestEventDescription','Title':'New event','Venue':'InOffice','StartDate':'2024-12-25T10:45:50.7545647Z','EndDate':'2024-12-25T11:45:50.7545647Z','ArrayOfAttachmentURLs':{'Image1':'https://github.com/Bayselonarrend/OpenIntegrations/raw/main/service/test_data/picture.jpg','Image2':'https://github.com/Bayselonarrend/OpenIntegrations/raw/main/service/test_data/picture2.jpg'},'SendNotifications':true}"
```
</TabItem>
</Tabs>
```json title="Result"
{
"kind": "calendar#event",
"etag": "\"3456908679760000\"",
"id": "7rfbn0fb8nai4i7v4l435tgl1c",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=N3JmYm4wZmI4bmFpNGk3djRsNDM1dGdsMWMgNjA2MTNkNTNjNDY3MGFiZGNlZWMzZTc2OTNjYTQ3NWIwZTg4ZGMxNjc4ZGI3MjEwNTIxMzU2YjQ5NDBhNjE0OEBn",
"created": "2024-10-09T06:12:19Z",
"updated": "2024-10-09T06:12:19.88Z",
"summary": "New event",
"description": "TestEventDescription",
"location": "InOffice",
"creator": {
"email": "bayselonarrend@gmail.com"
},
"organizer": {
"email": "60613d53c4670abdceec3e7693ca475b0e88dc1678db7210521356b4940a6148@group.calendar.google.com",
"displayName": "TestCalendar",
"self": true
},
"start": {
"dateTime": "2024-10-09T12:12:19+03:00",
"timeZone": "Europe/Moscow"
},
"end": {
"dateTime": "2024-10-09T13:12:19+03:00",
"timeZone": "Europe/Moscow"
},
"iCalUID": "7rfbn0fb8nai4i7v4l435tgl1c@google.com",
"sequence": 0,
"reminders": {
"useDefault": true
},
"attachments": [
{
"fileUrl": "https://github.com/Bayselonarrend/OpenIntegrations/raw/main/service/test_data/picture.jpg",
"title": "Image1",
"iconLink": ""
},
{
"fileUrl": "https://github.com/Bayselonarrend/OpenIntegrations/raw/main/service/test_data/picture2.jpg",
"title": "Image2",
"iconLink": ""
}
],
"eventType": "default"
}
```