@rezamirzapour/pod-sdk 1.0.5 → 1.0.8
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/README.md +364 -45
- package/dist/index.d.mts +1412 -15
- package/dist/index.d.ts +1412 -15
- package/dist/index.js +1646 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1634 -15
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -513,38 +513,1656 @@ var CustomPostService = class {
|
|
|
513
513
|
return new CustomPostCrudService(this, config);
|
|
514
514
|
}
|
|
515
515
|
};
|
|
516
|
+
|
|
517
|
+
// src/services/podspace/uploadDownload.ts
|
|
518
|
+
var PodspaceUploadDownloadService = class {
|
|
519
|
+
http;
|
|
520
|
+
baseUrl;
|
|
521
|
+
revalidate;
|
|
522
|
+
constructor(options) {
|
|
523
|
+
this.http = options.http;
|
|
524
|
+
this.baseUrl = options.baseUrl;
|
|
525
|
+
this.revalidate = options.revalidate || 0;
|
|
526
|
+
}
|
|
527
|
+
/**
|
|
528
|
+
* Upload a single file via FormData to POD Podspace storage.
|
|
529
|
+
* Swagger: POST /api/files
|
|
530
|
+
*/
|
|
531
|
+
async uploadFile(formData, paramsOrPath = "/", isPublic = true, options = {}) {
|
|
532
|
+
const queryParams = typeof paramsOrPath === "string" ? { path: paramsOrPath, isPublic } : { path: "/", isPublic: true, ...paramsOrPath };
|
|
533
|
+
if (Array.isArray(queryParams.tags)) {
|
|
534
|
+
queryParams.tags = queryParams.tags.join(",");
|
|
535
|
+
}
|
|
536
|
+
if (typeof queryParams.userMetadata === "object") {
|
|
537
|
+
queryParams.userMetadata = JSON.stringify(queryParams.userMetadata);
|
|
538
|
+
}
|
|
539
|
+
if (Array.isArray(queryParams.zoneNames)) {
|
|
540
|
+
queryParams.zoneNames = queryParams.zoneNames.join(",");
|
|
541
|
+
}
|
|
542
|
+
return this.http.post("/api/files", formData, {
|
|
543
|
+
params: queryParams,
|
|
544
|
+
headers: options.headers,
|
|
545
|
+
signal: options.signal
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
549
|
+
* Upload multiple files simultaneously using FormData.
|
|
550
|
+
* Swagger: POST /api/files/multiple
|
|
551
|
+
*/
|
|
552
|
+
async uploadMultipleFiles(formData, params = {}, options = {}) {
|
|
553
|
+
const queryParams = { ...params };
|
|
554
|
+
if (Array.isArray(queryParams.tags)) {
|
|
555
|
+
queryParams.tags = queryParams.tags.join(",");
|
|
556
|
+
}
|
|
557
|
+
if (typeof queryParams.userMetadata === "object") {
|
|
558
|
+
queryParams.userMetadata = JSON.stringify(queryParams.userMetadata);
|
|
559
|
+
}
|
|
560
|
+
if (Array.isArray(queryParams.zoneNames)) {
|
|
561
|
+
queryParams.zoneNames = queryParams.zoneNames.join(",");
|
|
562
|
+
}
|
|
563
|
+
return this.http.post("/api/files/multiple", formData, {
|
|
564
|
+
params: queryParams,
|
|
565
|
+
headers: options.headers,
|
|
566
|
+
signal: options.signal
|
|
567
|
+
});
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* Upload an image formatted as Base64 string.
|
|
571
|
+
* Swagger: POST /api/images/base64
|
|
572
|
+
*/
|
|
573
|
+
async uploadImageBase64(params, options = {}) {
|
|
574
|
+
const { filename, file, ...rest } = params;
|
|
575
|
+
const queryParams = {
|
|
576
|
+
filename,
|
|
577
|
+
file,
|
|
578
|
+
...rest
|
|
579
|
+
};
|
|
580
|
+
if (Array.isArray(queryParams.tags)) {
|
|
581
|
+
queryParams.tags = queryParams.tags.join(",");
|
|
582
|
+
}
|
|
583
|
+
if (typeof queryParams.userMetadata === "object") {
|
|
584
|
+
queryParams.userMetadata = JSON.stringify(queryParams.userMetadata);
|
|
585
|
+
}
|
|
586
|
+
return this.http.post("/api/images/base64", {}, {
|
|
587
|
+
params: queryParams,
|
|
588
|
+
headers: options.headers,
|
|
589
|
+
signal: options.signal
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* Replace the content of an existing file.
|
|
594
|
+
* Swagger: PUT /api/files/{hash}
|
|
595
|
+
*/
|
|
596
|
+
async replaceFile(hash, formData, params = {}, options = {}) {
|
|
597
|
+
return this.http.put(`/api/files/${hash}`, formData, {
|
|
598
|
+
params,
|
|
599
|
+
headers: options.headers,
|
|
600
|
+
signal: options.signal
|
|
601
|
+
});
|
|
602
|
+
}
|
|
603
|
+
/**
|
|
604
|
+
* Upload a file into an existing reserved link hash.
|
|
605
|
+
* Swagger: POST /api/files/{hash}
|
|
606
|
+
*/
|
|
607
|
+
async uploadByLink(hash, formData, params = {}, options = {}) {
|
|
608
|
+
return this.http.post(`/api/files/${hash}`, formData, {
|
|
609
|
+
params,
|
|
610
|
+
headers: options.headers,
|
|
611
|
+
signal: options.signal
|
|
612
|
+
});
|
|
613
|
+
}
|
|
614
|
+
/**
|
|
615
|
+
* Downloads raw file data.
|
|
616
|
+
* Swagger: GET /api/files/{hash}
|
|
617
|
+
*/
|
|
618
|
+
async downloadFile(hash, params = {}, options = {}) {
|
|
619
|
+
return this.http.get(`/api/files/${hash}`, {
|
|
620
|
+
params,
|
|
621
|
+
headers: options.headers,
|
|
622
|
+
signal: options.signal,
|
|
623
|
+
responseType: "blob"
|
|
624
|
+
});
|
|
625
|
+
}
|
|
626
|
+
/**
|
|
627
|
+
* Downloads processed image with optional resize, crop, or format conversion.
|
|
628
|
+
* Swagger: GET /api/v2/images/{hash}
|
|
629
|
+
*/
|
|
630
|
+
async downloadImage(hash, params = {}, options = {}) {
|
|
631
|
+
return this.http.get(`/api/v2/images/${hash}`, {
|
|
632
|
+
params,
|
|
633
|
+
headers: options.headers,
|
|
634
|
+
signal: options.signal,
|
|
635
|
+
responseType: "blob"
|
|
636
|
+
});
|
|
637
|
+
}
|
|
638
|
+
/**
|
|
639
|
+
* Downloads file thumbnail.
|
|
640
|
+
* Swagger: GET /api/files/{hash}/thumbnail
|
|
641
|
+
*/
|
|
642
|
+
async downloadThumbnail(hash, params = {}, options = {}) {
|
|
643
|
+
return this.http.get(`/api/files/${hash}/thumbnail`, {
|
|
644
|
+
params,
|
|
645
|
+
headers: options.headers,
|
|
646
|
+
signal: options.signal,
|
|
647
|
+
responseType: "blob"
|
|
648
|
+
});
|
|
649
|
+
}
|
|
650
|
+
/**
|
|
651
|
+
* Downloads multiple files and folders compressed into a single zip file.
|
|
652
|
+
* Swagger: GET /api/files
|
|
653
|
+
*/
|
|
654
|
+
async downloadFilesAsZip(params, options = {}) {
|
|
655
|
+
const entityHashes = Array.isArray(params.entityHashes) ? params.entityHashes.join(",") : params.entityHashes;
|
|
656
|
+
return this.http.get("/api/files", {
|
|
657
|
+
params: {
|
|
658
|
+
entityHashes,
|
|
659
|
+
customName: params.customName,
|
|
660
|
+
password: params.password
|
|
661
|
+
},
|
|
662
|
+
headers: options.headers,
|
|
663
|
+
signal: options.signal,
|
|
664
|
+
responseType: "blob"
|
|
665
|
+
});
|
|
666
|
+
}
|
|
667
|
+
/**
|
|
668
|
+
* Obtains a pre-signed upload link.
|
|
669
|
+
* Swagger: GET /api/files/link
|
|
670
|
+
*/
|
|
671
|
+
async getUploadLink(params, options = {}) {
|
|
672
|
+
const queryParams = { ...params };
|
|
673
|
+
if (Array.isArray(queryParams.zoneNames)) {
|
|
674
|
+
queryParams.zoneNames = queryParams.zoneNames.join(",");
|
|
675
|
+
}
|
|
676
|
+
if (Array.isArray(queryParams.fileTypeLimits)) {
|
|
677
|
+
queryParams.fileTypeLimits = queryParams.fileTypeLimits.join(",");
|
|
678
|
+
}
|
|
679
|
+
if (typeof queryParams.userMetadata === "object") {
|
|
680
|
+
queryParams.userMetadata = JSON.stringify(queryParams.userMetadata);
|
|
681
|
+
}
|
|
682
|
+
return this.http.get("/api/files/link", {
|
|
683
|
+
params: queryParams,
|
|
684
|
+
headers: options.headers,
|
|
685
|
+
signal: options.signal
|
|
686
|
+
});
|
|
687
|
+
}
|
|
688
|
+
/**
|
|
689
|
+
* Builds the direct URL to view or download a file.
|
|
690
|
+
*/
|
|
691
|
+
getFileUrl(hash, isPublic = true) {
|
|
692
|
+
return `${this.baseUrl}/api/files/${hash}?isPublic=${isPublic}`;
|
|
693
|
+
}
|
|
694
|
+
/**
|
|
695
|
+
* Builds URL to view/download an image with optional dimensions/crops.
|
|
696
|
+
*/
|
|
697
|
+
getImageUrl(hash, params = {}) {
|
|
698
|
+
const search = new URLSearchParams();
|
|
699
|
+
for (const [k, v] of Object.entries(params)) {
|
|
700
|
+
if (v !== void 0 && v !== null) {
|
|
701
|
+
search.append(k, String(v));
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
const qs = search.toString();
|
|
705
|
+
return `${this.baseUrl}/api/v2/images/${hash}${qs ? "?" + qs : ""}`;
|
|
706
|
+
}
|
|
707
|
+
/**
|
|
708
|
+
* Builds URL for a file thumbnail.
|
|
709
|
+
*/
|
|
710
|
+
getThumbnailUrl(hash, params = {}) {
|
|
711
|
+
const search = new URLSearchParams();
|
|
712
|
+
if (params.password) search.append("password", params.password);
|
|
713
|
+
if (params.cachePolicy) search.append("cachePolicy", params.cachePolicy);
|
|
714
|
+
if (params.accessLevel) search.append("accessLevel", params.accessLevel);
|
|
715
|
+
const qs = search.toString();
|
|
716
|
+
return `${this.baseUrl}/api/files/${hash}/thumbnail${qs ? "?" + qs : ""}`;
|
|
717
|
+
}
|
|
718
|
+
};
|
|
719
|
+
|
|
720
|
+
// src/services/podspace/files.ts
|
|
721
|
+
var PodspaceFilesService = class {
|
|
722
|
+
http;
|
|
723
|
+
revalidate;
|
|
724
|
+
constructor(options) {
|
|
725
|
+
this.http = options.http;
|
|
726
|
+
this.revalidate = options.revalidate || 0;
|
|
727
|
+
}
|
|
728
|
+
/**
|
|
729
|
+
* Retrieves full detail of a file or folder by its hash.
|
|
730
|
+
* Swagger: GET /api/files/{hash}/detail
|
|
731
|
+
*/
|
|
732
|
+
async getFileDetail(hash, params = {}, options = {}) {
|
|
733
|
+
return this.http.get(`/api/files/${hash}/detail`, {
|
|
734
|
+
params,
|
|
735
|
+
headers: options.headers,
|
|
736
|
+
signal: options.signal,
|
|
737
|
+
next: {
|
|
738
|
+
revalidate: options.revalidate !== void 0 ? options.revalidate === false ? 0 : options.revalidate : this.revalidate
|
|
739
|
+
}
|
|
740
|
+
});
|
|
741
|
+
}
|
|
742
|
+
/**
|
|
743
|
+
* Retrieves file details using its storage path.
|
|
744
|
+
* Swagger: GET /api/files/details
|
|
745
|
+
*/
|
|
746
|
+
async getFileDetailByPath(path, params = {}, options = {}) {
|
|
747
|
+
return this.http.get("/api/files/details", {
|
|
748
|
+
params: { path, ...params },
|
|
749
|
+
headers: options.headers,
|
|
750
|
+
signal: options.signal,
|
|
751
|
+
next: {
|
|
752
|
+
revalidate: options.revalidate !== void 0 ? options.revalidate === false ? 0 : options.revalidate : this.revalidate
|
|
753
|
+
}
|
|
754
|
+
});
|
|
755
|
+
}
|
|
756
|
+
/**
|
|
757
|
+
* Checks if an entity with given name exists in the folder.
|
|
758
|
+
* Swagger: GET /api/files/{hash}/exist
|
|
759
|
+
*/
|
|
760
|
+
async checkEntityExist(hash, fileName, params = {}, options = {}) {
|
|
761
|
+
return this.http.get(`/api/files/${hash}/exist`, {
|
|
762
|
+
params: { fileName, ...params },
|
|
763
|
+
headers: options.headers,
|
|
764
|
+
signal: options.signal
|
|
765
|
+
});
|
|
766
|
+
}
|
|
767
|
+
/**
|
|
768
|
+
* Renames a file or folder.
|
|
769
|
+
* Swagger: PUT /api/files/{hash}/rename
|
|
770
|
+
*/
|
|
771
|
+
async renameEntity(hash, newName, uniqueName, options = {}) {
|
|
772
|
+
return this.http.put(`/api/files/${hash}/rename`, {}, {
|
|
773
|
+
params: { newName, uniqueName },
|
|
774
|
+
headers: options.headers,
|
|
775
|
+
signal: options.signal
|
|
776
|
+
});
|
|
777
|
+
}
|
|
778
|
+
/**
|
|
779
|
+
* Moves a file or folder to a new destination folder.
|
|
780
|
+
* Swagger: PUT /api/files/{hash}/move
|
|
781
|
+
*/
|
|
782
|
+
async moveEntity(hash, destFolderHash, params = {}, options = {}) {
|
|
783
|
+
return this.http.put(`/api/files/${hash}/move`, {}, {
|
|
784
|
+
params: { destFolderHash, ...params },
|
|
785
|
+
headers: options.headers,
|
|
786
|
+
signal: options.signal
|
|
787
|
+
});
|
|
788
|
+
}
|
|
789
|
+
/**
|
|
790
|
+
* Copies a file or folder to a specified destination folder.
|
|
791
|
+
* Swagger: PUT /api/files/{hash}/copy
|
|
792
|
+
*/
|
|
793
|
+
async copyEntity(hash, destFolderHash, params = {}, options = {}) {
|
|
794
|
+
return this.http.put(`/api/files/${hash}/copy`, {}, {
|
|
795
|
+
params: { destFolderHash, ...params },
|
|
796
|
+
headers: options.headers,
|
|
797
|
+
signal: options.signal
|
|
798
|
+
});
|
|
799
|
+
}
|
|
800
|
+
/**
|
|
801
|
+
* Moves a file or folder to the trash.
|
|
802
|
+
* Swagger: DELETE /api/files/{hash}
|
|
803
|
+
*/
|
|
804
|
+
async trashEntity(hash, options = {}) {
|
|
805
|
+
return this.http.delete(`/api/files/${hash}`, {
|
|
806
|
+
headers: options.headers,
|
|
807
|
+
signal: options.signal
|
|
808
|
+
});
|
|
809
|
+
}
|
|
810
|
+
/**
|
|
811
|
+
* Updates file attributes (e.g. streamable flag).
|
|
812
|
+
* Swagger: PATCH /api/files/{hash}
|
|
813
|
+
*/
|
|
814
|
+
async updateFile(hash, params, options = {}) {
|
|
815
|
+
return this.http.patch(`/api/files/${hash}`, {}, {
|
|
816
|
+
params,
|
|
817
|
+
headers: options.headers,
|
|
818
|
+
signal: options.signal
|
|
819
|
+
});
|
|
820
|
+
}
|
|
821
|
+
/**
|
|
822
|
+
* Searches across user files content and folder names.
|
|
823
|
+
* Swagger: GET /api/files/search
|
|
824
|
+
*/
|
|
825
|
+
async searchFiles(params = {}, options = {}) {
|
|
826
|
+
return this.http.get("/api/files/search", {
|
|
827
|
+
params,
|
|
828
|
+
headers: options.headers,
|
|
829
|
+
signal: options.signal
|
|
830
|
+
});
|
|
831
|
+
}
|
|
832
|
+
/**
|
|
833
|
+
* Retrieves list of recently accessed/uploaded files.
|
|
834
|
+
* Swagger: GET /api/v2/files/recent
|
|
835
|
+
*/
|
|
836
|
+
async getRecentFiles(params = {}, options = {}) {
|
|
837
|
+
return this.http.get("/api/v2/files/recent", {
|
|
838
|
+
params,
|
|
839
|
+
headers: options.headers,
|
|
840
|
+
signal: options.signal
|
|
841
|
+
});
|
|
842
|
+
}
|
|
843
|
+
/**
|
|
844
|
+
* Retrieves versions history of a file.
|
|
845
|
+
* Swagger: GET /api/files/v2/{hash}/versions
|
|
846
|
+
*/
|
|
847
|
+
async getFileVersions(hash, options = {}) {
|
|
848
|
+
return this.http.get(`/api/files/v2/${hash}/versions`, {
|
|
849
|
+
headers: options.headers,
|
|
850
|
+
signal: options.signal
|
|
851
|
+
});
|
|
852
|
+
}
|
|
853
|
+
/**
|
|
854
|
+
* Rolls back a file to its previous version.
|
|
855
|
+
* Swagger: PATCH /api/files/versions/{hash}
|
|
856
|
+
*/
|
|
857
|
+
async rollbackFileVersion(hash, options = {}) {
|
|
858
|
+
return this.http.patch(`/api/files/versions/${hash}`, {}, {
|
|
859
|
+
headers: options.headers,
|
|
860
|
+
signal: options.signal
|
|
861
|
+
});
|
|
862
|
+
}
|
|
863
|
+
/**
|
|
864
|
+
* Retrieves native metadata of a file.
|
|
865
|
+
* Swagger: GET /api/v2/files/{hash}/native/metadata
|
|
866
|
+
*/
|
|
867
|
+
async getFileNativeMetadata(hash, options = {}) {
|
|
868
|
+
return this.http.get(`/api/v2/files/${hash}/native/metadata`, {
|
|
869
|
+
headers: options.headers,
|
|
870
|
+
signal: options.signal
|
|
871
|
+
});
|
|
872
|
+
}
|
|
873
|
+
/**
|
|
874
|
+
* Converts supported document file to PDF.
|
|
875
|
+
* Swagger: GET /api/files/{hash}/convert
|
|
876
|
+
*/
|
|
877
|
+
async convertFileToPdf(hash, convertType = "pdf", options = {}) {
|
|
878
|
+
return this.http.get(`/api/files/${hash}/convert`, {
|
|
879
|
+
params: { convertType },
|
|
880
|
+
headers: options.headers,
|
|
881
|
+
signal: options.signal,
|
|
882
|
+
responseType: "blob"
|
|
883
|
+
});
|
|
884
|
+
}
|
|
885
|
+
/**
|
|
886
|
+
* Retrieves breadcrumb path for a file or folder.
|
|
887
|
+
* Swagger: GET /api/files/{hash}/breadcrumb
|
|
888
|
+
*/
|
|
889
|
+
async getFileBreadcrumb(hash, params = {}, options = {}) {
|
|
890
|
+
return this.http.get(`/api/files/${hash}/breadcrumb`, {
|
|
891
|
+
params,
|
|
892
|
+
headers: options.headers,
|
|
893
|
+
signal: options.signal
|
|
894
|
+
});
|
|
895
|
+
}
|
|
896
|
+
/**
|
|
897
|
+
* Compresses multiple files and folders into a zip archive on the cloud.
|
|
898
|
+
* Swagger: POST /api/files/compress
|
|
899
|
+
*/
|
|
900
|
+
async compressToZip(params, options = {}) {
|
|
901
|
+
const queryParams = { ...params };
|
|
902
|
+
if (Array.isArray(queryParams.fileHashes)) queryParams.fileHashes = queryParams.fileHashes.join(",");
|
|
903
|
+
if (Array.isArray(queryParams.folderHashes)) queryParams.folderHashes = queryParams.folderHashes.join(",");
|
|
904
|
+
if (Array.isArray(queryParams.zoneNames)) queryParams.zoneNames = queryParams.zoneNames.join(",");
|
|
905
|
+
return this.http.post("/api/files/compress", {}, {
|
|
906
|
+
params: queryParams,
|
|
907
|
+
headers: options.headers,
|
|
908
|
+
signal: options.signal
|
|
909
|
+
});
|
|
910
|
+
}
|
|
911
|
+
/**
|
|
912
|
+
* Extracts a zip archive to a destination folder.
|
|
913
|
+
* Swagger: PUT /api/files/{hash}/extract
|
|
914
|
+
*/
|
|
915
|
+
async extractZip(hash, params = {}, options = {}) {
|
|
916
|
+
const queryParams = { ...params };
|
|
917
|
+
if (Array.isArray(queryParams.zoneNames)) queryParams.zoneNames = queryParams.zoneNames.join(",");
|
|
918
|
+
return this.http.put(`/api/files/${hash}/extract`, {}, {
|
|
919
|
+
params: queryParams,
|
|
920
|
+
headers: options.headers,
|
|
921
|
+
signal: options.signal
|
|
922
|
+
});
|
|
923
|
+
}
|
|
924
|
+
/**
|
|
925
|
+
* Sets or updates the cache policy for a file.
|
|
926
|
+
* Swagger: PUT /api/files/{hash}/cachePolicy
|
|
927
|
+
*/
|
|
928
|
+
async setCachePolicy(hash, cachePolicy, options = {}) {
|
|
929
|
+
return this.http.put(`/api/files/${hash}/cachePolicy`, {}, {
|
|
930
|
+
params: { cachePolicy },
|
|
931
|
+
headers: options.headers,
|
|
932
|
+
signal: options.signal
|
|
933
|
+
});
|
|
934
|
+
}
|
|
935
|
+
/**
|
|
936
|
+
* Retrieves recent actions and activities done on a file or folder.
|
|
937
|
+
* Swagger: GET /api/files/{hash}/activities
|
|
938
|
+
*/
|
|
939
|
+
async getFileActivities(hash, params = {}, options = {}) {
|
|
940
|
+
return this.http.get(`/api/files/${hash}/activities`, {
|
|
941
|
+
params,
|
|
942
|
+
headers: options.headers,
|
|
943
|
+
signal: options.signal
|
|
944
|
+
});
|
|
945
|
+
}
|
|
946
|
+
/**
|
|
947
|
+
* Retrieves specific activity log by type.
|
|
948
|
+
* Swagger: GET /api/files/{hash}/activities/{activity}
|
|
949
|
+
*/
|
|
950
|
+
async getSpecificActivities(hash, activity, params = {}, options = {}) {
|
|
951
|
+
return this.http.get(`/api/files/${hash}/activities/${activity}`, {
|
|
952
|
+
params,
|
|
953
|
+
headers: options.headers,
|
|
954
|
+
signal: options.signal
|
|
955
|
+
});
|
|
956
|
+
}
|
|
957
|
+
/**
|
|
958
|
+
* Retrieves count of specific activities done on file/folder.
|
|
959
|
+
* Swagger: GET /api/files/{hash}/activities/{activity}/count
|
|
960
|
+
*/
|
|
961
|
+
async getActivitiesCount(hash, activity, options = {}) {
|
|
962
|
+
return this.http.get(`/api/files/${hash}/activities/${activity}/count`, {
|
|
963
|
+
headers: options.headers,
|
|
964
|
+
signal: options.signal
|
|
965
|
+
});
|
|
966
|
+
}
|
|
967
|
+
};
|
|
968
|
+
|
|
969
|
+
// src/services/podspace/folders.ts
|
|
970
|
+
var PodspaceFoldersService = class {
|
|
971
|
+
http;
|
|
972
|
+
revalidate;
|
|
973
|
+
constructor(options) {
|
|
974
|
+
this.http = options.http;
|
|
975
|
+
this.revalidate = options.revalidate || 0;
|
|
976
|
+
}
|
|
977
|
+
/**
|
|
978
|
+
* Creates a new folder.
|
|
979
|
+
* Swagger: POST /api/folders
|
|
980
|
+
*/
|
|
981
|
+
async createFolder(params, options = {}) {
|
|
982
|
+
const queryParams = { ...params };
|
|
983
|
+
if (Array.isArray(queryParams.zoneNames)) queryParams.zoneNames = queryParams.zoneNames.join(",");
|
|
984
|
+
if (Array.isArray(queryParams.tags)) queryParams.tags = queryParams.tags.join(",");
|
|
985
|
+
if (typeof queryParams.userMetadata === "object") {
|
|
986
|
+
queryParams.userMetadata = JSON.stringify(queryParams.userMetadata);
|
|
987
|
+
}
|
|
988
|
+
return this.http.post("/api/folders", {}, {
|
|
989
|
+
params: queryParams,
|
|
990
|
+
headers: options.headers,
|
|
991
|
+
signal: options.signal
|
|
992
|
+
});
|
|
993
|
+
}
|
|
994
|
+
/**
|
|
995
|
+
* Creates nested directories inside a parent folder.
|
|
996
|
+
* Swagger: POST /api/folders/{hash}/directories
|
|
997
|
+
*/
|
|
998
|
+
async createDirectories(hash, directories, options = {}) {
|
|
999
|
+
const dirParam = Array.isArray(directories) ? directories.join(",") : directories;
|
|
1000
|
+
return this.http.post(`/api/folders/${hash}/directories`, {}, {
|
|
1001
|
+
params: { directories: dirParam },
|
|
1002
|
+
headers: options.headers,
|
|
1003
|
+
signal: options.signal
|
|
1004
|
+
});
|
|
1005
|
+
}
|
|
1006
|
+
/**
|
|
1007
|
+
* Retrieves subfolders and files inside a specified folder.
|
|
1008
|
+
* Swagger: GET /api/folders/{hash}/children
|
|
1009
|
+
*/
|
|
1010
|
+
async getFolderChildren(hash, params = {}, options = {}) {
|
|
1011
|
+
return this.http.get(`/api/folders/${hash}/children`, {
|
|
1012
|
+
params,
|
|
1013
|
+
headers: options.headers,
|
|
1014
|
+
signal: options.signal,
|
|
1015
|
+
next: {
|
|
1016
|
+
revalidate: options.revalidate !== void 0 ? options.revalidate === false ? 0 : options.revalidate : this.revalidate
|
|
1017
|
+
}
|
|
1018
|
+
});
|
|
1019
|
+
}
|
|
1020
|
+
/**
|
|
1021
|
+
* Retrieves recent folders accessed or created by user.
|
|
1022
|
+
* Swagger: GET /api/v2/folders/recent
|
|
1023
|
+
*/
|
|
1024
|
+
async getRecentFolders(params = {}, options = {}) {
|
|
1025
|
+
return this.http.get("/api/v2/folders/recent", {
|
|
1026
|
+
params,
|
|
1027
|
+
headers: options.headers,
|
|
1028
|
+
signal: options.signal
|
|
1029
|
+
});
|
|
1030
|
+
}
|
|
1031
|
+
/**
|
|
1032
|
+
* Checks if user has enough space and permission to upload a file into the folder.
|
|
1033
|
+
* Swagger: GET /api/folders/{hash}/check/upload
|
|
1034
|
+
*/
|
|
1035
|
+
async checkFolderUploadAccess(hash, size, options = {}) {
|
|
1036
|
+
return this.http.get(`/api/folders/${hash}/check/upload`, {
|
|
1037
|
+
params: { size },
|
|
1038
|
+
headers: options.headers,
|
|
1039
|
+
signal: options.signal
|
|
1040
|
+
});
|
|
1041
|
+
}
|
|
1042
|
+
/**
|
|
1043
|
+
* Retrieves folder actions summary for a specific date.
|
|
1044
|
+
* Swagger: GET /api/folders/{folderHash}/actions
|
|
1045
|
+
*/
|
|
1046
|
+
async getFolderActions(folderHash, date, options = {}) {
|
|
1047
|
+
return this.http.get(`/api/folders/${folderHash}/actions`, {
|
|
1048
|
+
params: { date },
|
|
1049
|
+
headers: options.headers,
|
|
1050
|
+
signal: options.signal
|
|
1051
|
+
});
|
|
1052
|
+
}
|
|
1053
|
+
};
|
|
1054
|
+
|
|
1055
|
+
// src/services/podspace/resumable.ts
|
|
1056
|
+
var PodspaceResumableService = class {
|
|
1057
|
+
http;
|
|
1058
|
+
constructor(options) {
|
|
1059
|
+
this.http = options.http;
|
|
1060
|
+
}
|
|
1061
|
+
/**
|
|
1062
|
+
* Initiates a resumable upload session.
|
|
1063
|
+
* Swagger: POST /api/files/resumable
|
|
1064
|
+
*/
|
|
1065
|
+
async create(headers = {}, options = {}) {
|
|
1066
|
+
return this.http.post("/api/files/resumable", {}, {
|
|
1067
|
+
headers: { ...headers, ...options.headers },
|
|
1068
|
+
signal: options.signal
|
|
1069
|
+
});
|
|
1070
|
+
}
|
|
1071
|
+
/**
|
|
1072
|
+
* Uploads a binary chunk to a resumable upload session.
|
|
1073
|
+
* Swagger: PATCH /api/files/resumable/{id}
|
|
1074
|
+
*/
|
|
1075
|
+
async append(id, chunk, offset, options = {}) {
|
|
1076
|
+
return this.http.patch(`/api/files/resumable/${id}`, chunk, {
|
|
1077
|
+
headers: {
|
|
1078
|
+
"Upload-Offset": String(offset),
|
|
1079
|
+
"Content-Type": "application/offset+octet-stream",
|
|
1080
|
+
...options.headers
|
|
1081
|
+
},
|
|
1082
|
+
signal: options.signal
|
|
1083
|
+
});
|
|
1084
|
+
}
|
|
1085
|
+
/**
|
|
1086
|
+
* Checks current uploaded byte offset for a resumable session.
|
|
1087
|
+
* Swagger: HEAD /api/files/resumable/{id}
|
|
1088
|
+
*/
|
|
1089
|
+
async getStatus(id, options = {}) {
|
|
1090
|
+
const res = await this.http.head(`/api/files/resumable/${id}`, {
|
|
1091
|
+
headers: options.headers,
|
|
1092
|
+
signal: options.signal
|
|
1093
|
+
});
|
|
1094
|
+
const offset = res?.headers?.get ? res.headers.get("upload-offset") : res?.headers?.["upload-offset"];
|
|
1095
|
+
return offset ? parseInt(offset, 10) : 0;
|
|
1096
|
+
}
|
|
1097
|
+
/**
|
|
1098
|
+
* Finalizes resumable upload and creates the file entity in the user's storage.
|
|
1099
|
+
* Swagger: POST /api/files/resumable/{id}/finalize
|
|
1100
|
+
*/
|
|
1101
|
+
async finalizeUpload(id, params, options = {}) {
|
|
1102
|
+
const queryParams = { ...params };
|
|
1103
|
+
if (Array.isArray(queryParams.tags)) queryParams.tags = queryParams.tags.join(",");
|
|
1104
|
+
if (typeof queryParams.userMetadata === "object") {
|
|
1105
|
+
queryParams.userMetadata = JSON.stringify(queryParams.userMetadata);
|
|
1106
|
+
}
|
|
1107
|
+
return this.http.post(`/api/files/resumable/${id}/finalize`, {}, {
|
|
1108
|
+
params: queryParams,
|
|
1109
|
+
headers: options.headers,
|
|
1110
|
+
signal: options.signal
|
|
1111
|
+
});
|
|
1112
|
+
}
|
|
1113
|
+
};
|
|
1114
|
+
|
|
1115
|
+
// src/services/podspace/links.ts
|
|
1116
|
+
var PodspaceLinksService = class {
|
|
1117
|
+
http;
|
|
1118
|
+
constructor(options) {
|
|
1119
|
+
this.http = options.http;
|
|
1120
|
+
}
|
|
1121
|
+
/**
|
|
1122
|
+
* Generates a download or integration public link for a file.
|
|
1123
|
+
* Swagger: GET /api/links/files/{hash}
|
|
1124
|
+
*/
|
|
1125
|
+
async createLink(hash, params = {}, options = {}) {
|
|
1126
|
+
return this.http.get(`/api/links/files/${hash}`, {
|
|
1127
|
+
params,
|
|
1128
|
+
headers: options.headers,
|
|
1129
|
+
signal: options.signal
|
|
1130
|
+
});
|
|
1131
|
+
}
|
|
1132
|
+
/**
|
|
1133
|
+
* Retrieves list of links created by current user.
|
|
1134
|
+
* Swagger: GET /api/links
|
|
1135
|
+
*/
|
|
1136
|
+
async getUserLinks(params, options = {}) {
|
|
1137
|
+
return this.http.get("/api/links", {
|
|
1138
|
+
params,
|
|
1139
|
+
headers: options.headers,
|
|
1140
|
+
signal: options.signal
|
|
1141
|
+
});
|
|
1142
|
+
}
|
|
1143
|
+
/**
|
|
1144
|
+
* Retrieves details of a specific link.
|
|
1145
|
+
* Swagger: GET /api/links/{link}/detail
|
|
1146
|
+
*/
|
|
1147
|
+
async getLinkDetail(link, options = {}) {
|
|
1148
|
+
return this.http.get(`/api/links/${link}/detail`, {
|
|
1149
|
+
headers: options.headers,
|
|
1150
|
+
signal: options.signal
|
|
1151
|
+
});
|
|
1152
|
+
}
|
|
1153
|
+
/**
|
|
1154
|
+
* Updates settings and permissions of a link.
|
|
1155
|
+
* Swagger: PATCH /api/links/{link}
|
|
1156
|
+
*/
|
|
1157
|
+
async updateLink(link, params, options = {}) {
|
|
1158
|
+
const queryParams = { ...params };
|
|
1159
|
+
if (Array.isArray(queryParams.fileTypeLimits)) {
|
|
1160
|
+
queryParams.fileTypeLimits = queryParams.fileTypeLimits.join(",");
|
|
1161
|
+
}
|
|
1162
|
+
if (typeof queryParams.userMetadata === "object") {
|
|
1163
|
+
queryParams.userMetadata = JSON.stringify(queryParams.userMetadata);
|
|
1164
|
+
}
|
|
1165
|
+
return this.http.patch(`/api/links/${link}`, {}, {
|
|
1166
|
+
params: queryParams,
|
|
1167
|
+
headers: options.headers,
|
|
1168
|
+
signal: options.signal
|
|
1169
|
+
});
|
|
1170
|
+
}
|
|
1171
|
+
/**
|
|
1172
|
+
* Revokes an existing link.
|
|
1173
|
+
* Swagger: DELETE /api/links/{link}
|
|
1174
|
+
*/
|
|
1175
|
+
async revokeLink(link, options = {}) {
|
|
1176
|
+
return this.http.delete(`/api/links/${link}`, {
|
|
1177
|
+
headers: options.headers,
|
|
1178
|
+
signal: options.signal
|
|
1179
|
+
});
|
|
1180
|
+
}
|
|
1181
|
+
/**
|
|
1182
|
+
* Downloads a file using its public shared link.
|
|
1183
|
+
* Swagger: GET /api/links/{hash}
|
|
1184
|
+
*/
|
|
1185
|
+
async downloadFileByLink(hash, params = {}, options = {}) {
|
|
1186
|
+
return this.http.get(`/api/links/${hash}`, {
|
|
1187
|
+
params,
|
|
1188
|
+
headers: options.headers,
|
|
1189
|
+
signal: options.signal,
|
|
1190
|
+
responseType: "blob"
|
|
1191
|
+
});
|
|
1192
|
+
}
|
|
1193
|
+
};
|
|
1194
|
+
|
|
1195
|
+
// src/services/podspace/shares.ts
|
|
1196
|
+
var PodspaceSharesService = class {
|
|
1197
|
+
http;
|
|
1198
|
+
constructor(options) {
|
|
1199
|
+
this.http = options.http;
|
|
1200
|
+
}
|
|
1201
|
+
/**
|
|
1202
|
+
* Shares a file or folder with a user by their identity (username/ssoId).
|
|
1203
|
+
* Swagger: POST /api/files/{hash}/shares/users/{identity}
|
|
1204
|
+
*/
|
|
1205
|
+
async shareWithUser(hash, identity, params, options = {}) {
|
|
1206
|
+
const queryParams = { ...params };
|
|
1207
|
+
if (Array.isArray(queryParams.access)) queryParams.access = queryParams.access.join(",");
|
|
1208
|
+
return this.http.post(`/api/files/${hash}/shares/users/${identity}`, {}, {
|
|
1209
|
+
params: queryParams,
|
|
1210
|
+
headers: options.headers,
|
|
1211
|
+
signal: options.signal
|
|
1212
|
+
});
|
|
1213
|
+
}
|
|
1214
|
+
/**
|
|
1215
|
+
* Removes share for a specific user identity.
|
|
1216
|
+
* Swagger: DELETE /api/files/{hash}/shares/users/{identity}
|
|
1217
|
+
*/
|
|
1218
|
+
async removeShareWithUser(hash, identity, identityType, options = {}) {
|
|
1219
|
+
return this.http.delete(`/api/files/${hash}/shares/users/${identity}`, {
|
|
1220
|
+
params: { identityType },
|
|
1221
|
+
headers: options.headers,
|
|
1222
|
+
signal: options.signal
|
|
1223
|
+
});
|
|
1224
|
+
}
|
|
1225
|
+
/**
|
|
1226
|
+
* Makes a file or folder public with optional password and expiration.
|
|
1227
|
+
* Swagger: POST /api/files/{hash}/public
|
|
1228
|
+
*/
|
|
1229
|
+
async makePublic(hash, params, options = {}) {
|
|
1230
|
+
const queryParams = { ...params };
|
|
1231
|
+
if (Array.isArray(queryParams.access)) queryParams.access = queryParams.access.join(",");
|
|
1232
|
+
return this.http.post(`/api/files/${hash}/public`, {}, {
|
|
1233
|
+
params: queryParams,
|
|
1234
|
+
headers: options.headers,
|
|
1235
|
+
signal: options.signal
|
|
1236
|
+
});
|
|
1237
|
+
}
|
|
1238
|
+
/**
|
|
1239
|
+
* Retrieves list of files and folders shared with current user.
|
|
1240
|
+
* Swagger: GET /api/shares
|
|
1241
|
+
*/
|
|
1242
|
+
async getSharedWithMe(params = {}, options = {}) {
|
|
1243
|
+
return this.http.get("/api/shares", {
|
|
1244
|
+
params,
|
|
1245
|
+
headers: options.headers,
|
|
1246
|
+
signal: options.signal
|
|
1247
|
+
});
|
|
1248
|
+
}
|
|
1249
|
+
/**
|
|
1250
|
+
* Retrieves details of a share by its share hash.
|
|
1251
|
+
* Swagger: GET /api/shares/{shareHash}
|
|
1252
|
+
*/
|
|
1253
|
+
async getShareDetail(shareHash, password, options = {}) {
|
|
1254
|
+
return this.http.get(`/api/shares/${shareHash}`, {
|
|
1255
|
+
params: { password },
|
|
1256
|
+
headers: options.headers,
|
|
1257
|
+
signal: options.signal
|
|
1258
|
+
});
|
|
1259
|
+
}
|
|
1260
|
+
/**
|
|
1261
|
+
* Revokes a share by its share hash.
|
|
1262
|
+
* Swagger: DELETE /api/shares/{shareHash}
|
|
1263
|
+
*/
|
|
1264
|
+
async revokeShare(shareHash, options = {}) {
|
|
1265
|
+
return this.http.delete(`/api/shares/${shareHash}`, {
|
|
1266
|
+
headers: options.headers,
|
|
1267
|
+
signal: options.signal
|
|
1268
|
+
});
|
|
1269
|
+
}
|
|
1270
|
+
/**
|
|
1271
|
+
* Retrieves shares list of a specific file or folder.
|
|
1272
|
+
* Swagger: GET /api/files/{hash}/shares
|
|
1273
|
+
*/
|
|
1274
|
+
async getFileShares(hash, params = {}, options = {}) {
|
|
1275
|
+
return this.http.get(`/api/files/${hash}/shares`, {
|
|
1276
|
+
params,
|
|
1277
|
+
headers: options.headers,
|
|
1278
|
+
signal: options.signal
|
|
1279
|
+
});
|
|
1280
|
+
}
|
|
1281
|
+
/**
|
|
1282
|
+
* Sets or removes password for a share using the share hash.
|
|
1283
|
+
* Swagger: PUT /api/shares/{hash}/password
|
|
1284
|
+
*/
|
|
1285
|
+
async setSharePassword(shareHash, password, options = {}) {
|
|
1286
|
+
return this.http.put(`/api/shares/${shareHash}/password`, {}, {
|
|
1287
|
+
params: { password },
|
|
1288
|
+
headers: options.headers,
|
|
1289
|
+
signal: options.signal
|
|
1290
|
+
});
|
|
1291
|
+
}
|
|
1292
|
+
/**
|
|
1293
|
+
* Sets or removes password for a share using the entity hash.
|
|
1294
|
+
* Swagger: PUT /api/files/{hash}/shares/password
|
|
1295
|
+
*/
|
|
1296
|
+
async setEntityPassword(entityHash, password, options = {}) {
|
|
1297
|
+
return this.http.put(`/api/files/${entityHash}/shares/password`, {}, {
|
|
1298
|
+
params: { password },
|
|
1299
|
+
headers: options.headers,
|
|
1300
|
+
signal: options.signal
|
|
1301
|
+
});
|
|
1302
|
+
}
|
|
1303
|
+
};
|
|
1304
|
+
|
|
1305
|
+
// src/services/podspace/trash.ts
|
|
1306
|
+
var PodspaceTrashService = class {
|
|
1307
|
+
http;
|
|
1308
|
+
constructor(options) {
|
|
1309
|
+
this.http = options.http;
|
|
1310
|
+
}
|
|
1311
|
+
/**
|
|
1312
|
+
* Retrieves list of trashed files and folders.
|
|
1313
|
+
* Swagger: GET /api/trashes
|
|
1314
|
+
*/
|
|
1315
|
+
async getTrashList(params = {}, options = {}) {
|
|
1316
|
+
return this.http.get("/api/trashes", {
|
|
1317
|
+
params,
|
|
1318
|
+
headers: options.headers,
|
|
1319
|
+
signal: options.signal
|
|
1320
|
+
});
|
|
1321
|
+
}
|
|
1322
|
+
/**
|
|
1323
|
+
* Restores a single file or folder from the trash.
|
|
1324
|
+
* Swagger: PUT /api/trashes/{hash}/restore
|
|
1325
|
+
*/
|
|
1326
|
+
async restore(hash, options = {}) {
|
|
1327
|
+
return this.http.put(`/api/trashes/${hash}/restore`, {}, {
|
|
1328
|
+
headers: options.headers,
|
|
1329
|
+
signal: options.signal
|
|
1330
|
+
});
|
|
1331
|
+
}
|
|
1332
|
+
/**
|
|
1333
|
+
* Restores all entities from trash.
|
|
1334
|
+
* Swagger: POST /api/trashes/restore
|
|
1335
|
+
*/
|
|
1336
|
+
async restoreAll(options = {}) {
|
|
1337
|
+
return this.http.post("/api/trashes/restore", {}, {
|
|
1338
|
+
headers: options.headers,
|
|
1339
|
+
signal: options.signal
|
|
1340
|
+
});
|
|
1341
|
+
}
|
|
1342
|
+
/**
|
|
1343
|
+
* Permanently deletes a single file or folder from the trash.
|
|
1344
|
+
* Swagger: DELETE /api/trashes/{hash}
|
|
1345
|
+
*/
|
|
1346
|
+
async deletePermanently(hash, force, options = {}) {
|
|
1347
|
+
return this.http.delete(`/api/trashes/${hash}`, {
|
|
1348
|
+
params: { force },
|
|
1349
|
+
headers: options.headers,
|
|
1350
|
+
signal: options.signal
|
|
1351
|
+
});
|
|
1352
|
+
}
|
|
1353
|
+
/**
|
|
1354
|
+
* Permanently empties all files and folders from the trash.
|
|
1355
|
+
* Swagger: DELETE /api/trashes
|
|
1356
|
+
*/
|
|
1357
|
+
async emptyTrash(options = {}) {
|
|
1358
|
+
return this.http.delete("/api/trashes", {
|
|
1359
|
+
headers: options.headers,
|
|
1360
|
+
signal: options.signal
|
|
1361
|
+
});
|
|
1362
|
+
}
|
|
1363
|
+
/**
|
|
1364
|
+
* Sets auto clean-up period for trash in days.
|
|
1365
|
+
* Swagger: POST /api/trashes/periods/{period}
|
|
1366
|
+
*/
|
|
1367
|
+
async setAutoCleanUpPeriod(period, options = {}) {
|
|
1368
|
+
return this.http.post(`/api/trashes/periods/${period}`, {}, {
|
|
1369
|
+
headers: options.headers,
|
|
1370
|
+
signal: options.signal
|
|
1371
|
+
});
|
|
1372
|
+
}
|
|
1373
|
+
};
|
|
1374
|
+
|
|
1375
|
+
// src/services/podspace/tags.ts
|
|
1376
|
+
var PodspaceTagsService = class {
|
|
1377
|
+
http;
|
|
1378
|
+
constructor(options) {
|
|
1379
|
+
this.http = options.http;
|
|
1380
|
+
}
|
|
1381
|
+
/**
|
|
1382
|
+
* Adds tags to a file or folder.
|
|
1383
|
+
* Swagger: POST /api/tags
|
|
1384
|
+
*/
|
|
1385
|
+
async addTags(hash, tags, options = {}) {
|
|
1386
|
+
const tagsParam = Array.isArray(tags) ? tags.join(",") : tags;
|
|
1387
|
+
return this.http.post("/api/tags", {}, {
|
|
1388
|
+
params: { hash, tags: tagsParam },
|
|
1389
|
+
headers: options.headers,
|
|
1390
|
+
signal: options.signal
|
|
1391
|
+
});
|
|
1392
|
+
}
|
|
1393
|
+
/**
|
|
1394
|
+
* Deletes tags from a file or folder.
|
|
1395
|
+
* Swagger: DELETE /api/tags
|
|
1396
|
+
*/
|
|
1397
|
+
async deleteTags(hash, tags, options = {}) {
|
|
1398
|
+
const tagsParam = Array.isArray(tags) ? tags.join(",") : tags;
|
|
1399
|
+
return this.http.delete("/api/tags", {
|
|
1400
|
+
params: { hash, tags: tagsParam },
|
|
1401
|
+
headers: options.headers,
|
|
1402
|
+
signal: options.signal
|
|
1403
|
+
});
|
|
1404
|
+
}
|
|
1405
|
+
/**
|
|
1406
|
+
* Retrieves tags of a file or folder.
|
|
1407
|
+
* Swagger: GET /api/tags/entities/{hash}
|
|
1408
|
+
*/
|
|
1409
|
+
async getEntityTags(hash, password, options = {}) {
|
|
1410
|
+
return this.http.get(`/api/tags/entities/${hash}`, {
|
|
1411
|
+
params: { password },
|
|
1412
|
+
headers: options.headers,
|
|
1413
|
+
signal: options.signal
|
|
1414
|
+
});
|
|
1415
|
+
}
|
|
1416
|
+
/**
|
|
1417
|
+
* Searches for existing tags with autocomplete.
|
|
1418
|
+
* Swagger: GET /api/tags/search/{tagName}
|
|
1419
|
+
*/
|
|
1420
|
+
async searchTags(tagName, params = {}, options = {}) {
|
|
1421
|
+
return this.http.get(`/api/tags/search/${tagName}`, {
|
|
1422
|
+
params,
|
|
1423
|
+
headers: options.headers,
|
|
1424
|
+
signal: options.signal
|
|
1425
|
+
});
|
|
1426
|
+
}
|
|
1427
|
+
/**
|
|
1428
|
+
* Retrieves list of files/folders that contain a specific tag.
|
|
1429
|
+
* Swagger: GET /api/tags/{tagName}
|
|
1430
|
+
*/
|
|
1431
|
+
async getEntitiesByTag(tagName, params = {}, options = {}) {
|
|
1432
|
+
return this.http.get(`/api/tags/${tagName}`, {
|
|
1433
|
+
params,
|
|
1434
|
+
headers: options.headers,
|
|
1435
|
+
signal: options.signal
|
|
1436
|
+
});
|
|
1437
|
+
}
|
|
1438
|
+
};
|
|
1439
|
+
|
|
1440
|
+
// src/services/podspace/bookmarks.ts
|
|
1441
|
+
var PodspaceBookmarksService = class {
|
|
1442
|
+
http;
|
|
1443
|
+
constructor(options) {
|
|
1444
|
+
this.http = options.http;
|
|
1445
|
+
}
|
|
1446
|
+
/**
|
|
1447
|
+
* Retrieves list of bookmarked files and folders.
|
|
1448
|
+
* Swagger: GET /api/bookmarks
|
|
1449
|
+
*/
|
|
1450
|
+
async getBookmarks(params = {}, options = {}) {
|
|
1451
|
+
return this.http.get("/api/bookmarks", {
|
|
1452
|
+
params,
|
|
1453
|
+
headers: options.headers,
|
|
1454
|
+
signal: options.signal
|
|
1455
|
+
});
|
|
1456
|
+
}
|
|
1457
|
+
/**
|
|
1458
|
+
* Adds a file or folder to bookmarks.
|
|
1459
|
+
* Swagger: POST /api/bookmarks
|
|
1460
|
+
*/
|
|
1461
|
+
async addBookmark(hash, options = {}) {
|
|
1462
|
+
return this.http.post("/api/bookmarks", {}, {
|
|
1463
|
+
params: { hash },
|
|
1464
|
+
headers: options.headers,
|
|
1465
|
+
signal: options.signal
|
|
1466
|
+
});
|
|
1467
|
+
}
|
|
1468
|
+
/**
|
|
1469
|
+
* Removes a file or folder from bookmarks.
|
|
1470
|
+
* Swagger: DELETE /api/bookmarks
|
|
1471
|
+
*/
|
|
1472
|
+
async removeBookmark(hash, options = {}) {
|
|
1473
|
+
return this.http.delete("/api/bookmarks", {
|
|
1474
|
+
params: { hash },
|
|
1475
|
+
headers: options.headers,
|
|
1476
|
+
signal: options.signal
|
|
1477
|
+
});
|
|
1478
|
+
}
|
|
1479
|
+
};
|
|
1480
|
+
|
|
1481
|
+
// src/services/podspace/metadata.ts
|
|
1482
|
+
var PodspaceMetadataService = class {
|
|
1483
|
+
http;
|
|
1484
|
+
constructor(options) {
|
|
1485
|
+
this.http = options.http;
|
|
1486
|
+
}
|
|
1487
|
+
/**
|
|
1488
|
+
* Retrieves metadata key-value dictionary for a file.
|
|
1489
|
+
* Swagger: GET /api/files/{hash}/metadata
|
|
1490
|
+
*/
|
|
1491
|
+
async getMetadata(hash, keys, options = {}) {
|
|
1492
|
+
const keysParam = Array.isArray(keys) ? keys.join(",") : keys;
|
|
1493
|
+
return this.http.get(`/api/files/${hash}/metadata`, {
|
|
1494
|
+
params: { keys: keysParam },
|
|
1495
|
+
headers: options.headers,
|
|
1496
|
+
signal: options.signal
|
|
1497
|
+
});
|
|
1498
|
+
}
|
|
1499
|
+
/**
|
|
1500
|
+
* Adds or updates metadata dictionary for a file.
|
|
1501
|
+
* Swagger: PUT /api/files/{hash}/metadata
|
|
1502
|
+
*/
|
|
1503
|
+
async setMetadata(hash, metadata, options = {}) {
|
|
1504
|
+
return this.http.put(`/api/files/${hash}/metadata`, metadata, {
|
|
1505
|
+
headers: options.headers,
|
|
1506
|
+
signal: options.signal
|
|
1507
|
+
});
|
|
1508
|
+
}
|
|
1509
|
+
/**
|
|
1510
|
+
* Deletes specific metadata keys from a file.
|
|
1511
|
+
* Swagger: DELETE /api/files/{hash}/metadata
|
|
1512
|
+
*/
|
|
1513
|
+
async deleteMetadata(hash, keys, options = {}) {
|
|
1514
|
+
const keysParam = Array.isArray(keys) ? keys.join(",") : keys;
|
|
1515
|
+
return this.http.delete(`/api/files/${hash}/metadata`, {
|
|
1516
|
+
params: { keys: keysParam },
|
|
1517
|
+
headers: options.headers,
|
|
1518
|
+
signal: options.signal
|
|
1519
|
+
});
|
|
1520
|
+
}
|
|
1521
|
+
/**
|
|
1522
|
+
* Searches metadata across files with specified parent.
|
|
1523
|
+
* Swagger: POST /api/files/metadata/search
|
|
1524
|
+
*/
|
|
1525
|
+
async searchMetadata(queryBody, params = {}, options = {}) {
|
|
1526
|
+
return this.http.post("/api/files/metadata/search", queryBody, {
|
|
1527
|
+
params,
|
|
1528
|
+
headers: options.headers,
|
|
1529
|
+
signal: options.signal
|
|
1530
|
+
});
|
|
1531
|
+
}
|
|
1532
|
+
/**
|
|
1533
|
+
* Retrieves description of a file or folder.
|
|
1534
|
+
* Swagger: GET /api/files/description
|
|
1535
|
+
*/
|
|
1536
|
+
async getDescription(hash, options = {}) {
|
|
1537
|
+
return this.http.get("/api/files/description", {
|
|
1538
|
+
params: { hash },
|
|
1539
|
+
headers: options.headers,
|
|
1540
|
+
signal: options.signal
|
|
1541
|
+
});
|
|
1542
|
+
}
|
|
1543
|
+
/**
|
|
1544
|
+
* Adds or updates description of a file or folder.
|
|
1545
|
+
* Swagger: PUT /api/files/description
|
|
1546
|
+
*/
|
|
1547
|
+
async setDescription(hash, description, options = {}) {
|
|
1548
|
+
return this.http.put("/api/files/description", {}, {
|
|
1549
|
+
params: { hash, description },
|
|
1550
|
+
headers: options.headers,
|
|
1551
|
+
signal: options.signal
|
|
1552
|
+
});
|
|
1553
|
+
}
|
|
1554
|
+
/**
|
|
1555
|
+
* Deletes description of a file or folder.
|
|
1556
|
+
* Swagger: DELETE /api/files/description
|
|
1557
|
+
*/
|
|
1558
|
+
async deleteDescription(hash, options = {}) {
|
|
1559
|
+
return this.http.delete("/api/files/description", {
|
|
1560
|
+
params: { hash },
|
|
1561
|
+
headers: options.headers,
|
|
1562
|
+
signal: options.signal
|
|
1563
|
+
});
|
|
1564
|
+
}
|
|
1565
|
+
};
|
|
1566
|
+
|
|
1567
|
+
// src/services/podspace/userGroups.ts
|
|
1568
|
+
var PodspaceUserGroupsService = class {
|
|
1569
|
+
http;
|
|
1570
|
+
constructor(options) {
|
|
1571
|
+
this.http = options.http;
|
|
1572
|
+
}
|
|
1573
|
+
/**
|
|
1574
|
+
* Creates a new user group for team collaboration.
|
|
1575
|
+
* Swagger: POST /api/usergroups
|
|
1576
|
+
*/
|
|
1577
|
+
async createUserGroup(params, options = {}) {
|
|
1578
|
+
const queryParams = { ...params };
|
|
1579
|
+
if (Array.isArray(queryParams.zoneNames)) queryParams.zoneNames = queryParams.zoneNames.join(",");
|
|
1580
|
+
if (typeof queryParams.metadata === "object") queryParams.metadata = JSON.stringify(queryParams.metadata);
|
|
1581
|
+
return this.http.post("/api/usergroups", {}, {
|
|
1582
|
+
params: queryParams,
|
|
1583
|
+
headers: options.headers,
|
|
1584
|
+
signal: options.signal
|
|
1585
|
+
});
|
|
1586
|
+
}
|
|
1587
|
+
/**
|
|
1588
|
+
* Retrieves user group info by hash.
|
|
1589
|
+
* Swagger: GET /api/usergroups/{userGroupHash}
|
|
1590
|
+
*/
|
|
1591
|
+
async getUserGroup(userGroupHash, options = {}) {
|
|
1592
|
+
return this.http.get(`/api/usergroups/${userGroupHash}`, {
|
|
1593
|
+
headers: options.headers,
|
|
1594
|
+
signal: options.signal
|
|
1595
|
+
});
|
|
1596
|
+
}
|
|
1597
|
+
/**
|
|
1598
|
+
* Deletes a user group.
|
|
1599
|
+
* Swagger: DELETE /api/usergroups/{userGroupHash}
|
|
1600
|
+
*/
|
|
1601
|
+
async deleteUserGroup(userGroupHash, options = {}) {
|
|
1602
|
+
return this.http.delete(`/api/usergroups/${userGroupHash}`, {
|
|
1603
|
+
headers: options.headers,
|
|
1604
|
+
signal: options.signal
|
|
1605
|
+
});
|
|
1606
|
+
}
|
|
1607
|
+
/**
|
|
1608
|
+
* Retrieves list of users in a user group.
|
|
1609
|
+
* Swagger: GET /api/usergroups/{userGroupHash}/users
|
|
1610
|
+
*/
|
|
1611
|
+
async getUserGroupUsers(userGroupHash, params = {}, options = {}) {
|
|
1612
|
+
return this.http.get(`/api/usergroups/${userGroupHash}/users`, {
|
|
1613
|
+
params,
|
|
1614
|
+
headers: options.headers,
|
|
1615
|
+
signal: options.signal
|
|
1616
|
+
});
|
|
1617
|
+
}
|
|
1618
|
+
/**
|
|
1619
|
+
* Adds a user to the user group.
|
|
1620
|
+
* Swagger: POST /api/usergroups/{userGroupHash}/users
|
|
1621
|
+
*/
|
|
1622
|
+
async addUserToGroup(userGroupHash, identity, identityType, options = {}) {
|
|
1623
|
+
return this.http.post(`/api/usergroups/${userGroupHash}/users`, {}, {
|
|
1624
|
+
params: { identity, identityType },
|
|
1625
|
+
headers: options.headers,
|
|
1626
|
+
signal: options.signal
|
|
1627
|
+
});
|
|
1628
|
+
}
|
|
1629
|
+
/**
|
|
1630
|
+
* Removes a user from the user group.
|
|
1631
|
+
* Swagger: DELETE /api/usergroups/{userGroupHash}/users
|
|
1632
|
+
*/
|
|
1633
|
+
async removeUserFromGroup(userGroupHash, identity, identityType, options = {}) {
|
|
1634
|
+
return this.http.delete(`/api/usergroups/${userGroupHash}/users`, {
|
|
1635
|
+
params: { identity, identityType },
|
|
1636
|
+
headers: options.headers,
|
|
1637
|
+
signal: options.signal
|
|
1638
|
+
});
|
|
1639
|
+
}
|
|
1640
|
+
/**
|
|
1641
|
+
* Retrieves list of files belonging to user group.
|
|
1642
|
+
* Swagger: GET /api/usergroups/{usergroupHash}/files
|
|
1643
|
+
*/
|
|
1644
|
+
async getUserGroupFiles(userGroupHash, params = {}, options = {}) {
|
|
1645
|
+
return this.http.get(`/api/usergroups/${userGroupHash}/files`, {
|
|
1646
|
+
params,
|
|
1647
|
+
headers: options.headers,
|
|
1648
|
+
signal: options.signal
|
|
1649
|
+
});
|
|
1650
|
+
}
|
|
1651
|
+
/**
|
|
1652
|
+
* Uploads a file directly into a user group.
|
|
1653
|
+
* Swagger: POST /api/usergroups/{userGroupHash}/files
|
|
1654
|
+
*/
|
|
1655
|
+
async uploadToUserGroup(userGroupHash, formData, options = {}) {
|
|
1656
|
+
return this.http.post(`/api/usergroups/${userGroupHash}/files`, formData, {
|
|
1657
|
+
headers: options.headers,
|
|
1658
|
+
signal: options.signal
|
|
1659
|
+
});
|
|
1660
|
+
}
|
|
1661
|
+
/**
|
|
1662
|
+
* Uploads an image directly into a user group.
|
|
1663
|
+
* Swagger: POST /api/usergroups/{userGroupHash}/images
|
|
1664
|
+
*/
|
|
1665
|
+
async uploadImageToUserGroup(userGroupHash, formData, options = {}) {
|
|
1666
|
+
return this.http.post(`/api/usergroups/${userGroupHash}/images`, formData, {
|
|
1667
|
+
headers: options.headers,
|
|
1668
|
+
signal: options.signal
|
|
1669
|
+
});
|
|
1670
|
+
}
|
|
1671
|
+
/**
|
|
1672
|
+
* Retrieves storage usage report for a user group.
|
|
1673
|
+
* Swagger: GET /api/usergroups/{userGroupHash}/usage
|
|
1674
|
+
*/
|
|
1675
|
+
async getUserGroupUsage(userGroupHash, options = {}) {
|
|
1676
|
+
return this.http.get(`/api/usergroups/${userGroupHash}/usage`, {
|
|
1677
|
+
headers: options.headers,
|
|
1678
|
+
signal: options.signal
|
|
1679
|
+
});
|
|
1680
|
+
}
|
|
1681
|
+
};
|
|
1682
|
+
|
|
1683
|
+
// src/services/podspace/workspaces.ts
|
|
1684
|
+
var PodspaceWorkspacesService = class {
|
|
1685
|
+
http;
|
|
1686
|
+
constructor(options) {
|
|
1687
|
+
this.http = options.http;
|
|
1688
|
+
}
|
|
1689
|
+
/**
|
|
1690
|
+
* Creates a new collaborative Workspace.
|
|
1691
|
+
* Swagger: POST /api/workspaces
|
|
1692
|
+
*/
|
|
1693
|
+
async createWorkspace(params, options = {}) {
|
|
1694
|
+
return this.http.post("/api/workspaces", {}, {
|
|
1695
|
+
params,
|
|
1696
|
+
headers: options.headers,
|
|
1697
|
+
signal: options.signal
|
|
1698
|
+
});
|
|
1699
|
+
}
|
|
1700
|
+
/**
|
|
1701
|
+
* Retrieves workspace details by its identity/username.
|
|
1702
|
+
* Swagger: GET /api/workspaces/{identity}
|
|
1703
|
+
*/
|
|
1704
|
+
async getWorkspace(identity, identityType, options = {}) {
|
|
1705
|
+
return this.http.get(`/api/workspaces/${identity}`, {
|
|
1706
|
+
params: { identityType },
|
|
1707
|
+
headers: options.headers,
|
|
1708
|
+
signal: options.signal
|
|
1709
|
+
});
|
|
1710
|
+
}
|
|
1711
|
+
/**
|
|
1712
|
+
* Updates workspace information.
|
|
1713
|
+
* Swagger: PATCH /api/workspaces/{identity}
|
|
1714
|
+
*/
|
|
1715
|
+
async updateWorkspace(identity, params = {}, options = {}) {
|
|
1716
|
+
return this.http.patch(`/api/workspaces/${identity}`, {}, {
|
|
1717
|
+
params,
|
|
1718
|
+
headers: options.headers,
|
|
1719
|
+
signal: options.signal
|
|
1720
|
+
});
|
|
1721
|
+
}
|
|
1722
|
+
/**
|
|
1723
|
+
* Retrieves members list of a workspace.
|
|
1724
|
+
* Swagger: GET /api/workspaces/{identity}/members
|
|
1725
|
+
*/
|
|
1726
|
+
async getWorkspaceMembers(identity, identityType, options = {}) {
|
|
1727
|
+
return this.http.get(`/api/workspaces/${identity}/members`, {
|
|
1728
|
+
params: { identityType },
|
|
1729
|
+
headers: options.headers,
|
|
1730
|
+
signal: options.signal
|
|
1731
|
+
});
|
|
1732
|
+
}
|
|
1733
|
+
/**
|
|
1734
|
+
* Adds or updates a member's access level in a workspace.
|
|
1735
|
+
* Swagger: PUT /api/workspaces/{identity}/members/{userIdentity}
|
|
1736
|
+
*/
|
|
1737
|
+
async updateWorkspaceMember(identity, userIdentity, accessLevel, params = {}, options = {}) {
|
|
1738
|
+
return this.http.put(`/api/workspaces/${identity}/members/${userIdentity}`, {}, {
|
|
1739
|
+
params: { accessLevel, ...params },
|
|
1740
|
+
headers: options.headers,
|
|
1741
|
+
signal: options.signal
|
|
1742
|
+
});
|
|
1743
|
+
}
|
|
1744
|
+
/**
|
|
1745
|
+
* Removes a member from a workspace.
|
|
1746
|
+
* Swagger: DELETE /api/workspaces/{identity}/members/{userIdentity}
|
|
1747
|
+
*/
|
|
1748
|
+
async removeWorkspaceMember(identity, userIdentity, params = {}, options = {}) {
|
|
1749
|
+
return this.http.delete(`/api/workspaces/${identity}/members/${userIdentity}`, {
|
|
1750
|
+
params,
|
|
1751
|
+
headers: options.headers,
|
|
1752
|
+
signal: options.signal
|
|
1753
|
+
});
|
|
1754
|
+
}
|
|
1755
|
+
};
|
|
1756
|
+
|
|
1757
|
+
// src/services/podspace/me.ts
|
|
1758
|
+
var PodspaceMeService = class {
|
|
1759
|
+
http;
|
|
1760
|
+
constructor(options) {
|
|
1761
|
+
this.http = options.http;
|
|
1762
|
+
}
|
|
1763
|
+
/**
|
|
1764
|
+
* Retrieves profile information of current authenticated user.
|
|
1765
|
+
* Swagger: GET /api/me
|
|
1766
|
+
*/
|
|
1767
|
+
async getUser(options = {}) {
|
|
1768
|
+
return this.http.get("/api/me", {
|
|
1769
|
+
headers: options.headers,
|
|
1770
|
+
signal: options.signal
|
|
1771
|
+
});
|
|
1772
|
+
}
|
|
1773
|
+
/**
|
|
1774
|
+
* Retrieves workspaces accessible to the user.
|
|
1775
|
+
* Swagger: GET /api/me/workspaces
|
|
1776
|
+
*/
|
|
1777
|
+
async getUserWorkspaces(params = {}, options = {}) {
|
|
1778
|
+
return this.http.get("/api/me/workspaces", {
|
|
1779
|
+
params,
|
|
1780
|
+
headers: options.headers,
|
|
1781
|
+
signal: options.signal
|
|
1782
|
+
});
|
|
1783
|
+
}
|
|
1784
|
+
/**
|
|
1785
|
+
* Retrieves user account status on PodSpace.
|
|
1786
|
+
* Swagger: GET /api/me/status
|
|
1787
|
+
*/
|
|
1788
|
+
async getUserStatus(options = {}) {
|
|
1789
|
+
return this.http.get("/api/me/status", {
|
|
1790
|
+
headers: options.headers,
|
|
1791
|
+
signal: options.signal
|
|
1792
|
+
});
|
|
1793
|
+
}
|
|
1794
|
+
/**
|
|
1795
|
+
* Retrieves user OAuth scopes.
|
|
1796
|
+
* Swagger: GET /api/me/scope
|
|
1797
|
+
*/
|
|
1798
|
+
async getUserScope(options = {}) {
|
|
1799
|
+
return this.http.get("/api/me/scope", {
|
|
1800
|
+
headers: options.headers,
|
|
1801
|
+
signal: options.signal
|
|
1802
|
+
});
|
|
1803
|
+
}
|
|
1804
|
+
/**
|
|
1805
|
+
* Retrieves storage usage report for current user.
|
|
1806
|
+
* Swagger: GET /api/me/reports/usage
|
|
1807
|
+
*/
|
|
1808
|
+
async getUserUsageReport(majorType, options = {}) {
|
|
1809
|
+
return this.http.get("/api/me/reports/usage", {
|
|
1810
|
+
params: { majorType },
|
|
1811
|
+
headers: options.headers,
|
|
1812
|
+
signal: options.signal
|
|
1813
|
+
});
|
|
1814
|
+
}
|
|
1815
|
+
/**
|
|
1816
|
+
* Retrieves user storage plans and quota limits.
|
|
1817
|
+
* Swagger: GET /api/me/plans
|
|
1818
|
+
*/
|
|
1819
|
+
async getUserPlans(options = {}) {
|
|
1820
|
+
return this.http.get("/api/me/plans", {
|
|
1821
|
+
headers: options.headers,
|
|
1822
|
+
signal: options.signal
|
|
1823
|
+
});
|
|
1824
|
+
}
|
|
1825
|
+
/**
|
|
1826
|
+
* Retrieves or creates the user's personal root folder.
|
|
1827
|
+
* Swagger: GET /api/me/folder
|
|
1828
|
+
*/
|
|
1829
|
+
async getPersonalFolder(options = {}) {
|
|
1830
|
+
return this.http.get("/api/me/folder", {
|
|
1831
|
+
headers: options.headers,
|
|
1832
|
+
signal: options.signal
|
|
1833
|
+
});
|
|
1834
|
+
}
|
|
1835
|
+
/**
|
|
1836
|
+
* Retrieves or creates the user's dedicated chat attachments folder.
|
|
1837
|
+
* Swagger: GET /api/me/folders/chat
|
|
1838
|
+
*/
|
|
1839
|
+
async getOrCreateChatFolder(options = {}) {
|
|
1840
|
+
return this.http.get("/api/me/folders/chat", {
|
|
1841
|
+
headers: options.headers,
|
|
1842
|
+
signal: options.signal
|
|
1843
|
+
});
|
|
1844
|
+
}
|
|
1845
|
+
/**
|
|
1846
|
+
* Retrieves the user's avatar image binary or URL.
|
|
1847
|
+
* Swagger: GET /api/me/avatar
|
|
1848
|
+
*/
|
|
1849
|
+
async getUserAvatar(options = {}) {
|
|
1850
|
+
return this.http.get("/api/me/avatar", {
|
|
1851
|
+
headers: options.headers,
|
|
1852
|
+
signal: options.signal,
|
|
1853
|
+
responseType: "blob"
|
|
1854
|
+
});
|
|
1855
|
+
}
|
|
1856
|
+
};
|
|
1857
|
+
|
|
1858
|
+
// src/services/podspace/index.ts
|
|
516
1859
|
var PodspaceService = class {
|
|
517
1860
|
http;
|
|
518
1861
|
apiToken;
|
|
519
1862
|
baseUrl;
|
|
1863
|
+
revalidate;
|
|
1864
|
+
/** Upload & Download sub-service */
|
|
1865
|
+
uploadDownload;
|
|
1866
|
+
/** Files management sub-service */
|
|
1867
|
+
files;
|
|
1868
|
+
/** Folders management sub-service */
|
|
1869
|
+
folders;
|
|
1870
|
+
/** Resumable upload sub-service */
|
|
1871
|
+
resumable;
|
|
1872
|
+
/** Links & Public Access sub-service */
|
|
1873
|
+
links;
|
|
1874
|
+
/** Shares & Permissions sub-service */
|
|
1875
|
+
shares;
|
|
1876
|
+
/** Trash & Permanent Delete sub-service */
|
|
1877
|
+
trash;
|
|
1878
|
+
/** Tags sub-service */
|
|
1879
|
+
tags;
|
|
1880
|
+
/** Bookmarks sub-service */
|
|
1881
|
+
bookmarks;
|
|
1882
|
+
/** Metadata & Descriptions sub-service */
|
|
1883
|
+
metadata;
|
|
1884
|
+
/** Team User Groups sub-service */
|
|
1885
|
+
userGroups;
|
|
1886
|
+
/** Workspaces sub-service */
|
|
1887
|
+
workspaces;
|
|
1888
|
+
/** User Account & Quota sub-service */
|
|
1889
|
+
me;
|
|
520
1890
|
constructor(options) {
|
|
521
1891
|
this.baseUrl = options.baseUrl;
|
|
522
1892
|
this.apiToken = options.apiToken || "";
|
|
523
|
-
this.
|
|
1893
|
+
this.revalidate = Number(options.revalidate) || 0;
|
|
1894
|
+
const authHeader = this.apiToken ? this.apiToken.startsWith("Bearer ") ? this.apiToken : `Bearer ${this.apiToken}` : "";
|
|
1895
|
+
this.http = options.http || createNextHttp({
|
|
524
1896
|
baseUrl: options.baseUrl,
|
|
525
1897
|
serviceName: "POD-Podspace",
|
|
526
1898
|
headers: {
|
|
527
|
-
Authorization:
|
|
1899
|
+
...authHeader ? { Authorization: authHeader, _token_: this.apiToken } : {}
|
|
528
1900
|
}
|
|
529
1901
|
});
|
|
1902
|
+
this.uploadDownload = new PodspaceUploadDownloadService({
|
|
1903
|
+
http: this.http,
|
|
1904
|
+
baseUrl: this.baseUrl,
|
|
1905
|
+
revalidate: this.revalidate
|
|
1906
|
+
});
|
|
1907
|
+
this.files = new PodspaceFilesService({
|
|
1908
|
+
http: this.http,
|
|
1909
|
+
revalidate: this.revalidate
|
|
1910
|
+
});
|
|
1911
|
+
this.folders = new PodspaceFoldersService({
|
|
1912
|
+
http: this.http,
|
|
1913
|
+
revalidate: this.revalidate
|
|
1914
|
+
});
|
|
1915
|
+
this.resumable = new PodspaceResumableService({
|
|
1916
|
+
http: this.http
|
|
1917
|
+
});
|
|
1918
|
+
this.links = new PodspaceLinksService({
|
|
1919
|
+
http: this.http
|
|
1920
|
+
});
|
|
1921
|
+
this.shares = new PodspaceSharesService({
|
|
1922
|
+
http: this.http
|
|
1923
|
+
});
|
|
1924
|
+
this.trash = new PodspaceTrashService({
|
|
1925
|
+
http: this.http
|
|
1926
|
+
});
|
|
1927
|
+
this.tags = new PodspaceTagsService({
|
|
1928
|
+
http: this.http
|
|
1929
|
+
});
|
|
1930
|
+
this.bookmarks = new PodspaceBookmarksService({
|
|
1931
|
+
http: this.http
|
|
1932
|
+
});
|
|
1933
|
+
this.metadata = new PodspaceMetadataService({
|
|
1934
|
+
http: this.http
|
|
1935
|
+
});
|
|
1936
|
+
this.userGroups = new PodspaceUserGroupsService({
|
|
1937
|
+
http: this.http
|
|
1938
|
+
});
|
|
1939
|
+
this.workspaces = new PodspaceWorkspacesService({
|
|
1940
|
+
http: this.http
|
|
1941
|
+
});
|
|
1942
|
+
this.me = new PodspaceMeService({
|
|
1943
|
+
http: this.http
|
|
1944
|
+
});
|
|
1945
|
+
}
|
|
1946
|
+
// =========================================================================
|
|
1947
|
+
// TOP-LEVEL CONVENIENCE DELEGATES
|
|
1948
|
+
// =========================================================================
|
|
1949
|
+
/**
|
|
1950
|
+
* Uploads a single file (via FormData) to POD Podspace storage.
|
|
1951
|
+
* Maintains 100% backward compatibility with `uploadFile(formData, path, isPublic)`.
|
|
1952
|
+
* Swagger: POST /api/files
|
|
1953
|
+
*/
|
|
1954
|
+
async uploadFile(formData, paramsOrPath = "/", isPublic = true, options = {}) {
|
|
1955
|
+
return this.uploadDownload.uploadFile(formData, paramsOrPath, isPublic, options);
|
|
530
1956
|
}
|
|
531
1957
|
/**
|
|
532
|
-
* Uploads
|
|
1958
|
+
* Uploads multiple files simultaneously.
|
|
1959
|
+
* Swagger: POST /api/files/multiple
|
|
533
1960
|
*/
|
|
534
|
-
async
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
1961
|
+
async uploadMultipleFiles(formData, params = {}, options = {}) {
|
|
1962
|
+
return this.uploadDownload.uploadMultipleFiles(formData, params, options);
|
|
1963
|
+
}
|
|
1964
|
+
/**
|
|
1965
|
+
* Uploads an image from a base64 string.
|
|
1966
|
+
* Swagger: POST /api/images/base64
|
|
1967
|
+
*/
|
|
1968
|
+
async uploadImageBase64(params, options = {}) {
|
|
1969
|
+
return this.uploadDownload.uploadImageBase64(params, options);
|
|
1970
|
+
}
|
|
1971
|
+
/**
|
|
1972
|
+
* Replaces the content of an existing file.
|
|
1973
|
+
* Swagger: PUT /api/files/{hash}
|
|
1974
|
+
*/
|
|
1975
|
+
async replaceFile(hash, formData, params = {}, options = {}) {
|
|
1976
|
+
return this.uploadDownload.replaceFile(hash, formData, params, options);
|
|
1977
|
+
}
|
|
1978
|
+
/**
|
|
1979
|
+
* Downloads raw file data.
|
|
1980
|
+
* Swagger: GET /api/files/{hash}
|
|
1981
|
+
*/
|
|
1982
|
+
async downloadFile(hash, params = {}, options = {}) {
|
|
1983
|
+
return this.uploadDownload.downloadFile(hash, params, options);
|
|
1984
|
+
}
|
|
1985
|
+
/**
|
|
1986
|
+
* Downloads processed image (with resize, crop, format options).
|
|
1987
|
+
* Swagger: GET /api/v2/images/{hash}
|
|
1988
|
+
*/
|
|
1989
|
+
async downloadImage(hash, params = {}, options = {}) {
|
|
1990
|
+
return this.uploadDownload.downloadImage(hash, params, options);
|
|
1991
|
+
}
|
|
1992
|
+
/**
|
|
1993
|
+
* Downloads file thumbnail.
|
|
1994
|
+
* Swagger: GET /api/files/{hash}/thumbnail
|
|
1995
|
+
*/
|
|
1996
|
+
async downloadThumbnail(hash, params = {}, options = {}) {
|
|
1997
|
+
return this.uploadDownload.downloadThumbnail(hash, params, options);
|
|
1998
|
+
}
|
|
1999
|
+
/**
|
|
2000
|
+
* Downloads multiple files and folders compressed into a zip file.
|
|
2001
|
+
* Swagger: GET /api/files
|
|
2002
|
+
*/
|
|
2003
|
+
async downloadFilesAsZip(params, options = {}) {
|
|
2004
|
+
return this.uploadDownload.downloadFilesAsZip(params, options);
|
|
2005
|
+
}
|
|
2006
|
+
/**
|
|
2007
|
+
* Obtains a pre-signed upload link.
|
|
2008
|
+
* Swagger: GET /api/files/link
|
|
2009
|
+
*/
|
|
2010
|
+
async getUploadLink(params, options = {}) {
|
|
2011
|
+
return this.uploadDownload.getUploadLink(params, options);
|
|
542
2012
|
}
|
|
543
2013
|
/**
|
|
544
|
-
* Builds
|
|
2014
|
+
* Builds direct view or download URL for a file.
|
|
545
2015
|
*/
|
|
546
2016
|
getFileUrl(hash, isPublic = true) {
|
|
547
|
-
return
|
|
2017
|
+
return this.uploadDownload.getFileUrl(hash, isPublic);
|
|
2018
|
+
}
|
|
2019
|
+
/**
|
|
2020
|
+
* Builds direct view URL for an image with crop/dimensions.
|
|
2021
|
+
*/
|
|
2022
|
+
getImageUrl(hash, params = {}) {
|
|
2023
|
+
return this.uploadDownload.getImageUrl(hash, params);
|
|
2024
|
+
}
|
|
2025
|
+
/**
|
|
2026
|
+
* Builds thumbnail URL for a file.
|
|
2027
|
+
*/
|
|
2028
|
+
getThumbnailUrl(hash, params = {}) {
|
|
2029
|
+
return this.uploadDownload.getThumbnailUrl(hash, params);
|
|
2030
|
+
}
|
|
2031
|
+
// Folders delegates
|
|
2032
|
+
/**
|
|
2033
|
+
* Creates a new folder.
|
|
2034
|
+
* Swagger: POST /api/folders
|
|
2035
|
+
*/
|
|
2036
|
+
async createFolder(params, options = {}) {
|
|
2037
|
+
return this.folders.createFolder(params, options);
|
|
2038
|
+
}
|
|
2039
|
+
/**
|
|
2040
|
+
* Creates nested directories in a parent folder.
|
|
2041
|
+
* Swagger: POST /api/folders/{hash}/directories
|
|
2042
|
+
*/
|
|
2043
|
+
async createDirectories(hash, directories, options = {}) {
|
|
2044
|
+
return this.folders.createDirectories(hash, directories, options);
|
|
2045
|
+
}
|
|
2046
|
+
/**
|
|
2047
|
+
* Retrieves subfolders and files inside a folder.
|
|
2048
|
+
* Swagger: GET /api/folders/{hash}/children
|
|
2049
|
+
*/
|
|
2050
|
+
async getFolderChildren(hash, params = {}, options = {}) {
|
|
2051
|
+
return this.folders.getFolderChildren(hash, params, options);
|
|
2052
|
+
}
|
|
2053
|
+
// Files delegates
|
|
2054
|
+
/**
|
|
2055
|
+
* Retrieves details of a file or folder.
|
|
2056
|
+
* Swagger: GET /api/files/{hash}/detail
|
|
2057
|
+
*/
|
|
2058
|
+
async getFileDetail(hash, params = {}, options = {}) {
|
|
2059
|
+
return this.files.getFileDetail(hash, params, options);
|
|
2060
|
+
}
|
|
2061
|
+
/**
|
|
2062
|
+
* Retrieves file details using its storage path.
|
|
2063
|
+
* Swagger: GET /api/files/details
|
|
2064
|
+
*/
|
|
2065
|
+
async getFileDetailByPath(path, params = {}, options = {}) {
|
|
2066
|
+
return this.files.getFileDetailByPath(path, params, options);
|
|
2067
|
+
}
|
|
2068
|
+
/**
|
|
2069
|
+
* Checks if a file or folder exists.
|
|
2070
|
+
* Swagger: GET /api/files/{hash}/exist
|
|
2071
|
+
*/
|
|
2072
|
+
async checkEntityExist(hash, fileName, params = {}, options = {}) {
|
|
2073
|
+
return this.files.checkEntityExist(hash, fileName, params, options);
|
|
2074
|
+
}
|
|
2075
|
+
/**
|
|
2076
|
+
* Renames a file or folder.
|
|
2077
|
+
* Swagger: PUT /api/files/{hash}/rename
|
|
2078
|
+
*/
|
|
2079
|
+
async renameEntity(hash, newName, uniqueName, options = {}) {
|
|
2080
|
+
return this.files.renameEntity(hash, newName, uniqueName, options);
|
|
2081
|
+
}
|
|
2082
|
+
/**
|
|
2083
|
+
* Moves a file or folder.
|
|
2084
|
+
* Swagger: PUT /api/files/{hash}/move
|
|
2085
|
+
*/
|
|
2086
|
+
async moveEntity(hash, destFolderHash, params = {}, options = {}) {
|
|
2087
|
+
return this.files.moveEntity(hash, destFolderHash, params, options);
|
|
2088
|
+
}
|
|
2089
|
+
/**
|
|
2090
|
+
* Copies a file or folder.
|
|
2091
|
+
* Swagger: PUT /api/files/{hash}/copy
|
|
2092
|
+
*/
|
|
2093
|
+
async copyEntity(hash, destFolderHash, params = {}, options = {}) {
|
|
2094
|
+
return this.files.copyEntity(hash, destFolderHash, params, options);
|
|
2095
|
+
}
|
|
2096
|
+
/**
|
|
2097
|
+
* Moves a file or folder to trash.
|
|
2098
|
+
* Swagger: DELETE /api/files/{hash}
|
|
2099
|
+
*/
|
|
2100
|
+
async trashEntity(hash, options = {}) {
|
|
2101
|
+
return this.files.trashEntity(hash, options);
|
|
2102
|
+
}
|
|
2103
|
+
/**
|
|
2104
|
+
* Alias for `trashEntity`.
|
|
2105
|
+
*/
|
|
2106
|
+
async deleteFile(hash, options = {}) {
|
|
2107
|
+
return this.trashEntity(hash, options);
|
|
2108
|
+
}
|
|
2109
|
+
/**
|
|
2110
|
+
* Searches files content and folders.
|
|
2111
|
+
* Swagger: GET /api/files/search
|
|
2112
|
+
*/
|
|
2113
|
+
async searchFiles(params = {}, options = {}) {
|
|
2114
|
+
return this.files.searchFiles(params, options);
|
|
2115
|
+
}
|
|
2116
|
+
/**
|
|
2117
|
+
* Retrieves recent files.
|
|
2118
|
+
* Swagger: GET /api/v2/files/recent
|
|
2119
|
+
*/
|
|
2120
|
+
async getRecentFiles(params = {}, options = {}) {
|
|
2121
|
+
return this.files.getRecentFiles(params, options);
|
|
2122
|
+
}
|
|
2123
|
+
// Sharing & Links delegates
|
|
2124
|
+
/**
|
|
2125
|
+
* Creates a download or integration public link for a file.
|
|
2126
|
+
* Swagger: GET /api/links/files/{hash}
|
|
2127
|
+
*/
|
|
2128
|
+
async createLink(hash, params = {}, options = {}) {
|
|
2129
|
+
return this.links.createLink(hash, params, options);
|
|
2130
|
+
}
|
|
2131
|
+
/**
|
|
2132
|
+
* Shares a file or folder with another user.
|
|
2133
|
+
* Swagger: POST /api/files/{hash}/shares/users/{identity}
|
|
2134
|
+
*/
|
|
2135
|
+
async shareWithUser(hash, identity, params, options = {}) {
|
|
2136
|
+
return this.shares.shareWithUser(hash, identity, params, options);
|
|
2137
|
+
}
|
|
2138
|
+
/**
|
|
2139
|
+
* Makes a file or folder publicly accessible.
|
|
2140
|
+
* Swagger: POST /api/files/{hash}/public
|
|
2141
|
+
*/
|
|
2142
|
+
async makePublic(hash, params, options = {}) {
|
|
2143
|
+
return this.shares.makePublic(hash, params, options);
|
|
2144
|
+
}
|
|
2145
|
+
// Bookmarks delegates
|
|
2146
|
+
/**
|
|
2147
|
+
* Retrieves bookmarked entities.
|
|
2148
|
+
* Swagger: GET /api/bookmarks
|
|
2149
|
+
*/
|
|
2150
|
+
async getBookmarks(params = {}, options = {}) {
|
|
2151
|
+
return this.bookmarks.getBookmarks(params, options);
|
|
2152
|
+
}
|
|
2153
|
+
/**
|
|
2154
|
+
* Bookmarks a file or folder.
|
|
2155
|
+
* Swagger: POST /api/bookmarks
|
|
2156
|
+
*/
|
|
2157
|
+
async addBookmark(hash, options = {}) {
|
|
2158
|
+
return this.bookmarks.addBookmark(hash, options);
|
|
2159
|
+
}
|
|
2160
|
+
/**
|
|
2161
|
+
* Removes bookmark from a file or folder.
|
|
2162
|
+
* Swagger: DELETE /api/bookmarks
|
|
2163
|
+
*/
|
|
2164
|
+
async removeBookmark(hash, options = {}) {
|
|
2165
|
+
return this.bookmarks.removeBookmark(hash, options);
|
|
548
2166
|
}
|
|
549
2167
|
};
|
|
550
2168
|
var PodFormService = class {
|
|
@@ -2334,7 +3952,8 @@ var PodSdk = class {
|
|
|
2334
3952
|
});
|
|
2335
3953
|
this.podspace = new PodspaceService({
|
|
2336
3954
|
baseUrl: urls.podspace,
|
|
2337
|
-
apiToken
|
|
3955
|
+
apiToken,
|
|
3956
|
+
revalidate
|
|
2338
3957
|
});
|
|
2339
3958
|
this.podform = new PodFormService({
|
|
2340
3959
|
baseUrl: urls.podform,
|
|
@@ -2377,6 +3996,6 @@ function createPodSdk(config) {
|
|
|
2377
3996
|
}
|
|
2378
3997
|
var client_default = PodSdk;
|
|
2379
3998
|
|
|
2380
|
-
export { CmsDataFormatter, CmsProductService, CmsService, CmsTagService, CustomPostCrudService, CustomPostService, DEFAULT_POD_URLS, IumsService, NotificationService, PodFormService, PodSdk, PodspaceService, SANDBOX_POD_URLS, SocialService, SsoService, createPodSdk, client_default as default, encodeBase64, generatePodSignatureHeader, resolvePodUrls };
|
|
3999
|
+
export { CmsDataFormatter, CmsProductService, CmsService, CmsTagService, CustomPostCrudService, CustomPostService, DEFAULT_POD_URLS, IumsService, NotificationService, PodFormService, PodSdk, PodspaceBookmarksService, PodspaceFilesService, PodspaceFoldersService, PodspaceLinksService, PodspaceMeService, PodspaceMetadataService, PodspaceResumableService, PodspaceService, PodspaceSharesService, PodspaceTagsService, PodspaceTrashService, PodspaceUploadDownloadService, PodspaceUserGroupsService, PodspaceWorkspacesService, SANDBOX_POD_URLS, SocialService, SsoService, createPodSdk, client_default as default, encodeBase64, generatePodSignatureHeader, resolvePodUrls };
|
|
2381
4000
|
//# sourceMappingURL=index.mjs.map
|
|
2382
4001
|
//# sourceMappingURL=index.mjs.map
|