aboutsummaryrefslogtreecommitdiff
path: root/captain/api.f90
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeff@approximatrix.com>2021-04-02 16:37:36 -0400
committerJeffrey Armstrong <jeff@approximatrix.com>2021-04-02 16:37:36 -0400
commitbff06af2176e2f2813482b4fa7b4096a9982999b (patch)
treeb84a25c66487355ce4b1bb123f6fc01b2992ef46 /captain/api.f90
parentb27bd7cfa58eb82fc2a6c76aaa848e07a6fa7c24 (diff)
downloadlevitating-bff06af2176e2f2813482b4fa7b4096a9982999b.tar.gz
levitating-bff06af2176e2f2813482b4fa7b4096a9982999b.zip
More work on titan request handling, including a titan request derived type
Diffstat (limited to 'captain/api.f90')
-rw-r--r--captain/api.f9036
1 files changed, 33 insertions, 3 deletions
diff --git a/captain/api.f90 b/captain/api.f90
index 48cae8a..8b6890d 100644
--- a/captain/api.f90
+++ b/captain/api.f90
@@ -50,6 +50,7 @@ contains
resp%code = GEMINI_CODE_SUCCESS
call resp%set_body_contents(RESPONSE_JSON_OKAY)
+ resp%body_mimetype = "application/json"
! Checkin - /api/player/{name}/checkin.json
else if(trim(req%component(2)) == "player" .and. trim(req%component(4)) == "checkin.json") then
@@ -76,8 +77,35 @@ contains
use server_response
implicit none
- type(request), intent(in)::req
+ type(titan_request), intent(in)::req
type(response)::resp
+
+ character(len=:), pointer::fullpath
+
+ fullpath => null()
+
+ ! Task - "/api/player/{name}/job/{jobid}/task/{task num}"
+ if(trim(req%component(2)) == "player" .and. &
+ trim(req%component(4)) == "job" .and. &
+ trim(req%component(6)) == "task") then
+
+ fullpath =>
+
+ end if
+
+ if(associated(fullpath)) then
+
+ resp%code = GEMINI_CODE_SUCCESS
+ call resp%set_body_contents(RESPONSE_JSON_OKAY)
+ resp%body_mimetype = "application/json"
+
+ else
+
+ resp%code = GEMINI_CODE_PERMFAIL
+
+ end if
+
+
end function api_request_titan
@@ -85,13 +113,15 @@ contains
use server_response
implicit none
- type(request), intent(in)::req
+ type(request)::req
+ type(titan_request)::titan_req
type(response)::resp
if(req%protocol == "gemini") then
resp = api_request_gemini(req)
else if(req%protocol == "titan") then
- resp = api_request_titan(req)
+ call titan_req%init_from_request(req)
+ resp = api_request_titan(titan_req)
end if
end function api_request