Skip to content

Commit

Permalink
Automatic update of client code.
Browse files Browse the repository at this point in the history
  • Loading branch information
Libninja Bot committed Oct 2, 2022
0 parents commit 3d94106
Show file tree
Hide file tree
Showing 18 changed files with 922 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: publish

on:
push:
tags:
- '*'

defaults:
run:
shell: bash

jobs:
run-publish:
permissions:
contents: read
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: katyo/publish-crates@v1
with:
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
30 changes: 30 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: test

on:
push:
branches:
- master
pull_request:
branches:
- master


defaults:
run:
shell: bash


jobs:
run-test:
permissions:
contents: read
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: Swatinem/rust-cache@v1
- run: cargo install just
- run: just test
63 changes: 63 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to make participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies within all project spaces, and it also applies when
an individual is representing the project or its community in public spaces.
Examples of representing a project or community include using an official
project e-mail address, posting via an official social media account, or acting
as an appointed representative at an online or offline event. Representation of
a project may be further defined and clarified by project maintainers.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
100 changes: 100 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
[package]
name = "paper-mc"
edition = "2021"
version = "0.1.0"
description = "PaperMC client, generated from the OpenAPI spec."
homepage = "https://github.com/libninjacom/paper-mc-rs"
documentation = "https://docs.rs/paper-mc"
readme = "README.md"
license = "MIT"
repository = "https://github.com/libninjacom/paper-mc-rs"

[workspace]
members = []

[dependencies]
anyhow = "1.0.57"
httpclient = "0.6.0"
serde_json = "1.0.81"

[dependencies.serde]
version = "1.0.137"
features = ["derive"]
optional = false
[dev-dependencies.tokio]
version = "1.18.2"
features = ["full"]
optional = false

[lib]
path = "src/lib.rs"
name = "paper_mc"
plugin = false
proc-macro = false
edition = "2021"
crate-type = ["rlib"]
required-features = []

[[example]]
path = "examples/build.rs"
name = "build"
plugin = false
proc-macro = false
edition = "2021"
required-features = []

[[example]]
path = "examples/builds.rs"
name = "builds"
plugin = false
proc-macro = false
edition = "2021"
required-features = []

[[example]]
path = "examples/download.rs"
name = "download"
plugin = false
proc-macro = false
edition = "2021"
required-features = []

[[example]]
path = "examples/family.rs"
name = "family"
plugin = false
proc-macro = false
edition = "2021"
required-features = []

[[example]]
path = "examples/family_builds.rs"
name = "family_builds"
plugin = false
proc-macro = false
edition = "2021"
required-features = []

[[example]]
path = "examples/project.rs"
name = "project"
plugin = false
proc-macro = false
edition = "2021"
required-features = []

[[example]]
path = "examples/projects.rs"
name = "projects"
plugin = false
proc-macro = false
edition = "2021"
required-features = []

[[example]]
path = "examples/version.rs"
name = "version"
plugin = false
proc-macro = false
edition = "2021"
required-features = []
58 changes: 58 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
set dotenv-load := true

help:
@just --list --unsorted

build:
cargo build
alias b := build

run *args:
cargo run {{args}}
alias r := run

release:
cargo build --release

install:
cargo install --path .

bootstrap:
cargo install cargo-edit

test *args:
cargo test {{args}}

check:
cargo check
alias c := check

fix:
cargo clippy --fix

# Bump version. level=major,minor,patch
version level:
git diff-index --exit-code HEAD > /dev/null || ! echo You have untracked changes. Commit your changes before bumping the version.
cargo set-version --bump {{level}}
cargo update # This bumps Cargo.lock
VERSION=$(rg "version = \"([0-9.]+)\"" -or '$1' Cargo.toml | head -n1) && \
git commit -am "Bump version {{level}} to $VERSION" && \
git tag v$VERSION && \
git push origin v$VERSION
git push

publish:
cargo publish

patch: test
just version patch
just publish

doc:
cargo doc --no-deps --open

test-full:
#!/usr/bin/env bash -euxo pipefail
for file in $(ls examples); do
cargo run --example "$(basename "$file" .rs)"
done
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License

Copyright (c) 2010-2018 Stripe (http://stripe.com)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
68 changes: 68 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<div id="top"></div>

<p align="center">
<a href="https://github.com/libninjacom/paper-mc-rs/graphs/contributors">
<img src="https://img.shields.io/github/contributors/libninjacom/paper-mc-rs.svg?style=flat-square" alt="GitHub Contributors" />
</a>
<a href="https://github.com/libninjacom/paper-mc-rs/stargazers">
<img src="https://img.shields.io/github/stars/libninjacom/paper-mc-rs.svg?style=flat-square" alt="Stars" />
</a>
<a href="https://github.com/libninjacom/paper-mc-rs/actions">
<img src="https://img.shields.io/github/workflow/status/libninjacom/paper-mc-rs/test?style=flat-square" alt="Build Status" />
</a>

<a href="https://crates.io/crates/paper-mc">
<img src="https://img.shields.io/crates/d/paper-mc?style=flat-square" alt="Downloads" />
</a>
<a href="https://crates.io/crates/paper-mc">
<img src="https://img.shields.io/crates/v/paper-mc?style=flat-square" alt="Crates.io" />
</a>

</p>

PaperMC client, generated from the OpenAPI spec.

# Usage

```rust
use paper_mc::PaperMcClient;
use paper_mc::model::*;
#[tokio::main]
async fn main() {
let client = PaperMcClient::from_env();
let response = client.projects().send().await.unwrap();
println!("{:#?}", response);
}

```

This example loads configuration from environment variables, specifically:

* `PAPER_MC_BASE_URL`



# Installation

Add this to your Cargo.toml:

```toml
[dependencies]
paper-mc = "0.1.0"
```


# Documentation



* [Client Library Documentation](https://docs.rs/paper-mc)


You can see working examples of every API call in the `examples/` directory.

# Contributing

Contributions are welcome!

*Library created with [Libninja](https://www.libninja.com).*
11 changes: 11 additions & 0 deletions examples/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
use paper_mc::PaperMcClient;
use paper_mc::model::*;
#[tokio::main]
async fn main() {
let client = PaperMcClient::from_env();
let project = "your project";
let version = "your version";
let build = 1;
let response = client.build(project, version, build).send().await.unwrap();
println!("{:#?}", response);
}
Loading

0 comments on commit 3d94106

Please sign in to comment.