mirror of
https://github.com/Bayselonarrend/OpenIntegrations.git
synced 2025-04-23 12:18:48 +02:00
79 lines
2.6 KiB
Plaintext
Vendored
79 lines
2.6 KiB
Plaintext
Vendored
---
|
|
sidebar_position: 2
|
|
---
|
|
|
|
import Tabs from '@theme/Tabs';
|
|
import TabItem from '@theme/TabItem';
|
|
|
|
# Upload files
|
|
Uploads multiple files to Neocities
|
|
|
|
|
|
|
|
`Function UploadFiles(Val Token, Val FileMapping, Val Singly = False) Export`
|
|
|
|
| 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 |
|
|
|
|
|
|
Returns: Map Of KeyAndValue - serialized JSON response from Neocities
|
|
|
|
<br/>
|
|
|
|
:::tip
|
|
Neocities API docs: [neocities.org/api](https://neocities.org/api)
|
|
:::
|
|
<br/>
|
|
|
|
|
|
|
|
```bsl title="1C:Enterprise/OneScript code example"
|
|
Token = "7419cd51de4037f7...";
|
|
|
|
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
|
|
|
|
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);
|
|
```
|
|
|
|
|
|
<Tabs>
|
|
|
|
<TabItem value="bash" label="Bash" default>
|
|
```bash
|
|
# JSON data can also be passed as a path to a .json file
|
|
|
|
oint neocities UploadFiles \
|
|
--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'}"
|
|
```
|
|
</TabItem>
|
|
|
|
<TabItem value="bat" label="CMD/Bat" default>
|
|
```batch
|
|
:: JSON data can also be passed as a path to a .json file
|
|
|
|
oint neocities UploadFiles ^
|
|
--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'}"
|
|
```
|
|
</TabItem>
|
|
</Tabs>
|
|
|
|
|
|
```json title="Result"
|
|
{
|
|
"result": "success",
|
|
"message": "your file(s) have been successfully uploaded"
|
|
}
|
|
```
|