ConsumerApi

<back to all web services

ReferFriendLinkUsedRequest

Consumer
The following routes are available for this service:
POST/share/refer-friend-link-usedA friend referral link was usedValidates the JWT token with the identity of the referring user 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 ReferFriendUser implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $firstName=null,
        /** @var string|null */
        public ?string $lastName=null,
        /** @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;
    }
}

enum ReferFriendState : string
{
    case Available = 'Available';
    case Awarded = 'Awarded';
    case CanNotReferYourself = 'CanNotReferYourself';
    case YouWereAlreadySignedUp = 'YouWereAlreadySignedUp';
    case Expired = 'Expired';
}

class ReferFriendLinkUsedResponse implements JsonSerializable
{
    public function __construct(
        /** @var ReferFriendUser|null */
        public ?ReferFriendUser $referringUser=null,
        /** @var ReferFriendState|null */
        public ?ReferFriendState $state=null
    ) {
    }

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

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

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

PHP ReferFriendLinkUsedRequest DTOs

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

HTTP + CSV

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

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

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

{"referringUser":{"firstName":"String","lastName":"String","profilePhotoUrl":"String"},"state":"Available"}