1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2025-05-31 23:20:02 +02:00
OpenIntegrations/docs/en/md/Twitter/Tweets/Create-image-tweet.mdx

88 lines
2.8 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
---
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);
Image = "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
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 \
2024-12-25 11:43:34 +03:00
--text "TestTweet5803652c-1af9-40b1-847b-7cca8ecd12eb" \
--pictures "C:\Users\Administrator\AppData\Local\Temp\nmfdqkzh2p0.tmp" \
2024-10-22 08:59:24 +03:00
--auth "{'redirect_uri':'https://api.athenaeum.digital/opi/hs/twitter','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 ^
2024-12-25 11:43:34 +03:00
--text "TestTweet5803652c-1af9-40b1-847b-7cca8ecd12eb" ^
--pictures "C:\Users\Administrator\AppData\Local\Temp\nmfdqkzh2p0.tmp" ^
2024-10-22 08:59:24 +03:00
--auth "{'redirect_uri':'https://api.athenaeum.digital/opi/hs/twitter','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"
}
}
```