Cdn Marketing API

<back to all web services

GetMarketplaceAdRequest

MarketplaceAds

Get CDN Marketplace ads

The following routes are available for this service:
GET/GetMarketplaceAdRequestEither Gsid or PCGS is required, not both.
<?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 BaseResponse implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $Total=0,
        /** @var int */
        public int $OpCode=0,
        /** @var string|null */
        public ?string $ErrorText=null,
        /** @var string|null */
        public ?string $RequestTime=null,
        /** @var string|null */
        public ?string $ResponseTime=null,
        /** @var string|null */
        public ?string $TotalExecutionTime=null,
        /** @var bool|null */
        public ?bool $CachedResponse=null,
        /** @var bool|null */
        public ?bool $PermitAccess=null,
        /** @var string|null */
        public ?string $AccessDeniedMessage=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Total'])) $this->Total = $o['Total'];
        if (isset($o['OpCode'])) $this->OpCode = $o['OpCode'];
        if (isset($o['ErrorText'])) $this->ErrorText = $o['ErrorText'];
        if (isset($o['RequestTime'])) $this->RequestTime = $o['RequestTime'];
        if (isset($o['ResponseTime'])) $this->ResponseTime = $o['ResponseTime'];
        if (isset($o['TotalExecutionTime'])) $this->TotalExecutionTime = $o['TotalExecutionTime'];
        if (isset($o['CachedResponse'])) $this->CachedResponse = $o['CachedResponse'];
        if (isset($o['PermitAccess'])) $this->PermitAccess = $o['PermitAccess'];
        if (isset($o['AccessDeniedMessage'])) $this->AccessDeniedMessage = $o['AccessDeniedMessage'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Total)) $o['Total'] = $this->Total;
        if (isset($this->OpCode)) $o['OpCode'] = $this->OpCode;
        if (isset($this->ErrorText)) $o['ErrorText'] = $this->ErrorText;
        if (isset($this->RequestTime)) $o['RequestTime'] = $this->RequestTime;
        if (isset($this->ResponseTime)) $o['ResponseTime'] = $this->ResponseTime;
        if (isset($this->TotalExecutionTime)) $o['TotalExecutionTime'] = $this->TotalExecutionTime;
        if (isset($this->CachedResponse)) $o['CachedResponse'] = $this->CachedResponse;
        if (isset($this->PermitAccess)) $o['PermitAccess'] = $this->PermitAccess;
        if (isset($this->AccessDeniedMessage)) $o['AccessDeniedMessage'] = $this->AccessDeniedMessage;
        return empty($o) ? new class(){} : $o;
    }
}

class MarketplaceAdItemDto implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Title=null,
        /** @var bool|null */
        public ?bool $IsAuction=null,
        /** @var DateTime|null */
        public ?DateTime $AuctionEnds=null,
        /** @var float */
        public float $BuyNowPrice=0.0,
        /** @var string|null */
        public ?string $ViewItemUrl=null,
        /** @var string|null */
        public ?string $ImageUrl=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Title'])) $this->Title = $o['Title'];
        if (isset($o['IsAuction'])) $this->IsAuction = $o['IsAuction'];
        if (isset($o['AuctionEnds'])) $this->AuctionEnds = JsonConverters::from('DateTime', $o['AuctionEnds']);
        if (isset($o['BuyNowPrice'])) $this->BuyNowPrice = $o['BuyNowPrice'];
        if (isset($o['ViewItemUrl'])) $this->ViewItemUrl = $o['ViewItemUrl'];
        if (isset($o['ImageUrl'])) $this->ImageUrl = $o['ImageUrl'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Title)) $o['Title'] = $this->Title;
        if (isset($this->IsAuction)) $o['IsAuction'] = $this->IsAuction;
        if (isset($this->AuctionEnds)) $o['AuctionEnds'] = JsonConverters::to('DateTime', $this->AuctionEnds);
        if (isset($this->BuyNowPrice)) $o['BuyNowPrice'] = $this->BuyNowPrice;
        if (isset($this->ViewItemUrl)) $o['ViewItemUrl'] = $this->ViewItemUrl;
        if (isset($this->ImageUrl)) $o['ImageUrl'] = $this->ImageUrl;
        return empty($o) ? new class(){} : $o;
    }
}

class MarketplaceAdResponse extends BaseResponse implements JsonSerializable
{
    /**
     * @param int $Total
     * @param int $OpCode
     * @param string|null $ErrorText
     * @param string|null $RequestTime
     * @param string|null $ResponseTime
     * @param string|null $TotalExecutionTime
     * @param bool|null $CachedResponse
     * @param bool|null $PermitAccess
     * @param string|null $AccessDeniedMessage
     */
    public function __construct(
        int $Total=0,
        int $OpCode=0,
        ?string $ErrorText=null,
        ?string $RequestTime=null,
        ?string $ResponseTime=null,
        ?string $TotalExecutionTime=null,
        ?bool $CachedResponse=null,
        ?bool $PermitAccess=null,
        ?string $AccessDeniedMessage=null,
        /** @var array<MarketplaceAdItemDto>|null */
        public ?array $Data=null
    ) {
        parent::__construct($Total,$OpCode,$ErrorText,$RequestTime,$ResponseTime,$TotalExecutionTime,$CachedResponse,$PermitAccess,$AccessDeniedMessage);
    }

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

/** @description Get CDN Marketplace ads */
// @Api(Description="Get CDN Marketplace ads")
class GetMarketplaceAdRequest implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $Gsid=0,
        /** @var string|null */
        public ?string $Pcgs=null,
        /** @var int */
        public int $NumberOfItems=0
    ) {
    }

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

PHP GetMarketplaceAdRequest 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.

GET /GetMarketplaceAdRequest HTTP/1.1 
Host: marketingapidev.greysheet.com 
Accept: text/csv
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"Data":[{"Title":"String","IsAuction":false,"AuctionEnds":"\/Date(-62135596800000-0000)\/","BuyNowPrice":0,"ViewItemUrl":"String","ImageUrl":"String"}],"Total":0,"OpCode":0,"ErrorText":"String","RequestTime":"String","ResponseTime":"String","TotalExecutionTime":"String","CachedResponse":false,"PermitAccess":false,"AccessDeniedMessage":"String"}