BokaMera.API.Host

<back to all web services

CompanyCoordinatesQuery

The following routes are available for this service:
GET/companies/coordinates
<?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 CompanyCoordinatesQueryResponse implements JsonSerializable
{
    public function __construct(
        /** @var float */
        public float $Longitude=0.0,
        /** @var float */
        public float $Latitude=0.0
    ) {
    }

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

class CompanyCoordinatesQuery implements JsonSerializable
{
    public function __construct(
        /** @description Street address */
        // @ApiMember(Description="Street address", IsRequired=true, ParameterType="query")
        /** @var string */
        public string $Street1='',

        /** @description Street adress */
        // @ApiMember(Description="Street adress", ParameterType="query")
        /** @var string|null */
        public ?string $Street2=null,

        /** @description Street zip code */
        // @ApiMember(Description="Street zip code", IsRequired=true, ParameterType="query")
        /** @var string */
        public string $ZipCode='',

        /** @description City */
        // @ApiMember(Description="City", IsRequired=true, ParameterType="query")
        /** @var string */
        public string $City='',

        /** @description Country Id (Example SE= Sweden) */
        // @ApiMember(Description="Country Id (Example SE= Sweden)", IsRequired=true, ParameterType="query")
        /** @var string */
        public string $CountryId=''
    ) {
    }

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

PHP CompanyCoordinatesQuery DTOs

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

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

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

GET /companies/coordinates HTTP/1.1 
Host: api.bokamera.se 
Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"Longitude":0,"Latitude":0}