WebService

<back to all web services

GetAlleDurchschnitt

<?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 DurchschnittNutzer implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $ID=0,
        /** @var string|null */
        public ?string $Kategorie=null,
        /** @var int */
        public int $Anzahl=0,
        /** @var float */
        public float $Durchschnittswert=0.0,
        /** @var DateTime */
        public DateTime $Zuletzt=new DateTime()
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ID'])) $this->ID = $o['ID'];
        if (isset($o['Kategorie'])) $this->Kategorie = $o['Kategorie'];
        if (isset($o['Anzahl'])) $this->Anzahl = $o['Anzahl'];
        if (isset($o['Durchschnittswert'])) $this->Durchschnittswert = $o['Durchschnittswert'];
        if (isset($o['Zuletzt'])) $this->Zuletzt = JsonConverters::from('DateTime', $o['Zuletzt']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ID)) $o['ID'] = $this->ID;
        if (isset($this->Kategorie)) $o['Kategorie'] = $this->Kategorie;
        if (isset($this->Anzahl)) $o['Anzahl'] = $this->Anzahl;
        if (isset($this->Durchschnittswert)) $o['Durchschnittswert'] = $this->Durchschnittswert;
        if (isset($this->Zuletzt)) $o['Zuletzt'] = JsonConverters::to('DateTime', $this->Zuletzt);
        return empty($o) ? new class(){} : $o;
    }
}

class DurchschnittListeResponse implements JsonSerializable
{
    public function __construct(
        /** @var array<DurchschnittNutzer>|null */
        public ?array $Liste=null
    ) {
    }

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

class GetAlleDurchschnitt implements JsonSerializable
{
    public function __construct(
        /** @var DateTime */
        public DateTime $Zuletzt=new DateTime()
    ) {
    }

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

PHP GetAlleDurchschnitt DTOs

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

HTTP + CSV

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

POST /csv/reply/GetAlleDurchschnitt HTTP/1.1 
Host: 52.142.207.43 
Accept: text/csv
Content-Type: text/csv
Content-Length: length

{"Zuletzt":"\/Date(-62135596800000-0000)\/"}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"Liste":[{"ID":0,"Kategorie":"String","Anzahl":0,"Durchschnittswert":0,"Zuletzt":"\/Date(-62135596800000-0000)\/"}]}