Required role: | REGISUserRole |
POST | /Academic/Institution/Create |
---|
<?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 InstitutionResponse implements JsonSerializable
{
public function __construct(
/** @var ResponseStatus|null */
public ?ResponseStatus $responseStatus=null,
/** @var int */
public int $institution_id=0,
/** @var string|null */
public ?string $institution_name=null,
/** @var string|null */
public ?string $institution_previous_names=null,
/** @var string|null */
public ?string $institution_other_names=null,
/** @var string|null */
public ?string $institution_type=null,
/** @var string|null */
public ?string $accreditation_status=null,
/** @var string|null */
public ?string $accreditation_status_notes=null,
/** @var array<string>|null */
public ?array $related_institutions=null,
/** @var DateTime|null */
public ?DateTime $accreditation_status_changed_date=null,
/** @var string|null */
public ?string $gpa_conversion=null,
/** @var string|null */
public ?string $credit_hour_conversion=null,
/** @var string|null */
public ?string $addr1=null,
/** @var string|null */
public ?string $addr2=null,
/** @var string|null */
public ?string $city=null,
/** @var string|null */
public ?string $state=null,
/** @var string|null */
public ?string $country=null,
/** @var string|null */
public ?string $zip=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['responseStatus'])) $this->responseStatus = JsonConverters::from('ResponseStatus', $o['responseStatus']);
if (isset($o['institution_id'])) $this->institution_id = $o['institution_id'];
if (isset($o['institution_name'])) $this->institution_name = $o['institution_name'];
if (isset($o['institution_previous_names'])) $this->institution_previous_names = $o['institution_previous_names'];
if (isset($o['institution_other_names'])) $this->institution_other_names = $o['institution_other_names'];
if (isset($o['institution_type'])) $this->institution_type = $o['institution_type'];
if (isset($o['accreditation_status'])) $this->accreditation_status = $o['accreditation_status'];
if (isset($o['accreditation_status_notes'])) $this->accreditation_status_notes = $o['accreditation_status_notes'];
if (isset($o['related_institutions'])) $this->related_institutions = JsonConverters::fromArray('string', $o['related_institutions']);
if (isset($o['accreditation_status_changed_date'])) $this->accreditation_status_changed_date = JsonConverters::from('DateTime', $o['accreditation_status_changed_date']);
if (isset($o['gpa_conversion'])) $this->gpa_conversion = $o['gpa_conversion'];
if (isset($o['credit_hour_conversion'])) $this->credit_hour_conversion = $o['credit_hour_conversion'];
if (isset($o['addr1'])) $this->addr1 = $o['addr1'];
if (isset($o['addr2'])) $this->addr2 = $o['addr2'];
if (isset($o['city'])) $this->city = $o['city'];
if (isset($o['state'])) $this->state = $o['state'];
if (isset($o['country'])) $this->country = $o['country'];
if (isset($o['zip'])) $this->zip = $o['zip'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->responseStatus)) $o['responseStatus'] = JsonConverters::to('ResponseStatus', $this->responseStatus);
if (isset($this->institution_id)) $o['institution_id'] = $this->institution_id;
if (isset($this->institution_name)) $o['institution_name'] = $this->institution_name;
if (isset($this->institution_previous_names)) $o['institution_previous_names'] = $this->institution_previous_names;
if (isset($this->institution_other_names)) $o['institution_other_names'] = $this->institution_other_names;
if (isset($this->institution_type)) $o['institution_type'] = $this->institution_type;
if (isset($this->accreditation_status)) $o['accreditation_status'] = $this->accreditation_status;
if (isset($this->accreditation_status_notes)) $o['accreditation_status_notes'] = $this->accreditation_status_notes;
if (isset($this->related_institutions)) $o['related_institutions'] = JsonConverters::toArray('string', $this->related_institutions);
if (isset($this->accreditation_status_changed_date)) $o['accreditation_status_changed_date'] = JsonConverters::to('DateTime', $this->accreditation_status_changed_date);
if (isset($this->gpa_conversion)) $o['gpa_conversion'] = $this->gpa_conversion;
if (isset($this->credit_hour_conversion)) $o['credit_hour_conversion'] = $this->credit_hour_conversion;
if (isset($this->addr1)) $o['addr1'] = $this->addr1;
if (isset($this->addr2)) $o['addr2'] = $this->addr2;
if (isset($this->city)) $o['city'] = $this->city;
if (isset($this->state)) $o['state'] = $this->state;
if (isset($this->country)) $o['country'] = $this->country;
if (isset($this->zip)) $o['zip'] = $this->zip;
return empty($o) ? new class(){} : $o;
}
}
class InstitutionCreateRequest implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $institution_name=null,
/** @var string|null */
public ?string $institution_other_names=null,
/** @var string|null */
public ?string $institution_previous_names=null,
/** @var string|null */
public ?string $institution_type=null,
/** @var string|null */
public ?string $accreditation_status=null,
/** @var string|null */
public ?string $accreditation_status_notes=null,
/** @var DateTime|null */
public ?DateTime $accreditation_status_changed_date=null,
/** @var string|null */
public ?string $gpa_conversion=null,
/** @var string|null */
public ?string $credit_hour_conversion=null,
/** @var string|null */
public ?string $authorizing_uuid=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['institution_name'])) $this->institution_name = $o['institution_name'];
if (isset($o['institution_other_names'])) $this->institution_other_names = $o['institution_other_names'];
if (isset($o['institution_previous_names'])) $this->institution_previous_names = $o['institution_previous_names'];
if (isset($o['institution_type'])) $this->institution_type = $o['institution_type'];
if (isset($o['accreditation_status'])) $this->accreditation_status = $o['accreditation_status'];
if (isset($o['accreditation_status_notes'])) $this->accreditation_status_notes = $o['accreditation_status_notes'];
if (isset($o['accreditation_status_changed_date'])) $this->accreditation_status_changed_date = JsonConverters::from('DateTime', $o['accreditation_status_changed_date']);
if (isset($o['gpa_conversion'])) $this->gpa_conversion = $o['gpa_conversion'];
if (isset($o['credit_hour_conversion'])) $this->credit_hour_conversion = $o['credit_hour_conversion'];
if (isset($o['authorizing_uuid'])) $this->authorizing_uuid = $o['authorizing_uuid'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->institution_name)) $o['institution_name'] = $this->institution_name;
if (isset($this->institution_other_names)) $o['institution_other_names'] = $this->institution_other_names;
if (isset($this->institution_previous_names)) $o['institution_previous_names'] = $this->institution_previous_names;
if (isset($this->institution_type)) $o['institution_type'] = $this->institution_type;
if (isset($this->accreditation_status)) $o['accreditation_status'] = $this->accreditation_status;
if (isset($this->accreditation_status_notes)) $o['accreditation_status_notes'] = $this->accreditation_status_notes;
if (isset($this->accreditation_status_changed_date)) $o['accreditation_status_changed_date'] = JsonConverters::to('DateTime', $this->accreditation_status_changed_date);
if (isset($this->gpa_conversion)) $o['gpa_conversion'] = $this->gpa_conversion;
if (isset($this->credit_hour_conversion)) $o['credit_hour_conversion'] = $this->credit_hour_conversion;
if (isset($this->authorizing_uuid)) $o['authorizing_uuid'] = $this->authorizing_uuid;
return empty($o) ? new class(){} : $o;
}
}
PHP InstitutionCreateRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /Academic/Institution/Create HTTP/1.1
Host: data.regent-college.edu
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
institution_name: String,
institution_other_names: String,
institution_previous_names: String,
institution_type: String,
accreditation_status: String,
accreditation_status_notes: String,
accreditation_status_changed_date: 0001-01-01,
gpa_conversion: String,
credit_hour_conversion: String,
authorizing_uuid: String
}
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 } }, institution_id: 0, institution_name: String, institution_previous_names: String, institution_other_names: String, institution_type: String, accreditation_status: String, accreditation_status_notes: String, related_institutions: [ String ], accreditation_status_changed_date: 0001-01-01, gpa_conversion: String, credit_hour_conversion: String, addr1: String, addr2: String, city: String, state: String, country: String, zip: String }