From 528e9818d8ebc8824d1873a4a7ceaab9597c4c1c Mon Sep 17 00:00:00 2001 From: Daniel Gyulai Date: Fri, 16 Oct 2020 22:08:40 +0200 Subject: [PATCH] Expanded API, added API classes --- CoviDok/API.md | 35 +++++++++++++++++++------ CoviDok/Api/Response.cs | 14 ++++++++++ CoviDok/Api/Role.cs | 14 ++++++++++ CoviDok/api/Request/AuthChild.cs | 16 +++++++++++ CoviDok/api/Request/AuthGet.cs | 12 +++++++++ CoviDok/api/Request/AuthLogin.cs | 13 +++++++++ CoviDok/api/Request/AuthRegistration.cs | 16 +++++++++++ 7 files changed, 112 insertions(+), 8 deletions(-) create mode 100644 CoviDok/Api/Response.cs create mode 100644 CoviDok/Api/Role.cs create mode 100644 CoviDok/api/Request/AuthChild.cs create mode 100644 CoviDok/api/Request/AuthGet.cs create mode 100644 CoviDok/api/Request/AuthLogin.cs create mode 100644 CoviDok/api/Request/AuthRegistration.cs diff --git a/CoviDok/API.md b/CoviDok/API.md index adb59f3..27e03ab 100644 --- a/CoviDok/API.md +++ b/CoviDok/API.md @@ -5,10 +5,11 @@ CoviDok API accepts and sends JSON objects. The basic response structure is comp { "version" : "1" "status": "OK/ERR" - "response" : "Description/data" + "body" : "Description/data" } The "response" field contains the actual content of the answer, while "status" indicates if the request was successful (value is either ERR or OK). +Error codes coming soon. # Accepted calls @@ -25,12 +26,21 @@ Login authentication. Requires account login info, returns a session ID and the ### POST /api/Auth -Registration call. +Registration call. Returns with the type and ID of the created entity. |Type|JSON| |-----|-----| |Request|{
"firstName": string,
"lastName": string,
"email": string,
"password": string,
"role": "Doc/Ast/Par"
}| -|Response|None| +|Response|{
"role": "Doc/ast/Par",
"ID": string}| + +### POST /api/Auth/child + +Adds a child to a parent. A parent can only add children to its own account (Parent is determined from session IDs). + +|Type|JSON| +|-----|-----| +|Request|{
"id": sessionID,
"firstName": string,
"lastName": string,
"birthDate": string,
"socSecNum": string
}| +|Response|{
"ChildID": Child.Id
}| ## Doc @@ -61,13 +71,22 @@ Lists childern with onging or finished cases assigned to a doctor. |Request|{
"id": sessionID
}| |Response|{[
"firstName": Child.Firstname,
"lastName" : Child.Lastname,
"id" : Child.Id], ...
}| -## Parent -### POST /api/Parent/child +## Case + +### POST /api/Case/{id}/certreq + +Posts a request for health certification. Must be related to a closed Task (represented by TaskID). + +|Type|JSON| +|-----|-----| +|Request|{
"id": SessionID,
}| +|Response|{
"certID": string
}| + +### GET /api/Case/{id}/certreq -Adds a child to a parent. A parent can only add children to its own account (Enforced on server side). +Check status of health certification. Must be related to a closed Task (represented by TaskID). |Type|JSON| |-----|-----| -|Request|{
"id": sessionID,
"firstName": string,
"lastName": string
}| -|Response|{
"ChildID": Child.Id
}| \ No newline at end of file +|Request|{
"id": SessionID,
}| \ No newline at end of file diff --git a/CoviDok/Api/Response.cs b/CoviDok/Api/Response.cs new file mode 100644 index 0000000..11d9837 --- /dev/null +++ b/CoviDok/Api/Response.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace CoviDok.Api +{ + public class Response + { + public int Version { get; set; } + public string Status { get; set; } + public Dictionary Body = new Dictionary(); + } +} diff --git a/CoviDok/Api/Role.cs b/CoviDok/Api/Role.cs new file mode 100644 index 0000000..5fb4bcb --- /dev/null +++ b/CoviDok/Api/Role.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace CoviDok.Api +{ + public enum Role + { + Doc, + Ast, + Par + } +} diff --git a/CoviDok/api/Request/AuthChild.cs b/CoviDok/api/Request/AuthChild.cs new file mode 100644 index 0000000..9afa0d3 --- /dev/null +++ b/CoviDok/api/Request/AuthChild.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace CoviDok.Api.Request +{ + public class AuthChild + { + public string SessionID { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + public string BirthDate { get; set; } + public string SocSecNum { get; set; } + } +} diff --git a/CoviDok/api/Request/AuthGet.cs b/CoviDok/api/Request/AuthGet.cs new file mode 100644 index 0000000..f6e6817 --- /dev/null +++ b/CoviDok/api/Request/AuthGet.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace CoviDok.Api.Request +{ + public class AuthGet + { + public string SessionID { get; set; } + } +} diff --git a/CoviDok/api/Request/AuthLogin.cs b/CoviDok/api/Request/AuthLogin.cs new file mode 100644 index 0000000..47b0bff --- /dev/null +++ b/CoviDok/api/Request/AuthLogin.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace CoviDok.Api.Request +{ + public class AuthLogin + { + public string Email { get; set; } + public string Password { get; set; } + } +} diff --git a/CoviDok/api/Request/AuthRegistration.cs b/CoviDok/api/Request/AuthRegistration.cs new file mode 100644 index 0000000..9ef8328 --- /dev/null +++ b/CoviDok/api/Request/AuthRegistration.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace CoviDok.Api.Request +{ + public class AuthRegistration + { + public string FirstName { get; set; } + public string LastName { get; set; } + public string Email { get; set; } + public string Password { get; set; } + public Role Role { get; set; } + } +}