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