| POST | /v4/user-affiliate-tokens | Add user's affiliate info for a specific program | List of supported affiliate programs may be retrieved by calling the GET /v3/affiliate-programs endpoint. Parameter names must match and valid values must be provided. |
|---|
<?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 AffiliateTokensRequestBase implements JsonSerializable
{
public function __construct(
// @DataMember(Name="username", IsRequired=true)
/** @var string|null */
public ?string $username=null,
// @DataMember(Name="parameters", IsRequired=true)
/** @var array<string,string>|null */
public ?array $parameters=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['username'])) $this->username = $o['username'];
if (isset($o['parameters'])) $this->parameters = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['parameters']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->username)) $o['username'] = $this->username;
if (isset($this->parameters)) $o['parameters'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->parameters);
return empty($o) ? new class(){} : $o;
}
}
// @DataContract
class BaseResponse implements JsonSerializable
{
public function __construct(
// @DataMember(Name="responseStatus")
/** @var ResponseStatus|null */
public ?ResponseStatus $responseStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['responseStatus'])) $this->responseStatus = JsonConverters::from('ResponseStatus', $o['responseStatus']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->responseStatus)) $o['responseStatus'] = JsonConverters::to('ResponseStatus', $this->responseStatus);
return empty($o) ? new class(){} : $o;
}
}
// @DataContract
class PostUserAffiliateTokensResponse extends BaseResponse implements JsonSerializable
{
/**
* @param ResponseStatus|null $responseStatus
*/
public function __construct(
?ResponseStatus $responseStatus=null,
// @DataMember
/** @var bool|null */
public ?bool $success=null,
// @DataMember
/** @var string|null */
public ?string $affiliateTokensId=null
) {
parent::__construct($responseStatus);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['success'])) $this->success = $o['success'];
if (isset($o['affiliateTokensId'])) $this->affiliateTokensId = $o['affiliateTokensId'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->success)) $o['success'] = $this->success;
if (isset($this->affiliateTokensId)) $o['affiliateTokensId'] = $this->affiliateTokensId;
return empty($o) ? new class(){} : $o;
}
}
// @DataContract
class PostUserAffiliateTokensRequest extends AffiliateTokensRequestBase implements JsonSerializable
{
/**
* @param string|null $username
* @param array<string,string>|null $parameters
*/
public function __construct(
?string $username=null,
?array $parameters=null,
// @DataMember(Name="programGuid", IsRequired=true)
/** @var string|null */
public ?string $programGuid=null
) {
parent::__construct($username,$parameters);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['programGuid'])) $this->programGuid = $o['programGuid'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->programGuid)) $o['programGuid'] = $this->programGuid;
return empty($o) ? new class(){} : $o;
}
}
PHP PostUserAffiliateTokensRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /v4/user-affiliate-tokens HTTP/1.1
Host: affiliation-api-zane.dev.platform.georiot.com
Accept: text/csv
Content-Type: text/csv
Content-Length: length
{"programGuid":"String","username":"String","parameters":{"String":"String"}}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length
{"success":false,"affiliateTokensId":"String","responseStatus":{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}}}