Added session in account to use `session_identification`

This commit is contained in:
Mahesh Bansod 2021-11-03 12:22:55 +05:30
parent 824747041b
commit 9619e63361
2 changed files with 10 additions and 9 deletions

View File

@ -1,22 +1,20 @@
use crate::SVSessionMethods;
use serde_json::json;
use socialvoid_rawclient::Error;
use socialvoid_types::SessionIdentification;
use std::sync::Arc;
pub struct SVAccountMethods {
client: Arc<socialvoid_rawclient::Client>,
session: Arc<SVSessionMethods>,
}
impl SVAccountMethods {
pub fn new(client: Arc<socialvoid_rawclient::Client>) -> Self {
Self { client }
pub fn new(client: Arc<socialvoid_rawclient::Client>, session: Arc<SVSessionMethods>) -> Self {
Self { client, session }
}
pub async fn set_profile_picture(
&self,
session_identification: SessionIdentification,
document_id: String,
) -> Result<bool, Error> {
pub async fn set_profile_picture(&self, document_id: String) -> Result<bool, Error> {
let session_identification = self.session.session_identification()?;
self.client
.send_request(
"account.set_profile_picture",

View File

@ -128,7 +128,10 @@ pub fn init_methods(
Arc::clone(&client),
Arc::clone(&session),
)),
Arc::new(SVAccountMethods::new(Arc::clone(&client))),
Arc::new(SVAccountMethods::new(
Arc::clone(&client),
Arc::clone(&session),
)),
Arc::new(SVTimelineMethods::new(
Arc::clone(&client),
Arc::clone(&session),