Skip to content

Commit d2486f8

Browse files
Merge pull request #37 from appwrite/feat-push-params
Add new push message parameters
2 parents c78ec21 + 9667d04 commit d2486f8

25 files changed

+350
-101
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Appwrite PHP SDK
22

33
![License](https://img.shields.io/github/license/appwrite/sdk-for-php.svg?style=flat-square&v=1)
4-
![Version](https://img.shields.io/badge/api%20version-1.6.0-blue.svg?style=flat-square&v=1)
4+
![Version](https://img.shields.io/badge/api%20version-1.6.1-blue.svg?style=flat-square&v=1)
55
[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
66
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
77
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)

docs/account.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
4242
| email | string | User email. | |
4343
| password | string | User password. Must be at least 8 chars. | |
4444

45-
## List Identities
45+
## List identities
4646

4747
```http request
4848
GET https://cloud.appwrite.io/v1/account/identities
@@ -106,7 +106,7 @@ PATCH https://cloud.appwrite.io/v1/account/mfa
106106
| --- | --- | --- | --- |
107107
| mfa | boolean | Enable or disable MFA. | |
108108

109-
## Create Authenticator
109+
## Create authenticator
110110

111111
```http request
112112
POST https://cloud.appwrite.io/v1/account/mfa/authenticators/{type}
@@ -120,7 +120,7 @@ POST https://cloud.appwrite.io/v1/account/mfa/authenticators/{type}
120120
| --- | --- | --- | --- |
121121
| type | string | **Required** Type of authenticator. Must be `totp` | |
122122

123-
## Verify Authenticator
123+
## Verify authenticator
124124

125125
```http request
126126
PUT https://cloud.appwrite.io/v1/account/mfa/authenticators/{type}
@@ -135,7 +135,7 @@ PUT https://cloud.appwrite.io/v1/account/mfa/authenticators/{type}
135135
| type | string | **Required** Type of authenticator. | |
136136
| otp | string | Valid verification token. | |
137137

138-
## Delete Authenticator
138+
## Delete authenticator
139139

140140
```http request
141141
DELETE https://cloud.appwrite.io/v1/account/mfa/authenticators/{type}
@@ -149,7 +149,7 @@ DELETE https://cloud.appwrite.io/v1/account/mfa/authenticators/{type}
149149
| --- | --- | --- | --- |
150150
| type | string | **Required** Type of authenticator. | |
151151

152-
## Create MFA Challenge
152+
## Create MFA challenge
153153

154154
```http request
155155
POST https://cloud.appwrite.io/v1/account/mfa/challenge
@@ -163,7 +163,7 @@ POST https://cloud.appwrite.io/v1/account/mfa/challenge
163163
| --- | --- | --- | --- |
164164
| factor | string | Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`. | |
165165

166-
## Create MFA Challenge (confirmation)
166+
## Create MFA challenge (confirmation)
167167

168168
```http request
169169
PUT https://cloud.appwrite.io/v1/account/mfa/challenge
@@ -178,31 +178,31 @@ PUT https://cloud.appwrite.io/v1/account/mfa/challenge
178178
| challengeId | string | ID of the challenge. | |
179179
| otp | string | Valid verification token. | |
180180

181-
## List Factors
181+
## List factors
182182

183183
```http request
184184
GET https://cloud.appwrite.io/v1/account/mfa/factors
185185
```
186186

187187
** List the factors available on the account to be used as a MFA challange. **
188188

189-
## Get MFA Recovery Codes
189+
## Get MFA recovery codes
190190

191191
```http request
192192
GET https://cloud.appwrite.io/v1/account/mfa/recovery-codes
193193
```
194194

195195
** Get recovery codes that can be used as backup for MFA flow. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to read recovery codes. **
196196

197-
## Create MFA Recovery Codes
197+
## Create MFA recovery codes
198198

199199
```http request
200200
POST https://cloud.appwrite.io/v1/account/mfa/recovery-codes
201201
```
202202

203203
** Generate recovery codes as backup for MFA flow. It's recommended to generate and show then immediately after user successfully adds their authehticator. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method. **
204204

205-
## Regenerate MFA Recovery Codes
205+
## Regenerate MFA recovery codes
206206

207207
```http request
208208
PATCH https://cloud.appwrite.io/v1/account/mfa/recovery-codes
@@ -469,7 +469,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
469469
POST https://cloud.appwrite.io/v1/account/tokens/magic-url
470470
```
471471

472-
** Sends the user an email with a secret key for creating a session. If the provided user ID has not been registered, a new user will be created. When the user clicks the link in the email, the user is redirected back to the URL you provided with the secret key and userId values attached to the URL query string. Use the query string parameters to submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The link sent to the user's email address is valid for 1 hour. If you are on a mobile device you can leave the URL parameter empty, so that the login completion will be handled by your Appwrite instance by default.
472+
** Sends the user an email with a secret key for creating a session. If the provided user ID has not been registered, a new user will be created. When the user clicks the link in the email, the user is redirected back to the URL you provided with the secret key and userId values attached to the URL query string. Use the query string parameters to submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The link sent to the user's email address is valid for 1 hour.
473473

474474
A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
475475
**

docs/examples/databases/update-string-attribute.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ $result = $databases->updateStringAttribute(
1616
key: '',
1717
required: false,
1818
default: '<DEFAULT>',
19-
size: null, // optional
19+
size: 1, // optional
2020
newKey: '' // optional
2121
);

docs/examples/messaging/create-push.md

+7-4
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ $messaging = new Messaging($client);
1212

1313
$result = $messaging->createPush(
1414
messageId: '<MESSAGE_ID>',
15-
title: '<TITLE>',
16-
body: '<BODY>',
15+
title: '<TITLE>', // optional
16+
body: '<BODY>', // optional
1717
topics: [], // optional
1818
users: [], // optional
1919
targets: [], // optional
@@ -24,7 +24,10 @@ $result = $messaging->createPush(
2424
sound: '<SOUND>', // optional
2525
color: '<COLOR>', // optional
2626
tag: '<TAG>', // optional
27-
badge: '<BADGE>', // optional
27+
badge: null, // optional
2828
draft: false, // optional
29-
scheduledAt: '' // optional
29+
scheduledAt: '', // optional
30+
contentAvailable: false, // optional
31+
critical: false, // optional
32+
priority: MessagePriority::NORMAL() // optional
3033
);

docs/examples/messaging/update-push.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,8 @@ $result = $messaging->updatePush(
2626
tag: '<TAG>', // optional
2727
badge: null, // optional
2828
draft: false, // optional
29-
scheduledAt: '' // optional
29+
scheduledAt: '', // optional
30+
contentAvailable: false, // optional
31+
critical: false, // optional
32+
priority: MessagePriority::NORMAL() // optional
3033
);

docs/functions.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ POST https://cloud.appwrite.io/v1/functions
4848
| templateOwner | string | The name of the owner of the template. | |
4949
| templateRootDirectory | string | Path to function code in the template repo. | |
5050
| templateVersion | string | Version (tag) for the repo linked to the function template. | |
51-
| specification | string | Runtime specification for the function and builds. | s-0.5vcpu-512mb |
51+
| specification | string | Runtime specification for the function and builds. | s-1vcpu-512mb |
5252

5353
## List runtimes
5454

@@ -110,7 +110,7 @@ PUT https://cloud.appwrite.io/v1/functions/{functionId}
110110
| providerBranch | string | Production branch for the repo linked to the function | |
111111
| providerSilentMode | boolean | Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests. | |
112112
| providerRootDirectory | string | Path to function code in the linked repo. | |
113-
| specification | string | Runtime specification for the function and builds. | s-0.5vcpu-512mb |
113+
| specification | string | Runtime specification for the function and builds. | s-1vcpu-512mb |
114114

115115
## Delete function
116116

docs/locale.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ GET https://cloud.appwrite.io/v1/locale
1010

1111
([IP Geolocation by DB-IP](https://db-ip.com)) **
1212

13-
## List Locale Codes
13+
## List locale codes
1414

1515
```http request
1616
GET https://cloud.appwrite.io/v1/locale/codes

docs/messaging.md

+9-3
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,19 @@ POST https://cloud.appwrite.io/v1/messaging/messages/push
8484
| topics | array | List of Topic IDs. | [] |
8585
| users | array | List of User IDs. | [] |
8686
| targets | array | List of Targets IDs. | [] |
87-
| data | object | Additional Data for push notification. | {} |
87+
| data | object | Additional key-value pair data for push notification. | {} |
8888
| action | string | Action for push notification. | |
8989
| image | string | Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. It should be formatted as <BUCKET_ID>:<FILE_ID>. | |
9090
| icon | string | Icon for push notification. Available only for Android and Web Platform. | |
91-
| sound | string | Sound for push notification. Available only for Android and IOS Platform. | |
91+
| sound | string | Sound for push notification. Available only for Android and iOS Platform. | |
9292
| color | string | Color for push notification. Available only for Android Platform. | |
9393
| tag | string | Tag for push notification. Available only for Android Platform. | |
94-
| badge | string | Badge for push notification. Available only for IOS Platform. | |
94+
| badge | integer | Badge for push notification. Available only for iOS Platform. | -1 |
9595
| draft | boolean | Is message a draft | |
9696
| scheduledAt | string | Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. | |
97+
| contentAvailable | boolean | If set to true, the notification will be delivered in the background. Available only for iOS Platform. | |
98+
| critical | boolean | If set to true, the notification will be marked as critical. This requires the app to have the critical notification entitlement. Available only for iOS Platform. | |
99+
| priority | string | Set the notification priority. "normal" will consider device state and may not deliver notifications immediately. "high" will always attempt to immediately deliver the notification. | high |
97100

98101
## Update push notification
99102

@@ -124,6 +127,9 @@ PATCH https://cloud.appwrite.io/v1/messaging/messages/push/{messageId}
124127
| badge | integer | Badge for push notification. Available only for iOS platforms. | |
125128
| draft | boolean | Is message a draft | |
126129
| scheduledAt | string | Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. | |
130+
| contentAvailable | boolean | If set to true, the notification will be delivered in the background. Available only for iOS Platform. | |
131+
| critical | boolean | If set to true, the notification will be marked as critical. This requires the app to have the critical notification entitlement. Available only for iOS Platform. | |
132+
| priority | string | Set the notification priority. "normal" will consider device battery state and may send notifications later. "high" will always attempt to immediately deliver the notification. | |
127133

128134
## Create SMS
129135

docs/storage.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ PUT https://cloud.appwrite.io/v1/storage/buckets/{bucketId}/files/{fileId}
161161
| name | string | Name of the file | |
162162
| permissions | array | An array of permission string. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). | |
163163

164-
## Delete File
164+
## Delete file
165165

166166
```http request
167167
DELETE https://cloud.appwrite.io/v1/storage/buckets/{bucketId}/files/{fileId}

docs/teams.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ DELETE https://cloud.appwrite.io/v1/teams/{teamId}
8080
GET https://cloud.appwrite.io/v1/teams/{teamId}/memberships
8181
```
8282

83-
** Use this endpoint to list a team&#039;s members using the team&#039;s ID. All team members have read access to this endpoint. **
83+
** Use this endpoint to list a team&#039;s members using the team&#039;s ID. All team members have read access to this endpoint. Hide sensitive attributes from the response by toggling membership privacy in the Console. **
8484

8585
### Parameters
8686

@@ -123,7 +123,7 @@ Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatShee
123123
GET https://cloud.appwrite.io/v1/teams/{teamId}/memberships/{membershipId}
124124
```
125125

126-
** Get a team member by the membership unique id. All team members have read access for this resource. **
126+
** Get a team member by the membership unique id. All team members have read access for this resource. Hide sensitive attributes from the response by toggling membership privacy in the Console. **
127127

128128
### Parameters
129129

docs/users.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ POST https://cloud.appwrite.io/v1/users/bcrypt
6767
| password | string | User password hashed using Bcrypt. | |
6868
| name | string | User name. Max length: 128 chars. | |
6969

70-
## List Identities
70+
## List identities
7171

7272
```http request
7373
GET https://cloud.appwrite.io/v1/users/identities
@@ -310,7 +310,7 @@ PATCH https://cloud.appwrite.io/v1/users/{userId}/mfa
310310
| userId | string | **Required** User ID. | |
311311
| mfa | boolean | Enable or disable MFA. | |
312312

313-
## Delete Authenticator
313+
## Delete authenticator
314314

315315
```http request
316316
DELETE https://cloud.appwrite.io/v1/users/{userId}/mfa/authenticators/{type}
@@ -325,7 +325,7 @@ DELETE https://cloud.appwrite.io/v1/users/{userId}/mfa/authenticators/{type}
325325
| userId | string | **Required** User ID. | |
326326
| type | string | **Required** Type of authenticator. | |
327327

328-
## List Factors
328+
## List factors
329329

330330
```http request
331331
GET https://cloud.appwrite.io/v1/users/{userId}/mfa/factors
@@ -339,7 +339,7 @@ GET https://cloud.appwrite.io/v1/users/{userId}/mfa/factors
339339
| --- | --- | --- | --- |
340340
| userId | string | **Required** User ID. | |
341341

342-
## Get MFA Recovery Codes
342+
## Get MFA recovery codes
343343

344344
```http request
345345
GET https://cloud.appwrite.io/v1/users/{userId}/mfa/recovery-codes
@@ -353,7 +353,7 @@ GET https://cloud.appwrite.io/v1/users/{userId}/mfa/recovery-codes
353353
| --- | --- | --- | --- |
354354
| userId | string | **Required** User ID. | |
355355

356-
## Regenerate MFA Recovery Codes
356+
## Regenerate MFA recovery codes
357357

358358
```http request
359359
PUT https://cloud.appwrite.io/v1/users/{userId}/mfa/recovery-codes
@@ -367,7 +367,7 @@ PUT https://cloud.appwrite.io/v1/users/{userId}/mfa/recovery-codes
367367
| --- | --- | --- | --- |
368368
| userId | string | **Required** User ID. | |
369369

370-
## Create MFA Recovery Codes
370+
## Create MFA recovery codes
371371

372372
```http request
373373
PATCH https://cloud.appwrite.io/v1/users/{userId}/mfa/recovery-codes
@@ -529,7 +529,7 @@ PATCH https://cloud.appwrite.io/v1/users/{userId}/status
529529
| userId | string | **Required** User ID. | |
530530
| status | boolean | User Status. To activate the user pass `true` and to block the user pass `false`. | |
531531

532-
## List User Targets
532+
## List user targets
533533

534534
```http request
535535
GET https://cloud.appwrite.io/v1/users/{userId}/targets
@@ -544,7 +544,7 @@ GET https://cloud.appwrite.io/v1/users/{userId}/targets
544544
| userId | string | **Required** User ID. | |
545545
| queries | array | Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels | [] |
546546

547-
## Create User Target
547+
## Create user target
548548

549549
```http request
550550
POST https://cloud.appwrite.io/v1/users/{userId}/targets
@@ -563,7 +563,7 @@ POST https://cloud.appwrite.io/v1/users/{userId}/targets
563563
| providerId | string | Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used. | |
564564
| name | string | Target name. Max length: 128 chars. For example: My Awesome App Galaxy S23. | |
565565

566-
## Get User Target
566+
## Get user target
567567

568568
```http request
569569
GET https://cloud.appwrite.io/v1/users/{userId}/targets/{targetId}
@@ -578,7 +578,7 @@ GET https://cloud.appwrite.io/v1/users/{userId}/targets/{targetId}
578578
| userId | string | **Required** User ID. | |
579579
| targetId | string | **Required** Target ID. | |
580580

581-
## Update User target
581+
## Update user target
582582

583583
```http request
584584
PATCH https://cloud.appwrite.io/v1/users/{userId}/targets/{targetId}

src/Appwrite/Client.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ class Client
3737
*/
3838
protected array $headers = [
3939
'content-type' => '',
40-
'user-agent' => 'AppwritePHPSDK/12.0.0 ()',
40+
'user-agent' => 'AppwritePHPSDK/12.2.0 ()',
4141
'x-sdk-name'=> 'PHP',
4242
'x-sdk-platform'=> 'server',
4343
'x-sdk-language'=> 'php',
44-
'x-sdk-version'=> '12.0.0',
44+
'x-sdk-version'=> '12.2.0',
4545
];
4646

4747
/**

src/Appwrite/Enums/ImageFormat.php

+8
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class ImageFormat implements JsonSerializable
1111
private static ImageFormat $GIF;
1212
private static ImageFormat $PNG;
1313
private static ImageFormat $WEBP;
14+
private static ImageFormat $AVIF;
1415

1516
private string $value;
1617

@@ -64,4 +65,11 @@ public static function WEBP(): ImageFormat
6465
}
6566
return self::$WEBP;
6667
}
68+
public static function AVIF(): ImageFormat
69+
{
70+
if (!isset(self::$AVIF)) {
71+
self::$AVIF = new ImageFormat('avif');
72+
}
73+
return self::$AVIF;
74+
}
6775
}

0 commit comments

Comments
 (0)