BusinessApi

<back to all web services

GetSubscriptionRequest

Business
Requires Authentication
Required role:Business
The following routes are available for this service:
GET/subscription/get
<?php namespace BusinessApi;

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 SubscriptionDetailsFreeUntil implements JsonSerializable
{
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        return empty($o) ? new class(){} : $o;
    }
}

class SubscriptionDetailsInvoice implements JsonSerializable
{
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        return empty($o) ? new class(){} : $o;
    }
}

class SubscriptionDetailsStripe implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $stripeX=null,
        /** @var int */
        public int $cardExpiresAtMonth=0,
        /** @var int */
        public int $cardExpiresAtYear=0
    ) {
    }

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

class SubscriptionDetailsFreeOnClaim implements JsonSerializable
{
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        return empty($o) ? new class(){} : $o;
    }
}

class SubscriptionDetailsUnion implements JsonSerializable
{
    public function __construct(
        /** @var SubscriptionDetailsFreeUntil|null */
        public ?SubscriptionDetailsFreeUntil $freeUntil=null,
        /** @var SubscriptionDetailsInvoice|null */
        public ?SubscriptionDetailsInvoice $invoice=null,
        /** @var SubscriptionDetailsStripe|null */
        public ?SubscriptionDetailsStripe $stripe=null,
        /** @var SubscriptionDetailsFreeOnClaim|null */
        public ?SubscriptionDetailsFreeOnClaim $freeOnClaim=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['freeUntil'])) $this->freeUntil = JsonConverters::from('SubscriptionDetailsFreeUntil', $o['freeUntil']);
        if (isset($o['invoice'])) $this->invoice = JsonConverters::from('SubscriptionDetailsInvoice', $o['invoice']);
        if (isset($o['stripe'])) $this->stripe = JsonConverters::from('SubscriptionDetailsStripe', $o['stripe']);
        if (isset($o['freeOnClaim'])) $this->freeOnClaim = JsonConverters::from('SubscriptionDetailsFreeOnClaim', $o['freeOnClaim']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->freeUntil)) $o['freeUntil'] = JsonConverters::to('SubscriptionDetailsFreeUntil', $this->freeUntil);
        if (isset($this->invoice)) $o['invoice'] = JsonConverters::to('SubscriptionDetailsInvoice', $this->invoice);
        if (isset($this->stripe)) $o['stripe'] = JsonConverters::to('SubscriptionDetailsStripe', $this->stripe);
        if (isset($this->freeOnClaim)) $o['freeOnClaim'] = JsonConverters::to('SubscriptionDetailsFreeOnClaim', $this->freeOnClaim);
        return empty($o) ? new class(){} : $o;
    }
}

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

GET /subscription/get HTTP/1.1 
Host: business-api.brovs.com 
Accept: text/jsonl
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"subscription":[{"id":0,"businessId":0,"subscriptionPlanId":0,"subscriptionDetails":{"freeUntil":{},"invoice":{},"stripe":{"stripeX":"String","cardExpiresAtMonth":0,"cardExpiresAtYear":0},"freeOnClaim":{}}}]}