Browse Source

Expanded API, added API classes

master
Daniel Gyulai 5 years ago
parent
commit
528e9818d8
  1. 35
      CoviDok/API.md
  2. 14
      CoviDok/Api/Response.cs
  3. 14
      CoviDok/Api/Role.cs
  4. 16
      CoviDok/api/Request/AuthChild.cs
  5. 12
      CoviDok/api/Request/AuthGet.cs
  6. 13
      CoviDok/api/Request/AuthLogin.cs
  7. 16
      CoviDok/api/Request/AuthRegistration.cs

35
CoviDok/API.md

@ -5,10 +5,11 @@ CoviDok API accepts and sends JSON objects. The basic response structure is comp
{ {
"version" : "1" "version" : "1"
"status": "OK/ERR" "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). 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 # Accepted calls
@ -25,12 +26,21 @@ Login authentication. Requires account login info, returns a session ID and the
### POST /api/Auth ### POST /api/Auth
Registration call. Registration call. Returns with the type and ID of the created entity.
|Type|JSON| |Type|JSON|
|-----|-----| |-----|-----|
|Request|{<br> "firstName": string,<br> "lastName": string,<br> "email": string,<br> "password": string,<br> "role": "Doc/Ast/Par"<br>}| |Request|{<br> "firstName": string,<br> "lastName": string,<br> "email": string,<br> "password": string,<br> "role": "Doc/Ast/Par"<br>}|
|Response|None| |Response|{<br> "role": "Doc/ast/Par",<br> "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|{<br> "id": sessionID,<br> "firstName": string,<br> "lastName": string,<br> "birthDate": string,<br> "socSecNum": string<br>}|
|Response|{<br> "ChildID": Child.Id<br>}|
## Doc ## Doc
@ -61,13 +71,22 @@ Lists childern with onging or finished cases assigned to a doctor.
|Request|{<br> "id": sessionID<br>}| |Request|{<br> "id": sessionID<br>}|
|Response|{[<br> "firstName": Child.Firstname,<br> "lastName" : Child.Lastname,<br> "id" : Child.Id], ...<br>}| |Response|{[<br> "firstName": Child.Firstname,<br> "lastName" : Child.Lastname,<br> "id" : Child.Id], ...<br>}|
## 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|{<br> "id": SessionID,<br>}|
|Response|{<br> "certID": string<br>}|
### 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| |Type|JSON|
|-----|-----| |-----|-----|
|Request|{<br> "id": sessionID,<br> "firstName": string,<br> "lastName": string<br>}| |Request|{<br> "id": SessionID,<br>}|
|Response|{<br> "ChildID": Child.Id<br>}|

14
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<string, string> Body = new Dictionary<string, string>();
}
}

14
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
}
}

16
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; }
}
}

12
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; }
}
}

13
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; }
}
}

16
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; }
}
}
Loading…
Cancel
Save