ConsumerApi

<back to all web services

ReferBusinessLinkUsedRequest

ConsumerBusiness
The following routes are available for this service:
POST/share/refer-business-link-usedA business referral link was usedValidates the JWT token with the identity of the referring user and the place, and returns relevant information.
<?php namespace ConsumerApi;

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 ReferBusinessUser implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $firstName='',
        /** @var string */
        public string $lastName='',
        /** @var string|null */
        public ?string $profilePhotoUrl=null
    ) {
    }

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

class ReferredPlace implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $id=0,
        /** @var string */
        public string $guid='',
        /** @var string */
        public string $name='',
        /** @var string|null */
        public ?string $logoUrl=null,
        /** @var string|null */
        public ?string $imageUrl=null
    ) {
    }

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

enum ReferBusinessState : string
{
    case SignInToSee = 'SignInToSee';
    case Available = 'Available';
    case CanNotReferYourself = 'CanNotReferYourself';
    case AlreadyClaimedByYou = 'AlreadyClaimedByYou';
    case AlreadyClaimedBySomeoneElse = 'AlreadyClaimedBySomeoneElse';
    case Expired = 'Expired';
}

class ReferBusinessLinkUsedResponse implements JsonSerializable
{
    public function __construct(
        /** @var ReferBusinessUser|null */
        public ?ReferBusinessUser $referringUser=null,
        /** @var ReferredPlace|null */
        public ?ReferredPlace $referredPlace=null,
        /** @var ReferBusinessState|null */
        public ?ReferBusinessState $state=null
    ) {
    }

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

class ReferBusinessLinkUsedRequest implements IPost, JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $referBusinessToken=''
    ) {
    }

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

PHP ReferBusinessLinkUsedRequest DTOs

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

HTTP + OTHER

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

POST /share/refer-business-link-used HTTP/1.1 
Host: unstable-consumer-api.brovs.com 
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length

{"referBusinessToken":"String"}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"referringUser":{"firstName":"String","lastName":"String","profilePhotoUrl":"String"},"referredPlace":{"id":0,"name":"String","logoUrl":"String","imageUrl":"String"},"state":"SignInToSee"}