Required permission: | CMPermission |
POST | /CampaignMonitor/{email}/Summary |
---|
<?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 CMListResponse implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $id=null,
/** @var string|null */
public ?string $name=null,
/** @var string|null */
public ?string $status=null,
/** @var array<string>|null */
public ?array $segments=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['id'])) $this->id = $o['id'];
if (isset($o['name'])) $this->name = $o['name'];
if (isset($o['status'])) $this->status = $o['status'];
if (isset($o['segments'])) $this->segments = JsonConverters::fromArray('string', $o['segments']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->id)) $o['id'] = $this->id;
if (isset($this->name)) $o['name'] = $this->name;
if (isset($this->status)) $o['status'] = $this->status;
if (isset($this->segments)) $o['segments'] = JsonConverters::toArray('string', $this->segments);
return empty($o) ? new class(){} : $o;
}
}
class CMSummaryResponse implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $email=null,
/** @var bool|null */
public ?bool $is_optin=null,
/** @var bool|null */
public ?bool $is_ebr=null,
/** @var string|null */
public ?string $is_express_consent=null,
/** @var bool|null */
public ?bool $is_suppressed=null,
/** @var string|null */
public ?string $last_consent_source=null,
/** @var DateTime|null */
public ?DateTime $last_consent_date=null,
/** @var DateTime|null */
public ?DateTime $last_event_date=null,
/** @var DateTime|null */
public ?DateTime $last_reframe_purchase_date=null,
/** @var array<CMListResponse>|null */
public ?array $lists=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['email'])) $this->email = $o['email'];
if (isset($o['is_optin'])) $this->is_optin = $o['is_optin'];
if (isset($o['is_ebr'])) $this->is_ebr = $o['is_ebr'];
if (isset($o['is_express_consent'])) $this->is_express_consent = $o['is_express_consent'];
if (isset($o['is_suppressed'])) $this->is_suppressed = $o['is_suppressed'];
if (isset($o['last_consent_source'])) $this->last_consent_source = $o['last_consent_source'];
if (isset($o['last_consent_date'])) $this->last_consent_date = JsonConverters::from('DateTime', $o['last_consent_date']);
if (isset($o['last_event_date'])) $this->last_event_date = JsonConverters::from('DateTime', $o['last_event_date']);
if (isset($o['last_reframe_purchase_date'])) $this->last_reframe_purchase_date = JsonConverters::from('DateTime', $o['last_reframe_purchase_date']);
if (isset($o['lists'])) $this->lists = JsonConverters::fromArray('CMListResponse', $o['lists']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->email)) $o['email'] = $this->email;
if (isset($this->is_optin)) $o['is_optin'] = $this->is_optin;
if (isset($this->is_ebr)) $o['is_ebr'] = $this->is_ebr;
if (isset($this->is_express_consent)) $o['is_express_consent'] = $this->is_express_consent;
if (isset($this->is_suppressed)) $o['is_suppressed'] = $this->is_suppressed;
if (isset($this->last_consent_source)) $o['last_consent_source'] = $this->last_consent_source;
if (isset($this->last_consent_date)) $o['last_consent_date'] = JsonConverters::to('DateTime', $this->last_consent_date);
if (isset($this->last_event_date)) $o['last_event_date'] = JsonConverters::to('DateTime', $this->last_event_date);
if (isset($this->last_reframe_purchase_date)) $o['last_reframe_purchase_date'] = JsonConverters::to('DateTime', $this->last_reframe_purchase_date);
if (isset($this->lists)) $o['lists'] = JsonConverters::toArray('CMListResponse', $this->lists);
return empty($o) ? new class(){} : $o;
}
}
class CMSummaryRequest implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $email=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['email'])) $this->email = $o['email'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->email)) $o['email'] = $this->email;
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /CampaignMonitor/{email}/Summary HTTP/1.1
Host: data.regent-college.edu
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length
{"email":"String"}
HTTP/1.1 200 OK Content-Type: text/jsonl Content-Length: length {"email":"String","is_optin":false,"is_ebr":false,"is_express_consent":"String","is_suppressed":false,"last_consent_source":"String","last_consent_date":"0001-01-01T00:00:00.0000000","last_event_date":"0001-01-01T00:00:00.0000000","last_reframe_purchase_date":"0001-01-01T00:00:00.0000000","lists":[{"id":"String","name":"String","status":"String","segments":["String"]}]}