Skip to content

Another Rust client for the Neocities API

License

Notifications You must be signed in to change notification settings

kugland/neocities-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

83 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

neocities-client

Crates.io Version GitHub Actions Workflow Status License


neocities-deployGitHub | Codeberg | Releases | AUR | AUR (git) | AUR (binary)

neocities-clientGitHub | Codeberg | crates.io | docs.rs


This is a Rust library for interacting with the Neocities API. It is part of the neocities-deploy project, a command-line tool for deploying a NeoCities site.

This project is in no way affiliated with Neocities. It is a personal project and is not endorsed by Neocities.

Usage

The Client struct provides a simple interface for interacting with the website API. To use it, first create a new instance of the Client struct (replace "username:password" with your actual username and password):

let client = Client::builder()
    .auth(Auth::from("username:password"))
    .build()?;

Once you have a Client instance, you can use its methods to interact with the website API. For example, to create an API key (which can be later used to authenticate with the API without providing your username and password):

let api_key = client.key()?;
println!("API key: {}", api_key);

Or to get more information about the website:

let info = client.info()?;
println!("{:?}", info);

To list the files on the website:

let files = client.list()?;
for file in files {
    println!("{}", file.path);
}

To upload one or more files to the website:

client.upload(&[
    ("/1st_file.txt", b"Contents of the first file"),
    ("/2nd_file.txt", b"Contents of the second file"),
])?;

To delete one or more files from the website:

client.delete(&["file1.txt", "file2.txt"])?;

For more information on the available methods, see the documentation for the Client struct.

License

This project is licensed under the GNU General Public License v3.0. See the LICENSE file for details.

Send me a tip

If you find this project useful, you can send me a tip.

Bitcoin: bc1qlj7jdw6fff0q8yg93ssg6qp04p88cuurgwxk8r

Monero: 43mSMDDTuwbGX8LBH7XpT6gbnUcJ86KWVfrpKbopnk7QTDpQkSb53e43MBGGyZ8FgYZ3YzcaTa4Pb46cQUz3DsXeRn4Ef5e

About

Another Rust client for the Neocities API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages