@@ -578,6 +578,18 @@ export declare namespace rs {
578578 delimiter ?: string ;
579579 }
580580
581+ type BucketEventName = 'put'
582+ | 'mkfile'
583+ | 'delete'
584+ | 'copy'
585+ | 'move'
586+ | 'append'
587+ | 'disable'
588+ | 'enable'
589+ | 'deleteMarkerCreate'
590+ | 'predelete'
591+ | 'restore:completed' ;
592+
581593 class BucketManager {
582594 mac : auth . digest . Mac ;
583595 config : conf . Config ;
@@ -866,6 +878,113 @@ export declare namespace rs {
866878 * @param callbackFunc - 回调函数
867879 */
868880 getBucketLifecycleRule ( bucket : string , callbackFunc : callback ) : void
881+
882+ /**
883+ * 添加事件通知
884+ * https://developer.qiniu.com/kodo/8610/dev-event-notification
885+ * @param bucket - 空间名
886+ * @param options - 配置项
887+ * @param options.name - 规则名称 bucket 内唯一,长度小于50,不能为空,只能为字母、数字、下划线
888+ * @param options.event - 事件类型,接受数组设置多个
889+ * @param options.callbackUrl - 事件通知回调 URL,接受数组设置多个,失败依次重试
890+ * @param options.prefix - 可选,文件配置的前缀
891+ * @param options.suffix - 可选,文件配置的后缀
892+ * @param options.access_key - 可选,设置的话会对通知请求用对应的ak、sk进行签名
893+ * @param options.host - 可选,通知请求的host
894+ * @param callbackFunc - 回调函数
895+ */
896+ putBucketEvent (
897+ bucket : string ,
898+ options : {
899+ name : string ,
900+ event : BucketEventName | BucketEventName [ ] ,
901+ callbackUrl : string | string [ ] ,
902+ prefix ?: string ,
903+ suffix ?: string ,
904+ access_key ?: string ,
905+ host ?: string ,
906+ } ,
907+ callbackFunc : callback ,
908+ ) : void
909+
910+ /**
911+ * 更新事件通知
912+ * https://developer.qiniu.com/kodo/8610/dev-event-notification
913+ * @param bucket - 空间名
914+ * @param options - 配置项
915+ * @param options.name - 规则名称 bucket 内唯一,长度小于50,不能为空,只能为字母、数字、下划线
916+ * @param options.event - 事件类型,接受数组设置多个
917+ * @param options.callbackUrl - 事件通知回调 URL,接受数组设置多个,失败依次重试
918+ * @param options.prefix - 可选,文件配置的前缀
919+ * @param options.suffix - 可选,文件配置的后缀
920+ * @param options.access_key - 可选,设置的话会对通知请求用对应的ak、sk进行签名
921+ * @param options.host - 可选,通知请求的host
922+ * @param callbackFunc - 回调函数
923+ */
924+ updateBucketEvent (
925+ bucket : string ,
926+ options : {
927+ name : string ,
928+ event ?: BucketEventName | BucketEventName [ ] ,
929+ callbackUrl ?: string | string [ ] ,
930+ prefix ?: string ,
931+ suffix ?: string ,
932+ access_key ?: string ,
933+ host ?: string ,
934+ } ,
935+ callbackFunc : callback ,
936+ ) : void
937+
938+ /**
939+ * 获取事件通知规则
940+ * https://developer.qiniu.com/kodo/8610/dev-event-notification
941+ *
942+ * @param bucket - 空间名
943+ * @param callbackFunc - 回调函数
944+ */
945+ getBucketEvent ( bucket : string , callbackFunc : callback ) : void
946+
947+ /**
948+ * 删除事件通知规则
949+ * https://developer.qiniu.com/kodo/8610/dev-event-notification
950+ *
951+ * @param bucket - 空间名
952+ * @param name - 规则名称
953+ * @param callbackFunc - 回调函数
954+ */
955+ deleteBucketEvent ( bucket : string , name : string , callbackFunc : callback ) : void
956+
957+ /**
958+ * 设置 bucket 的 cors(跨域)规则
959+ * https://developer.qiniu.com/kodo/8539/set-the-cross-domain-resource-sharing
960+ * @param bucket - 空间名
961+ * @param body - 规则配置
962+ * @param body[].allowed_origin - 允许的域名
963+ * @param body[].allowed_method - 允许的请求方法;大小写不敏感
964+ * @param body[].allowed_header - 可选,允许的 header;默认不允许任何 header;大小写不敏感
965+ * @param body[].exposed_header - 可选,暴露的 header;默认 X-Log, X-Reqid;大小写不敏感
966+ * @param body[].max_age - 可选,结果可以缓存的时间;默认不缓存
967+ * @param callbackFunc - 回调函数
968+ */
969+ putCorsRules (
970+ bucket : string ,
971+ body : {
972+ allowed_origin : string [ ] ,
973+ allowed_method : string [ ] ,
974+ allowed_header ?: string [ ] ,
975+ exposed_header ?: string [ ] ,
976+ max_age ?: number ,
977+ } [ ] ,
978+ callbackFunc : callback
979+ ) : void
980+
981+ /**
982+ * 获取 bucket 的 cors(跨域)规则
983+ * https://developer.qiniu.com/kodo/8539/set-the-cross-domain-resource-sharing
984+ * @param bucket - 空间名
985+ * @param callbackFunc - 回调函数
986+ */
987+ getCorsRules ( bucket : string , callbackFunc : callback ) : void
869988 }
870989
871990 /**
0 commit comments