update readme

This commit is contained in:
synt-xerror
2026-02-19 02:20:52 -03:00
parent 795cd984cd
commit 94f34439dc

View File

@@ -51,12 +51,10 @@ If you're coding a CLI or application, you must provide the key at runtime (env
## API Overview ## API Overview
Just an overview. For more detailed information, see: [[Function-Guide.md]]
### Info (public) ### Info (public)
```c ```c
int neocities_info(const char *sitename, neocities_info_t *out); int neocities_info(const char *sitename, char **out);
``` ```
Fetch metadata about a site. Fetch metadata about a site.
@@ -66,9 +64,7 @@ Fetch metadata about a site.
### List files ### List files
```c ```c
int neocities_list(const char *api_key, int neocities_list(const char *api_key, const char *path, char** out);
const char *path,
neocities_filelist_t *out);
``` ```
List files at a path. List files at a path.
@@ -78,11 +74,7 @@ List files at a path.
### Upload ### Upload
```c ```c
int neocities_upload(const char *api_key, int neocities_upload(const char *api_key, const char **local_files, const char **remote_names, size_t count, char **response);
const char **local_files,
const char **remote_names,
size_t count,
char **response);
``` ```
Uploads multiple files. Uploads multiple files.
@@ -95,10 +87,7 @@ Uploads multiple files.
### Delete ### Delete
```c ```c
int neocities_delete(const char *api_key, int neocities_delete(const char *api_key, const char **filenames, size_t count, char **response);
const char **filenames,
size_t count,
char **response);
``` ```
Deletes files from the site. Deletes files from the site.
@@ -111,46 +100,9 @@ For security reasons, you should get the API key via Neocities settings. This fu
--- ---
## Memory Management
Always free parsed outputs:
```c
void neocities_free_info(neocities_info_t *info);
void neocities_free_filelist(neocities_filelist_t *list);
```
`response` returned by upload/delete must also be freed by caller.
---
## Example Usage ## Example Usage
### List files See [[example.c]]
```c
neocities_filelist_t list;
if (neocities_list(api_key, "/", &list) == 0) {
for (size_t i = 0; i < list.count; i++)
printf("%s\n", list.paths[i]);
neocities_free_filelist(&list);
}
```
---
### Upload
```c
const char *local[] = {"index.html"};
const char *remote[] = {"index.html"};
char *resp;
neocities_upload(api_key, local, remote, 1, &resp);
free(resp);
```
--- ---
@@ -176,17 +128,6 @@ Recommended:
--- ---
## Future Extensions (Optional)
Possible areas to explore:
* Structured responses for upload/delete
* JSON passthrough mode
* Streaming uploads
* Error codes standardization
---
## License ## License
[MIT](LICENSE) [MIT](LICENSE)