use the http responses directly for object creation
This commit is contained in:
parent
af37f7b307
commit
420b0dff79
3 changed files with 20 additions and 15 deletions
|
|
@ -4,6 +4,8 @@ import androidx.annotation.NonNull;
|
|||
import androidx.room.Entity;
|
||||
import androidx.room.PrimaryKey;
|
||||
|
||||
import org.jellyfin.apiclient.model.system.SystemInfo;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Entity(tableName = "servers")
|
||||
|
|
@ -19,10 +21,10 @@ public class Server {
|
|||
this.id = UUID.randomUUID().toString();
|
||||
}
|
||||
|
||||
public Server(String name, String url) {
|
||||
this.id = UUID.randomUUID().toString();
|
||||
public Server(SystemInfo systemInfo) {
|
||||
this.id = systemInfo.getId();
|
||||
|
||||
this.name = name;
|
||||
this.url = url;
|
||||
this.name = systemInfo.getServerName();
|
||||
this.url = systemInfo.getWanAddress();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ import androidx.room.Entity;
|
|||
import androidx.room.ForeignKey;
|
||||
import androidx.room.PrimaryKey;
|
||||
|
||||
import org.jellyfin.apiclient.model.users.AuthenticationResult;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Entity(tableName = "users")
|
||||
|
|
@ -28,12 +30,12 @@ public class User {
|
|||
this.id = UUID.randomUUID().toString();
|
||||
}
|
||||
|
||||
public User(String serverId, String name, String token) {
|
||||
this.id = UUID.randomUUID().toString();
|
||||
public User(AuthenticationResult result) {
|
||||
this.id = result.getUser().getId();
|
||||
|
||||
this.serverId = serverId;
|
||||
this.serverId = result.getServerId();
|
||||
|
||||
this.name = name;
|
||||
this.token = token;
|
||||
this.name = result.getUser().getName();
|
||||
this.token = result.getAccessToken();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue