class Api::Tasks::CheckTask

Overview

JSON API: On http get with and id, checks the database for the id and returns the task if completed and existing.

This class harbours the api functionality of the server regarding checking if a transcompilation task exists or is finished. The user must supply an #id of the task and his own api token (auth_token). The function then returns HTTP::Status::OK (200) if the task exists. Is completed true means that the task was executed and output_code is then also returned.

Example for calling the api:

curl example.com/api/checktask/task-id -X GET -d "auth_token=your-token"

Possible return values: The task exists but is not completed. HTTP::Status::OK

{"id": "task-id", "completed": "false"}

The task exists and is completed. HTTP::Status::OK

{"id": "task-id", "completed": "true", "output_code": "output_code"}

The task does not exist. HTTP::Status::NOT_FOUND

{id: id, completed: false}
{id: id}

The former means there is still no such task. The later means there is something wrong: The task was fetched but is nil.

Defined in:

actions/api/tasks/check_task.cr

Constant Summary

AFTER_PIPES = [] of Symbol

JSON API: On http get with and id, checks the database for the id and returns the task if completed and existing.

This class harbours the api functionality of the server regarding checking if a transcompilation task exists or is finished. The user must supply an #id of the task and his own api token (auth_token). The function then returns HTTP::Status::OK (200) if the task exists. Is completed true means that the task was executed and output_code is then also returned.

Example for calling the api:

curl example.com/api/checktask/task-id -X GET -d "auth_token=your-token"

Possible return values: The task exists but is not completed. HTTP::Status::OK

{"id": "task-id", "completed": "false"}

The task exists and is completed. HTTP::Status::OK

{"id": "task-id", "completed": "true", "output_code": "output_code"}

The task does not exist. HTTP::Status::NOT_FOUND

{id: id, completed: false}
{id: id}

The former means there is still no such task. The later means there is something wrong: The task was fetched but is nil.

BEFORE_PIPES = [verify_accepted_format, require_auth_token] of Symbol

JSON API: On http get with and id, checks the database for the id and returns the task if completed and existing.

This class harbours the api functionality of the server regarding checking if a transcompilation task exists or is finished. The user must supply an #id of the task and his own api token (auth_token). The function then returns HTTP::Status::OK (200) if the task exists. Is completed true means that the task was executed and output_code is then also returned.

Example for calling the api:

curl example.com/api/checktask/task-id -X GET -d "auth_token=your-token"

Possible return values: The task exists but is not completed. HTTP::Status::OK

{"id": "task-id", "completed": "false"}

The task exists and is completed. HTTP::Status::OK

{"id": "task-id", "completed": "true", "output_code": "output_code"}

The task does not exist. HTTP::Status::NOT_FOUND

{id: id, completed: false}
{id: id}

The former means there is still no such task. The later means there is something wrong: The task was fetched but is nil.

EXPOSURES = [] of Symbol

JSON API: On http get with and id, checks the database for the id and returns the task if completed and existing.

This class harbours the api functionality of the server regarding checking if a transcompilation task exists or is finished. The user must supply an #id of the task and his own api token (auth_token). The function then returns HTTP::Status::OK (200) if the task exists. Is completed true means that the task was executed and output_code is then also returned.

Example for calling the api:

curl example.com/api/checktask/task-id -X GET -d "auth_token=your-token"

Possible return values: The task exists but is not completed. HTTP::Status::OK

{"id": "task-id", "completed": "false"}

The task exists and is completed. HTTP::Status::OK

{"id": "task-id", "completed": "true", "output_code": "output_code"}

The task does not exist. HTTP::Status::NOT_FOUND

{id: id, completed: false}
{id: id}

The former means there is still no such task. The later means there is something wrong: The task was fetched but is nil.

PARAM_DECLARATIONS = [] of Crystal::Macros::TypeDeclaration

JSON API: On http get with and id, checks the database for the id and returns the task if completed and existing.

This class harbours the api functionality of the server regarding checking if a transcompilation task exists or is finished. The user must supply an #id of the task and his own api token (auth_token). The function then returns HTTP::Status::OK (200) if the task exists. Is completed true means that the task was executed and output_code is then also returned.

Example for calling the api:

curl example.com/api/checktask/task-id -X GET -d "auth_token=your-token"

Possible return values: The task exists but is not completed. HTTP::Status::OK

{"id": "task-id", "completed": "false"}

The task exists and is completed. HTTP::Status::OK

{"id": "task-id", "completed": "true", "output_code": "output_code"}

The task does not exist. HTTP::Status::NOT_FOUND

{id: id, completed: false}
{id: id}

The former means there is still no such task. The later means there is something wrong: The task was fetched but is nil.

ROUTE_SETTINGS = {prefix: ""}

JSON API: On http get with and id, checks the database for the id and returns the task if completed and existing.

This class harbours the api functionality of the server regarding checking if a transcompilation task exists or is finished. The user must supply an #id of the task and his own api token (auth_token). The function then returns HTTP::Status::OK (200) if the task exists. Is completed true means that the task was executed and output_code is then also returned.

Example for calling the api:

curl example.com/api/checktask/task-id -X GET -d "auth_token=your-token"

Possible return values: The task exists but is not completed. HTTP::Status::OK

{"id": "task-id", "completed": "false"}

The task exists and is completed. HTTP::Status::OK

{"id": "task-id", "completed": "true", "output_code": "output_code"}

The task does not exist. HTTP::Status::NOT_FOUND

{id: id, completed: false}
{id: id}

The former means there is still no such task. The later means there is something wrong: The task was fetched but is nil.

SKIPPED_PIPES = [] of Symbol

JSON API: On http get with and id, checks the database for the id and returns the task if completed and existing.

This class harbours the api functionality of the server regarding checking if a transcompilation task exists or is finished. The user must supply an #id of the task and his own api token (auth_token). The function then returns HTTP::Status::OK (200) if the task exists. Is completed true means that the task was executed and output_code is then also returned.

Example for calling the api:

curl example.com/api/checktask/task-id -X GET -d "auth_token=your-token"

Possible return values: The task exists but is not completed. HTTP::Status::OK

{"id": "task-id", "completed": "false"}

The task exists and is completed. HTTP::Status::OK

{"id": "task-id", "completed": "true", "output_code": "output_code"}

The task does not exist. HTTP::Status::NOT_FOUND

{id: id, completed: false}
{id: id}

The former means there is still no such task. The later means there is something wrong: The task was fetched but is nil.

Class Method Summary

Instance Method Summary

Class methods inherited from class ApiAction

_accepted_formats _accepted_formats

Instance methods inherited from module Api::Auth::Helpers

current_user? : User | Nil current_user?, current_user__tuple_cached? : Tuple(User | Nil) current_user__tuple_cached?, current_user__uncached? : User | Nil current_user__uncached?

Class Method Detail

def self.path(*args, **named_args) : String #

def self.path_without_query_params(id) #

def self.route(id, anchor : String | Nil = nil) : Lucky::RouteHelper #

def self.url(*args, **named_args) : String #

def self.url_without_query_params(id) #

def self.with(id, anchor : String | Nil = nil) : Lucky::RouteHelper #

Instance Method Detail

def call #

def id : String #