1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2025-12-17 23:48:13 +02:00
Files
OpenIntegrations/docs/en/md/Twitter/Tweets/Create-image-tweet.mdx

90 lines
3.1 KiB
Plaintext
Raw Normal View History

2024-10-15 10:50:56 +03:00
---
2024-10-15 10:16:04 +03:00
sidebar_position: 3
2025-05-05 11:15:20 +03:00
description: Create image tweet and other functions to work with Twitter in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
2025-05-05 09:49:19 +03:00
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, Twitter]
2024-10-15 10:16:04 +03:00
---
2024-10-15 10:50:56 +03:00
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
2024-10-15 10:16:04 +03:00
# Create image tweet
Creates a tweet with an image attachment
`Function CreateImageTweet(Val Text, Val ImageArray, Val Parameters = "") Export`
2024-10-15 15:15:47 +03:00
| Parameter | CLI option | Type | Required | Description |
|-|-|-|-|-|
| Text | --text | String | ✔ | Tweet text |
| ImageArray | --pictures | Array of String, BinaryData | ✔ | Image files array |
| Parameters | --auth | Structure Of String | ✖ | Authorization data. See GetStandardParameters |
2024-10-15 10:16:04 +03:00
Returns: Map Of KeyAndValue - serialized JSON response from Twitter
<br/>
2024-10-15 13:51:58 +03:00
:::tip
Parameters with Binary data type can also accept file paths on disk and URLs
:::
<br/>
2024-10-15 10:16:04 +03:00
2024-12-16 19:38:57 +03:00
2024-10-15 21:15:56 +03:00
```bsl title="1C:Enterprise/OneScript code example"
2024-10-15 10:16:04 +03:00
Parameters = GetTwitterAuthData();
Text = "TestTweet" + String(New UUID);
2025-06-29 14:35:33 +03:00
Image = "https://hut.openintegrations.dev/test_data/picture.jpg"; // URL, Binary or File path
Image2 = "https://hut.openintegrations.dev/test_data/picture2.jpg"; // URL, Binary or File path
2024-10-15 10:16:04 +03:00
ImageArray = New Array;
ImageArray.Add(Image);
ImageArray.Add(Image2);
Result = OPI_Twitter.CreateImageTweet(Text, ImageArray, Parameters);
Text = "TestTweet" + String(New UUID);
Result = OPI_Twitter.CreateImageTweet(Text, Image, Parameters);
```
2024-10-20 22:36:03 +03:00
<Tabs>
<TabItem value="bash" label="Bash" default>
```bash
2024-10-22 08:59:24 +03:00
# JSON data can also be passed as a path to a .json file
2024-10-20 22:36:03 +03:00
oint twitter CreateImageTweet \
2025-07-15 23:11:07 +03:00
--text "TestTweetdc73f890-98e2-4c81-9d27-a3378a9396a0" \
--pictures "/tmp/onri1da2.zms" \
--auth "{'redirect_uri':'https://hut.openintegrations.dev/melezh/6ad91cc8b','client_id':'***','client_secret':'***','access_token':'***','refresh_token':'***','oauth_token':'***','oauth_token_secret':'***','oauth_consumer_key':'***','oauth_consumer_secret':'***'}"
2024-10-20 22:36:03 +03:00
```
</TabItem>
<TabItem value="bat" label="CMD/Bat" default>
```batch
2024-10-22 08:59:24 +03:00
:: JSON data can also be passed as a path to a .json file
2024-10-20 22:36:03 +03:00
oint twitter CreateImageTweet ^
2025-07-15 23:11:07 +03:00
--text "TestTweetdc73f890-98e2-4c81-9d27-a3378a9396a0" ^
--pictures "/tmp/onri1da2.zms" ^
--auth "{'redirect_uri':'https://hut.openintegrations.dev/melezh/6ad91cc8b','client_id':'***','client_secret':'***','access_token':'***','refresh_token':'***','oauth_token':'***','oauth_token_secret':'***','oauth_consumer_key':'***','oauth_consumer_secret':'***'}"
2024-10-20 22:36:03 +03:00
```
</TabItem>
</Tabs>
2024-10-15 10:16:04 +03:00
```json title="Result"
{
"data": {
"id": "1843891880246775903",
"edit_history_tweet_ids": [
"1843891880246775903"
],
"text": "TestTweet451aa501-9a10-4e00-bcc5-0c3c8d61221a https://t.co/VWvjWsdQHs"
}
}
```