[][src]Struct jiragen::JiraClient

pub struct JiraClient { /* fields omitted */ }

A JiraClient instance handles requests sent to JIRA. An instance is created via JiraClient::new(Config), and then that instance can then be used for creating requests to JIRA, via .init_request() (which creates authorization headers using the Config username/password).

Methods

impl JiraClient[src]

pub fn new(config: Config) -> Self[src]

Creates a new reqwest client and returns the JiraClient struct wrapper.

use jiragen::{Config, JiraClient};

let config = Config {
  jira_url: "https://my-jira.com".to_string(),
  jira_user: "my-user".to_string(),
  jira_password: "my-password".to_string(),
};

let jira = JiraClient::new(config);

pub fn get_client(&self) -> &Client[src]

Returns a reference to the Reqwest Client with preconfigured headers.

pub fn get_config(&self) -> &Config[src]

Returns a reference to the JIRA Config object.

pub fn init_request(&self, method_str: &str, endpoint: &str) -> RequestBuilder[src]

Creates a reqwest Request Builder with some predefined authorization headers.

use jiragen::{Config, JiraClient};
use serde_json::json;

let config = Config {
  jira_url: "https://my-jira.com".to_string(),
  jira_user: "my-user".to_string(),
  jira_password: "my-password".to_string(),
};

let jira = JiraClient::new(config);

let request = jira.init_request("POST", "/rest/api/2/issue/bulk");
let json = json!({ "some_key": "some_value" }).to_string();

let response = request.body(json).send();

Auto Trait Implementations

impl Send for JiraClient

impl Sync for JiraClient

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Erased for T