so://phie

verbal

A mobile app for listening to radio stations from around the globe
git clone git://soophie.de/verbal

blob: 0a79aacea68d0ca588a3b225c36e7bd1d5ec4b18 (1320 bytes)[doc][blame][raw]

1use serde::Serialize;

2

3use crate::model;

4use crate::utils::upgrade_to_https;

5

6#[derive(Debug, Serialize)]

7pub struct Account {

8 pub username: Option<String>,

9 pub language: String,

10 pub is_playback_history: bool,

11}

12

13impl Into<Account> for model::Account {

14 fn into(self) -> Account {

15 Account {

16 username: self.username,

17 language: self.language,

18 is_playback_history: self.is_playback_history,

19 }

20 }

21}

22

23#[derive(Debug, Serialize)]

24pub struct Station {

25 pub uuid: String,

26 pub name: String,

27 pub stream_url: String,

28 pub votes: i32,

29 pub favicon: Option<String>,

30 pub homepage: Option<String>,

31 pub tags: Vec<String>,

32 pub country: Option<String>,

33 pub languages: Vec<String>,

34 pub state: Option<String>,

35 pub is_favorite: bool,

36}

37

38impl Into<Station> for model::Station {

39 fn into(self) -> Station {

40 Station {

41 uuid: self.uuid,

42 name: self.name,

43 stream_url: upgrade_to_https(self.stream_url),

44 votes: self.votes,

45 favicon: self.favicon,

46 homepage: self.homepage,

47 tags: self.tags,

48 country: self.country,

49 languages: self.languages,

50 state: self.state,

51 is_favorite: false,

52 }

53 }

54}