Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new push message parameters #37

Merged
merged 1 commit into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Appwrite PHP SDK

![License](https://img.shields.io/github/license/appwrite/sdk-for-php.svg?style=flat-square&v=1)
![Version](https://img.shields.io/badge/api%20version-1.6.0-blue.svg?style=flat-square&v=1)
![Version](https://img.shields.io/badge/api%20version-1.6.1-blue.svg?style=flat-square&v=1)
[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)
Expand Down
22 changes: 11 additions & 11 deletions docs/account.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ This endpoint can also be used to convert an anonymous account to a normal one,
| email | string | User email. | |
| password | string | User password. Must be at least 8 chars. | |

## List Identities
## List identities

```http request
GET https://cloud.appwrite.io/v1/account/identities
Expand Down Expand Up @@ -106,7 +106,7 @@ PATCH https://cloud.appwrite.io/v1/account/mfa
| --- | --- | --- | --- |
| mfa | boolean | Enable or disable MFA. | |

## Create Authenticator
## Create authenticator

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

## Verify Authenticator
## Verify authenticator

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

## Delete Authenticator
## Delete authenticator

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

## Create MFA Challenge
## Create MFA challenge

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

## Create MFA Challenge (confirmation)
## Create MFA challenge (confirmation)

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

## List Factors
## List factors

```http request
GET https://cloud.appwrite.io/v1/account/mfa/factors
```

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

## Get MFA Recovery Codes
## Get MFA recovery codes

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

** 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. **

## Create MFA Recovery Codes
## Create MFA recovery codes

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

** 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. **

## Regenerate MFA Recovery Codes
## Regenerate MFA recovery codes

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

** 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.
** 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.

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).
**
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/databases/update-string-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ $result = $databases->updateStringAttribute(
key: '',
required: false,
default: '<DEFAULT>',
size: null, // optional
size: 1, // optional
newKey: '' // optional
);
11 changes: 7 additions & 4 deletions docs/examples/messaging/create-push.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ $messaging = new Messaging($client);

$result = $messaging->createPush(
messageId: '<MESSAGE_ID>',
title: '<TITLE>',
body: '<BODY>',
title: '<TITLE>', // optional
body: '<BODY>', // optional
topics: [], // optional
users: [], // optional
targets: [], // optional
Expand All @@ -24,7 +24,10 @@ $result = $messaging->createPush(
sound: '<SOUND>', // optional
color: '<COLOR>', // optional
tag: '<TAG>', // optional
badge: '<BADGE>', // optional
badge: null, // optional
draft: false, // optional
scheduledAt: '' // optional
scheduledAt: '', // optional
contentAvailable: false, // optional
critical: false, // optional
priority: MessagePriority::NORMAL() // optional
);
5 changes: 4 additions & 1 deletion docs/examples/messaging/update-push.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,8 @@ $result = $messaging->updatePush(
tag: '<TAG>', // optional
badge: null, // optional
draft: false, // optional
scheduledAt: '' // optional
scheduledAt: '', // optional
contentAvailable: false, // optional
critical: false, // optional
priority: MessagePriority::NORMAL() // optional
);
4 changes: 2 additions & 2 deletions docs/functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ POST https://cloud.appwrite.io/v1/functions
| templateOwner | string | The name of the owner of the template. | |
| templateRootDirectory | string | Path to function code in the template repo. | |
| templateVersion | string | Version (tag) for the repo linked to the function template. | |
| specification | string | Runtime specification for the function and builds. | s-0.5vcpu-512mb |
| specification | string | Runtime specification for the function and builds. | s-1vcpu-512mb |

## List runtimes

Expand Down Expand Up @@ -110,7 +110,7 @@ PUT https://cloud.appwrite.io/v1/functions/{functionId}
| providerBranch | string | Production branch for the repo linked to the function | |
| 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. | |
| providerRootDirectory | string | Path to function code in the linked repo. | |
| specification | string | Runtime specification for the function and builds. | s-0.5vcpu-512mb |
| specification | string | Runtime specification for the function and builds. | s-1vcpu-512mb |

## Delete function

Expand Down
2 changes: 1 addition & 1 deletion docs/locale.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ GET https://cloud.appwrite.io/v1/locale

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

## List Locale Codes
## List locale codes

```http request
GET https://cloud.appwrite.io/v1/locale/codes
Expand Down
12 changes: 9 additions & 3 deletions docs/messaging.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,19 @@ POST https://cloud.appwrite.io/v1/messaging/messages/push
| topics | array | List of Topic IDs. | [] |
| users | array | List of User IDs. | [] |
| targets | array | List of Targets IDs. | [] |
| data | object | Additional Data for push notification. | {} |
| data | object | Additional key-value pair data for push notification. | {} |
| action | string | Action for push notification. | |
| 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>. | |
| icon | string | Icon for push notification. Available only for Android and Web Platform. | |
| sound | string | Sound for push notification. Available only for Android and IOS Platform. | |
| sound | string | Sound for push notification. Available only for Android and iOS Platform. | |
| color | string | Color for push notification. Available only for Android Platform. | |
| tag | string | Tag for push notification. Available only for Android Platform. | |
| badge | string | Badge for push notification. Available only for IOS Platform. | |
| badge | integer | Badge for push notification. Available only for iOS Platform. | -1 |
| draft | boolean | Is message a draft | |
| 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. | |
| contentAvailable | boolean | If set to true, the notification will be delivered in the background. Available only for iOS Platform. | |
| 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. | |
| 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 |

## Update push notification

Expand Down Expand Up @@ -124,6 +127,9 @@ PATCH https://cloud.appwrite.io/v1/messaging/messages/push/{messageId}
| badge | integer | Badge for push notification. Available only for iOS platforms. | |
| draft | boolean | Is message a draft | |
| 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. | |
| contentAvailable | boolean | If set to true, the notification will be delivered in the background. Available only for iOS Platform. | |
| 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. | |
| 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. | |

## Create SMS

Expand Down
2 changes: 1 addition & 1 deletion docs/storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ PUT https://cloud.appwrite.io/v1/storage/buckets/{bucketId}/files/{fileId}
| name | string | Name of the file | |
| permissions | array | An array of permission string. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). | |

## Delete File
## Delete file

```http request
DELETE https://cloud.appwrite.io/v1/storage/buckets/{bucketId}/files/{fileId}
Expand Down
4 changes: 2 additions & 2 deletions docs/teams.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ DELETE https://cloud.appwrite.io/v1/teams/{teamId}
GET https://cloud.appwrite.io/v1/teams/{teamId}/memberships
```

** 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. **
** 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. **

### Parameters

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

** Get a team member by the membership unique id. All team members have read access for this resource. **
** 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. **

### Parameters

Expand Down
20 changes: 10 additions & 10 deletions docs/users.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ POST https://cloud.appwrite.io/v1/users/bcrypt
| password | string | User password hashed using Bcrypt. | |
| name | string | User name. Max length: 128 chars. | |

## List Identities
## List identities

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

## Delete Authenticator
## Delete authenticator

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

## List Factors
## List factors

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

## Get MFA Recovery Codes
## Get MFA recovery codes

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

## Regenerate MFA Recovery Codes
## Regenerate MFA recovery codes

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

## Create MFA Recovery Codes
## Create MFA recovery codes

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

## List User Targets
## List user targets

```http request
GET https://cloud.appwrite.io/v1/users/{userId}/targets
Expand All @@ -544,7 +544,7 @@ GET https://cloud.appwrite.io/v1/users/{userId}/targets
| userId | string | **Required** User ID. | |
| 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 | [] |

## Create User Target
## Create user target

```http request
POST https://cloud.appwrite.io/v1/users/{userId}/targets
Expand All @@ -563,7 +563,7 @@ POST https://cloud.appwrite.io/v1/users/{userId}/targets
| 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. | |
| name | string | Target name. Max length: 128 chars. For example: My Awesome App Galaxy S23. | |

## Get User Target
## Get user target

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

## Update User target
## Update user target

```http request
PATCH https://cloud.appwrite.io/v1/users/{userId}/targets/{targetId}
Expand Down
4 changes: 2 additions & 2 deletions src/Appwrite/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ class Client
*/
protected array $headers = [
'content-type' => '',
'user-agent' => 'AppwritePHPSDK/12.0.0 ()',
'user-agent' => 'AppwritePHPSDK/12.2.0 ()',
'x-sdk-name'=> 'PHP',
'x-sdk-platform'=> 'server',
'x-sdk-language'=> 'php',
'x-sdk-version'=> '12.0.0',
'x-sdk-version'=> '12.2.0',
christyjacob4 marked this conversation as resolved.
Show resolved Hide resolved
];

/**
Expand Down
8 changes: 8 additions & 0 deletions src/Appwrite/Enums/ImageFormat.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class ImageFormat implements JsonSerializable
private static ImageFormat $GIF;
private static ImageFormat $PNG;
private static ImageFormat $WEBP;
private static ImageFormat $AVIF;

private string $value;

Expand Down Expand Up @@ -64,4 +65,11 @@ public static function WEBP(): ImageFormat
}
return self::$WEBP;
}
public static function AVIF(): ImageFormat
{
if (!isset(self::$AVIF)) {
self::$AVIF = new ImageFormat('avif');
}
return self::$AVIF;
}
}
Loading
Loading