1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2025-04-23 12:18:48 +02:00

79 lines
2.6 KiB
Plaintext
Raw Normal View History

2024-10-15 10:50:56 +03:00
---
2024-09-24 11:38:18 +03:00
sidebar_position: 2
---
2024-10-15 10:50:56 +03:00
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
2024-09-24 11:38:18 +03:00
# Upload files
Uploads multiple files to Neocities
`Function UploadFiles(Val Token, Val FileMapping, Val Singly = False) Export`
2024-10-15 15:15:47 +03:00
| Parameter | CLI option | Type | Required | Description |
|-|-|-|-|-|
| Token | --token | String | ✔ | Auth token |
| FileMapping | --files | Map Of KeyAndValue | ✔ | Files: Key > destination path on NC, Value > file |
| Singly | --singly | Boolean | ✖ | True > sends files in separate requests |
2024-09-24 11:38:18 +03:00
2024-10-09 09:42:00 +03:00
Returns: Map Of KeyAndValue - serialized JSON response from Neocities
2024-09-24 11:38:18 +03:00
<br/>
:::tip
2024-11-21 13:27:18 +03:00
Neocities API docs: [neocities.org/api](https://neocities.org/api)
2024-09-24 11:38:18 +03:00
:::
<br/>
2024-12-16 19:38:57 +03:00
2024-10-15 21:15:56 +03:00
```bsl title="1C:Enterprise/OneScript code example"
2024-09-24 11:38:18 +03:00
Token = "7419cd51de4037f7...";
2024-10-15 10:07:27 +03:00
Image1 = "https://api.athenaeum.digital/test_data/picture.jpg"; // URL, Path or Binary Data
Image2 = "https://api.athenaeum.digital/test_data/picture2.jpg"; // URL, Path or Binary Data
GIF = "https://api.athenaeum.digital/test_data/animation.gif"; // URL, Path or Binary Data
2024-09-24 11:38:18 +03:00
FileMapping = New Map;
FileMapping.Insert("test/pic1.png", Image1);
FileMapping.Insert("test/gif.gif" , Image2);
FileMapping.Insert("pic2.png" , GIF);
Result = OPI_Neocities.UploadFiles(Token, FileMapping);
```
2024-10-15 09:53:37 +03:00
2024-09-24 11:38:18 +03:00
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 neocities UploadFiles \
2024-10-22 08:59:24 +03:00
--token "***" \
--files "{'test/pic1.png':'https://github.com/Bayselonarrend/OpenIntegrations/raw/main/service/test_data/picture.jpg','test/gif.gif':'https://github.com/Bayselonarrend/OpenIntegrations/raw/main/service/test_data/picture2.jpg','pic2.png':'https://github.com/Bayselonarrend/OpenIntegrations/raw/main/service/test_data/animation.gif'}"
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 neocities UploadFiles ^
2024-10-22 08:59:24 +03:00
--token "***" ^
--files "{'test/pic1.png':'https://github.com/Bayselonarrend/OpenIntegrations/raw/main/service/test_data/picture.jpg','test/gif.gif':'https://github.com/Bayselonarrend/OpenIntegrations/raw/main/service/test_data/picture2.jpg','pic2.png':'https://github.com/Bayselonarrend/OpenIntegrations/raw/main/service/test_data/animation.gif'}"
2024-10-20 22:36:03 +03:00
```
</TabItem>
</Tabs>
2024-09-24 11:38:18 +03:00
```json title="Result"
2024-09-24 15:43:51 +03:00
{
"result": "success",
"message": "your file(s) have been successfully uploaded"
}
2024-09-24 11:38:18 +03:00
```