ts-mailcow-api 0.7.0 → 0.8.2
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 +13 -13
- package/dist/Endpoints/forwarding-endpoints.d.ts +27 -0
- package/dist/Endpoints/forwarding-endpoints.js +23 -0
- package/dist/Endpoints/forwarding-endpoints.js.map +1 -0
- package/dist/Endpoints/log-endpoints.d.ts +55 -0
- package/dist/Endpoints/log-endpoints.js +39 -0
- package/dist/Endpoints/log-endpoints.js.map +1 -0
- package/dist/Endpoints/syncjob-endpoints.d.ts +2 -2
- package/dist/Endpoints/syncjob-endpoints.js.map +1 -1
- package/dist/index.d.ts +15 -1
- package/dist/index.js +15 -1
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +398 -8
- package/dist/types.js +0 -4
- package/dist/types.js.map +1 -1
- package/package.json +2 -1
- package/src/Endpoints/forwarding-endpoints.ts +51 -0
- package/src/Endpoints/log-endpoints.ts +130 -0
- package/src/Endpoints/mailbox-endpoint.ts +1 -1
- package/src/Endpoints/syncjob-endpoints.ts +7 -7
- package/src/index.ts +18 -2
- package/src/types.ts +1393 -974
package/dist/types.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export interface BaseDomainAttributes {
|
|
|
9
9
|
/**
|
|
10
10
|
* The language code associated with this domain.
|
|
11
11
|
*/
|
|
12
|
-
lang:
|
|
12
|
+
lang: 'sk' | 'cs' | 'de' | 'en' | 'es' | 'fr' | 'lv' | 'nl' | 'pl' | 'pt' | 'ru' | 'it' | 'ca';
|
|
13
13
|
/**
|
|
14
14
|
* Boolean if the domain is active.
|
|
15
15
|
*/
|
|
@@ -296,9 +296,9 @@ export interface SpamPolicy {
|
|
|
296
296
|
*/
|
|
297
297
|
export interface BaseMailboxAttributes {
|
|
298
298
|
/**
|
|
299
|
-
*
|
|
299
|
+
* Integer representing if the mailbox is active (allows for custom states).
|
|
300
300
|
*/
|
|
301
|
-
active:
|
|
301
|
+
active: number;
|
|
302
302
|
/**
|
|
303
303
|
* Boolean if the user is forced to update their password on login.
|
|
304
304
|
*/
|
|
@@ -504,7 +504,7 @@ export interface Mailbox {
|
|
|
504
504
|
/**
|
|
505
505
|
* Class representation of quota usage.
|
|
506
506
|
*/
|
|
507
|
-
percent_class:
|
|
507
|
+
percent_class: 'success' | 'warning' | 'danger';
|
|
508
508
|
/**
|
|
509
509
|
* Maximum possible quota.
|
|
510
510
|
*/
|
|
@@ -767,7 +767,7 @@ export interface SyncjobAttributes {
|
|
|
767
767
|
/**
|
|
768
768
|
* The encryption method used to connect to the mailserver.
|
|
769
769
|
*/
|
|
770
|
-
enc1:
|
|
770
|
+
enc1: 'TLS' | 'SSL' | 'PLAIN';
|
|
771
771
|
/**
|
|
772
772
|
* The interval in which messages should be synced.
|
|
773
773
|
*/
|
|
@@ -860,37 +860,427 @@ export interface SyncjobUpdateRequest {
|
|
|
860
860
|
* Sync job as returned by the Mailcow API.
|
|
861
861
|
*/
|
|
862
862
|
export interface Syncjob {
|
|
863
|
+
/**
|
|
864
|
+
* Enables or disables the sync job.
|
|
865
|
+
*/
|
|
863
866
|
active: boolean;
|
|
867
|
+
/**
|
|
868
|
+
* MD5 hash of the authentication.
|
|
869
|
+
*/
|
|
864
870
|
authmd51: boolean;
|
|
865
|
-
|
|
871
|
+
/**
|
|
872
|
+
* Authentication mechanism.
|
|
873
|
+
*/
|
|
874
|
+
authmech1: 'TLS' | 'SSL' | 'PLAIN';
|
|
875
|
+
/**
|
|
876
|
+
* Try to automap folders ("sent items", "sent" => "sent" etc.) (--automap).
|
|
877
|
+
*/
|
|
866
878
|
automap: boolean;
|
|
879
|
+
/**
|
|
880
|
+
* Creation date in epoch.
|
|
881
|
+
*/
|
|
867
882
|
created: string;
|
|
883
|
+
/**
|
|
884
|
+
* Custom parameters.
|
|
885
|
+
*/
|
|
868
886
|
custom_params: string;
|
|
887
|
+
/**
|
|
888
|
+
* Delete from source when completed (--delete1).
|
|
889
|
+
*/
|
|
869
890
|
delete1: boolean;
|
|
891
|
+
/**
|
|
892
|
+
* Delete messages on destination that are not on source (--delete2).
|
|
893
|
+
*/
|
|
870
894
|
delete2: boolean;
|
|
895
|
+
/**
|
|
896
|
+
* Delete duplicates on destination (--delete2duplicates).
|
|
897
|
+
*/
|
|
871
898
|
delete2duplicates: boolean;
|
|
899
|
+
/**
|
|
900
|
+
* Target domain.
|
|
901
|
+
*/
|
|
872
902
|
domain2: string;
|
|
873
|
-
|
|
903
|
+
/**
|
|
904
|
+
* The encryption method used to connect to the mailserver.
|
|
905
|
+
*/
|
|
906
|
+
enc1: 'TLS' | 'SSL' | 'PLAIN';
|
|
907
|
+
/**
|
|
908
|
+
* Exclude objects (regex).
|
|
909
|
+
*/
|
|
874
910
|
exclude: string;
|
|
911
|
+
/**
|
|
912
|
+
* The smtp server where mails should be synced from.
|
|
913
|
+
*/
|
|
875
914
|
host1: string;
|
|
915
|
+
/**
|
|
916
|
+
* ID of the sync job.
|
|
917
|
+
*/
|
|
876
918
|
id: number;
|
|
919
|
+
/**
|
|
920
|
+
* If the sync job is currently running.
|
|
921
|
+
*/
|
|
877
922
|
is_running: boolean;
|
|
923
|
+
/**
|
|
924
|
+
* Date of the last run.
|
|
925
|
+
*/
|
|
878
926
|
last_run: string;
|
|
927
|
+
/**
|
|
928
|
+
* Logfile
|
|
929
|
+
*/
|
|
879
930
|
log: string;
|
|
931
|
+
/**
|
|
932
|
+
* Only sync messages up to this age in days.
|
|
933
|
+
*/
|
|
880
934
|
maxage: number;
|
|
935
|
+
/**
|
|
936
|
+
* Max speed transfer limit for the sync.
|
|
937
|
+
*/
|
|
881
938
|
maxbytespersecond: number;
|
|
939
|
+
/**
|
|
940
|
+
* The interval in which messages should be synced.
|
|
941
|
+
*/
|
|
882
942
|
mins_interval: number;
|
|
883
|
-
|
|
943
|
+
/**
|
|
944
|
+
* Last modified date of the sync job..
|
|
945
|
+
*/
|
|
946
|
+
modified: string | null;
|
|
947
|
+
/**
|
|
948
|
+
* Port of the source server.
|
|
949
|
+
*/
|
|
884
950
|
port1: number;
|
|
951
|
+
/**
|
|
952
|
+
* Regex.
|
|
953
|
+
*/
|
|
885
954
|
regextrans2: string;
|
|
955
|
+
/**
|
|
956
|
+
* If cross duplicates should be skipped.
|
|
957
|
+
*/
|
|
886
958
|
skipcrossduplicates: boolean;
|
|
959
|
+
/**
|
|
960
|
+
* Subfolder on target server.
|
|
961
|
+
*/
|
|
887
962
|
subfolder2: string;
|
|
963
|
+
/**
|
|
964
|
+
* If the sync job is subscribed to all mailboxes.
|
|
965
|
+
*/
|
|
888
966
|
subscribeall: boolean;
|
|
967
|
+
/**
|
|
968
|
+
* Timeout for connection to remote host.
|
|
969
|
+
*/
|
|
889
970
|
timeout1: number;
|
|
971
|
+
/**
|
|
972
|
+
* Timeout for connection to local host.
|
|
973
|
+
*/
|
|
890
974
|
timeout2: number;
|
|
975
|
+
/**
|
|
976
|
+
* User on the remote host.
|
|
977
|
+
*/
|
|
891
978
|
user1: string;
|
|
979
|
+
/**
|
|
980
|
+
* User on the local host.
|
|
981
|
+
*/
|
|
892
982
|
user2: string;
|
|
893
983
|
}
|
|
984
|
+
/**
|
|
985
|
+
* Forwarding host creation payload.
|
|
986
|
+
*/
|
|
987
|
+
export interface ForwardingCreateRequest {
|
|
988
|
+
/**
|
|
989
|
+
* True to enable spam filter, false to disable spam filter.
|
|
990
|
+
*/
|
|
991
|
+
filter_spam: boolean;
|
|
992
|
+
/**
|
|
993
|
+
* Contains the hostname you want to add.
|
|
994
|
+
*/
|
|
995
|
+
hostname: string;
|
|
996
|
+
}
|
|
997
|
+
/**
|
|
998
|
+
* Forwarding host deletion payload.
|
|
999
|
+
*/
|
|
1000
|
+
export interface ForwardingDeleteRequest {
|
|
1001
|
+
/**
|
|
1002
|
+
* IPs of the forwarding hosts to delete.
|
|
1003
|
+
*/
|
|
1004
|
+
items: string[];
|
|
1005
|
+
}
|
|
1006
|
+
/**
|
|
1007
|
+
* Forwarding host as returned by the Mailcow API.
|
|
1008
|
+
*/
|
|
1009
|
+
export interface ForwardingHost {
|
|
1010
|
+
/**
|
|
1011
|
+
* IP of the forwarding host.
|
|
1012
|
+
*/
|
|
1013
|
+
host: string;
|
|
1014
|
+
/**
|
|
1015
|
+
* If the host keeps or discards spam.
|
|
1016
|
+
*/
|
|
1017
|
+
keep_spam: 'yes' | 'no';
|
|
1018
|
+
/**
|
|
1019
|
+
* Hostname.
|
|
1020
|
+
*/
|
|
1021
|
+
source: string;
|
|
1022
|
+
}
|
|
1023
|
+
/**
|
|
1024
|
+
* Base Log interface
|
|
1025
|
+
*/
|
|
1026
|
+
export interface Log {
|
|
1027
|
+
/**
|
|
1028
|
+
* Timestamp in Epoch format.
|
|
1029
|
+
*/
|
|
1030
|
+
time: number;
|
|
1031
|
+
}
|
|
1032
|
+
export interface ACMELog extends Log {
|
|
1033
|
+
/**
|
|
1034
|
+
* Log message.
|
|
1035
|
+
*/
|
|
1036
|
+
message: string;
|
|
1037
|
+
}
|
|
1038
|
+
/**
|
|
1039
|
+
* API Log item.
|
|
1040
|
+
*/
|
|
1041
|
+
export interface APILog extends Log {
|
|
1042
|
+
/**
|
|
1043
|
+
* Payload used in the API call.
|
|
1044
|
+
*/
|
|
1045
|
+
data: string;
|
|
1046
|
+
/**
|
|
1047
|
+
* Request method.
|
|
1048
|
+
*/
|
|
1049
|
+
method: 'GET' | 'POST';
|
|
1050
|
+
/**
|
|
1051
|
+
* IP that did the call.
|
|
1052
|
+
*/
|
|
1053
|
+
remote: string;
|
|
1054
|
+
/**
|
|
1055
|
+
* API Route used.
|
|
1056
|
+
*/
|
|
1057
|
+
uri: string;
|
|
1058
|
+
}
|
|
1059
|
+
/**
|
|
1060
|
+
* Autodiscover log item.
|
|
1061
|
+
*/
|
|
1062
|
+
export interface ADLog extends Log {
|
|
1063
|
+
/**
|
|
1064
|
+
* Service used.
|
|
1065
|
+
*/
|
|
1066
|
+
service: string;
|
|
1067
|
+
/**
|
|
1068
|
+
* User agent.
|
|
1069
|
+
*/
|
|
1070
|
+
ua: string;
|
|
1071
|
+
/**
|
|
1072
|
+
* The user.
|
|
1073
|
+
*/
|
|
1074
|
+
user: string;
|
|
1075
|
+
}
|
|
1076
|
+
/**
|
|
1077
|
+
* Dovecot log item.
|
|
1078
|
+
*/
|
|
1079
|
+
export interface DCLog extends Log {
|
|
1080
|
+
/**
|
|
1081
|
+
* The dovecot log message.
|
|
1082
|
+
*/
|
|
1083
|
+
message: string;
|
|
1084
|
+
/**
|
|
1085
|
+
* The dovecot priority level.
|
|
1086
|
+
*/
|
|
1087
|
+
priority: string;
|
|
1088
|
+
/**
|
|
1089
|
+
* Program used.
|
|
1090
|
+
*/
|
|
1091
|
+
program: string;
|
|
1092
|
+
}
|
|
1093
|
+
/**
|
|
1094
|
+
* Netfilter log item.
|
|
1095
|
+
*/
|
|
1096
|
+
export interface NFLog extends Log {
|
|
1097
|
+
/**
|
|
1098
|
+
* The netfilter message.
|
|
1099
|
+
*/
|
|
1100
|
+
message: string;
|
|
1101
|
+
/**
|
|
1102
|
+
* The netfilter priority level.
|
|
1103
|
+
*/
|
|
1104
|
+
priority: string;
|
|
1105
|
+
}
|
|
1106
|
+
/**
|
|
1107
|
+
* Postfix log item.
|
|
1108
|
+
*/
|
|
1109
|
+
export interface PFLog extends Log {
|
|
1110
|
+
/**
|
|
1111
|
+
* The Postfix log message.
|
|
1112
|
+
*/
|
|
1113
|
+
message: string;
|
|
1114
|
+
/**
|
|
1115
|
+
* The Postfix priority level.
|
|
1116
|
+
*/
|
|
1117
|
+
priority: string;
|
|
1118
|
+
/**
|
|
1119
|
+
* Program used.
|
|
1120
|
+
*/
|
|
1121
|
+
program: string;
|
|
1122
|
+
}
|
|
1123
|
+
/**
|
|
1124
|
+
* Ratelimited log item.
|
|
1125
|
+
*/
|
|
1126
|
+
export interface RLLog extends Log {
|
|
1127
|
+
/**
|
|
1128
|
+
* From email adress.
|
|
1129
|
+
*/
|
|
1130
|
+
from: string;
|
|
1131
|
+
/**
|
|
1132
|
+
* Header of the from field.
|
|
1133
|
+
*/
|
|
1134
|
+
header_from: string;
|
|
1135
|
+
/**
|
|
1136
|
+
* Header of the subject field.
|
|
1137
|
+
*/
|
|
1138
|
+
header_subject: string;
|
|
1139
|
+
/**
|
|
1140
|
+
* IP of the sender.
|
|
1141
|
+
*/
|
|
1142
|
+
ip: string;
|
|
1143
|
+
/**
|
|
1144
|
+
* ID of the message.
|
|
1145
|
+
*/
|
|
1146
|
+
message_id: string;
|
|
1147
|
+
/**
|
|
1148
|
+
* QID of the message.
|
|
1149
|
+
*/
|
|
1150
|
+
qid: string;
|
|
1151
|
+
/**
|
|
1152
|
+
* Recipient of the message.
|
|
1153
|
+
*/
|
|
1154
|
+
rcpt: string;
|
|
1155
|
+
/**
|
|
1156
|
+
* Ratelimit hash.
|
|
1157
|
+
*/
|
|
1158
|
+
rl_hash: string;
|
|
1159
|
+
/**
|
|
1160
|
+
* Ratelimit info
|
|
1161
|
+
*/
|
|
1162
|
+
rl_info: string;
|
|
1163
|
+
/**
|
|
1164
|
+
* Ratelimit name
|
|
1165
|
+
*/
|
|
1166
|
+
rl_name: string;
|
|
1167
|
+
/**
|
|
1168
|
+
* Sender of the message.
|
|
1169
|
+
*/
|
|
1170
|
+
user: string;
|
|
1171
|
+
}
|
|
1172
|
+
/**
|
|
1173
|
+
* Rspamd log item.
|
|
1174
|
+
*/
|
|
1175
|
+
export interface RSLog extends Log {
|
|
1176
|
+
/**
|
|
1177
|
+
* What happend to the message.
|
|
1178
|
+
*/
|
|
1179
|
+
action: string;
|
|
1180
|
+
/**
|
|
1181
|
+
* Size of the message.
|
|
1182
|
+
*/
|
|
1183
|
+
size: string;
|
|
1184
|
+
/**
|
|
1185
|
+
* Array of recipients SMTPs.
|
|
1186
|
+
*/
|
|
1187
|
+
rcpt_smtp: string[];
|
|
1188
|
+
/**
|
|
1189
|
+
* Array of recipients MIME.
|
|
1190
|
+
*/
|
|
1191
|
+
rcpt_mime: string[];
|
|
1192
|
+
/**
|
|
1193
|
+
* Object containing all the Rspamd scoring info.
|
|
1194
|
+
*/
|
|
1195
|
+
symbols: object;
|
|
1196
|
+
/**
|
|
1197
|
+
* Score needed to pass.
|
|
1198
|
+
*/
|
|
1199
|
+
required_score: string;
|
|
1200
|
+
/**
|
|
1201
|
+
* Message ID
|
|
1202
|
+
*/
|
|
1203
|
+
'message-id': string;
|
|
1204
|
+
/**
|
|
1205
|
+
* IP of the sender
|
|
1206
|
+
*/
|
|
1207
|
+
ip: string;
|
|
1208
|
+
/**
|
|
1209
|
+
* Name of the user
|
|
1210
|
+
*/
|
|
1211
|
+
user: string;
|
|
1212
|
+
/**
|
|
1213
|
+
* Time used.
|
|
1214
|
+
*/
|
|
1215
|
+
time_real: string;
|
|
1216
|
+
/**
|
|
1217
|
+
* SMTP of the receiver.
|
|
1218
|
+
*/
|
|
1219
|
+
sender_smtp: string;
|
|
1220
|
+
/**
|
|
1221
|
+
* If the message was skipped.
|
|
1222
|
+
*/
|
|
1223
|
+
is_skipped: boolean;
|
|
1224
|
+
/**
|
|
1225
|
+
* Score of the message
|
|
1226
|
+
*/
|
|
1227
|
+
score: number;
|
|
1228
|
+
/**
|
|
1229
|
+
* MIME of the sender.
|
|
1230
|
+
*/
|
|
1231
|
+
sender_mime: string;
|
|
1232
|
+
/**
|
|
1233
|
+
* EPOCH time stamp.
|
|
1234
|
+
*/
|
|
1235
|
+
unix_time: number;
|
|
1236
|
+
/**
|
|
1237
|
+
* Subject of the e-mail.
|
|
1238
|
+
*/
|
|
1239
|
+
subject: string;
|
|
1240
|
+
}
|
|
1241
|
+
/**
|
|
1242
|
+
* SOGo log item.
|
|
1243
|
+
*/
|
|
1244
|
+
export interface SGLog extends Log {
|
|
1245
|
+
/**
|
|
1246
|
+
* The log message.
|
|
1247
|
+
*/
|
|
1248
|
+
message: string;
|
|
1249
|
+
/**
|
|
1250
|
+
* The priority level.
|
|
1251
|
+
*/
|
|
1252
|
+
priority: string;
|
|
1253
|
+
program: 'sogod';
|
|
1254
|
+
}
|
|
1255
|
+
/**
|
|
1256
|
+
* Watchdog log item.
|
|
1257
|
+
*/
|
|
1258
|
+
export interface WDLog extends Log {
|
|
1259
|
+
/**
|
|
1260
|
+
* Difference with previous health.
|
|
1261
|
+
*/
|
|
1262
|
+
hpdiff: number;
|
|
1263
|
+
/**
|
|
1264
|
+
* Current health
|
|
1265
|
+
*/
|
|
1266
|
+
hpnow: number;
|
|
1267
|
+
/**
|
|
1268
|
+
* Total health.
|
|
1269
|
+
*/
|
|
1270
|
+
hptotal: number;
|
|
1271
|
+
/**
|
|
1272
|
+
* Level of the service
|
|
1273
|
+
*/
|
|
1274
|
+
lvl: number;
|
|
1275
|
+
/**
|
|
1276
|
+
* Service being watched
|
|
1277
|
+
*/
|
|
1278
|
+
service: string;
|
|
1279
|
+
/**
|
|
1280
|
+
* Time of report in Epoch.
|
|
1281
|
+
*/
|
|
1282
|
+
time: number;
|
|
1283
|
+
}
|
|
894
1284
|
/**
|
|
895
1285
|
* Error class used for exception handling.
|
|
896
1286
|
*/
|
package/dist/types.js
CHANGED
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAi1CA;;GAEG;AACH,MAAa,gBAAiB,SAAQ,KAAK;CAK1C;AALD,4CAKC"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-mailcow-api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.2",
|
|
4
4
|
"description": "TypeScript wrapper for the mailcow API.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "ts-mocha ./test/**/*.test.ts",
|
|
7
7
|
"lint": "eslint --fix ./src/**/*.ts",
|
|
8
|
+
"quick": "ts-node ./src/custom.ts",
|
|
8
9
|
"docs": "typedoc",
|
|
9
10
|
"build": "tsc",
|
|
10
11
|
"prepare": "tsc",
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import MailcowClient from '../index';
|
|
2
|
+
import { ForwardingCreateRequest, ForwardingDeleteRequest, ForwardingHost, MailcowResponse } from '../types';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Interface for all Forwarding Hosts endpoints.
|
|
6
|
+
*/
|
|
7
|
+
export interface ForwardingEndpoints {
|
|
8
|
+
/**
|
|
9
|
+
* Endpoint for deleting forwarding host.
|
|
10
|
+
* @param payload - The deletion payload
|
|
11
|
+
*/
|
|
12
|
+
delete(payload: ForwardingDeleteRequest): Promise<MailcowResponse>
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Endpoint for creating forwarding host.
|
|
16
|
+
* @param payload - The creation payload
|
|
17
|
+
*/
|
|
18
|
+
create(payload: ForwardingCreateRequest): Promise<MailcowResponse>
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Endpoint for getting all forwarding host.
|
|
22
|
+
*/
|
|
23
|
+
getAll(): Promise<ForwardingHost[]>
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Binder function between the MailcowClient class and the ForwardingEndpoints.
|
|
28
|
+
* @param bind - The MailcowClient to bind.
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
export function forwardingEndpoints(bind: MailcowClient): ForwardingEndpoints {
|
|
32
|
+
return {
|
|
33
|
+
delete(payload: ForwardingDeleteRequest): Promise<MailcowResponse> {
|
|
34
|
+
return bind.requestFactory.post<MailcowResponse>(
|
|
35
|
+
'/api/v1/delete/fwdhost',
|
|
36
|
+
payload.items
|
|
37
|
+
);
|
|
38
|
+
},
|
|
39
|
+
create(payload: ForwardingCreateRequest): Promise<MailcowResponse> {
|
|
40
|
+
return bind.requestFactory.post<MailcowResponse>(
|
|
41
|
+
'/api/v1/add/fwdhost',
|
|
42
|
+
payload
|
|
43
|
+
);
|
|
44
|
+
},
|
|
45
|
+
getAll(): Promise<ForwardingHost[]> {
|
|
46
|
+
return bind.requestFactory.get<ForwardingHost[]>(
|
|
47
|
+
'/api/v1/get/fwdhost/all'
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import MailcowClient from '../index';
|
|
2
|
+
import {
|
|
3
|
+
ACMELog,
|
|
4
|
+
ADLog,
|
|
5
|
+
APILog,
|
|
6
|
+
DCLog,
|
|
7
|
+
NFLog,
|
|
8
|
+
PFLog,
|
|
9
|
+
RLLog,
|
|
10
|
+
RSLog,
|
|
11
|
+
SGLog,
|
|
12
|
+
WDLog
|
|
13
|
+
} from '../types';
|
|
14
|
+
|
|
15
|
+
export interface LogEndpoints {
|
|
16
|
+
/**
|
|
17
|
+
* Endpoint for returning ACME Logs.
|
|
18
|
+
* @param count - The number of logs to return.
|
|
19
|
+
*/
|
|
20
|
+
acme(count: number): Promise<ACMELog[]>;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Endpoint for returning API Logs.
|
|
24
|
+
* @param count - The number of logs to return.
|
|
25
|
+
*/
|
|
26
|
+
api(count: number): Promise<APILog[]>;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Endpoint for returning Autodiscover Logs.
|
|
30
|
+
* @param count - The number of logs to return.
|
|
31
|
+
*/
|
|
32
|
+
autodiscover(count: number): Promise<ADLog[]>;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Endpoint for returning dovecot Logs.
|
|
36
|
+
* @param count - The number of logs to return.
|
|
37
|
+
*/
|
|
38
|
+
dovecot(count: number): Promise<DCLog[]>;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Endpoint for returning Netfilter Logs.
|
|
42
|
+
* @param count - The number of logs to return.
|
|
43
|
+
*/
|
|
44
|
+
netfilter(count: number): Promise<NFLog[]>;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Endpoint for returning Postfix Logs.
|
|
48
|
+
* @param count - The number of logs to return.
|
|
49
|
+
*/
|
|
50
|
+
postfix(count: number): Promise<PFLog[]>;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Endpoint for returning Rate limited Logs.
|
|
54
|
+
* @param count - The number of logs to return.
|
|
55
|
+
*/
|
|
56
|
+
ratelimited(count: number): Promise<RLLog[]>;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Endpoint for returning Rspamd Logs.
|
|
60
|
+
* @param count - The number of logs to return.
|
|
61
|
+
*/
|
|
62
|
+
rspamd(count: number): Promise<RSLog[]>;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Endpoint for returning SOGo Logs.
|
|
66
|
+
* @param count - The number of logs to return.
|
|
67
|
+
*/
|
|
68
|
+
sogo(count: number): Promise<SGLog[]>;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Endpoint for returning Watchdog Logs.
|
|
72
|
+
* @param count - The number of logs to return.
|
|
73
|
+
*/
|
|
74
|
+
watchdog(count: number): Promise<WDLog[]>;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function logEndpoints(bind: MailcowClient): LogEndpoints {
|
|
78
|
+
return {
|
|
79
|
+
acme(count: number): Promise<ACMELog[]> {
|
|
80
|
+
return bind.requestFactory.get<ACMELog[]>(
|
|
81
|
+
`/api/v1/get/logs/acme/${count}`
|
|
82
|
+
);
|
|
83
|
+
},
|
|
84
|
+
api(count: number): Promise<APILog[]> {
|
|
85
|
+
return bind.requestFactory.get<APILog[]>(
|
|
86
|
+
`/api/v1/get/logs/api/${count}`
|
|
87
|
+
);
|
|
88
|
+
},
|
|
89
|
+
autodiscover(count: number): Promise<ADLog[]> {
|
|
90
|
+
return bind.requestFactory.get<ADLog[]>(
|
|
91
|
+
`/api/v1/get/logs/autodiscover/${count}`
|
|
92
|
+
);
|
|
93
|
+
},
|
|
94
|
+
dovecot(count: number): Promise<DCLog[]> {
|
|
95
|
+
return bind.requestFactory.get<DCLog[]>(
|
|
96
|
+
`/api/v1/get/logs/dovecot/${count}`
|
|
97
|
+
);
|
|
98
|
+
},
|
|
99
|
+
netfilter(count: number): Promise<NFLog[]> {
|
|
100
|
+
return bind.requestFactory.get<NFLog[]>(
|
|
101
|
+
`/api/v1/get/logs/netfilter/${count}`
|
|
102
|
+
);
|
|
103
|
+
},
|
|
104
|
+
postfix(count: number): Promise<PFLog[]> {
|
|
105
|
+
return bind.requestFactory.get<PFLog[]>(
|
|
106
|
+
`/api/v1/get/logs/postfix/${count}`
|
|
107
|
+
);
|
|
108
|
+
},
|
|
109
|
+
ratelimited(count: number): Promise<RLLog[]> {
|
|
110
|
+
return bind.requestFactory.get<RLLog[]>(
|
|
111
|
+
`/api/v1/get/logs/ratelimited/${count}`
|
|
112
|
+
);
|
|
113
|
+
},
|
|
114
|
+
rspamd(count: number): Promise<RSLog[]> {
|
|
115
|
+
return bind.requestFactory.get<RSLog[]>(
|
|
116
|
+
`/api/v1/get/logs/rspamd-history/${count}`
|
|
117
|
+
);
|
|
118
|
+
},
|
|
119
|
+
sogo(count: number): Promise<SGLog[]> {
|
|
120
|
+
return bind.requestFactory.get<SGLog[]>(
|
|
121
|
+
`/api/v1/get/logs/sogo/${count}`
|
|
122
|
+
);
|
|
123
|
+
},
|
|
124
|
+
watchdog(count: number): Promise<WDLog[]> {
|
|
125
|
+
return bind.requestFactory.get<WDLog[]>(
|
|
126
|
+
`/api/v1/get/logs/watchdog/${count}`
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
}
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
SpamScoreEditRequest
|
|
11
11
|
} from '../types';
|
|
12
12
|
import MailcowClient from '../index';
|
|
13
|
-
import { wrapPromiseToArray } from
|
|
13
|
+
import { wrapPromiseToArray } from '../request-factory';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Interface for all Mailbox endpoints.
|