|
2 | 2 | window.Appwrite = function () { |
3 | 3 |
|
4 | 4 | let config = { |
5 | | - endpoint: 'https://appwrite.test/v1', |
| 5 | + endpoint: 'https://appwrite.io/v1', |
6 | 6 | project: '', |
7 | 7 | key: '', |
8 | 8 | locale: '', |
|
572 | 572 | }); |
573 | 573 | }, |
574 | 574 |
|
| 575 | + /** |
| 576 | + * OAuth Callback |
| 577 | + * |
| 578 | + * |
| 579 | + * @param {string} projectId |
| 580 | + * @param {string} provider |
| 581 | + * @param {string} code |
| 582 | + * @param {string} state |
| 583 | + * @throws {Error} |
| 584 | + * @return {Promise} */ |
| 585 | + oauthCallback: function(projectId, provider, code, state = '') { |
| 586 | + if(projectId === undefined) { |
| 587 | + throw new Error('Missing required parameter: "projectId"'); |
| 588 | + } |
| 589 | + |
| 590 | + if(provider === undefined) { |
| 591 | + throw new Error('Missing required parameter: "provider"'); |
| 592 | + } |
| 593 | + |
| 594 | + if(code === undefined) { |
| 595 | + throw new Error('Missing required parameter: "code"'); |
| 596 | + } |
| 597 | + |
| 598 | + let path = '/auth/oauth/callback/{provider}/{projectId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{provider}', 'g'), provider); |
| 599 | + |
| 600 | + return http |
| 601 | + .get(path, {'content-type': 'application/json'}, |
| 602 | + { |
| 603 | + 'code': code, |
| 604 | + 'state': state |
| 605 | + }); |
| 606 | + }, |
| 607 | + |
| 608 | + /** |
| 609 | + * OAuth Login |
| 610 | + * |
| 611 | + * |
| 612 | + * @param {string} provider |
| 613 | + * @param {string} success |
| 614 | + * @param {string} failure |
| 615 | + * @throws {Error} |
| 616 | + * @return {Promise} */ |
| 617 | + oauth: function(provider, success = '', failure = '') { |
| 618 | + if(provider === undefined) { |
| 619 | + throw new Error('Missing required parameter: "provider"'); |
| 620 | + } |
| 621 | + |
| 622 | + let path = '/auth/oauth/{provider}'.replace(new RegExp('{provider}', 'g'), provider); |
| 623 | + |
| 624 | + return http |
| 625 | + .get(path, {'content-type': 'application/json'}, |
| 626 | + { |
| 627 | + 'success': success, |
| 628 | + 'failure': failure |
| 629 | + }); |
| 630 | + }, |
| 631 | + |
575 | 632 | /** |
576 | 633 | * Password Recovery |
577 | 634 | * |
|
768 | 825 | { |
769 | 826 | 'redirect': redirect |
770 | 827 | }); |
771 | | - }, |
772 | | - |
773 | | - /** |
774 | | - * OAuth Callback |
775 | | - * |
776 | | - * |
777 | | - * @param {string} projectId |
778 | | - * @param {string} provider |
779 | | - * @param {string} code |
780 | | - * @param {string} state |
781 | | - * @throws {Error} |
782 | | - * @return {Promise} */ |
783 | | - oauthCallback: function(projectId, provider, code, state = '') { |
784 | | - if(projectId === undefined) { |
785 | | - throw new Error('Missing required parameter: "projectId"'); |
786 | | - } |
787 | | - |
788 | | - if(provider === undefined) { |
789 | | - throw new Error('Missing required parameter: "provider"'); |
790 | | - } |
791 | | - |
792 | | - if(code === undefined) { |
793 | | - throw new Error('Missing required parameter: "code"'); |
794 | | - } |
795 | | - |
796 | | - let path = '/oauth/callback/{provider}/{projectId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{provider}', 'g'), provider); |
797 | | - |
798 | | - return http |
799 | | - .get(path, {'content-type': 'application/json'}, |
800 | | - { |
801 | | - 'code': code, |
802 | | - 'state': state |
803 | | - }); |
804 | | - }, |
805 | | - |
806 | | - /** |
807 | | - * OAuth Login |
808 | | - * |
809 | | - * |
810 | | - * @param {string} provider |
811 | | - * @param {string} success |
812 | | - * @param {string} failure |
813 | | - * @throws {Error} |
814 | | - * @return {Promise} */ |
815 | | - oauth: function(provider, success = '', failure = '') { |
816 | | - if(provider === undefined) { |
817 | | - throw new Error('Missing required parameter: "provider"'); |
818 | | - } |
819 | | - |
820 | | - let path = '/oauth/{provider}'.replace(new RegExp('{provider}', 'g'), provider); |
821 | | - |
822 | | - return http |
823 | | - .get(path, {'content-type': 'application/json'}, |
824 | | - { |
825 | | - 'success': success, |
826 | | - 'failure': failure |
827 | | - }); |
828 | 828 | } |
829 | 829 | }; |
830 | 830 |
|
|
943 | 943 | }, |
944 | 944 |
|
945 | 945 | /** |
946 | | - * Get image from and HTTP URL and crop to any size. |
| 946 | + * Get Image from URL |
947 | 947 | * |
948 | 948 | * Use this endpoint to fetch a remote image URL and crop it to any image size |
949 | | - * you want. This endpoint is very useful if you need to crop a remote image |
950 | | - * or in cases, you want to make sure a 3rd party image is properly served |
951 | | - * using a TLS protocol. |
| 949 | + * you want. This endpoint is very useful if you need to crop and display |
| 950 | + * remote images in your app or in cases, you want to make sure a 3rd party |
| 951 | + * image is properly served using a TLS protocol. |
952 | 952 | * |
953 | 953 | * @param {string} url |
954 | 954 | * @param {number} width |
|
1423 | 1423 | * @param {string} description |
1424 | 1424 | * @param {string} logo |
1425 | 1425 | * @param {string} url |
1426 | | - * @param {array} clients |
1427 | 1426 | * @param {string} legalName |
1428 | 1427 | * @param {string} legalCountry |
1429 | 1428 | * @param {string} legalState |
|
1432 | 1431 | * @param {string} legalTaxId |
1433 | 1432 | * @throws {Error} |
1434 | 1433 | * @return {Promise} */ |
1435 | | - createProject: function(name, teamId, description = '', logo = '', url = '', clients = [], legalName = '', legalCountry = '', legalState = '', legalCity = '', legalAddress = '', legalTaxId = '') { |
| 1434 | + createProject: function(name, teamId, description = '', logo = '', url = '', legalName = '', legalCountry = '', legalState = '', legalCity = '', legalAddress = '', legalTaxId = '') { |
1436 | 1435 | if(name === undefined) { |
1437 | 1436 | throw new Error('Missing required parameter: "name"'); |
1438 | 1437 | } |
|
1451 | 1450 | 'description': description, |
1452 | 1451 | 'logo': logo, |
1453 | 1452 | 'url': url, |
1454 | | - 'clients': clients, |
1455 | 1453 | 'legalName': legalName, |
1456 | 1454 | 'legalCountry': legalCountry, |
1457 | 1455 | 'legalState': legalState, |
|
1490 | 1488 | * @param {string} description |
1491 | 1489 | * @param {string} logo |
1492 | 1490 | * @param {string} url |
1493 | | - * @param {array} clients |
1494 | 1491 | * @param {string} legalName |
1495 | 1492 | * @param {string} legalCountry |
1496 | 1493 | * @param {string} legalState |
|
1499 | 1496 | * @param {string} legalTaxId |
1500 | 1497 | * @throws {Error} |
1501 | 1498 | * @return {Promise} */ |
1502 | | - updateProject: function(projectId, name, description = '', logo = '', url = '', clients = [], legalName = '', legalCountry = '', legalState = '', legalCity = '', legalAddress = '', legalTaxId = '') { |
| 1499 | + updateProject: function(projectId, name, description = '', logo = '', url = '', legalName = '', legalCountry = '', legalState = '', legalCity = '', legalAddress = '', legalTaxId = '') { |
1503 | 1500 | if(projectId === undefined) { |
1504 | 1501 | throw new Error('Missing required parameter: "projectId"'); |
1505 | 1502 | } |
|
1517 | 1514 | 'description': description, |
1518 | 1515 | 'logo': logo, |
1519 | 1516 | 'url': url, |
1520 | | - 'clients': clients, |
1521 | 1517 | 'legalName': legalName, |
1522 | 1518 | 'legalCountry': legalCountry, |
1523 | 1519 | 'legalState': legalState, |
|
2332 | 2328 | }); |
2333 | 2329 | }, |
2334 | 2330 |
|
| 2331 | + /** |
| 2332 | + * Update File |
| 2333 | + * |
| 2334 | + * Update file by its unique ID. Only users with write permissions have access |
| 2335 | + * to update this resource. |
| 2336 | + * |
| 2337 | + * @param {string} fileId |
| 2338 | + * @param {array} read |
| 2339 | + * @param {array} write |
| 2340 | + * @param {string} folderId |
| 2341 | + * @throws {Error} |
| 2342 | + * @return {Promise} */ |
| 2343 | + updateFile: function(fileId, read = [], write = [], folderId = '') { |
| 2344 | + if(fileId === undefined) { |
| 2345 | + throw new Error('Missing required parameter: "fileId"'); |
| 2346 | + } |
| 2347 | + |
| 2348 | + let path = '/storage/files/{fileId}'.replace(new RegExp('{fileId}', 'g'), fileId); |
| 2349 | + |
| 2350 | + return http |
| 2351 | + .put(path, {'content-type': 'application/json'}, |
| 2352 | + { |
| 2353 | + 'read': read, |
| 2354 | + 'write': write, |
| 2355 | + 'folderId': folderId |
| 2356 | + }); |
| 2357 | + }, |
| 2358 | + |
2335 | 2359 | /** |
2336 | 2360 | * Delete File |
2337 | 2361 | * |
|
2355 | 2379 | }, |
2356 | 2380 |
|
2357 | 2381 | /** |
2358 | | - * Download File |
| 2382 | + * Get File for Download |
2359 | 2383 | * |
2360 | 2384 | * Get file content by its unique ID. The endpoint response return with a |
2361 | 2385 | * 'Content-Disposition: attachment' header that tells the browser to start |
|
2378 | 2402 | }, |
2379 | 2403 |
|
2380 | 2404 | /** |
2381 | | - * Preview File |
| 2405 | + * Get File Preview |
2382 | 2406 | * |
2383 | 2407 | * Get file preview image. Currently, this method supports preview for image |
2384 | 2408 | * files (jpg, png, and gif), other supported formats, like pdf, docs, slides, |
|
2412 | 2436 | }, |
2413 | 2437 |
|
2414 | 2438 | /** |
2415 | | - * View File |
| 2439 | + * Get File for View |
2416 | 2440 | * |
2417 | 2441 | * Get file content by its unique ID. This endpoint is similar to the download |
2418 | 2442 | * method but returns with no 'Content-Disposition: attachment' header. |
|
2666 | 2690 | }, |
2667 | 2691 |
|
2668 | 2692 | /** |
2669 | | - * Create Team Membership (Resend Invitation Email) |
| 2693 | + * Create Team Membership (Resend) |
2670 | 2694 | * |
2671 | 2695 | * Use this endpoint to resend your invitation email for a user to join a |
2672 | 2696 | * team. |
|
0 commit comments