aboutsummaryrefslogtreecommitdiff
path: root/client/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/lib.rs')
-rw-r--r--client/src/lib.rs14
1 files changed, 2 insertions, 12 deletions
diff --git a/client/src/lib.rs b/client/src/lib.rs
index 96349ed..f88ecc5 100644
--- a/client/src/lib.rs
+++ b/client/src/lib.rs
@@ -4,14 +4,12 @@
Copyright (C) 2023 metamuffin <metamuffin.org>
*/
use anyhow::Result;
-use jellycommon::user::UserPermission;
+use jellycommon::user::CreateSessionParams;
use log::{debug, info};
use reqwest::{
header::{HeaderMap, HeaderValue},
Client,
};
-use serde::Serialize;
-use std::collections::HashSet;
use stream::StreamSpec;
use tokio::io::AsyncWriteExt;
@@ -23,14 +21,6 @@ pub struct Instance {
pub tls: bool,
}
-#[derive(Serialize)]
-pub struct LoginDetails {
- pub username: String,
- pub password: String,
- pub expire: Option<i64>,
- pub drop_permissions: Option<HashSet<UserPermission>>,
-}
-
impl Instance {
pub fn new(host: String, tls: bool) -> Self {
Self { host, tls }
@@ -42,7 +32,7 @@ impl Instance {
self.host
)
}
- pub async fn login(self, data: LoginDetails) -> anyhow::Result<Session> {
+ pub async fn login(self, data: CreateSessionParams) -> anyhow::Result<Session> {
let session_token = Client::builder()
.build()?
.post(format!("{}/api/create_session", self.base()))