regis

<back to all web services

SectionDocumentsRequest

Requires Authentication
Required role:REGISUserRole
The following routes are available for this service:
POST/Sections/{uuid}/Documents
<?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 DocumentResponse implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $code=null,
        /** @var string|null */
        public ?string $document_name=null,
        /** @var string|null */
        public ?string $document_description=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['code'])) $this->code = $o['code'];
        if (isset($o['document_name'])) $this->document_name = $o['document_name'];
        if (isset($o['document_description'])) $this->document_description = $o['document_description'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->code)) $o['code'] = $this->code;
        if (isset($this->document_name)) $o['document_name'] = $this->document_name;
        if (isset($this->document_description)) $o['document_description'] = $this->document_description;
        return empty($o) ? new class(){} : $o;
    }
}

class SectionDocumentsResponse implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $uuid=null,
        /** @var string|null */
        public ?string $course_name=null,
        /** @var string|null */
        public ?string $title=null,
        /** @var string|null */
        public ?string $term=null,
        /** @var string|null */
        public ?string $reporting_term=null,
        /** @var array<DocumentResponse>|null */
        public ?array $assigned_documents=null,
        /** @var array<DocumentResponse>|null */
        public ?array $available_documents=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['uuid'])) $this->uuid = $o['uuid'];
        if (isset($o['course_name'])) $this->course_name = $o['course_name'];
        if (isset($o['title'])) $this->title = $o['title'];
        if (isset($o['term'])) $this->term = $o['term'];
        if (isset($o['reporting_term'])) $this->reporting_term = $o['reporting_term'];
        if (isset($o['assigned_documents'])) $this->assigned_documents = JsonConverters::fromArray('DocumentResponse', $o['assigned_documents']);
        if (isset($o['available_documents'])) $this->available_documents = JsonConverters::fromArray('DocumentResponse', $o['available_documents']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->uuid)) $o['uuid'] = $this->uuid;
        if (isset($this->course_name)) $o['course_name'] = $this->course_name;
        if (isset($this->title)) $o['title'] = $this->title;
        if (isset($this->term)) $o['term'] = $this->term;
        if (isset($this->reporting_term)) $o['reporting_term'] = $this->reporting_term;
        if (isset($this->assigned_documents)) $o['assigned_documents'] = JsonConverters::toArray('DocumentResponse', $this->assigned_documents);
        if (isset($this->available_documents)) $o['available_documents'] = JsonConverters::toArray('DocumentResponse', $this->available_documents);
        return empty($o) ? new class(){} : $o;
    }
}

class SectionDocumentsRequest implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $uuid=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['uuid'])) $this->uuid = $o['uuid'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->uuid)) $o['uuid'] = $this->uuid;
        return empty($o) ? new class(){} : $o;
    }
}

PHP SectionDocumentsRequest 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 /Sections/{uuid}/Documents HTTP/1.1 
Host: data.regent-college.edu 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

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

{
	uuid: String,
	course_name: String,
	title: String,
	term: String,
	reporting_term: String,
	assigned_documents: 
	[
		{
			code: String,
			document_name: String,
			document_description: String
		}
	],
	available_documents: 
	[
		{
			code: String,
			document_name: String,
			document_description: String
		}
	]
}