regis

<back to all web services

GradesRequest

Requires Authentication
Required role:REGISUserRole
The following routes are available for this service:
POST/Grades
<?php namespace dtos;

use DateTime;
use Exception;
use DateInterval;
use JsonSerializable;
use ServiceStack\{IReturn,IReturnVoid,IGet,IPost,IPut,IDelete,IPatch,IMeta,IHasSessionId,IHasBearerToken,IHasVersion};
use ServiceStack\{ICrud,ICreateDb,IUpdateDb,IPatchDb,IDeleteDb,ISaveDb,AuditBase,QueryDb,QueryDb2,QueryData,QueryData2,QueryResponse};
use ServiceStack\{ResponseStatus,ResponseError,EmptyResponse,IdResponse,ArrayList,KeyValuePair2,StringResponse,StringsResponse,Tuple2,Tuple3,ByteArray};
use ServiceStack\{JsonConverters,Returns,TypeContext};


class GradeResponse implements JsonSerializable
{
    public function __construct(
        /** @var ResponseStatus|null */
        public ?ResponseStatus $responseStatus=null,
        /** @var int */
        public int $id=0,
        /** @var string|null */
        public ?string $grade_code=null,
        /** @var string|null */
        public ?string $grade_name=null,
        /** @var float */
        public float $grade_points=0.0,
        /** @var bool|null */
        public ?bool $gpa_credit=null,
        /** @var bool|null */
        public ?bool $completed_credit=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['responseStatus'])) $this->responseStatus = JsonConverters::from('ResponseStatus', $o['responseStatus']);
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['grade_code'])) $this->grade_code = $o['grade_code'];
        if (isset($o['grade_name'])) $this->grade_name = $o['grade_name'];
        if (isset($o['grade_points'])) $this->grade_points = $o['grade_points'];
        if (isset($o['gpa_credit'])) $this->gpa_credit = $o['gpa_credit'];
        if (isset($o['completed_credit'])) $this->completed_credit = $o['completed_credit'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->responseStatus)) $o['responseStatus'] = JsonConverters::to('ResponseStatus', $this->responseStatus);
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->grade_code)) $o['grade_code'] = $this->grade_code;
        if (isset($this->grade_name)) $o['grade_name'] = $this->grade_name;
        if (isset($this->grade_points)) $o['grade_points'] = $this->grade_points;
        if (isset($this->gpa_credit)) $o['gpa_credit'] = $this->gpa_credit;
        if (isset($this->completed_credit)) $o['completed_credit'] = $this->completed_credit;
        return empty($o) ? new class(){} : $o;
    }
}

class GradesResponse implements JsonSerializable
{
    public function __construct(
        /** @var ResponseStatus|null */
        public ?ResponseStatus $responseStatus=null,
        /** @var array<GradeResponse>|null */
        public ?array $grades=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['responseStatus'])) $this->responseStatus = JsonConverters::from('ResponseStatus', $o['responseStatus']);
        if (isset($o['grades'])) $this->grades = JsonConverters::fromArray('GradeResponse', $o['grades']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->responseStatus)) $o['responseStatus'] = JsonConverters::to('ResponseStatus', $this->responseStatus);
        if (isset($this->grades)) $o['grades'] = JsonConverters::toArray('GradeResponse', $this->grades);
        return empty($o) ? new class(){} : $o;
    }
}

class GradesRequest implements JsonSerializable
{
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        return empty($o) ? new class(){} : $o;
    }
}

PHP GradesRequest DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv

HTTP + JSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /Grades HTTP/1.1 
Host: data.regent-college.edu 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	responseStatus: 
	{
		errorCode: String,
		message: String,
		stackTrace: String,
		errors: 
		[
			{
				errorCode: String,
				fieldName: String,
				message: String,
				meta: 
				{
					String: String
				}
			}
		],
		meta: 
		{
			String: String
		}
	},
	grades: 
	[
		{
			responseStatus: 
			{
				errorCode: String,
				message: String,
				stackTrace: String,
				errors: 
				[
					{
						errorCode: String,
						fieldName: String,
						message: String,
						meta: 
						{
							String: String
						}
					}
				],
				meta: 
				{
					String: String
				}
			},
			id: 0,
			grade_code: String,
			grade_name: String,
			grade_points: 0,
			gpa_credit: False,
			completed_credit: False
		}
	]
}