mirror of
https://github.com/kristoferssolo/transmission-rpc.git
synced 2025-10-21 20:10:37 +00:00
added CI
This commit is contained in:
parent
282f7995c1
commit
3733645ead
17
.github/workflows/ci.yml
vendored
Normal file
17
.github/workflows/ci.yml
vendored
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
name: CI
|
||||||
|
|
||||||
|
on: [push]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build_and_test:
|
||||||
|
name: Rust project
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: stable
|
||||||
|
- uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: build
|
||||||
|
args: --release --all-features
|
||||||
13
src/lib.rs
13
src/lib.rs
@ -1,6 +1,3 @@
|
|||||||
// #[allow(unused_imports)]
|
|
||||||
// #[allow(dead_code)]
|
|
||||||
|
|
||||||
extern crate env_logger;
|
extern crate env_logger;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate log;
|
extern crate log;
|
||||||
@ -10,6 +7,7 @@ use reqwest::header::CONTENT_TYPE;
|
|||||||
use serde::de::DeserializeOwned;
|
use serde::de::DeserializeOwned;
|
||||||
|
|
||||||
pub mod types;
|
pub mod types;
|
||||||
|
|
||||||
use types::BasicAuth;
|
use types::BasicAuth;
|
||||||
use types::SessionGet;
|
use types::SessionGet;
|
||||||
use types::TorrentAction;
|
use types::TorrentAction;
|
||||||
@ -49,7 +47,7 @@ impl TransClient {
|
|||||||
} else {
|
} else {
|
||||||
client.post(&self.url)
|
client.post(&self.url)
|
||||||
}
|
}
|
||||||
.header(CONTENT_TYPE, "application/json")
|
.header(CONTENT_TYPE, "application/json")
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Performs session-get call and takes the x-transmission-session-id
|
/// Performs session-get call and takes the x-transmission-session-id
|
||||||
@ -72,7 +70,7 @@ impl TransClient {
|
|||||||
},
|
},
|
||||||
_ => "",
|
_ => "",
|
||||||
}
|
}
|
||||||
.to_owned();
|
.to_owned();
|
||||||
info!("Received session id: {}", session_id);
|
info!("Received session id: {}", session_id);
|
||||||
session_id
|
session_id
|
||||||
}
|
}
|
||||||
@ -338,8 +336,8 @@ impl TransClient {
|
|||||||
///
|
///
|
||||||
/// Any IO Error or Deserialization error
|
/// Any IO Error or Deserialization error
|
||||||
async fn call<RS>(&self, request: RpcRequest) -> Result<RpcResponse<RS>>
|
async fn call<RS>(&self, request: RpcRequest) -> Result<RpcResponse<RS>>
|
||||||
where
|
where
|
||||||
RS: RpcResponseArgument + DeserializeOwned + std::fmt::Debug,
|
RS: RpcResponseArgument + DeserializeOwned + std::fmt::Debug,
|
||||||
{
|
{
|
||||||
info!("Loaded auth: {:?}", &self.auth);
|
info!("Loaded auth: {:?}", &self.auth);
|
||||||
let rq: reqwest::RequestBuilder = self
|
let rq: reqwest::RequestBuilder = self
|
||||||
@ -373,7 +371,6 @@ impl BodyString for reqwest::RequestBuilder {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use dotenv::dotenv;
|
use dotenv::dotenv;
|
||||||
use std::env;
|
use std::env;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user