Struct redmine_api::api::Redmine
source · pub struct Redmine { /* private fields */ }
Expand description
main API client object
Implementations§
source§impl Redmine
impl Redmine
sourcepub fn new(redmine_url: Url, api_key: &str) -> Result<Self, Error>
pub fn new(redmine_url: Url, api_key: &str) -> Result<Self, Error>
create a Redmine object
§Errors
This will return crate::Error::ReqwestError
if initialization of Reqwest client is failed.
sourcepub fn impersonate_user(&mut self, id: u64)
pub fn impersonate_user(&mut self, id: u64)
Sets the user id of a user to impersonate in all future API calls
this requires Redmine admin privileges
sourcepub fn issue_url(&self, issue_id: u64) -> Url
pub fn issue_url(&self, issue_id: u64) -> Url
returns the issue URL for a given issue id
this is mostly for convenience since we are already storing the redmine URL and it works entirely on the client
sourcepub fn ignore_response_body<E>(&self, endpoint: &E) -> Result<(), Error>where
E: Endpoint,
pub fn ignore_response_body<E>(&self, endpoint: &E) -> Result<(), Error>where
E: Endpoint,
use this with endpoints that have no response body, e.g. those just deleting a Redmine object
§Errors
This can return an error if the endpoint returns an error when creating the request body or when the web request fails
sourcepub fn json_response_body<E, R>(&self, endpoint: &E) -> Result<R, Error>
pub fn json_response_body<E, R>(&self, endpoint: &E) -> Result<R, Error>
use this with endpoints which return a JSON response but do not support pagination
you can use it with those that support pagination but they will only return the first page
§Errors
This can return an error if the endpoint returns an error when creating the request body, when the web request fails or when the response can not be parsed as a JSON object into the result type
sourcepub fn json_response_body_page<E, R>(
&self,
endpoint: &E,
offset: u64,
limit: u64
) -> Result<ResponsePage<R>, Error>
pub fn json_response_body_page<E, R>( &self, endpoint: &E, offset: u64, limit: u64 ) -> Result<ResponsePage<R>, Error>
use this to get a single page of a paginated JSON response
§Errors
This can return an error if the endpoint returns an error when creating the request body, when the web request fails, when the response can not be parsed as a JSON object, when any of the pagination keys or the value key are missing in the JSON object or when the values can not be parsed as the result type.
sourcepub fn json_response_body_all_pages<E, R>(
&self,
endpoint: &E
) -> Result<Vec<R>, Error>
pub fn json_response_body_all_pages<E, R>( &self, endpoint: &E ) -> Result<Vec<R>, Error>
use this to get the results for all pages of a paginated JSON response
§Errors
This can return an error if the endpoint returns an error when creating the request body, when any of the web requests fails, when the response can not be parsed as a JSON object, when any of the pagination keys or the value key are missing in the JSON object or when the values can not be parsed as the result type.