DStack.IdGen

<back to all web services

GetIds

The following routes are available for this service:
All Verbs/ids
<?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 GetIds implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $provider=null,
        /** @var int */
        public int $batchSize=0,
        /** @var array<string,string>|null */
        public ?array $options=null
    ) {
    }

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

PHP GetIds 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 /ids HTTP/1.1 
Host: idgen.sbbet.ath.cx 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	provider: String,
	batchSize: 0,
	options: 
	{
		String: String
	}
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

[
	String
]