Atlassian Rust API
atlassian-rust-api is an async wrapper for the Atlassian REST API. It provides a simple, builder-pattern focused way to interact with the Atlassian products. It is based on the official REST APIs for each product.
Note that this is currently under heavy construction and I am currently focusing on Jira Data Center/Cloud for the moment. JSM and Confluence are in the pipeline right after, followed by the rest of the tools.
Versions
- Jira Data Center: v9.17.0
Features
Cargo Feature Flags
jira: Add access to thejiracrate.experimental: Add access to experimental endpoints.
Usage
See the examples/ folder for more in-depth usage.
Quickstart
Most of these quickstarts assume tokio is being used to provide the async runtime, but the library is agnostic of the async runtime.
Jira
use Jira;
async
Rocket example
extern crate rocket;
use Jira;
async
Design Pattern
Endpoints
Every endpoint is made up of 3 parts, the EndpointBuilder, the EndpointRequest, and the impl Client block in the endpoint. Each endpoint to one of the core REST API endpoints gets each of these things.
EndpointBuilder
The EndpointBuilder is what the user interacts with and holds a copy of the RestClient for making the call to the REST API and the EndpointRequest. The builder implements the setters for the fields contained in the EndpointRequest as well as the send() function for executing the request.
EndpointRequest
The EndpointRequest holds the information required to make the request to the REST API. It also implements the Endpoint trait which builds the URL, the query parameters, and the body of the request. It is separate from the EndpointBuilder so that each of the fields can remain private from the user and so that it can implement Default
impl Client Block
The impl Client block is created in the same file as the EndpointBuilder and EndpointRequest so that they don't have to be explicitly publicized. The user is responsible for setting required fields in the initial call and the Client fn should always return the EndpointBuilder regardless if there are zero fields for the endpoint. The user should be responsible for calling .send().await?; on the EndpointBuilder to execute the request.