Betting.WebApi

<back to all web services

GetUserNotifications

Requires Authentication
The following routes are available for this service:
All Verbs/qry/users/notifications
<?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};


enum Severity : int
{
    case Success = 0;
    case Info = 1;
    case Warning = 2;
    case Error = 3;
}

enum NotificationType : int
{
    case Default = 0;
    case SlipDeliveryConfirmationRequest = 1;
    case SlipDeliveryIssueResolved = 2;
}

class Notification implements JsonSerializable
{
    public function __construct(
        /** @var Severity|null */
        public ?Severity $severity=null,
        /** @var NotificationType|null */
        public ?NotificationType $type=null,
        /** @var RecordDictionary2<string, string>|null */
        public ?RecordDictionary2 $data=null
    ) {
    }

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

class UserNotification implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $id=null,
        /** @var Notification|null */
        public ?Notification $notification=null,
        /** @var DateTime */
        public DateTime $dispatchedAt=new DateTime()
    ) {
    }

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

class UserNotifications implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $id=null,
        /** @var int */
        public int $n=0,
        /** @var int */
        public int $s=0,
        /** @var int */
        public int $i=0,
        /** @var int */
        public int $w=0,
        /** @var int */
        public int $e=0,
        /** @var array<string,UserNotification>|null */
        public ?array $notifications=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['n'])) $this->n = $o['n'];
        if (isset($o['s'])) $this->s = $o['s'];
        if (isset($o['i'])) $this->i = $o['i'];
        if (isset($o['w'])) $this->w = $o['w'];
        if (isset($o['e'])) $this->e = $o['e'];
        if (isset($o['notifications'])) $this->notifications = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','UserNotification']), $o['notifications']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->n)) $o['n'] = $this->n;
        if (isset($this->s)) $o['s'] = $this->s;
        if (isset($this->i)) $o['i'] = $this->i;
        if (isset($this->w)) $o['w'] = $this->w;
        if (isset($this->e)) $o['e'] = $this->e;
        if (isset($this->notifications)) $o['notifications'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','UserNotification']), $this->notifications);
        return empty($o) ? new class(){} : $o;
    }
}

class GetUserNotifications implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $id=null
    ) {
    }

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

/**
 * @template TKey
 * @template TVal
 * @template array of TKey
 * @template array1 of TVal
 */
class RecordDictionary2 extends array implements JsonSerializable
{
    public array $genericArgs = [];
    public static function create(array $genericArgs=[]): RecordDictionary2 {
        $to = new RecordDictionary2();
        $to->genericArgs = $genericArgs;
        return $to;
    }

    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        return empty($o) ? new class(){} : $o;
    }
}

PHP GetUserNotifications DTOs

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

HTTP + XML

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

POST /qry/users/notifications HTTP/1.1 
Host: api.sbbet.ath.cx 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<GetUserNotifications xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Betting.WebApi.ServiceModel">
  <Id>String</Id>
</GetUserNotifications>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<UserNotifications xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Betting.ReadModel">
  <Id>String</Id>
  <Notifications xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:KeyValueOfstringUserNotifications.UserNotificationICRnA2uO>
      <d2p1:Key>String</d2p1:Key>
      <d2p1:Value>
        <DispatchedAt>0001-01-01T00:00:00</DispatchedAt>
        <Id>String</Id>
        <Notification xmlns:d5p1="http://schemas.datacontract.org/2004/07/Betting.Common">
          <d5p1:Data>
            <d2p1:KeyValueOfstringstring>
              <d2p1:Key>String</d2p1:Key>
              <d2p1:Value>String</d2p1:Value>
            </d2p1:KeyValueOfstringstring>
          </d5p1:Data>
          <d5p1:Severity>Success</d5p1:Severity>
          <d5p1:Type>Default</d5p1:Type>
        </Notification>
      </d2p1:Value>
    </d2p1:KeyValueOfstringUserNotifications.UserNotificationICRnA2uO>
  </Notifications>
</UserNotifications>