| GET | /recherche/{mode}/{search} |
|---|
<?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 _recherche implements JsonSerializable
{
public function __construct(
/** @var int */
public int $id=0,
/** @var string|null */
public ?string $libelle=null,
/** @var string|null */
public ?string $barcode=null,
/** @var int */
public int $barcode_match=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['id'])) $this->id = $o['id'];
if (isset($o['libelle'])) $this->libelle = $o['libelle'];
if (isset($o['barcode'])) $this->barcode = $o['barcode'];
if (isset($o['barcode_match'])) $this->barcode_match = $o['barcode_match'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->id)) $o['id'] = $this->id;
if (isset($this->libelle)) $o['libelle'] = $this->libelle;
if (isset($this->barcode)) $o['barcode'] = $this->barcode;
if (isset($this->barcode_match)) $o['barcode_match'] = $this->barcode_match;
return empty($o) ? new class(){} : $o;
}
}
class rechercheResponse implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $mode=null,
/** @var string|null */
public ?string $search=null,
/** @var array<_recherche>|null */
public ?array $results=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['mode'])) $this->mode = $o['mode'];
if (isset($o['search'])) $this->search = $o['search'];
if (isset($o['results'])) $this->results = JsonConverters::fromArray('_recherche', $o['results']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->mode)) $o['mode'] = $this->mode;
if (isset($this->search)) $o['search'] = $this->search;
if (isset($this->results)) $o['results'] = JsonConverters::toArray('_recherche', $this->results);
return empty($o) ? new class(){} : $o;
}
}
class rechercheRequest implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $mode=null,
/** @var string|null */
public ?string $search=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['mode'])) $this->mode = $o['mode'];
if (isset($o['search'])) $this->search = $o['search'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->mode)) $o['mode'] = $this->mode;
if (isset($this->search)) $o['search'] = $this->search;
return empty($o) ? new class(){} : $o;
}
}
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
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /recherche/{mode}/{search} HTTP/1.1
Host: freemotion-staging.milliet.paris
Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{"mode":"String","search":"String","results":[{"id":0,"libelle":"String","barcode":"String","barcode_match":0}]}