Skip to content

Commit

Permalink
feat: adding features to dock models and re-naming
Browse files Browse the repository at this point in the history
  • Loading branch information
dbirman committed Apr 10, 2024
1 parent 86b4383 commit 9c381e7
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 20 deletions.
46 changes: 37 additions & 9 deletions models/csharp/DockModels.cs
Original file line number Diff line number Diff line change
@@ -1,36 +1,62 @@
using System;
[Serializable]
public struct BucketModel
public struct BucketRequest
{
public string Token;
public string Password;

public BucketModel(string token, string password)
public BucketRequest(string token, string password)
{
Token = token;
Password = password;
}
}

[Serializable]
public struct DownloadModel
public struct DownloadRequest
{
public string Password;

public DownloadModel(string password)
public DownloadRequest(string password)
{
Password = password;
}
}

[Serializable]
public struct DownloadResponse
{
public string Type;
public string Data;

public DownloadResponse(string type, string data)
{
Type = type;
Data = data;
}
}

[Serializable]
public struct LoadModel
{
public int[] Types;
public string[] Data;

public LoadModel(int[] types, string[] data)
{
Types = types;
Data = data;
}
}

[Serializable]
public struct LoadRequest
{
public string Filename;
public string Bucket;
public string Password;

public LoadModel(string filename, string bucket, string password)
public LoadRequest(string filename, string bucket, string password)
{
Filename = filename;
Bucket = bucket;
Expand All @@ -39,13 +65,13 @@ public LoadModel(string filename, string bucket, string password)
}

[Serializable]
public struct SaveModel
public struct SaveRequest
{
public string Filename;
public string Bucket;
public string Password;

public SaveModel(string filename, string bucket, string password)
public SaveRequest(string filename, string bucket, string password)
{
Filename = filename;
Bucket = bucket;
Expand All @@ -54,13 +80,15 @@ public SaveModel(string filename, string bucket, string password)
}

[Serializable]
public struct UploadModel
public struct UploadRequest
{
public int Type;
public string Data;
public string Password;

public UploadModel(string data, string password)
public UploadRequest(int type, string data, string password)
{
Type = type;
Data = data;
Password = password;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"properties": {"Token": {"title": "Token", "type": "string"}, "Password": {"title": "Password", "type": "string"}}, "required": ["Token", "Password"], "title": "BucketModel", "type": "object"}
{"properties": {"Token": {"title": "Token", "type": "string"}, "Password": {"title": "Password", "type": "string"}}, "required": ["Token", "Password"], "title": "BucketRequest", "type": "object"}
1 change: 0 additions & 1 deletion models/schemas/dock/DownloadModel.json

This file was deleted.

1 change: 1 addition & 0 deletions models/schemas/dock/DownloadRequest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"properties": {"Password": {"title": "Password", "type": "string"}}, "required": ["Password"], "title": "DownloadRequest", "type": "object"}
1 change: 1 addition & 0 deletions models/schemas/dock/DownloadResponse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"properties": {"Type": {"title": "Type", "type": "string"}, "Data": {"title": "Data", "type": "string"}}, "required": ["Type", "Data"], "title": "DownloadResponse", "type": "object"}
2 changes: 1 addition & 1 deletion models/schemas/dock/LoadModel.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"properties": {"Filename": {"default": "", "title": "Filename", "type": "string"}, "Bucket": {"default": "", "title": "Bucket", "type": "string"}, "Password": {"default": "", "title": "Password", "type": "string"}}, "title": "LoadModel", "type": "object"}
{"properties": {"Types": {"items": {"type": "integer"}, "title": "Types", "type": "array"}, "Data": {"items": {"type": "string"}, "title": "Data", "type": "array"}}, "required": ["Types", "Data"], "title": "LoadModel", "type": "object"}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"properties": {"Filename": {"default": "", "title": "Filename", "type": "string"}, "Bucket": {"default": "", "title": "Bucket", "type": "string"}, "Password": {"default": "", "title": "Password", "type": "string"}}, "title": "SaveModel", "type": "object"}
{"properties": {"Filename": {"default": "", "title": "Filename", "type": "string"}, "Bucket": {"default": "", "title": "Bucket", "type": "string"}, "Password": {"default": "", "title": "Password", "type": "string"}}, "title": "LoadRequest", "type": "object"}
1 change: 1 addition & 0 deletions models/schemas/dock/SaveRequest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"properties": {"Filename": {"default": "", "title": "Filename", "type": "string"}, "Bucket": {"default": "", "title": "Bucket", "type": "string"}, "Password": {"default": "", "title": "Password", "type": "string"}}, "title": "SaveRequest", "type": "object"}
1 change: 0 additions & 1 deletion models/schemas/dock/UploadModel.json

This file was deleted.

1 change: 1 addition & 0 deletions models/schemas/dock/UploadRequest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"properties": {"Type": {"title": "Type", "type": "integer"}, "Data": {"title": "Data", "type": "string"}, "Password": {"title": "Password", "type": "string"}}, "required": ["Type", "Data", "Password"], "title": "UploadRequest", "type": "object"}
20 changes: 14 additions & 6 deletions src/vbl_aquarium/models/dock.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,34 @@


# Models for sending data to dock server
class BucketModel(VBLBaseModel):
class BucketRequest(VBLBaseModel):
token: str
password: str


class UploadModel(VBLBaseModel):
class UploadRequest(VBLBaseModel):
type: int
data: str
password: str

class DownloadModel(VBLBaseModel):
class DownloadRequest(VBLBaseModel):
password: str

class DownloadResponse(VBLBaseModel):
type: str
data: str

# Models for sending save/load messages
class SaveModel(VBLBaseModel):
class SaveRequest(VBLBaseModel):
filename: str = ''
bucket: str = ''
password: str = ''


class LoadModel(VBLBaseModel):
class LoadRequest(VBLBaseModel):
filename: str = ''
bucket: str = ''
password: str = ''

class LoadModel(VBLBaseModel):
types: list[int]
data: list[str]

0 comments on commit 9c381e7

Please sign in to comment.