Skip to content

Commit f277d80

Browse files
committed
Updated Auto Generated Code
1 parent cb633a1 commit f277d80

File tree

6 files changed

+304
-2
lines changed

6 files changed

+304
-2
lines changed

src/Definitions/FortifiApiDefinition.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class FortifiApiDefinition extends ApiDefinition
1111
public function __construct()
1212
{
1313
$this->setTitle('Fortifi API');
14-
$this->setVersion('3.160.0');
14+
$this->setVersion('3.161.0');
1515
$this->setDescription(<<<DESCRIPTION
1616
The second version of the Fortifi API is an exciting step forward towards
1717
making it easier for businesses to have open access to their data. We created it

src/Endpoints/CustomersCustomerFidEndpoint.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,18 @@ public function sentEmails()
273273
return $endpoint;
274274
}
275275

276+
/**
277+
* @return CustomersCustomerFidNotificationsEndpoint
278+
*/
279+
public function notifications()
280+
{
281+
$endpoint = new CustomersCustomerFidNotificationsEndpoint(
282+
$this->_replacements['{customerFid}']
283+
);
284+
$endpoint->_buildFromEndpoint($this);
285+
return $endpoint;
286+
}
287+
276288
/**
277289
* @summary Retrieve a customer
278290
*
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
namespace Fortifi\Api\V1\Endpoints;
3+
4+
use Fortifi\Api\V1\Requests\NotificationsRequest;
5+
use Fortifi\Api\Core\ApiRequestDetail;
6+
use Fortifi\Api\Core\ApiEndpoint;
7+
8+
class CustomersCustomerFidNotificationsEndpoint extends ApiEndpoint
9+
{
10+
protected $_path = 'customers/{customerFid}/notifications';
11+
protected $_replacements = [];
12+
13+
public function __construct($customerFid)
14+
{
15+
$this->_replacements['{customerFid}'] = $customerFid;
16+
}
17+
18+
/**
19+
* @summary List Push Notification sent to a Customer
20+
*
21+
* @return NotificationsRequest
22+
*/
23+
public function all()
24+
{
25+
$request = new NotificationsRequest();
26+
$request->setConnection($this->_getConnection());
27+
$request->setEndpoint($this);
28+
29+
$detail = new ApiRequestDetail();
30+
$detail->setRequireAuth(true);
31+
$detail->setUrl($this->_buildUrl(
32+
str_replace(
33+
array_keys($this->_replacements),
34+
array_values($this->_replacements),
35+
'customers/{customerFid}/notifications'
36+
)
37+
));
38+
$detail->setMethod('GET');
39+
$request->setRequestDetail($detail);
40+
return $request;
41+
}
42+
}
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
<?php
2+
namespace Fortifi\Api\V1\Requests;
3+
4+
use Fortifi\Api\Core\ApiRequest;
5+
use Packaged\Helpers\Objects;
6+
use Packaged\Helpers\Strings;
7+
8+
class NotificationRequest
9+
extends ApiRequest
10+
implements \JsonSerializable
11+
{
12+
13+
#[\ReturnTypeWillChange]
14+
public function jsonSerialize()
15+
{
16+
return [
17+
"campaignFid" => $this->getCampaignFid(),
18+
"companyFid" => $this->getCompanyFid(),
19+
"messageFid" => $this->getMessageFid(),
20+
"bounced" => $this->isBounced(),
21+
"opened" => $this->isOpened(),
22+
"clicked" => $this->isClicked(),
23+
"complained" => $this->isComplained(),
24+
"subject" => $this->getSubject(),
25+
"sentTimestamp" => $this->getSentTimestamp(),
26+
"recipientEmails" => $this->getRecipientEmails(),
27+
];
28+
}
29+
30+
/**
31+
* @param mixed $default
32+
* @param bool $trim Trim Value
33+
*
34+
* @return string
35+
*/
36+
public function getCampaignFid($default = null, $trim = true)
37+
{
38+
$value = Objects::property($this->_getResultJson(), 'campaignFid', $default);
39+
return $trim ? Strings::ntrim($value) : $value;
40+
}
41+
42+
/**
43+
* @param mixed $default
44+
* @param bool $trim Trim Value
45+
*
46+
* @return string
47+
*/
48+
public function getCompanyFid($default = null, $trim = true)
49+
{
50+
$value = Objects::property($this->_getResultJson(), 'companyFid', $default);
51+
return $trim ? Strings::ntrim($value) : $value;
52+
}
53+
54+
/**
55+
* @param mixed $default
56+
* @param bool $trim Trim Value
57+
*
58+
* @return string
59+
*/
60+
public function getMessageFid($default = null, $trim = true)
61+
{
62+
$value = Objects::property($this->_getResultJson(), 'messageFid', $default);
63+
return $trim ? Strings::ntrim($value) : $value;
64+
}
65+
66+
/**
67+
* @param bool $default
68+
*
69+
* @return boolean
70+
*/
71+
public function isBounced($default = false)
72+
{
73+
return Objects::property($this->_getResultJson(), 'bounced', $default);
74+
}
75+
76+
/**
77+
* @param bool $default
78+
*
79+
* @return boolean
80+
*/
81+
public function isOpened($default = false)
82+
{
83+
return Objects::property($this->_getResultJson(), 'opened', $default);
84+
}
85+
86+
/**
87+
* @param bool $default
88+
*
89+
* @return boolean
90+
*/
91+
public function isClicked($default = false)
92+
{
93+
return Objects::property($this->_getResultJson(), 'clicked', $default);
94+
}
95+
96+
/**
97+
* @param bool $default
98+
*
99+
* @return boolean
100+
*/
101+
public function isComplained($default = false)
102+
{
103+
return Objects::property($this->_getResultJson(), 'complained', $default);
104+
}
105+
106+
/**
107+
* @param mixed $default
108+
* @param bool $trim Trim Value
109+
*
110+
* @return string
111+
*/
112+
public function getSubject($default = null, $trim = true)
113+
{
114+
$value = Objects::property($this->_getResultJson(), 'subject', $default);
115+
return $trim ? Strings::ntrim($value) : $value;
116+
}
117+
118+
/**
119+
* @param mixed $default
120+
* @param bool $trim Trim Value
121+
*
122+
* @return string
123+
*/
124+
public function getSentTimestamp($default = null, $trim = true)
125+
{
126+
$value = Objects::property($this->_getResultJson(), 'sentTimestamp', $default);
127+
return $trim ? Strings::ntrim($value) : $value;
128+
}
129+
130+
/**
131+
* @param mixed $default
132+
*
133+
* @return string[]
134+
*/
135+
public function getRecipientEmails($default = [])
136+
{
137+
return Objects::property($this->_getResultJson(), 'recipientEmails', $default);
138+
}
139+
140+
protected function _prepareResult($result)
141+
{
142+
$return = parent::_prepareResult($result);
143+
144+
145+
return $return;
146+
}
147+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
namespace Fortifi\Api\V1\Requests;
3+
4+
use Fortifi\Api\Core\ApiRequest;
5+
use Packaged\Helpers\Objects;
6+
use Packaged\Helpers\Strings;
7+
8+
class NotificationsRequest
9+
extends ApiRequest
10+
implements \JsonSerializable
11+
{
12+
13+
#[\ReturnTypeWillChange]
14+
public function jsonSerialize()
15+
{
16+
return [
17+
"notifications" => $this->getNotifications(),
18+
];
19+
}
20+
21+
/**
22+
* @param mixed $default
23+
*
24+
* @return NotificationRequest[]
25+
*/
26+
public function getNotifications($default = [])
27+
{
28+
return Objects::property($this->_getResultJson(), 'notifications', $default);
29+
}
30+
31+
protected function _prepareResult($result)
32+
{
33+
$return = parent::_prepareResult($result);
34+
35+
if(!empty($return->notifications))
36+
{
37+
foreach($return->notifications as $itmKey => $itm)
38+
{
39+
$return->notifications[$itmKey] = (new NotificationRequest())
40+
->hydrate($itm);
41+
}
42+
}
43+
44+
return $return;
45+
}
46+
}

swagger.yaml

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
swagger: '2.0'
22
info:
33
title: Fortifi API
4-
version: '3.160.0'
4+
version: '3.161.0'
55
termsOfService: 'https://fortifi.io/legal/terms/api'
66
description: >
77
The second version of the Fortifi API is an exciting step forward towards
@@ -4637,6 +4637,27 @@ paths:
46374637
description: Error
46384638
schema:
46394639
$ref: '#/definitions/Envelope'
4640+
'/customers/{customerFid}/notifications':
4641+
get:
4642+
summary: List Push Notification sent to a Customer
4643+
tags:
4644+
- Customers
4645+
- Messenger
4646+
security:
4647+
- OAuth:
4648+
- customer
4649+
- accessToken: [ ]
4650+
parameters:
4651+
- $ref: '#/parameters/customerFid'
4652+
responses:
4653+
200:
4654+
schema:
4655+
$ref: '#/definitions/Notifications'
4656+
description: List of Notifications sent to Customer
4657+
default:
4658+
description: Error
4659+
schema:
4660+
$ref: '#/definitions/Envelope'
46404661
/customers:
46414662
post:
46424663
summary: Create a new customer
@@ -13573,3 +13594,37 @@ definitions:
1357313594
default: false
1357413595
required:
1357513596
- trigger
13597+
13598+
Notification:
13599+
properties:
13600+
campaignFid:
13601+
type: string
13602+
companyFid:
13603+
type: string
13604+
messageFid:
13605+
type: string
13606+
bounced:
13607+
type: boolean
13608+
opened:
13609+
type: boolean
13610+
clicked:
13611+
type: boolean
13612+
complained:
13613+
type: boolean
13614+
subject:
13615+
type: string
13616+
sentTimestamp:
13617+
type: string
13618+
recipientEmails:
13619+
type: array
13620+
items:
13621+
type: string
13622+
13623+
13624+
Notifications:
13625+
description: Sent Notifications
13626+
properties:
13627+
notifications:
13628+
type: array
13629+
items:
13630+
$ref: '#/definitions/Notification'

0 commit comments

Comments
 (0)