Language Migration #21

Merged
kdeng00 merged 47 commits from rust-lg into master 2024-06-15 12:22:18 -04:00
5 changed files with 85 additions and 3 deletions
Showing only changes of commit 115e8b1527 - Show all commits
+16 -2
View File
@@ -1,10 +1,24 @@
use std::default::Default;
use crate::models; use crate::models;
use super::syncer_base;
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct Delete { pub struct Delete {
pub api: models::api::API, pub api: models::api::API,
} }
impl Delete { impl Default for Delete {
pub fn delete_song(&self, token: &models::token::Token, song: &models::song::Song) {} fn default() -> Self {
Delete {
api: models::api::API::default(),
}
}
}
impl Delete {
pub fn delete_song(&self, token: &models::token::Token, song: &models::song::Song) {
let url = syncer_base::Syncer::retrieve_url(&self.api, &song);
}
} }
+14
View File
@@ -1 +1,15 @@
use std::default::Default;
use crate::models;
pub struct Download{
pub api: models::api::API,
}
impl Default for Download {
fn default() -> Self {
Download {
api: models::api::API::default(),
}
}
}
+16
View File
@@ -1 +1,17 @@
use std::default::Default;
use crate::models;
pub struct RetrieveRecords {
pub api: models::api::API,
}
impl Default for RetrieveRecords {
fn default() -> Self {
RetrieveRecords {
api: models::api::API::default(),
}
}
}
+25 -1
View File
@@ -1,6 +1,10 @@
use crate::models; use crate::models;
struct Syncer {} pub struct Syncer {
ok: i32,
unauthorized: i32,
not_found: i32,
}
impl Syncer { impl Syncer {
pub fn retrieve_url(api: &models::api::API, song: &models::song::Song) -> String { pub fn retrieve_url(api: &models::api::API, song: &models::song::Song) -> String {
@@ -14,4 +18,24 @@ impl Syncer {
return url; return url;
} }
pub fn ok() -> i32 {
return 200;
} }
pub fn unauthorized() -> i32 {
return 401;
}
pub fn not_found() -> i32 {
return 404;
}
}
pub enum Result {
OK,
UNAUTHORIZED,
NOTFOUND,
}
+14
View File
@@ -1 +1,15 @@
use std::default::Default;
use crate::models;
pub struct Upload {
pub api: models::api::API,
}
impl Default for Upload {
fn default() -> Self {
Upload {
api: models::api::API::default(),
}
}
}