@fonderie/client 0.17.0 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -28,6 +28,7 @@ __export(index_exports, {
28
28
  CustomersClient: () => CustomersClient,
29
29
  FonderieApiError: () => FonderieApiError,
30
30
  FonderieClient: () => FonderieClient,
31
+ MediaClient: () => MediaClient,
31
32
  WebhooksClient: () => WebhooksClient,
32
33
  WorkspacesClient: () => WorkspacesClient,
33
34
  createMemoryCache: () => createMemoryCache,
@@ -98,6 +99,12 @@ var HttpClient = class {
98
99
  cache;
99
100
  defaultTtlMs;
100
101
  refresh;
102
+ // Absolute URL for a path on this client's origin — for endpoints a browser
103
+ // navigates to or embeds (e.g. a public `<img src>`) rather than fetches
104
+ // through request(). Mirrors the `${baseUrl}${path}` join request() uses.
105
+ absolute(path) {
106
+ return `${this.baseUrl}${path}`;
107
+ }
101
108
  // Drop all cached responses — sign-out must not leave one session's data
102
109
  // servable to the next.
103
110
  clearCache() {
@@ -455,7 +462,7 @@ var BillingClient = class {
455
462
  getPlan(planId, opts) {
456
463
  return this.http.request({
457
464
  method: "GET",
458
- path: `/plans/${planId}`,
465
+ path: `/plans/${encodeURIComponent(planId)}`,
459
466
  bust: opts?.bust
460
467
  });
461
468
  }
@@ -477,7 +484,7 @@ var BillingClient = class {
477
484
  updatePlan(planId, input) {
478
485
  return this.http.request({
479
486
  method: "PUT",
480
- path: `/plans/${planId}`,
487
+ path: `/plans/${encodeURIComponent(planId)}`,
481
488
  body: input,
482
489
  token: this.tokens.get()
483
490
  });
@@ -485,7 +492,7 @@ var BillingClient = class {
485
492
  deletePlan(planId) {
486
493
  return this.http.request({
487
494
  method: "DELETE",
488
- path: `/plans/${planId}`,
495
+ path: `/plans/${encodeURIComponent(planId)}`,
489
496
  token: this.tokens.get()
490
497
  });
491
498
  }
@@ -552,7 +559,7 @@ var BillingClient = class {
552
559
  getUsage(metric, opts) {
553
560
  return this.http.request({
554
561
  method: "GET",
555
- path: `/billing/usage/${metric}`,
562
+ path: `/billing/usage/${encodeURIComponent(metric)}`,
556
563
  token: this.tokens.get(),
557
564
  workspaceId: this.workspaceId,
558
565
  bust: opts?.bust
@@ -722,7 +729,7 @@ var CustomersClient = class {
722
729
  const qs = input.depth === 1 ? "?depth=1" : "";
723
730
  return this.http.request({
724
731
  method: "GET",
725
- path: `/customers/${customerId}${qs}`,
732
+ path: `/customers/${encodeURIComponent(customerId)}${qs}`,
726
733
  token: this.tokens.get(),
727
734
  workspaceId: this.workspaceId,
728
735
  bust: opts?.bust
@@ -731,7 +738,7 @@ var CustomersClient = class {
731
738
  updateCustomer(customerId, input) {
732
739
  return this.http.request({
733
740
  method: "PUT",
734
- path: `/customers/${customerId}`,
741
+ path: `/customers/${encodeURIComponent(customerId)}`,
735
742
  body: input,
736
743
  token: this.tokens.get(),
737
744
  workspaceId: this.workspaceId
@@ -740,7 +747,7 @@ var CustomersClient = class {
740
747
  deleteCustomer(customerId) {
741
748
  return this.http.request({
742
749
  method: "DELETE",
743
- path: `/customers/${customerId}`,
750
+ path: `/customers/${encodeURIComponent(customerId)}`,
744
751
  token: this.tokens.get(),
745
752
  workspaceId: this.workspaceId
746
753
  });
@@ -748,7 +755,7 @@ var CustomersClient = class {
748
755
  blacklistCustomer(customerId, input = {}) {
749
756
  return this.http.request({
750
757
  method: "POST",
751
- path: `/customers/${customerId}/blacklist`,
758
+ path: `/customers/${encodeURIComponent(customerId)}/blacklist`,
752
759
  body: input,
753
760
  token: this.tokens.get(),
754
761
  workspaceId: this.workspaceId
@@ -757,7 +764,7 @@ var CustomersClient = class {
757
764
  unblacklistCustomer(customerId) {
758
765
  return this.http.request({
759
766
  method: "POST",
760
- path: `/customers/${customerId}/unblacklist`,
767
+ path: `/customers/${encodeURIComponent(customerId)}/unblacklist`,
761
768
  token: this.tokens.get(),
762
769
  workspaceId: this.workspaceId
763
770
  });
@@ -766,7 +773,7 @@ var CustomersClient = class {
766
773
  listEmails(customerId, opts) {
767
774
  return this.http.request({
768
775
  method: "GET",
769
- path: `/customers/${customerId}/emails`,
776
+ path: `/customers/${encodeURIComponent(customerId)}/emails`,
770
777
  token: this.tokens.get(),
771
778
  workspaceId: this.workspaceId,
772
779
  bust: opts?.bust
@@ -775,7 +782,7 @@ var CustomersClient = class {
775
782
  addEmail(customerId, input) {
776
783
  return this.http.request({
777
784
  method: "POST",
778
- path: `/customers/${customerId}/emails`,
785
+ path: `/customers/${encodeURIComponent(customerId)}/emails`,
779
786
  body: input,
780
787
  token: this.tokens.get(),
781
788
  workspaceId: this.workspaceId
@@ -786,7 +793,7 @@ var CustomersClient = class {
786
793
  updateEmailLabel(customerId, emailId, label) {
787
794
  return this.http.request({
788
795
  method: "PATCH",
789
- path: `/customers/${customerId}/emails/${emailId}`,
796
+ path: `/customers/${encodeURIComponent(customerId)}/emails/${encodeURIComponent(emailId)}`,
790
797
  body: { label },
791
798
  token: this.tokens.get(),
792
799
  workspaceId: this.workspaceId
@@ -795,7 +802,7 @@ var CustomersClient = class {
795
802
  setPrimaryEmail(customerId, emailId) {
796
803
  return this.http.request({
797
804
  method: "PUT",
798
- path: `/customers/${customerId}/emails/${emailId}/primary`,
805
+ path: `/customers/${encodeURIComponent(customerId)}/emails/${encodeURIComponent(emailId)}/primary`,
799
806
  token: this.tokens.get(),
800
807
  workspaceId: this.workspaceId
801
808
  });
@@ -803,7 +810,7 @@ var CustomersClient = class {
803
810
  removeEmail(customerId, emailId) {
804
811
  return this.http.request({
805
812
  method: "DELETE",
806
- path: `/customers/${customerId}/emails/${emailId}`,
813
+ path: `/customers/${encodeURIComponent(customerId)}/emails/${encodeURIComponent(emailId)}`,
807
814
  token: this.tokens.get(),
808
815
  workspaceId: this.workspaceId
809
816
  });
@@ -812,7 +819,7 @@ var CustomersClient = class {
812
819
  listPhones(customerId, opts) {
813
820
  return this.http.request({
814
821
  method: "GET",
815
- path: `/customers/${customerId}/phones`,
822
+ path: `/customers/${encodeURIComponent(customerId)}/phones`,
816
823
  token: this.tokens.get(),
817
824
  workspaceId: this.workspaceId,
818
825
  bust: opts?.bust
@@ -821,7 +828,7 @@ var CustomersClient = class {
821
828
  addPhone(customerId, input) {
822
829
  return this.http.request({
823
830
  method: "POST",
824
- path: `/customers/${customerId}/phones`,
831
+ path: `/customers/${encodeURIComponent(customerId)}/phones`,
825
832
  body: input,
826
833
  token: this.tokens.get(),
827
834
  workspaceId: this.workspaceId
@@ -831,7 +838,7 @@ var CustomersClient = class {
831
838
  updatePhoneLabel(customerId, phoneId, label) {
832
839
  return this.http.request({
833
840
  method: "PATCH",
834
- path: `/customers/${customerId}/phones/${phoneId}`,
841
+ path: `/customers/${encodeURIComponent(customerId)}/phones/${encodeURIComponent(phoneId)}`,
835
842
  body: { label },
836
843
  token: this.tokens.get(),
837
844
  workspaceId: this.workspaceId
@@ -840,7 +847,7 @@ var CustomersClient = class {
840
847
  setPrimaryPhone(customerId, phoneId) {
841
848
  return this.http.request({
842
849
  method: "PUT",
843
- path: `/customers/${customerId}/phones/${phoneId}/primary`,
850
+ path: `/customers/${encodeURIComponent(customerId)}/phones/${encodeURIComponent(phoneId)}/primary`,
844
851
  token: this.tokens.get(),
845
852
  workspaceId: this.workspaceId
846
853
  });
@@ -848,7 +855,7 @@ var CustomersClient = class {
848
855
  removePhone(customerId, phoneId) {
849
856
  return this.http.request({
850
857
  method: "DELETE",
851
- path: `/customers/${customerId}/phones/${phoneId}`,
858
+ path: `/customers/${encodeURIComponent(customerId)}/phones/${encodeURIComponent(phoneId)}`,
852
859
  token: this.tokens.get(),
853
860
  workspaceId: this.workspaceId
854
861
  });
@@ -857,7 +864,7 @@ var CustomersClient = class {
857
864
  listAddresses(customerId, opts) {
858
865
  return this.http.request({
859
866
  method: "GET",
860
- path: `/customers/${customerId}/addresses`,
867
+ path: `/customers/${encodeURIComponent(customerId)}/addresses`,
861
868
  token: this.tokens.get(),
862
869
  workspaceId: this.workspaceId,
863
870
  bust: opts?.bust
@@ -866,7 +873,7 @@ var CustomersClient = class {
866
873
  addAddress(customerId, input) {
867
874
  return this.http.request({
868
875
  method: "POST",
869
- path: `/customers/${customerId}/addresses`,
876
+ path: `/customers/${encodeURIComponent(customerId)}/addresses`,
870
877
  body: input,
871
878
  token: this.tokens.get(),
872
879
  workspaceId: this.workspaceId
@@ -876,7 +883,7 @@ var CustomersClient = class {
876
883
  updateAddressLabel(customerId, addrId, label) {
877
884
  return this.http.request({
878
885
  method: "PATCH",
879
- path: `/customers/${customerId}/addresses/${addrId}`,
886
+ path: `/customers/${encodeURIComponent(customerId)}/addresses/${encodeURIComponent(addrId)}`,
880
887
  body: { label },
881
888
  token: this.tokens.get(),
882
889
  workspaceId: this.workspaceId
@@ -885,7 +892,7 @@ var CustomersClient = class {
885
892
  setPrimaryAddress(customerId, addrId) {
886
893
  return this.http.request({
887
894
  method: "PUT",
888
- path: `/customers/${customerId}/addresses/${addrId}/primary`,
895
+ path: `/customers/${encodeURIComponent(customerId)}/addresses/${encodeURIComponent(addrId)}/primary`,
889
896
  token: this.tokens.get(),
890
897
  workspaceId: this.workspaceId
891
898
  });
@@ -893,7 +900,7 @@ var CustomersClient = class {
893
900
  removeAddress(customerId, addrId) {
894
901
  return this.http.request({
895
902
  method: "DELETE",
896
- path: `/customers/${customerId}/addresses/${addrId}`,
903
+ path: `/customers/${encodeURIComponent(customerId)}/addresses/${encodeURIComponent(addrId)}`,
897
904
  token: this.tokens.get(),
898
905
  workspaceId: this.workspaceId
899
906
  });
@@ -902,7 +909,7 @@ var CustomersClient = class {
902
909
  listNotes(customerId, opts) {
903
910
  return this.http.request({
904
911
  method: "GET",
905
- path: `/customers/${customerId}/notes`,
912
+ path: `/customers/${encodeURIComponent(customerId)}/notes`,
906
913
  token: this.tokens.get(),
907
914
  workspaceId: this.workspaceId,
908
915
  bust: opts?.bust
@@ -911,7 +918,7 @@ var CustomersClient = class {
911
918
  createNote(customerId, body) {
912
919
  return this.http.request({
913
920
  method: "POST",
914
- path: `/customers/${customerId}/notes`,
921
+ path: `/customers/${encodeURIComponent(customerId)}/notes`,
915
922
  body: { body },
916
923
  token: this.tokens.get(),
917
924
  workspaceId: this.workspaceId
@@ -920,7 +927,7 @@ var CustomersClient = class {
920
927
  updateNote(customerId, noteId, body) {
921
928
  return this.http.request({
922
929
  method: "PUT",
923
- path: `/customers/${customerId}/notes/${noteId}`,
930
+ path: `/customers/${encodeURIComponent(customerId)}/notes/${encodeURIComponent(noteId)}`,
924
931
  body: { body },
925
932
  token: this.tokens.get(),
926
933
  workspaceId: this.workspaceId
@@ -929,7 +936,7 @@ var CustomersClient = class {
929
936
  deleteNote(customerId, noteId) {
930
937
  return this.http.request({
931
938
  method: "DELETE",
932
- path: `/customers/${customerId}/notes/${noteId}`,
939
+ path: `/customers/${encodeURIComponent(customerId)}/notes/${encodeURIComponent(noteId)}`,
933
940
  token: this.tokens.get(),
934
941
  workspaceId: this.workspaceId
935
942
  });
@@ -938,7 +945,7 @@ var CustomersClient = class {
938
945
  listTags(customerId, opts) {
939
946
  return this.http.request({
940
947
  method: "GET",
941
- path: `/customers/${customerId}/tags`,
948
+ path: `/customers/${encodeURIComponent(customerId)}/tags`,
942
949
  token: this.tokens.get(),
943
950
  workspaceId: this.workspaceId,
944
951
  bust: opts?.bust
@@ -947,7 +954,7 @@ var CustomersClient = class {
947
954
  addTag(customerId, tag) {
948
955
  return this.http.request({
949
956
  method: "POST",
950
- path: `/customers/${customerId}/tags`,
957
+ path: `/customers/${encodeURIComponent(customerId)}/tags`,
951
958
  body: { tag },
952
959
  token: this.tokens.get(),
953
960
  workspaceId: this.workspaceId
@@ -965,7 +972,7 @@ var CustomersClient = class {
965
972
  listRelationships(customerId, opts) {
966
973
  return this.http.request({
967
974
  method: "GET",
968
- path: `/customers/${customerId}/relationships`,
975
+ path: `/customers/${encodeURIComponent(customerId)}/relationships`,
969
976
  token: this.tokens.get(),
970
977
  workspaceId: this.workspaceId,
971
978
  bust: opts?.bust
@@ -974,7 +981,7 @@ var CustomersClient = class {
974
981
  addRelationship(customerId, input) {
975
982
  return this.http.request({
976
983
  method: "POST",
977
- path: `/customers/${customerId}/relationships`,
984
+ path: `/customers/${encodeURIComponent(customerId)}/relationships`,
978
985
  body: input,
979
986
  token: this.tokens.get(),
980
987
  workspaceId: this.workspaceId
@@ -983,7 +990,7 @@ var CustomersClient = class {
983
990
  setPrimaryRelationship(customerId, relatedId) {
984
991
  return this.http.request({
985
992
  method: "PUT",
986
- path: `/customers/${customerId}/relationships/${relatedId}/primary`,
993
+ path: `/customers/${encodeURIComponent(customerId)}/relationships/${encodeURIComponent(relatedId)}/primary`,
987
994
  token: this.tokens.get(),
988
995
  workspaceId: this.workspaceId
989
996
  });
@@ -991,7 +998,7 @@ var CustomersClient = class {
991
998
  removeRelationship(customerId, relatedId) {
992
999
  return this.http.request({
993
1000
  method: "DELETE",
994
- path: `/customers/${customerId}/relationships/${relatedId}`,
1001
+ path: `/customers/${encodeURIComponent(customerId)}/relationships/${encodeURIComponent(relatedId)}`,
995
1002
  token: this.tokens.get(),
996
1003
  workspaceId: this.workspaceId
997
1004
  });
@@ -1004,7 +1011,7 @@ var CustomersClient = class {
1004
1011
  listLabels(type, opts) {
1005
1012
  return this.http.request({
1006
1013
  method: "GET",
1007
- path: `/customers/labels?type=${type}`,
1014
+ path: `/customers/labels?type=${encodeURIComponent(type)}`,
1008
1015
  token: this.tokens.get(),
1009
1016
  workspaceId: this.workspaceId,
1010
1017
  bust: opts?.bust
@@ -1013,13 +1020,62 @@ var CustomersClient = class {
1013
1020
  removeLabel(labelId) {
1014
1021
  return this.http.request({
1015
1022
  method: "DELETE",
1016
- path: `/customers/labels/${labelId}`,
1023
+ path: `/customers/labels/${encodeURIComponent(labelId)}`,
1017
1024
  token: this.tokens.get(),
1018
1025
  workspaceId: this.workspaceId
1019
1026
  });
1020
1027
  }
1021
1028
  };
1022
1029
 
1030
+ // src/modules/media.ts
1031
+ var MediaClient = class {
1032
+ constructor(http, tokens) {
1033
+ this.http = http;
1034
+ this.tokens = tokens;
1035
+ }
1036
+ http;
1037
+ tokens;
1038
+ setAccessToken(token) {
1039
+ this.tokens.set(token);
1040
+ }
1041
+ // POST /media — store an image; returns the asset with its monomorphic
1042
+ // /media/:id url. requireAuth server-side.
1043
+ upload(input) {
1044
+ return this.http.request({
1045
+ method: "POST",
1046
+ path: "/media",
1047
+ body: input,
1048
+ token: this.tokens.get()
1049
+ });
1050
+ }
1051
+ // DELETE /media/:id — uploader-only (403 for anyone else).
1052
+ delete(id) {
1053
+ return this.http.request({
1054
+ method: "DELETE",
1055
+ path: `/media/${encodeURIComponent(id)}`,
1056
+ token: this.tokens.get()
1057
+ });
1058
+ }
1059
+ // Absolute URL for a stored asset — an `<img src>` target. The GET /media/:id
1060
+ // route is public and cached (it can't carry a Bearer token), so turn an
1061
+ // upload's `asset.id` into a browser-loadable URL with this, and use it as
1062
+ // the avatarUrl handed to auth's updateProfile.
1063
+ assetUrl(id) {
1064
+ return this.http.absolute(`/media/${encodeURIComponent(id)}`);
1065
+ }
1066
+ // Inverse of assetUrl: pull the asset id out of one of THIS brick's
1067
+ // /media/:id URLs (absolute or relative); null for empty/external URLs. Lets
1068
+ // avatar cleanup delete only assets we minted (matched as a UUID), never a
1069
+ // placeholder or third-party avatar URL.
1070
+ assetIdFromUrl(url) {
1071
+ if (!url) return null;
1072
+ const m = url.match(
1073
+ /\/media\/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?:[/?#]|$)/i
1074
+ );
1075
+ return m ? m[1] : null;
1076
+ }
1077
+ };
1078
+
1023
1079
  // src/modules/webhooks.ts
1024
1080
  var WebhooksClient = class {
1025
1081
  constructor(http, tokens) {
@@ -1060,7 +1116,7 @@ var WebhooksClient = class {
1060
1116
  getEndpoint(endpointId, opts) {
1061
1117
  return this.http.request({
1062
1118
  method: "GET",
1063
- path: `/webhooks/${endpointId}`,
1119
+ path: `/webhooks/${encodeURIComponent(endpointId)}`,
1064
1120
  token: this.tokens.get(),
1065
1121
  workspaceId: this.workspaceId,
1066
1122
  bust: opts?.bust
@@ -1069,7 +1125,7 @@ var WebhooksClient = class {
1069
1125
  updateEndpoint(endpointId, input) {
1070
1126
  return this.http.request({
1071
1127
  method: "PATCH",
1072
- path: `/webhooks/${endpointId}`,
1128
+ path: `/webhooks/${encodeURIComponent(endpointId)}`,
1073
1129
  body: input,
1074
1130
  token: this.tokens.get(),
1075
1131
  workspaceId: this.workspaceId
@@ -1078,7 +1134,7 @@ var WebhooksClient = class {
1078
1134
  deleteEndpoint(endpointId) {
1079
1135
  return this.http.request({
1080
1136
  method: "DELETE",
1081
- path: `/webhooks/${endpointId}`,
1137
+ path: `/webhooks/${encodeURIComponent(endpointId)}`,
1082
1138
  token: this.tokens.get(),
1083
1139
  workspaceId: this.workspaceId
1084
1140
  });
@@ -1086,7 +1142,7 @@ var WebhooksClient = class {
1086
1142
  listDeliveries(endpointId, opts) {
1087
1143
  return this.http.request({
1088
1144
  method: "GET",
1089
- path: `/webhooks/${endpointId}/deliveries`,
1145
+ path: `/webhooks/${encodeURIComponent(endpointId)}/deliveries`,
1090
1146
  token: this.tokens.get(),
1091
1147
  workspaceId: this.workspaceId,
1092
1148
  bust: opts?.bust
@@ -1095,7 +1151,7 @@ var WebhooksClient = class {
1095
1151
  testEndpoint(endpointId) {
1096
1152
  return this.http.request({
1097
1153
  method: "POST",
1098
- path: `/webhooks/${endpointId}/test`,
1154
+ path: `/webhooks/${encodeURIComponent(endpointId)}/test`,
1099
1155
  token: this.tokens.get(),
1100
1156
  workspaceId: this.workspaceId
1101
1157
  });
@@ -1139,7 +1195,7 @@ var WorkspacesClient = class {
1139
1195
  getWorkspace(id, opts) {
1140
1196
  return this.http.request({
1141
1197
  method: "GET",
1142
- path: `/workspaces/${id}`,
1198
+ path: `/workspaces/${encodeURIComponent(id)}`,
1143
1199
  token: this.tokens.get(),
1144
1200
  bust: opts?.bust
1145
1201
  });
@@ -1192,7 +1248,7 @@ var WorkspacesClient = class {
1192
1248
  getRole(roleId, opts) {
1193
1249
  return this.http.request({
1194
1250
  method: "GET",
1195
- path: `/workspaces/roles/${roleId}`,
1251
+ path: `/workspaces/roles/${encodeURIComponent(roleId)}`,
1196
1252
  token: this.tokens.get(),
1197
1253
  workspaceId: this.workspaceId,
1198
1254
  bust: opts?.bust
@@ -1201,7 +1257,7 @@ var WorkspacesClient = class {
1201
1257
  updateRole(roleId, input) {
1202
1258
  return this.http.request({
1203
1259
  method: "PUT",
1204
- path: `/workspaces/roles/${roleId}`,
1260
+ path: `/workspaces/roles/${encodeURIComponent(roleId)}`,
1205
1261
  body: input,
1206
1262
  token: this.tokens.get(),
1207
1263
  workspaceId: this.workspaceId
@@ -1210,7 +1266,7 @@ var WorkspacesClient = class {
1210
1266
  removeRole(roleId) {
1211
1267
  return this.http.request({
1212
1268
  method: "DELETE",
1213
- path: `/workspaces/roles/${roleId}`,
1269
+ path: `/workspaces/roles/${encodeURIComponent(roleId)}`,
1214
1270
  token: this.tokens.get(),
1215
1271
  workspaceId: this.workspaceId
1216
1272
  });
@@ -1218,7 +1274,7 @@ var WorkspacesClient = class {
1218
1274
  getRolePermissions(roleId, opts) {
1219
1275
  return this.http.request({
1220
1276
  method: "GET",
1221
- path: `/workspaces/roles/${roleId}/permissions`,
1277
+ path: `/workspaces/roles/${encodeURIComponent(roleId)}/permissions`,
1222
1278
  token: this.tokens.get(),
1223
1279
  workspaceId: this.workspaceId,
1224
1280
  bust: opts?.bust
@@ -1227,7 +1283,7 @@ var WorkspacesClient = class {
1227
1283
  setRolePermissions(roleId, permissions) {
1228
1284
  return this.http.request({
1229
1285
  method: "POST",
1230
- path: `/workspaces/roles/${roleId}/permissions`,
1286
+ path: `/workspaces/roles/${encodeURIComponent(roleId)}/permissions`,
1231
1287
  body: { permissions },
1232
1288
  token: this.tokens.get(),
1233
1289
  workspaceId: this.workspaceId
@@ -1246,7 +1302,7 @@ var WorkspacesClient = class {
1246
1302
  removeMember(userId) {
1247
1303
  return this.http.request({
1248
1304
  method: "DELETE",
1249
- path: `/workspaces/members/${userId}`,
1305
+ path: `/workspaces/members/${encodeURIComponent(userId)}`,
1250
1306
  token: this.tokens.get(),
1251
1307
  workspaceId: this.workspaceId
1252
1308
  });
@@ -1254,7 +1310,7 @@ var WorkspacesClient = class {
1254
1310
  getMemberRoles(userId, opts) {
1255
1311
  return this.http.request({
1256
1312
  method: "GET",
1257
- path: `/workspaces/members/${userId}/roles`,
1313
+ path: `/workspaces/members/${encodeURIComponent(userId)}/roles`,
1258
1314
  token: this.tokens.get(),
1259
1315
  workspaceId: this.workspaceId,
1260
1316
  bust: opts?.bust
@@ -1263,7 +1319,7 @@ var WorkspacesClient = class {
1263
1319
  addMemberRole(userId, roleId) {
1264
1320
  return this.http.request({
1265
1321
  method: "POST",
1266
- path: `/workspaces/members/${userId}/roles`,
1322
+ path: `/workspaces/members/${encodeURIComponent(userId)}/roles`,
1267
1323
  body: { roleId },
1268
1324
  token: this.tokens.get(),
1269
1325
  workspaceId: this.workspaceId
@@ -1272,7 +1328,7 @@ var WorkspacesClient = class {
1272
1328
  removeMemberRole(userId, roleId) {
1273
1329
  return this.http.request({
1274
1330
  method: "DELETE",
1275
- path: `/workspaces/members/${userId}/roles/${roleId}`,
1331
+ path: `/workspaces/members/${encodeURIComponent(userId)}/roles/${encodeURIComponent(roleId)}`,
1276
1332
  token: this.tokens.get(),
1277
1333
  workspaceId: this.workspaceId
1278
1334
  });
@@ -1299,7 +1355,7 @@ var WorkspacesClient = class {
1299
1355
  cancelInvitation(inviteId) {
1300
1356
  return this.http.request({
1301
1357
  method: "DELETE",
1302
- path: `/workspaces/invitations/${inviteId}`,
1358
+ path: `/workspaces/invitations/${encodeURIComponent(inviteId)}`,
1303
1359
  token: this.tokens.get(),
1304
1360
  workspaceId: this.workspaceId
1305
1361
  });
@@ -1355,6 +1411,7 @@ var FonderieClient = class {
1355
1411
  audit;
1356
1412
  webhooks;
1357
1413
  customers;
1414
+ media;
1358
1415
  http;
1359
1416
  tokens;
1360
1417
  workspaceId;
@@ -1377,6 +1434,7 @@ var FonderieClient = class {
1377
1434
  this.audit = new AuditClient(this.http, this.tokens);
1378
1435
  this.webhooks = new WebhooksClient(this.http, this.tokens);
1379
1436
  this.customers = new CustomersClient(this.http, this.tokens);
1437
+ this.media = new MediaClient(this.http, this.tokens);
1380
1438
  if (opts.workspaceId !== void 0) this.setWorkspaceId(opts.workspaceId);
1381
1439
  }
1382
1440
  // Single-flight refresh: POST /auth/refresh with the app-supplied refresh
@@ -1491,14 +1549,14 @@ var ConfigAdminClient = class {
1491
1549
  getConfig(key, environment) {
1492
1550
  return this.http.request({
1493
1551
  method: "GET",
1494
- path: `/admin/config/${key}${envQuery(environment)}`,
1552
+ path: `/admin/config/${encodeURIComponent(key)}${envQuery(environment)}`,
1495
1553
  token: this.adminToken
1496
1554
  });
1497
1555
  }
1498
1556
  setConfig(key, input, environment) {
1499
1557
  return this.http.request({
1500
1558
  method: "PUT",
1501
- path: `/admin/config/${key}${envQuery(environment)}`,
1559
+ path: `/admin/config/${encodeURIComponent(key)}${envQuery(environment)}`,
1502
1560
  body: input,
1503
1561
  token: this.adminToken,
1504
1562
  headers: this.actorHeaders
@@ -1507,7 +1565,7 @@ var ConfigAdminClient = class {
1507
1565
  deleteConfig(key, environment) {
1508
1566
  return this.http.request({
1509
1567
  method: "DELETE",
1510
- path: `/admin/config/${key}${envQuery(environment)}`,
1568
+ path: `/admin/config/${encodeURIComponent(key)}${envQuery(environment)}`,
1511
1569
  token: this.adminToken,
1512
1570
  headers: this.actorHeaders
1513
1571
  });
@@ -1515,14 +1573,14 @@ var ConfigAdminClient = class {
1515
1573
  listConfigRevisions(key, environment) {
1516
1574
  return this.http.request({
1517
1575
  method: "GET",
1518
- path: `/admin/config/${key}/revisions${envQuery(environment)}`,
1576
+ path: `/admin/config/${encodeURIComponent(key)}/revisions${envQuery(environment)}`,
1519
1577
  token: this.adminToken
1520
1578
  });
1521
1579
  }
1522
1580
  rollbackConfig(key, input, environment) {
1523
1581
  return this.http.request({
1524
1582
  method: "POST",
1525
- path: `/admin/config/${key}/rollback${envQuery(environment)}`,
1583
+ path: `/admin/config/${encodeURIComponent(key)}/rollback${envQuery(environment)}`,
1526
1584
  body: input,
1527
1585
  token: this.adminToken,
1528
1586
  headers: this.actorHeaders
@@ -1539,14 +1597,14 @@ var ConfigAdminClient = class {
1539
1597
  getSecret(key, environment) {
1540
1598
  return this.http.request({
1541
1599
  method: "GET",
1542
- path: `/admin/secrets/${key}${envQuery(environment)}`,
1600
+ path: `/admin/secrets/${encodeURIComponent(key)}${envQuery(environment)}`,
1543
1601
  token: this.adminToken
1544
1602
  });
1545
1603
  }
1546
1604
  setSecret(key, input, environment) {
1547
1605
  return this.http.request({
1548
1606
  method: "PUT",
1549
- path: `/admin/secrets/${key}${envQuery(environment)}`,
1607
+ path: `/admin/secrets/${encodeURIComponent(key)}${envQuery(environment)}`,
1550
1608
  body: input,
1551
1609
  token: this.adminToken,
1552
1610
  headers: this.actorHeaders
@@ -1555,7 +1613,7 @@ var ConfigAdminClient = class {
1555
1613
  deleteSecret(key, environment) {
1556
1614
  return this.http.request({
1557
1615
  method: "DELETE",
1558
- path: `/admin/secrets/${key}${envQuery(environment)}`,
1616
+ path: `/admin/secrets/${encodeURIComponent(key)}${envQuery(environment)}`,
1559
1617
  token: this.adminToken,
1560
1618
  headers: this.actorHeaders
1561
1619
  });
@@ -1563,14 +1621,14 @@ var ConfigAdminClient = class {
1563
1621
  listSecretRevisions(key, environment) {
1564
1622
  return this.http.request({
1565
1623
  method: "GET",
1566
- path: `/admin/secrets/${key}/revisions${envQuery(environment)}`,
1624
+ path: `/admin/secrets/${encodeURIComponent(key)}/revisions${envQuery(environment)}`,
1567
1625
  token: this.adminToken
1568
1626
  });
1569
1627
  }
1570
1628
  rollbackSecret(key, input, environment) {
1571
1629
  return this.http.request({
1572
1630
  method: "POST",
1573
- path: `/admin/secrets/${key}/rollback${envQuery(environment)}`,
1631
+ path: `/admin/secrets/${encodeURIComponent(key)}/rollback${envQuery(environment)}`,
1574
1632
  body: input,
1575
1633
  token: this.adminToken,
1576
1634
  headers: this.actorHeaders
@@ -1580,7 +1638,7 @@ var ConfigAdminClient = class {
1580
1638
  revealSecret(key, environment) {
1581
1639
  return this.http.request({
1582
1640
  method: "POST",
1583
- path: `/admin/secrets/${key}/reveal${envQuery(environment)}`,
1641
+ path: `/admin/secrets/${encodeURIComponent(key)}/reveal${envQuery(environment)}`,
1584
1642
  token: this.adminToken,
1585
1643
  headers: this.actorHeaders
1586
1644
  });
@@ -1608,7 +1666,7 @@ var CourierAdminClient = class {
1608
1666
  const q = locale ? `?locale=${encodeURIComponent(locale)}` : "";
1609
1667
  return this.http.request({
1610
1668
  method: "GET",
1611
- path: `/admin/templates/${type}${q}`,
1669
+ path: `/admin/templates/${encodeURIComponent(type)}${q}`,
1612
1670
  token: this.adminToken
1613
1671
  });
1614
1672
  }
@@ -1616,7 +1674,7 @@ var CourierAdminClient = class {
1616
1674
  const q = locale ? `?locale=${encodeURIComponent(locale)}` : "";
1617
1675
  return this.http.request({
1618
1676
  method: "PUT",
1619
- path: `/admin/templates/${type}${q}`,
1677
+ path: `/admin/templates/${encodeURIComponent(type)}${q}`,
1620
1678
  body: input,
1621
1679
  token: this.adminToken,
1622
1680
  headers: this.actorHeaders
@@ -1626,7 +1684,7 @@ var CourierAdminClient = class {
1626
1684
  const q = locale ? `?locale=${encodeURIComponent(locale)}` : "";
1627
1685
  return this.http.request({
1628
1686
  method: "DELETE",
1629
- path: `/admin/templates/${type}${q}`,
1687
+ path: `/admin/templates/${encodeURIComponent(type)}${q}`,
1630
1688
  token: this.adminToken,
1631
1689
  headers: this.actorHeaders
1632
1690
  });
@@ -1635,7 +1693,7 @@ var CourierAdminClient = class {
1635
1693
  const q = locale ? `?locale=${encodeURIComponent(locale)}` : "";
1636
1694
  return this.http.request({
1637
1695
  method: "GET",
1638
- path: `/admin/templates/${type}/revisions${q}`,
1696
+ path: `/admin/templates/${encodeURIComponent(type)}/revisions${q}`,
1639
1697
  token: this.adminToken
1640
1698
  });
1641
1699
  }
@@ -1643,7 +1701,7 @@ var CourierAdminClient = class {
1643
1701
  const q = locale ? `?locale=${encodeURIComponent(locale)}` : "";
1644
1702
  return this.http.request({
1645
1703
  method: "POST",
1646
- path: `/admin/templates/${type}/rollback${q}`,
1704
+ path: `/admin/templates/${encodeURIComponent(type)}/rollback${q}`,
1647
1705
  body: input,
1648
1706
  token: this.adminToken,
1649
1707
  headers: this.actorHeaders
@@ -1665,6 +1723,7 @@ function isMfaRequired(result) {
1665
1723
  CustomersClient,
1666
1724
  FonderieApiError,
1667
1725
  FonderieClient,
1726
+ MediaClient,
1668
1727
  WebhooksClient,
1669
1728
  WorkspacesClient,
1670
1729
  createMemoryCache,