react-native-appwrite 0.15.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/dist/cjs/sdk.js +61 -5
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +61 -5
- package/dist/esm/sdk.js.map +1 -1
- package/docs/examples/account/create-email-verification.md +13 -0
- package/docs/examples/account/update-email-verification.md +14 -0
- package/package.json +1 -1
- package/src/client.ts +1 -1
- package/src/services/account.ts +123 -4
- package/src/services/tables-db.ts +12 -12
- package/types/services/account.d.ts +49 -0
- package/types/services/tables-db.d.ts +12 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Change log
|
|
2
2
|
|
|
3
|
+
## 0.16.0
|
|
4
|
+
|
|
5
|
+
* Deprecate `createVerification` method in `Account` service
|
|
6
|
+
* Add `createEmailVerification` method in `Account` service
|
|
7
|
+
|
|
3
8
|
## 0.11.0
|
|
4
9
|
|
|
5
10
|
* Add `incrementDocumentAttribute` and `decrementDocumentAttribute` support to `Databases` service
|
package/dist/cjs/sdk.js
CHANGED
|
@@ -100,7 +100,7 @@ class Client {
|
|
|
100
100
|
'x-sdk-name': 'React Native',
|
|
101
101
|
'x-sdk-platform': 'client',
|
|
102
102
|
'x-sdk-language': 'reactnative',
|
|
103
|
-
'x-sdk-version': '0.
|
|
103
|
+
'x-sdk-version': '0.16.0',
|
|
104
104
|
'X-Appwrite-Response-Format': '1.8.0',
|
|
105
105
|
};
|
|
106
106
|
this.realtime = {
|
|
@@ -1738,6 +1738,30 @@ class Account extends Service {
|
|
|
1738
1738
|
'content-type': 'application/json',
|
|
1739
1739
|
}, payload);
|
|
1740
1740
|
}
|
|
1741
|
+
createEmailVerification(paramsOrFirst) {
|
|
1742
|
+
let params;
|
|
1743
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1744
|
+
params = (paramsOrFirst || {});
|
|
1745
|
+
}
|
|
1746
|
+
else {
|
|
1747
|
+
params = {
|
|
1748
|
+
url: paramsOrFirst
|
|
1749
|
+
};
|
|
1750
|
+
}
|
|
1751
|
+
const url = params.url;
|
|
1752
|
+
if (typeof url === 'undefined') {
|
|
1753
|
+
throw new AppwriteException('Missing required parameter: "url"');
|
|
1754
|
+
}
|
|
1755
|
+
const apiPath = '/account/verifications/email';
|
|
1756
|
+
const payload = {};
|
|
1757
|
+
if (typeof url !== 'undefined') {
|
|
1758
|
+
payload['url'] = url;
|
|
1759
|
+
}
|
|
1760
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1761
|
+
return this.client.call('post', uri, {
|
|
1762
|
+
'content-type': 'application/json',
|
|
1763
|
+
}, payload);
|
|
1764
|
+
}
|
|
1741
1765
|
createVerification(paramsOrFirst) {
|
|
1742
1766
|
let params;
|
|
1743
1767
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
@@ -1752,7 +1776,7 @@ class Account extends Service {
|
|
|
1752
1776
|
if (typeof url === 'undefined') {
|
|
1753
1777
|
throw new AppwriteException('Missing required parameter: "url"');
|
|
1754
1778
|
}
|
|
1755
|
-
const apiPath = '/account/
|
|
1779
|
+
const apiPath = '/account/verifications/email';
|
|
1756
1780
|
const payload = {};
|
|
1757
1781
|
if (typeof url !== 'undefined') {
|
|
1758
1782
|
payload['url'] = url;
|
|
@@ -1762,6 +1786,38 @@ class Account extends Service {
|
|
|
1762
1786
|
'content-type': 'application/json',
|
|
1763
1787
|
}, payload);
|
|
1764
1788
|
}
|
|
1789
|
+
updateEmailVerification(paramsOrFirst, ...rest) {
|
|
1790
|
+
let params;
|
|
1791
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
1792
|
+
params = (paramsOrFirst || {});
|
|
1793
|
+
}
|
|
1794
|
+
else {
|
|
1795
|
+
params = {
|
|
1796
|
+
userId: paramsOrFirst,
|
|
1797
|
+
secret: rest[0]
|
|
1798
|
+
};
|
|
1799
|
+
}
|
|
1800
|
+
const userId = params.userId;
|
|
1801
|
+
const secret = params.secret;
|
|
1802
|
+
if (typeof userId === 'undefined') {
|
|
1803
|
+
throw new AppwriteException('Missing required parameter: "userId"');
|
|
1804
|
+
}
|
|
1805
|
+
if (typeof secret === 'undefined') {
|
|
1806
|
+
throw new AppwriteException('Missing required parameter: "secret"');
|
|
1807
|
+
}
|
|
1808
|
+
const apiPath = '/account/verifications/email';
|
|
1809
|
+
const payload = {};
|
|
1810
|
+
if (typeof userId !== 'undefined') {
|
|
1811
|
+
payload['userId'] = userId;
|
|
1812
|
+
}
|
|
1813
|
+
if (typeof secret !== 'undefined') {
|
|
1814
|
+
payload['secret'] = secret;
|
|
1815
|
+
}
|
|
1816
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1817
|
+
return this.client.call('put', uri, {
|
|
1818
|
+
'content-type': 'application/json',
|
|
1819
|
+
}, payload);
|
|
1820
|
+
}
|
|
1765
1821
|
updateVerification(paramsOrFirst, ...rest) {
|
|
1766
1822
|
let params;
|
|
1767
1823
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
@@ -1781,7 +1837,7 @@ class Account extends Service {
|
|
|
1781
1837
|
if (typeof secret === 'undefined') {
|
|
1782
1838
|
throw new AppwriteException('Missing required parameter: "secret"');
|
|
1783
1839
|
}
|
|
1784
|
-
const apiPath = '/account/
|
|
1840
|
+
const apiPath = '/account/verifications/email';
|
|
1785
1841
|
const payload = {};
|
|
1786
1842
|
if (typeof userId !== 'undefined') {
|
|
1787
1843
|
payload['userId'] = userId;
|
|
@@ -1801,7 +1857,7 @@ class Account extends Service {
|
|
|
1801
1857
|
* @returns {Promise}
|
|
1802
1858
|
*/
|
|
1803
1859
|
createPhoneVerification() {
|
|
1804
|
-
const apiPath = '/account/
|
|
1860
|
+
const apiPath = '/account/verifications/phone';
|
|
1805
1861
|
const payload = {};
|
|
1806
1862
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1807
1863
|
return this.client.call('post', uri, {
|
|
@@ -1827,7 +1883,7 @@ class Account extends Service {
|
|
|
1827
1883
|
if (typeof secret === 'undefined') {
|
|
1828
1884
|
throw new AppwriteException('Missing required parameter: "secret"');
|
|
1829
1885
|
}
|
|
1830
|
-
const apiPath = '/account/
|
|
1886
|
+
const apiPath = '/account/verifications/phone';
|
|
1831
1887
|
const payload = {};
|
|
1832
1888
|
if (typeof userId !== 'undefined') {
|
|
1833
1889
|
payload['userId'] = userId;
|