index.d.ts 65 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995
  1. /**
  2. * typescript definition for qiniu 7.x
  3. * @author xialeistudio<xialeistudio@gmail.com>
  4. */
  5. import {Callback, RequestOptions} from 'urllib';
  6. import {Agent as HttpAgent, IncomingMessage} from 'http';
  7. import {Agent as HttpsAgent} from 'https';
  8. import {Readable} from "stream";
  9. import {
  10. BatchOpsResult,
  11. FetchObjectResult,
  12. GetBucketCorsRulesResult,
  13. GetBucketDomainsV3Result,
  14. GetBucketEventsResult,
  15. GetBucketInfoV2Result,
  16. GetBucketQuotaResult,
  17. GetBucketRulesResult,
  18. GetBucketsResult,
  19. GetObjectsResult,
  20. StatObjectResult
  21. } from "./StorageResponseInterface";
  22. export declare type callback<T = any> = (e?: Error, respBody?: T, respInfo?: any) => void;
  23. export declare namespace auth {
  24. namespace digest {
  25. interface MacOptions {
  26. disableQiniuTimestampSignature?: boolean;
  27. }
  28. class Mac {
  29. accessKey: string;
  30. secretKey: string;
  31. options: MacOptions;
  32. constructor(accessKey?: string, secretKey?: string, options?: MacOptions);
  33. }
  34. }
  35. }
  36. export declare namespace cdn {
  37. class CdnManager {
  38. mac: auth.digest.Mac;
  39. constructor(mac?: auth.digest.Mac);
  40. /**
  41. * 获取域名日志下载链接
  42. * @see http://developer.qiniu.com/article/fusion/api/log.html
  43. *
  44. * @param domains 域名列表 如:['obbid7qc6.qnssl.com','7xkh68.com1.z0.glb.clouddn.com']
  45. * @param logDay logDay 如 2016-07-01
  46. * @param callback callbackFunc(err, respBody, respInfo)
  47. */
  48. getCdnLogList(domains: string[], logDay: string, callback: callback): void;
  49. /**
  50. * 获取域名访问流量数据
  51. * @see http://developer.qiniu.com/article/fusion/api/traffic-bandwidth.html#batch-flux
  52. *
  53. * @param startDate 开始日期,例如:2016-07-01
  54. * @param endDate 结束日期,例如:2016-07-03
  55. * @param granularity 粒度,取值:5min/hour/day
  56. * @param domains 域名列表 domain = ['obbid7qc6.qnssl.com','obbid7qc6.qnssl.com'];
  57. * @param callback callbackFunc(err, respBody, respInfo)
  58. */
  59. getFluxData(startDate: string, endDate: string, granularity: string, domains: string[], callback: callback): void;
  60. /**
  61. * 获取域名带宽数据
  62. * @see http://developer.qiniu.com/article/fusion/api/traffic-bandwidth.html#batch-flux
  63. * @param startDate 开始日期,例如:2016-07-01
  64. * @param endDate 结束日期,例如:2016-07-03
  65. * @param granularity 粒度,取值:5min/hour/day
  66. * @param domains 域名列表 domain = ['obbid7qc6.qnssl.com','obbid7qc6.qnssl.com'];
  67. * @param callback callbackFunc(err, respBody, respInfo)
  68. */
  69. getBandwidthData(startDate: string, endDate: string, granularity: string, domains: string[], callback: callback): void;
  70. /**
  71. * 预取文件链接
  72. * @see http://developer.qiniu.com/article/fusion/api/prefetch.html
  73. *
  74. * @param urls 预取urls urls = ['http://obbid7qc6.qnssl.com/023','http://obbid7qc6.qnssl.com/025']
  75. * @param callback callbackFunc(err, respBody, respInfo)
  76. */
  77. prefetchUrls(urls: string[], callback: callback): void;
  78. /**
  79. * 刷新链接
  80. * @see http://developer.qiniu.com/article/fusion/api/refresh.html
  81. *
  82. * @param urls refreshUrls = ['http://obbid7qc6.qnssl.com/023','http://obbid7qc6.qnssl.com/025']
  83. * @param callback callbackFunc(err, respBody, respInfo)
  84. */
  85. refreshUrls(urls: string[], callback: callback): void;
  86. /**
  87. * 刷新目录列表,每次最多不可以超过10个目录, 刷新目录需要额外开通权限,可以联系七牛技术支持处理
  88. * @see http://developer.qiniu.com/article/fusion/api/refresh.html
  89. *
  90. * @param dirs refreshDirs = ['http://obbid7qc6.qnssl.com/wo/','http://obbid7qc6.qnssl.com/']
  91. * @param callback callbackFunc(err, respBody, respInfo)
  92. */
  93. refreshDirs(dirs: string[], callback: callback): void;
  94. /**
  95. * 刷新目录和链接
  96. * @param urls refreshUrls = ['http://obbid7qc6.qnssl.com/023','http://obbid7qc6.qnssl.com/025']
  97. * @param dirs refreshDirs = ['http://obbid7qc6.qnssl.com/wo/','http://obbid7qc6.qnssl.com/']
  98. * @param callback callbackFunc(err, respBody, respInfo)
  99. */
  100. refreshUrlsAndDirs(urls: string[], dirs: string[], callback: callback): void;
  101. /**
  102. * 构建标准的基于时间戳的防盗链
  103. * @param domain 自定义域名,例如 http://img.abc.com
  104. * @param fileName 待访问的原始文件名,必须是utf8编码,不需要进行urlencode
  105. * @param query 业务自身的查询参数,必须是utf8编码,不需要进行urlencode, 例如 {aa:"23", attname:"11111111111111"}
  106. * @param encryptKey 时间戳防盗链的签名密钥,从七牛后台获取
  107. * @param deadline 链接的有效期时间戳,是以秒为单位的Unix时间戳
  108. * @return signedUrl 最终的带时间戳防盗链的url
  109. */
  110. createTimestampAntiLeechUrl(domain: string, fileName: string, query: any, encryptKey: string, deadline: number): string;
  111. }
  112. }
  113. export declare namespace conf {
  114. let ACCESS_KEY: string;
  115. let SECRET_KEY: string;
  116. let USER_AGENT: string;
  117. let BLOCK_SIZE: number;
  118. let FormMimeUrl: string;
  119. let FormMimeJson: string;
  120. let FormMimeRaw: string;
  121. let RS_HOST: string;
  122. let RPC_TIMEOUT: number;
  123. interface getRegionsProviderOptions {
  124. bucketName: string;
  125. accessKey: string;
  126. }
  127. interface ConfigOptions {
  128. /**
  129. * @default false
  130. */
  131. useHttpsDomain?: boolean;
  132. /**
  133. * 在使用前需要提前开通加速域名
  134. * 详见:https://developer.qiniu.com/kodo/12656/transfer-acceleration
  135. * @default false
  136. */
  137. accelerateUploading?: boolean;
  138. /**
  139. * @deprecated 实际已无加速上传能力,使用 accelerateUploading 代替
  140. * @default true
  141. */
  142. useCdnDomain?: boolean;
  143. /**
  144. * @default null
  145. */
  146. ucEndpointsProvider?: httpc.EndpointsProvider;
  147. /**
  148. * @default null
  149. */
  150. queryRegionsEndpointsProvider?: httpc.EndpointsProvider;
  151. /**
  152. * @deprecated use regionsProvider instead
  153. * @default null
  154. */
  155. zone?: Zone;
  156. /**
  157. * @deprecated
  158. * @default -1
  159. */
  160. zoneExpire?: number;
  161. /**
  162. * @default null
  163. */
  164. regionsProvider?: httpc.RegionsProvider;
  165. }
  166. class Config {
  167. useHttpsDomain: boolean;
  168. accelerateUploading: boolean;
  169. /**
  170. * @deprecated 实际已无加速上传能力,使用 accelerateUploading 代替
  171. */
  172. useCdnDomain: boolean;
  173. ucEndpointsProvider?: httpc.EndpointsProvider | null;
  174. queryRegionsEndpointsProvider?: httpc.EndpointsProvider | null;
  175. regionsProvider?: httpc.RegionsProvider | null;
  176. regionsQueryResultCachePath?: string | null;
  177. zone?: Zone | null;
  178. zoneExpire?: number;
  179. constructor(options?: ConfigOptions);
  180. getUcEndpointsProvider(): httpc.EndpointsProvider;
  181. getRegionsProvider(options?: getRegionsProviderOptions): Promise<httpc.RegionsProvider>
  182. }
  183. class Zone {
  184. srcUpHosts: any;
  185. cdnUpHosts: any;
  186. ioHost: string;
  187. rsHost: string;
  188. rsfHost: string;
  189. apiHost: string;
  190. constructor(srcUpHosts?: any, cdnUpHosts?: any, ioHost?: string, rsHost?: string, rsfHost?: string, apiHost?: string);
  191. }
  192. }
  193. export declare namespace form_up {
  194. type UploadResult = httpc.ResponseWrapper
  195. class FormUploader {
  196. conf: conf.Config;
  197. constructor(config?: conf.Config);
  198. /**
  199. *
  200. * @param uploadToken
  201. * @param key
  202. * @param fsStream
  203. * @param putExtra
  204. * @param callback
  205. */
  206. putStream(
  207. uploadToken: string,
  208. key: string | null,
  209. fsStream: NodeJS.ReadableStream,
  210. putExtra: PutExtra | null,
  211. callback?: callback
  212. ): Promise<UploadResult>;
  213. /**
  214. *
  215. * @param uploadToken
  216. * @param key
  217. * @param body
  218. * @param putExtra
  219. * @param callback
  220. */
  221. put(
  222. uploadToken: string,
  223. key: string | null,
  224. body: any,
  225. putExtra: PutExtra | null,
  226. callback?: callback
  227. ): Promise<UploadResult>;
  228. /**
  229. *
  230. * @param uploadToken
  231. * @param body
  232. * @param putExtra
  233. * @param callback
  234. */
  235. putWithoutKey(
  236. uploadToken: string,
  237. body: any,
  238. putExtra: PutExtra | null,
  239. callback?: callback
  240. ): Promise<UploadResult>;
  241. /**
  242. * 上传本地文件
  243. * @param uploadToken 上传凭证
  244. * @param key 目标文件名
  245. * @param localFile 本地文件路径
  246. * @param putExtra 额外选项
  247. * @param callback
  248. */
  249. putFile(
  250. uploadToken: string,
  251. key: string | null,
  252. localFile: string,
  253. putExtra: PutExtra | null,
  254. callback?: callback
  255. ): Promise<UploadResult>;
  256. /**
  257. *
  258. * @param uploadToken
  259. * @param localFile
  260. * @param putExtra
  261. * @param callback
  262. */
  263. putFileWithoutKey(
  264. uploadToken: string,
  265. localFile: string,
  266. putExtra: PutExtra | null,
  267. callback?: callback
  268. ): Promise<UploadResult>;
  269. }
  270. class PutExtra {
  271. /**
  272. * @default ''
  273. */
  274. fname: string;
  275. /**
  276. * @default {}
  277. */
  278. params: Record<string, string>;
  279. /**
  280. * @default null
  281. */
  282. mimeType?: string;
  283. /**
  284. * @default null
  285. */
  286. crc32?: string;
  287. /**
  288. * @default 0|false
  289. */
  290. checkCrc?: number | boolean;
  291. /**
  292. * @default {}
  293. */
  294. metadata?: Record<string, string>;
  295. /**
  296. * 上传可选参数
  297. * @param fname 请求体中的文件的名称
  298. * @param params 额外参数设置,参数名称必须以x:开头
  299. * @param mimeType 指定文件的mimeType
  300. * @param crc32 指定文件的crc32值
  301. * @param checkCrc 指定是否检测文件的crc32值
  302. * @param metadata 元数据设置,参数名称必须以 x-qn-meta-${name}: 开头
  303. */
  304. constructor(fname?: string, params?: Record<string, string>, mimeType?: string, crc32?: string, checkCrc?: number | boolean, metadata?: Record<string, string>);
  305. }
  306. }
  307. export declare namespace resume_up {
  308. type UploadResult = {
  309. data: any;
  310. resp: Omit<IncomingMessage, 'url'> & { requestUrls: string[] };
  311. }
  312. class ResumeUploader {
  313. config: conf.Config;
  314. constructor(config?: conf.Config);
  315. /**
  316. * 通过数据流的方式上传一个文件,如果不指定文件保存的 key,服务会自动生成一个key;
  317. * 如果 putExtra 为 null,则默认使用使用分片 v2 进行上传
  318. *
  319. * @param uploadToken
  320. * @param key
  321. * @param rsStream
  322. * @param rsStreamLen
  323. * @param putExtra
  324. * @param callback
  325. */
  326. putStream(
  327. uploadToken: string,
  328. key: string | null,
  329. rsStream: NodeJS.ReadableStream,
  330. rsStreamLen: number,
  331. putExtra: PutExtra | null,
  332. callback?: callback
  333. ): Promise<UploadResult>;
  334. /**
  335. * 通过数据流的方式上传一个文件,如果不指定文件保存的 key,服务会自动生成一个key;
  336. * 如果 putExtra 为 null,则默认使用使用分片 v2 进行上传
  337. *
  338. * @param uploadToken
  339. * @param key
  340. * @param rsStream
  341. * @param rsStreamLen
  342. * @param putExtra
  343. * @param callback
  344. */
  345. putStreamV2(
  346. uploadToken: string,
  347. key: string | null,
  348. rsStream: NodeJS.ReadableStream,
  349. rsStreamLen: number,
  350. putExtra: PutExtra | null,
  351. callback?: callback
  352. ): Promise<UploadResult>;
  353. /**
  354. * 上传一个文件,如果不指定文件保存的 key,服务会自动生成一个key;
  355. * 如果 putExtra 为 null,则默认使用使用分片 v2 进行上传
  356. *
  357. * @param uploadToken
  358. * @param key
  359. * @param localFile
  360. * @param putExtra
  361. * @param callback
  362. */
  363. putFile(
  364. uploadToken: string,
  365. key: string | null,
  366. localFile: string,
  367. putExtra: PutExtra | null,
  368. callback?: callback
  369. ): Promise<UploadResult>;
  370. /**
  371. * 上传一个文件,不指定文件保存的 key,服务会自动生成一个key;
  372. * 如果 putExtra 为 null,则默认使用使用分片 v2 进行上传
  373. *
  374. * @param uploadToken
  375. * @param key
  376. * @param localFile
  377. * @param putExtra
  378. * @param callback
  379. */
  380. putFileV2(
  381. uploadToken: string,
  382. key: string | null,
  383. localFile: string,
  384. putExtra: PutExtra | null,
  385. callback?: callback
  386. ): Promise<UploadResult>;
  387. /**
  388. *
  389. * @param uploadToken
  390. * @param localFile
  391. * @param putExtra
  392. * @param callback
  393. */
  394. putFileWithoutKey(
  395. uploadToken: string,
  396. localFile: string,
  397. putExtra: PutExtra | null,
  398. callback?: callback
  399. ): Promise<UploadResult>;
  400. /**
  401. * 上传一个文件,不指定文件保存的 key,服务会自动生成一个key;
  402. * 如果 putExtra 为 null,则默认使用使用分片 v2 进行上传
  403. *
  404. * @param uploadToken
  405. * @param localFile
  406. * @param putExtra
  407. * @param callback
  408. */
  409. putFileWithoutKeyV2(
  410. uploadToken: string,
  411. localFile: string,
  412. putExtra: PutExtra | null,
  413. callback?: callback
  414. ): Promise<UploadResult>;
  415. }
  416. class PutExtra {
  417. /**
  418. * @default ''
  419. */
  420. fname?: string;
  421. /**
  422. * @default {}
  423. */
  424. params?: Record<string, string>;
  425. /**
  426. * @default null
  427. */
  428. mimeType?: string;
  429. /**
  430. * @default null
  431. * @deprecated 使用 `resumeRecorder` 与 `resumeKey` 代替
  432. */
  433. resumeRecordFile?: string | null
  434. /**
  435. * @default null
  436. */
  437. progressCallback?: ((uploadBytes: number, totalBytes: number) => void) | null
  438. /**
  439. * @default v1
  440. */
  441. version?: string
  442. /**
  443. * @default 4 * 1024 * 1024
  444. */
  445. partSize?: number
  446. /**
  447. * @default {}
  448. */
  449. metadata?: Record<string, string>
  450. /**
  451. * 断点续传记录器,请通过 `createResumeRecorder` 或 `createResumeRecorderSync` 获取,优先级比 `resumeRecordFile` 低
  452. * @default null
  453. */
  454. resumeRecorder?: ResumeRecorder
  455. /**
  456. * 断点续传记录文件的具体文件名,不设置时会由当次上传自动生成
  457. * @default null
  458. */
  459. resumeKey?: string | null
  460. /**
  461. * 上传可选参数
  462. * @param fname 请求体中的文件的名称
  463. * @param params 额外参数设置,参数名称必须以x:开头
  464. * @param mimeType 指定文件的mimeType
  465. * @param resumeRecordFile
  466. * @param progressCallback
  467. * @param partSize 分片上传v2必传字段 默认大小为4MB 分片大小范围为1 MB - 1 GB
  468. * @param version 分片上传版本 目前支持v1/v2版本 默认v1
  469. * @param metadata 元数据设置,参数名称必须以 x-qn-meta-${name}: 开头
  470. * @param resumeRecorder 断点续传记录器,请通过 `createResumeRecorder` 或 `createResumeRecorderSync` 获取,优先级比 `resumeRecordFile` 低
  471. * @param resumeKey 断点续传记录文件的具体文件名,不设置时会由当次上传自动生成,推荐不设置
  472. */
  473. constructor(fname?: string, params?: Record<string, string>, mimeType?: string, resumeRecordFile?: string,
  474. progressCallback?: (uploadBytes: number, totalBytes: number) => void,
  475. partSize?: number, version?: string, metadata?: Record<string, string>,
  476. resumeRecorder?: ResumeRecorder, resumeKey?: string);
  477. /**
  478. * 上传可选参数
  479. * @param fname 请求体中的文件的名称
  480. * @param params 额外参数设置,参数名称必须以x:开头
  481. * @param mimeType 指定文件的mimeType
  482. * @param resumeRecordFile
  483. * @param progressCallback
  484. * @param partSize 分片上传v2必传字段 默认大小为4MB 分片大小范围为1 MB - 1 GB
  485. * @param version 分片上传版本 目前支持v1/v2版本 默认v2
  486. * @param metadata 元数据设置,参数名称必须以 x-qn-meta-${name}: 开头
  487. * @param resumeRecorder 断点续传记录器,请通过 `createResumeRecorder` 或 `createResumeRecorderSync` 获取,优先级比 `resumeRecordFile` 低
  488. * @param resumeKey 断点续传记录文件的具体文件名,不设置时会由当次上传自动生成,推荐不设置
  489. */
  490. static create(fname?: string, params?: Record<string, string>, mimeType?: string, resumeRecordFile?: string,
  491. progressCallback?: (uploadBytes: number, totalBytes: number) => void,
  492. partSize?: number, version?: string, metadata?: Record<string, string>,
  493. resumeRecorder?: ResumeRecorder, resumeKey?: string): PutExtra;
  494. }
  495. /**
  496. * 历史原因其方法当前仅支持了同步调用这一不推荐的使用方式,暂不公开具体内部信息,仅供 TypeScript 类型检查使用。
  497. * 实际不存在这个类,未来会变更为 interface。
  498. */
  499. abstract class ResumeRecorder {
  500. }
  501. /**
  502. *
  503. * @param baseDirPath 默认值为 `os.tmpdir()`,该方法若 baseDirPath 不存在将自动创建
  504. */
  505. function createResumeRecorder(baseDirPath?: string): Promise<ResumeRecorder>
  506. /**
  507. * `createResumeRecorder` 的同步版本,不推荐使用
  508. */
  509. function createResumeRecorderSync(baseDirPath?: string): ResumeRecorder
  510. }
  511. export declare namespace util {
  512. function isTimestampExpired(timestamp: number): boolean;
  513. /**
  514. * 使用 UTC 时间来格式化日期时间
  515. *
  516. * @param date 与 new Date() 接受的参数一样,内部会使用 new Date(date) 生成日期时间对象
  517. * @param layout 目前仅接受
  518. * YYYY
  519. * MM
  520. * DD
  521. * HH
  522. * mm
  523. * ss
  524. * SSS
  525. */
  526. function formatDateUTC(date: Date | number | string, layout?: string): string;
  527. function encodedEntry(bucket: string, key?: string): string;
  528. function getAKFromUptoken(uploadToken: string): string;
  529. function getBucketFromUptoken(uploadToken: string): string;
  530. function base64ToUrlSafe(v: string): string;
  531. function urlSafeToBase64(v: string): string;
  532. function urlsafeBase64Encode(jsonFlags: string): string;
  533. function urlSafeBase64Decode(fromStr: string): string;
  534. function hmacSha1(encodedFlags: string | Buffer, secretKey: string | Buffer): string;
  535. function canonicalMimeHeaderKey(fieldName: string): string;
  536. /**
  537. * 创建AccessToken凭证
  538. * @param mac AK&SK对象
  539. * @param requestURI 请求URL
  540. * @param reqBody 请求Body,仅当请求的ContentType为application/x-www-form-urlencoded 时才需要传入该参数
  541. */
  542. function generateAccessToken(mac: auth.digest.Mac, requestURI: string, reqBody?: string): string;
  543. /**
  544. * 创建AccessToken凭证
  545. * @param mac AK&SK对象
  546. * @param requestURI 请求URL
  547. * @param reqMethod 请求方法,例如 GET,POST
  548. * @param reqContentType 请求类型,例如 application/json 或者 application/x-www-form-urlencoded
  549. * @param reqBody 请求Body,仅当请求的 ContentType 为 application/json 或者 application/x-www-form-urlencoded 时才需要传入该参数
  550. * @param reqHeaders 请求Headers,例如 {"X-Qiniu-Name": "Qiniu", "Content-Type": "application/x-www-form-urlencoded"}
  551. */
  552. function generateAccessTokenV2(mac: auth.digest.Mac, requestURI: string, reqMethod: string, reqContentType: string, reqBody?: string, reqHeaders?: Record<string, string>): string;
  553. /**
  554. * 校验七牛上传回调的Authorization
  555. * @param mac AK&SK对象
  556. * @param requestURI 回调的URL中的requestURI
  557. * @param reqBody 回调的URL中的requestURI 请求Body,仅当请求的ContentType为application/x-www-form-urlencoded时才需要传入该参数
  558. * @param callbackAuth 回调时请求的Authorization头部值
  559. * @param extra 当回调为 Qiniu 签名时需要传入
  560. * @param extra.reqMethod 请求方法,例如 GET,POST
  561. * @param extra.reqContentType 请求类型,例如 application/json 或者 application/x-www-form-urlencoded
  562. * @param extra.reqHeaders 请求头部
  563. */
  564. function isQiniuCallback(
  565. mac: auth.digest.Mac,
  566. requestURI: string,
  567. reqBody: string | null,
  568. callbackAuth: string,
  569. extra?: {
  570. reqMethod: string,
  571. reqContentType?: string,
  572. reqHeaders?: Record<string, string>
  573. }
  574. ): boolean;
  575. }
  576. export declare namespace httpc {
  577. interface ReqOpts<T = any> {
  578. agent?: HttpAgent;
  579. httpsAgent?: HttpsAgent;
  580. url: string;
  581. middlewares?: middleware.Middleware[];
  582. callback?: Callback<T>;
  583. urllibOptions: RequestOptions;
  584. }
  585. // responseWrapper.js
  586. interface ResponseWrapperOptions<T = any> {
  587. data: T;
  588. resp: Omit<IncomingMessage, 'url'> & { requestUrls: string[] };
  589. }
  590. interface ResponseError {
  591. error_code?: string,
  592. error?: string,
  593. }
  594. class ResponseWrapper<T = any> {
  595. data: T extends void ? undefined | ResponseError : T & ResponseError;
  596. resp: Omit<IncomingMessage, 'url'> & { requestUrls: string[] };
  597. constructor(options: ResponseWrapperOptions);
  598. ok(): boolean;
  599. needRetry(): boolean;
  600. }
  601. // middleware package
  602. namespace middleware {
  603. interface Middleware {
  604. send<T>(
  605. request: ReqOpts<T>,
  606. next: (reqOpts: ReqOpts<T>) => Promise<ResponseWrapper<T>>
  607. ): Promise<ResponseWrapper<T>>;
  608. }
  609. /**
  610. * 组合中间件为一个调用函数
  611. * @param middlewares 中间件列表
  612. * @param handler 请求函数
  613. */
  614. function composeMiddlewares<T>(
  615. middlewares: Middleware[],
  616. handler: (reqOpts: ReqOpts<T>) => Promise<ResponseWrapper<T>>
  617. ): (reqOpts: ReqOpts<T>) => Promise<ResponseWrapper<T>>;
  618. /**
  619. * 设置 User-Agent 请求头中间件
  620. */
  621. class UserAgentMiddleware implements Middleware {
  622. constructor(sdkVersion: string);
  623. send<T>(
  624. request: httpc.ReqOpts<T>,
  625. next: (reqOpts: httpc.ReqOpts<T>) => Promise<httpc.ResponseWrapper<T>>
  626. ): Promise<httpc.ResponseWrapper<T>>;
  627. }
  628. interface RetryDomainsMiddlewareOptions {
  629. backupDomains: string[];
  630. maxRetryTimes: number;
  631. retryCondition: () => boolean;
  632. }
  633. class RetryDomainsMiddleware implements Middleware {
  634. /**
  635. * 备用域名
  636. */
  637. backupDomains: string[];
  638. /**
  639. * 最大重试次数,包括首次请求
  640. */
  641. maxRetryTimes: number;
  642. /**
  643. * 是否可以重试,可以通过该函数配置更详细的重试规则
  644. */
  645. retryCondition: () => boolean;
  646. /**
  647. * 已经重试的次数
  648. * @private
  649. */
  650. private _retriedTimes: number;
  651. /**
  652. * 实例化重试域名中间件
  653. * @param retryDomainsOptions
  654. */
  655. constructor(retryDomainsOptions: RetryDomainsMiddlewareOptions)
  656. /**
  657. * 重试域名中间件逻辑
  658. * @param request
  659. * @param next
  660. */
  661. send<T>(
  662. request: httpc.ReqOpts<T>,
  663. next: (reqOpts: httpc.ReqOpts<T>) => Promise<httpc.ResponseWrapper<T>>
  664. ): Promise<httpc.ResponseWrapper<T>>;
  665. /**
  666. * 控制重试逻辑,主要为 {@link retryCondition} 服务。若没有设置 retryCondition,默认 2xx 才会终止重试
  667. * @param err
  668. * @param respWrapper
  669. * @param reqOpts
  670. * @private
  671. */
  672. private _shouldRetry<T>(
  673. err: Error | null,
  674. respWrapper: ResponseWrapper<T>,
  675. reqOpts: ReqOpts<T>
  676. ): boolean;
  677. }
  678. }
  679. // client.js
  680. interface HttpClientOptions {
  681. httpAgent?: HttpAgent;
  682. httpsAgent?: HttpsAgent;
  683. middlewares?: middleware.Middleware[];
  684. }
  685. interface GetOptions<T = any> extends Omit<ReqOpts<T>, 'urllibOptions'> {
  686. params: Record<string, string>;
  687. headers: Record<string, string>;
  688. }
  689. interface PostOptions<T = any> extends Omit<ReqOpts<T>, 'urllibOptions'> {
  690. data: string | Buffer | Readable;
  691. headers: Record<string, string>;
  692. }
  693. interface PutOptions<T = any> extends Omit<ReqOpts<T>, 'urllibOptions'> {
  694. data: string | Buffer | Readable;
  695. headers: Record<string, string>
  696. }
  697. class HttpClient {
  698. httpAgent: HttpAgent;
  699. httpsAgent: HttpsAgent;
  700. middlewares: middleware.Middleware[];
  701. constructor(options: HttpClientOptions)
  702. sendRequest(requestOptions: ReqOpts): Promise<ResponseWrapper>
  703. get(getOptions: GetOptions, urllibOptions?: RequestOptions): Promise<ResponseWrapper>
  704. post(postOptions: PostOptions, urllibOptions?: RequestOptions): Promise<ResponseWrapper>
  705. put(putOptions: PutOptions, urllibOptions?: RequestOptions): Promise<ResponseWrapper>
  706. }
  707. // endpoint.js
  708. interface EndpointOptions {
  709. defaultScheme?: string;
  710. }
  711. interface EndpointPersistInfo {
  712. host: string;
  713. defaultScheme: string;
  714. }
  715. class Endpoint implements EndpointsProvider {
  716. host: string;
  717. defaultScheme: string;
  718. constructor(host: string, options?: EndpointOptions);
  719. getValue(options?: { scheme?: string }): string;
  720. getEndpoints(): Promise<httpc.Endpoint[]>;
  721. clone(): Endpoint;
  722. }
  723. // region.js
  724. enum SERVICE_NAME {
  725. UC = 'uc',
  726. UP = 'up',
  727. UP_ACC = 'up_acc',
  728. IO = 'io',
  729. RS = 'rs',
  730. RSF = 'rsf',
  731. API = 'api',
  732. S3 = 's3'
  733. }
  734. interface RegionOptions {
  735. regionId?: string;
  736. s3RegionId?: string;
  737. services?: Record<string, Endpoint[]>;
  738. ttl?: number;
  739. createTime?: Date;
  740. }
  741. interface RegionFromZoneOptions {
  742. regionId?: string;
  743. s3RegionId?: string;
  744. ttl?: number;
  745. preferredScheme?: 'http' | 'https' | string
  746. isPreferCdnHost?: boolean;
  747. }
  748. interface RegionFromRegionIdOptions {
  749. s3RegionId?: string;
  750. ttl?: number;
  751. createTime?: Date;
  752. extendedServices?: Record<SERVICE_NAME | string, Endpoint[]>
  753. preferredScheme?: 'http' | 'https' | string
  754. isPreferCdnUpHost?: boolean
  755. }
  756. interface RegionPersistInfo {
  757. regionId?: string;
  758. s3RegionId?: string;
  759. services: Record<SERVICE_NAME | string, EndpointPersistInfo[]>;
  760. ttl: number;
  761. createTime: number;
  762. }
  763. interface QueryRegionsRespData {
  764. region: string;
  765. ttl: number;
  766. s3: {
  767. domains: string[];
  768. region_alias: string;
  769. };
  770. uc: {
  771. domains: string[];
  772. };
  773. up: {
  774. domains: string[];
  775. };
  776. io: {
  777. domains: string[];
  778. };
  779. rs: {
  780. domains: string[];
  781. };
  782. rsf: {
  783. domains: string[];
  784. };
  785. api: {
  786. domains: string[];
  787. };
  788. }
  789. class Region implements RegionsProvider {
  790. static fromZone(zone: conf.Zone, options?: RegionFromZoneOptions): Region;
  791. static fromRegionId(regionId: string, options?: RegionFromRegionIdOptions): Region;
  792. static merge(...r: Region[]): Region;
  793. // non-unique
  794. regionId?: string;
  795. s3RegionId?: string;
  796. services: Record<SERVICE_NAME | string, Endpoint[]>
  797. ttl: number;
  798. createTime: Date;
  799. constructor(options: RegionOptions);
  800. getRegions(): Promise<httpc.Region[]>;
  801. clone(): Region;
  802. merge(...r: Region[]): Region;
  803. get isLive(): boolean;
  804. }
  805. // endpointProvider.js
  806. interface EndpointsProvider {
  807. getEndpoints(): Promise<Endpoint[]>
  808. }
  809. interface MutableEndpointsProvider extends EndpointsProvider {
  810. setEndpoints(endpoints: Endpoint[]): Promise<void>
  811. }
  812. class StaticEndpointsProvider implements EndpointsProvider {
  813. static fromRegion(region: Region, serviceName: SERVICE_NAME | string): StaticEndpointsProvider;
  814. constructor(endpoints: Endpoint[]);
  815. getEndpoints(): Promise<Endpoint[]>;
  816. }
  817. // regionsProvider.js
  818. interface RegionsProvider {
  819. getRegions(): Promise<Region[]>
  820. }
  821. interface MutableRegionsProvider extends RegionsProvider {
  822. setRegions(regions: Region[]): Promise<void>
  823. }
  824. // StaticRegionsProvider
  825. class StaticRegionsProvider implements RegionsProvider {
  826. regions: Region[];
  827. constructor(regions: Region[]);
  828. getRegions(): Promise<Region[]>;
  829. }
  830. // CachedRegionsProviderOptions
  831. interface CachedRegionsProviderOptions {
  832. cacheKey: string;
  833. baseRegionsProvider: RegionsProvider;
  834. persistPath?: string;
  835. shrinkInterval?: number; // ms
  836. }
  837. class CachedRegionsProvider implements MutableRegionsProvider {
  838. static cleanupCache(options: {
  839. isClearAll?: boolean,
  840. /**
  841. * if instance is not passed, it will clean up the default scoop.
  842. */
  843. instance?: CachedRegionsProvider,
  844. }): Promise<void>
  845. cacheKey: string;
  846. baseRegionsProvider: RegionsProvider;
  847. lastShrinkAt: Date;
  848. shrinkInterval: number;
  849. constructor(
  850. options: CachedRegionsProviderOptions
  851. );
  852. setRegions(regions: Region[]): Promise<void>;
  853. getRegions(): Promise<Region[]>;
  854. }
  855. // QueryRegionsProvider
  856. interface QueryRegionsProviderOptions {
  857. accessKey: string;
  858. bucketName: string;
  859. endpointsProvider: EndpointsProvider;
  860. preferredScheme?: 'http' | 'https' | string;
  861. }
  862. class QueryRegionsProvider implements RegionsProvider {
  863. accessKey: string;
  864. bucketName: string;
  865. endpointsProvider: EndpointsProvider;
  866. constructor(options: QueryRegionsProviderOptions);
  867. getRegions(): Promise<Region[]>;
  868. }
  869. }
  870. export declare namespace rpc {
  871. type Headers = Record<string, string> & {
  872. 'User-Agent'?: string;
  873. Connection?: string;
  874. }
  875. interface RequestOptions {
  876. headers: Headers;
  877. mac: auth.digest.Mac;
  878. }
  879. const qnHttpClient: httpc.HttpClient;
  880. /**
  881. *
  882. * @param requestUrl 请求地址
  883. * @param headers 请求 headers
  884. * @param callbackFunc 回调函数
  885. */
  886. function get(requestUrl: string, headers: Headers | null, callbackFunc: callback): void;
  887. /**
  888. * @param requestUrl 请求地址
  889. * @param options 请求的配置
  890. * @param callbackFunc 回调函数
  891. */
  892. function getWithOptions(
  893. requestUrl: string,
  894. options: RequestOptions | null,
  895. callbackFunc: callback
  896. ): ReturnType<typeof get>;
  897. /**
  898. *
  899. * @param requestUrl 请求地址
  900. * @param token 请求认证签名
  901. * @param callbackFunc 回调函数
  902. */
  903. function getWithToken(requestUrl: string, token: string | null, callbackFunc: callback): void;
  904. /**
  905. *
  906. * @param requestURI
  907. * @param requestForm
  908. * @param headers
  909. * @param callback
  910. */
  911. function post(requestURI: string, requestForm: Buffer | string | NodeJS.ReadableStream | null, headers: Headers | null, callback: callback): void;
  912. /**
  913. * @param requestUrl 请求地址
  914. * @param requestForm 请求体
  915. * @param options 请求的配置
  916. * @param callbackFunc 回调函数
  917. */
  918. function postWithOptions(
  919. requestUrl: string,
  920. requestForm: Buffer | string | NodeJS.ReadableStream | null,
  921. options: RequestOptions | null,
  922. callbackFunc: callback
  923. ): ReturnType<typeof post>;
  924. /**
  925. *
  926. * @param requestURI
  927. * @param requestForm
  928. * @param callback
  929. */
  930. function postMultipart(requestURI: string, requestForm: Buffer | string | NodeJS.ReadableStream | null, callback: callback): void;
  931. /**
  932. *
  933. * @param requestURI
  934. * @param requestForm
  935. * @param token
  936. * @param callback
  937. */
  938. function postWithForm(requestURI: string, requestForm: Buffer | string | NodeJS.ReadableStream | null, token: string | null, callback: callback): void;
  939. /**
  940. *
  941. * @param requestURI
  942. * @param token
  943. * @param callback
  944. */
  945. function postWithoutForm(requestURI: string, token: string | null, callback: callback): void;
  946. }
  947. export declare namespace zone {
  948. //huadong
  949. const Zone_z0: conf.Zone;
  950. //huadong2
  951. const Zone_cn_east_2: conf.Zone;
  952. //huabei
  953. const Zone_z1: conf.Zone;
  954. //huanan
  955. const Zone_z2: conf.Zone;
  956. //beimei
  957. const Zone_na0: conf.Zone;
  958. //Southeast Asia
  959. const Zone_as0: conf.Zone;
  960. }
  961. export declare namespace fop {
  962. interface PfopOptions {
  963. /**
  964. * 回调业务服务器,通知处理结果
  965. */
  966. notifyURL?: string;
  967. /**
  968. * 结果是否强制覆盖已有的同名文件
  969. */
  970. force?: boolean;
  971. /**
  972. * 为 `1` 时开启闲时任务
  973. */
  974. type?: number;
  975. /**
  976. * 工作流模版 ID,与函数参数中的 fops 参数二选一
  977. */
  978. workflowTemplateID?: string
  979. }
  980. class OperationManager {
  981. mac: auth.digest.Mac;
  982. config: conf.Config;
  983. constructor(mac?: auth.digest.Mac, config?: conf.Config);
  984. /**
  985. * 发送持久化数据处理请求
  986. * @param bucket 空间名称
  987. * @param key 文件名称
  988. * @param fops 处理指令集合,与 options.workflowTemplateID 二选一
  989. * @param pipeline 处理队列名称
  990. * @param options
  991. * @param callback
  992. */
  993. pfop(
  994. bucket: string,
  995. key: string,
  996. fops: string[],
  997. pipeline: string,
  998. options: PfopOptions | null,
  999. callback: callback<{
  1000. persistentId: string
  1001. }>
  1002. ): void;
  1003. /**
  1004. * 查询持久化数据处理进度
  1005. * @param persistentId pfop 操作返回的持久化处理ID
  1006. * @param callback
  1007. */
  1008. prefop(
  1009. persistentId: string,
  1010. callback: callback<{
  1011. id: string,
  1012. pipeline: string,
  1013. code: number,
  1014. desc: string,
  1015. reqid: string,
  1016. inputBucket: string,
  1017. inputKey: string,
  1018. creationDate?: string,
  1019. type?: number,
  1020. taskFrom?: string,
  1021. items: {
  1022. cmd: string,
  1023. code: number,
  1024. desc: string,
  1025. returnOld: number,
  1026. error?: string,
  1027. hash?: string,
  1028. key?: string,
  1029. }[]
  1030. }>
  1031. ): void;
  1032. }
  1033. }
  1034. export declare namespace rs {
  1035. interface ListPrefixOptions {
  1036. /**
  1037. * 列举的文件前缀
  1038. */
  1039. prefix?: string;
  1040. /**
  1041. * 上一次列举返回的位置标记
  1042. */
  1043. marker?: any;
  1044. /**
  1045. * 每次返回的最大列举文件数量
  1046. */
  1047. limit?: number;
  1048. /**
  1049. * 指定目录分隔符
  1050. */
  1051. delimiter?: string;
  1052. }
  1053. type BucketEventName = 'put'
  1054. | 'mkfile'
  1055. | 'delete'
  1056. | 'copy'
  1057. | 'move'
  1058. | 'append'
  1059. | 'disable'
  1060. | 'enable'
  1061. | 'deleteMarkerCreate'
  1062. | 'predelete'
  1063. | 'restore:completed';
  1064. class BucketManager {
  1065. mac: auth.digest.Mac;
  1066. config: conf.Config;
  1067. constructor(mac?: auth.digest.Mac, config?: conf.Config);
  1068. /**
  1069. * 获取资源信息
  1070. * @see https://developer.qiniu.com/kodo/api/1308/stat
  1071. *
  1072. * @param bucket 空间名称
  1073. * @param key 文件名称
  1074. * @param callback
  1075. */
  1076. stat(bucket: string, key: string, callback?: callback): Promise<httpc.ResponseWrapper<StatObjectResult>>;
  1077. /**
  1078. * 修改文件的类型
  1079. * @see https://developer.qiniu.com/kodo/api/1252/chgm
  1080. *
  1081. * @param bucket 空间名称
  1082. * @param key 文件名称
  1083. * @param newMime 新文件类型
  1084. * @param callback
  1085. */
  1086. changeMime(bucket: string, key: string, newMime: string, callback?: callback): Promise<httpc.ResponseWrapper<void>>;
  1087. /**
  1088. * 修改文件的Headers
  1089. * @see TODO
  1090. *
  1091. * @param bucket 空间名称
  1092. * @param key 文件名称
  1093. * @param headers Headers对象
  1094. * @param callback
  1095. */
  1096. changeHeaders(bucket: string, key: string, headers: {
  1097. [k: string]: string
  1098. }, callback?: callback): Promise<httpc.ResponseWrapper<void>>;
  1099. /**
  1100. * 移动或重命名文件,当bucketSrc==bucketDest相同的时候,就是重命名文件操作
  1101. * @see https://developer.qiniu.com/kodo/api/1288/move
  1102. *
  1103. * @param srcBucket 源空间名称
  1104. * @param srcKey 源文件名称
  1105. * @param destBucket 目标空间名称
  1106. * @param destKey 目标文件名称
  1107. * @param options
  1108. * @param callback
  1109. */
  1110. move(srcBucket: string, srcKey: string, destBucket: string, destKey: string, options: {
  1111. force?: boolean
  1112. } | null, callback?: callback): Promise<httpc.ResponseWrapper<void>>;
  1113. /**
  1114. * 复制文件
  1115. * @see https://developer.qiniu.com/kodo/api/1254/copy
  1116. *
  1117. * @param srcBucket 源空间名称
  1118. * @param srcKey 源文件名称
  1119. * @param destBucket 目标空间名称
  1120. * @param destKey 目标文件名称
  1121. * @param options
  1122. * @param callback
  1123. */
  1124. copy(srcBucket: string, srcKey: string, destBucket: string, destKey: string, options: {
  1125. force?: boolean
  1126. } | null, callback?: callback): Promise<httpc.ResponseWrapper<void>>;
  1127. /**
  1128. * 删除资源
  1129. * @see https://developer.qiniu.com/kodo/api/1257/delete
  1130. *
  1131. * @param bucket 空间名称
  1132. * @param key 文件名称
  1133. * @param callback
  1134. */
  1135. delete(bucket: string, key: string, callback?: callback): Promise<httpc.ResponseWrapper<void>>;
  1136. /**
  1137. * 设置文件删除的生命周期
  1138. * @see https://developer.qiniu.com/kodo/api/1732/update-file-lifecycle
  1139. *
  1140. * @param bucket 空间名称
  1141. * @param key 文件名称
  1142. * @param days 有效期天数
  1143. * @param callback
  1144. */
  1145. deleteAfterDays(bucket: string, key: string, days: number, callback?: callback): Promise<httpc.ResponseWrapper<void>>;
  1146. /**
  1147. * 设置文件的生命周期
  1148. * @param { string } bucket - 空间名称
  1149. * @param { string } key - 文件名称
  1150. * @param { Object } options - 配置项
  1151. * @param { number } options.toIaAfterDays - 多少天后将文件转为低频存储,设置为 -1 表示取消已设置的转低频存储的生命周期规则, 0 表示不修改转低频生命周期规则。
  1152. * @param { number } options.toArchiveIRAfterDays - 多少天后将文件转为归档直读存储,设置为 -1 表示取消已设置的转归档直读存储的生命周期规则, 0 表示不修改转归档直读生命周期规则。
  1153. * @param { number } options.toArchiveAfterDays - 多少天后将文件转为归档存储,设置为 -1 表示取消已设置的转归档存储的生命周期规则, 0 表示不修改转归档生命周期规则。
  1154. * @param { number } options.toDeepArchiveAfterDays - 多少天后将文件转为深度归档存储,设置为 -1 表示取消已设置的转深度归档存储的生命周期规则, 0 表示不修改转深度归档生命周期规则。
  1155. * @param { number } options.deleteAfterDays - 多少天后将文件删除,设置为 -1 表示取消已设置的删除存储的生命周期规则, 0 表示不修改删除存储的生命周期规则。
  1156. * @param { Object } options.cond - 匹配条件,只有条件匹配才会设置成功
  1157. * @param { string } options.cond.hash
  1158. * @param { string } options.cond.mime
  1159. * @param { number } options.cond.fsize
  1160. * @param { number } options.cond.putTime
  1161. * @param { function } callbackFunc - 回调函数
  1162. */
  1163. setObjectLifeCycle(
  1164. bucket: string,
  1165. key: string,
  1166. options: {
  1167. toIaAfterDays?: number,
  1168. toArchiveIRAfterDays?: number,
  1169. toArchiveAfterDays?: number,
  1170. toDeepArchiveAfterDays?: number,
  1171. deleteAfterDays?: number
  1172. cond?: {
  1173. hash?: string,
  1174. mime?: string,
  1175. fsize?: number,
  1176. putTime?: number
  1177. }
  1178. },
  1179. callbackFunc?: callback
  1180. ): Promise<httpc.ResponseWrapper<void>>;
  1181. listBucketDomains(bucket: string, callbackFunc?: callback): Promise<httpc.ResponseWrapper<GetBucketDomainsV3Result>>
  1182. /**
  1183. * 解冻归档存储文件
  1184. * @param entry
  1185. * @param freezeAfterDays
  1186. * @param callbackFunc
  1187. */
  1188. restoreAr(entry: string, freezeAfterDays: number, callbackFunc?: callback): Promise<httpc.ResponseWrapper<void>>;
  1189. /**
  1190. * 抓取资源
  1191. * @see https://developer.qiniu.com/kodo/api/1263/fetch
  1192. *
  1193. * @param resUrl 资源链接
  1194. * @param bucket 空间名称
  1195. * @param key 文件名称
  1196. * @param callback
  1197. */
  1198. fetch(resUrl: string, bucket: string, key: string, callback?: callback): Promise<httpc.ResponseWrapper<FetchObjectResult>>;
  1199. /**
  1200. * 更新镜像副本
  1201. * @see https://developer.qiniu.com/kodo/api/1293/prefetch
  1202. *
  1203. * @param bucket 空间名称
  1204. * @param key 文件名称
  1205. * @param callback
  1206. */
  1207. prefetch(bucket: string, key: string, callback?: callback): Promise<httpc.ResponseWrapper<void>>;
  1208. /**
  1209. * 修改文件的存储类型
  1210. * @see https://developer.qiniu.com/kodo/api/3710/modify-the-file-type
  1211. *
  1212. * @param bucket 空间名称
  1213. * @param key 文件名称
  1214. * @param newType 0 表示标准存储;1 表示低频存储。
  1215. * @param callback
  1216. */
  1217. changeType(bucket: string, key: string, newType: number, callback?: callback): Promise<httpc.ResponseWrapper<void>>;
  1218. /**
  1219. * 设置空间镜像源
  1220. * @see https://developer.qiniu.com/kodo/api/1370/mirror
  1221. *
  1222. * @param bucket 空间名称
  1223. * @param srcSiteUrl 镜像源地址
  1224. * @param srcHost 镜像Host
  1225. * @param callback
  1226. */
  1227. image(bucket: string, srcSiteUrl: string, srcHost?: string, callback?: callback): Promise<httpc.ResponseWrapper<void>>;
  1228. /**
  1229. * 取消设置空间镜像源
  1230. * @see https://developer.qiniu.com/kodo/api/1370/mirror
  1231. *
  1232. * @param bucket 空间名称
  1233. * @param callback
  1234. */
  1235. unimage(bucket: string, callback?: callback): Promise<httpc.ResponseWrapper<void>>;
  1236. /**
  1237. * 获取指定前缀的文件列表
  1238. * @see https://developer.qiniu.com/kodo/api/1284/list
  1239. *
  1240. * @param bucket 空间名称
  1241. * @param options 列举操作的可选参数
  1242. * @param callback 回调函数
  1243. */
  1244. listPrefix(bucket: string, options: ListPrefixOptions | null, callback?: callback): Promise<httpc.ResponseWrapper<GetObjectsResult>>;
  1245. /**
  1246. * 获取制定前缀的文件列表 V2
  1247. *
  1248. * @deprecated API 可能返回仅包含 marker,不包含 item 或 dir 的项,请使用 {@link listPrefix}
  1249. *
  1250. * @param bucket 空间名称
  1251. * @param options 列举操作的可选参数
  1252. * @param callback 回调函数
  1253. */
  1254. listPrefixV2(bucket: string, options: ListPrefixOptions | null, callback?: callback): Promise<httpc.ResponseWrapper<string>>;
  1255. /**
  1256. * 批量文件管理请求,支持stat,chgm,chtype,delete,copy,move
  1257. * @param operations
  1258. * @param callback
  1259. */
  1260. batch(operations: any, callback?: callback): Promise<httpc.ResponseWrapper<BatchOpsResult>>;
  1261. /**
  1262. * 获取私有空间的下载链接
  1263. * @param domain 空间绑定的域名,比如以http或https开头
  1264. * @param fileName 原始文件名
  1265. * @param deadline 文件有效期时间戳(单位秒)
  1266. */
  1267. privateDownloadUrl(domain: string, fileName: string, deadline: number): string;
  1268. /**
  1269. * 获取公开空间的下载链接
  1270. * @param domain 空间绑定的域名,比如以http或https开头
  1271. * @param fileName 原始文件名
  1272. */
  1273. publicDownloadUrl(domain: string, fileName: string): string;
  1274. /**
  1275. * /chstatus 修改文件状态
  1276. * @param bucket - 空间名
  1277. * @param key - 文件
  1278. * @param status - 状态
  1279. * @param callbackFunc - 回调函数
  1280. */
  1281. updateObjectStatus(
  1282. bucket: string,
  1283. key: string,
  1284. status: number,
  1285. callbackFunc?: callback
  1286. ): Promise<httpc.ResponseWrapper<void>>
  1287. /**
  1288. * 获取所有空间
  1289. * @param callbackFunc
  1290. */
  1291. listBucket(callbackFunc?: callback): Promise<httpc.ResponseWrapper<GetBucketsResult>>
  1292. listBucket(options: {
  1293. shared: string,
  1294. tagCondition: Record<string, string>
  1295. }, callbackFunc?: callback): Promise<httpc.ResponseWrapper<GetBucketsResult>>
  1296. /**
  1297. * 创建空间
  1298. * @param bucket 空间名
  1299. * @param options 选项
  1300. * @param options.regionId 区域 ID
  1301. * @param callbackFunc 回调函数
  1302. */
  1303. createBucket(
  1304. bucket: string,
  1305. options: {
  1306. regionId: string
  1307. },
  1308. callbackFunc?: callback
  1309. ): Promise<httpc.ResponseWrapper<void>>
  1310. /**
  1311. * 删除空间
  1312. * @param bucket 空间名
  1313. * @param callbackFunc 回调函数
  1314. */
  1315. deleteBucket(
  1316. bucket: string,
  1317. callbackFunc?: callback
  1318. ): Promise<httpc.ResponseWrapper<void>>
  1319. /**
  1320. * 获取空间详情
  1321. * @param bucket - 空间名
  1322. * @param callbackFunc
  1323. */
  1324. getBucketInfo(bucket: string, callbackFunc?: callback): Promise<httpc.ResponseWrapper<GetBucketInfoV2Result>>
  1325. /**
  1326. * rules/add 增加 bucket 规则
  1327. *
  1328. * @param bucket - 空间名
  1329. *
  1330. * @param options - 配置项
  1331. * @param options.name - 规则名称 bucket 内唯一,长度小于50,不能为空,只能为字母、数字、下划线
  1332. * @param options.prefix - 同一个 bucket 里面前缀不能重复
  1333. * @param options.to_line_after_days - 指定文件上传多少天后转低频存储。指定为0表示不转低频存储
  1334. * @param options.to_archive_ir_after_days - 指定文件上传多少天后转归档直读存储。指定为0表示不转归档直读存储
  1335. * @param options.to_archive_after_days - 指定文件上传多少天后转归档存储。指定为0表示不转归档存储
  1336. * @param options.to_deep_archive_after_days - 指定文件上传多少天后转深度归档存储。指定为0表示不转深度归档存储
  1337. * @param options.delete_after_days - 指定上传文件多少天后删除,指定为0表示不删除,大于0表示多少天后删除
  1338. * @param options.history_delete_after_days - 指定文件成为历史版本多少天后删除,指定为0表示不删除,大于0表示多少天后删除
  1339. * @param options.history_to_line_after_days - 指定文件成为历史版本多少天后转低频存储。指定为0表示不转低频存储
  1340. *
  1341. * @param callbackFunc - 回调函数
  1342. */
  1343. putBucketLifecycleRule(
  1344. bucket: string,
  1345. options: {
  1346. name: string,
  1347. prefix?: string,
  1348. to_line_after_days?: number,
  1349. to_archive_ir_after_days?: number,
  1350. to_archive_after_days?: number,
  1351. to_deep_archive_after_days?: number,
  1352. delete_after_days?: number,
  1353. history_delete_after_days?: number,
  1354. history_to_line_after_days?: number,
  1355. },
  1356. callbackFunc?: callback
  1357. ): Promise<httpc.ResponseWrapper<void>>;
  1358. /** rules/delete 删除 bucket 规则
  1359. * @param bucket - 空间名
  1360. * @param name - 规则名称 bucket 内唯一,长度小于50,不能为空,只能为字母、数字、下划线
  1361. * @param callbackFunc - 回调函数
  1362. */
  1363. deleteBucketLifecycleRule(bucket: string, name: string, callbackFunc?: callback): Promise<httpc.ResponseWrapper<void>>;
  1364. /**
  1365. * rules/update 更新 bucket 规则
  1366. *
  1367. * @param bucket - 空间名
  1368. *
  1369. * @param options - 配置项
  1370. * @param options.name - 规则名称 bucket 内唯一,长度小于50,不能为空,只能为字母、数字、下划线
  1371. * @param options.prefix - 同一个 bucket 里面前缀不能重复
  1372. * @param options.to_line_after_days - 指定文件上传多少天后转低频存储。指定为0表示不转低频存储
  1373. * @param options.to_archive_ir_after_days - 指定文件上传多少天后转归档直读存储。指定为0表示不转归档直读存储
  1374. * @param options.to_archive_after_days - 指定文件上传多少天后转归档存储。指定为0表示不转归档存储
  1375. * @param options.to_deep_archive_after_days - 指定文件上传多少天后转深度归档存储。指定为0表示不转深度归档存储
  1376. * @param options.delete_after_days - 指定上传文件多少天后删除,指定为0表示不删除,大于0表示多少天后删除
  1377. * @param options.history_delete_after_days - 指定文件成为历史版本多少天后删除,指定为0表示不删除,大于0表示多少天后删除
  1378. * @param options.history_to_line_after_days - 指定文件成为历史版本多少天后转低频存储。指定为0表示不转低频存储
  1379. *
  1380. * @param callbackFunc - 回调函数
  1381. */
  1382. updateBucketLifecycleRule(
  1383. bucket: string,
  1384. options: {
  1385. name: string,
  1386. prefix?: string,
  1387. to_line_after_days?: number,
  1388. to_archive_ir_after_days?: number,
  1389. to_archive_after_days?: number,
  1390. to_deep_archive_after_days?: number,
  1391. delete_after_days?: number,
  1392. history_delete_after_days?: number,
  1393. history_to_line_after_days?: number,
  1394. },
  1395. callbackFunc?: callback
  1396. ): Promise<httpc.ResponseWrapper<void>>;
  1397. /** rules/get - 获取 bucket 规则
  1398. * @param bucket - 空间名
  1399. * @param callbackFunc - 回调函数
  1400. */
  1401. getBucketLifecycleRule(bucket: string, callbackFunc?: callback): Promise<httpc.ResponseWrapper<GetBucketRulesResult>>
  1402. /**
  1403. * 添加事件通知
  1404. * https://developer.qiniu.com/kodo/8610/dev-event-notification
  1405. * @param bucket - 空间名
  1406. * @param options - 配置项
  1407. * @param options.name - 规则名称 bucket 内唯一,长度小于50,不能为空,只能为字母、数字、下划线
  1408. * @param options.event - 事件类型,接受数组设置多个
  1409. * @param options.callbackURL - 事件通知回调 URL,接受数组设置多个,失败依次重试
  1410. * @param options.prefix - 可选,文件配置的前缀
  1411. * @param options.suffix - 可选,文件配置的后缀
  1412. * @param options.access_key - 可选,设置的话会对通知请求用对应的ak、sk进行签名
  1413. * @param options.host - 可选,通知请求的host
  1414. * @param callbackFunc - 回调函数
  1415. */
  1416. putBucketEvent(
  1417. bucket: string,
  1418. options: {
  1419. name: string,
  1420. event: BucketEventName | BucketEventName[],
  1421. callbackURL: string | string[],
  1422. prefix?: string,
  1423. suffix?: string,
  1424. access_key?: string,
  1425. host?: string,
  1426. },
  1427. callbackFunc?: callback,
  1428. ): Promise<httpc.ResponseWrapper<void>>
  1429. /**
  1430. * 更新事件通知
  1431. * https://developer.qiniu.com/kodo/8610/dev-event-notification
  1432. * @param bucket - 空间名
  1433. * @param options - 配置项
  1434. * @param options.name - 规则名称 bucket 内唯一,长度小于50,不能为空,只能为字母、数字、下划线
  1435. * @param options.event - 事件类型,接受数组设置多个
  1436. * @param options.callbackURL - 事件通知回调 URL,接受数组设置多个,失败依次重试
  1437. * @param options.prefix - 可选,文件配置的前缀
  1438. * @param options.suffix - 可选,文件配置的后缀
  1439. * @param options.access_key - 可选,设置的话会对通知请求用对应的ak、sk进行签名
  1440. * @param options.host - 可选,通知请求的host
  1441. * @param callbackFunc - 回调函数
  1442. */
  1443. updateBucketEvent(
  1444. bucket: string,
  1445. options: {
  1446. name: string,
  1447. event?: BucketEventName | BucketEventName[],
  1448. callbackURL?: string | string[],
  1449. prefix?: string,
  1450. suffix?: string,
  1451. access_key?: string,
  1452. host?: string,
  1453. },
  1454. callbackFunc?: callback,
  1455. ): Promise<httpc.ResponseWrapper<void>>
  1456. /**
  1457. * 获取事件通知规则
  1458. * https://developer.qiniu.com/kodo/8610/dev-event-notification
  1459. *
  1460. * @param bucket - 空间名
  1461. * @param callbackFunc - 回调函数
  1462. */
  1463. getBucketEvent(bucket: string, callbackFunc?: callback): Promise<httpc.ResponseWrapper<GetBucketEventsResult>>
  1464. /**
  1465. * 删除事件通知规则
  1466. * https://developer.qiniu.com/kodo/8610/dev-event-notification
  1467. *
  1468. * @param bucket - 空间名
  1469. * @param name - 规则名称
  1470. * @param callbackFunc - 回调函数
  1471. */
  1472. deleteBucketEvent(bucket: string, name: string, callbackFunc?: callback): Promise<httpc.ResponseWrapper<void>>;
  1473. /**
  1474. * @param bucket - 空间名
  1475. * @param options - 配置
  1476. */
  1477. putReferAntiLeech(
  1478. bucket: string,
  1479. options: {
  1480. mode: number,
  1481. norefer: number,
  1482. pattern: string,
  1483. }
  1484. ): Promise<httpc.ResponseWrapper<void>>;
  1485. /**
  1486. * 设置 bucket 的 cors(跨域)规则
  1487. * https://developer.qiniu.com/kodo/8539/set-the-cross-domain-resource-sharing
  1488. * @param bucket - 空间名
  1489. * @param body - 规则配置
  1490. * @param body[].allowed_origin - 允许的域名
  1491. * @param body[].allowed_method - 允许的请求方法;大小写不敏感
  1492. * @param body[].allowed_header - 可选,允许的 header;默认不允许任何 header;大小写不敏感
  1493. * @param body[].exposed_header - 可选,暴露的 header;默认 X-Log, X-Reqid;大小写不敏感
  1494. * @param body[].max_age - 可选,结果可以缓存的时间;默认不缓存
  1495. * @param callbackFunc - 回调函数
  1496. */
  1497. putCorsRules(
  1498. bucket: string,
  1499. body: {
  1500. allowed_origin: string[],
  1501. allowed_method: string[],
  1502. allowed_header?: string[],
  1503. exposed_header?: string[],
  1504. max_age?: number,
  1505. }[],
  1506. callbackFunc?: callback
  1507. ): Promise<httpc.ResponseWrapper<void>>
  1508. /**
  1509. * 获取 bucket 的 cors(跨域)规则
  1510. * https://developer.qiniu.com/kodo/8539/set-the-cross-domain-resource-sharing
  1511. * @param bucket - 空间名
  1512. * @param callbackFunc - 回调函数
  1513. */
  1514. getCorsRules(bucket: string, callbackFunc?: callback): Promise<httpc.ResponseWrapper<GetBucketCorsRulesResult>>
  1515. /**
  1516. * 设置空间原图保护
  1517. * @param bucket 空间名
  1518. * @param mode 为 1 表示开启原图保护,0 表示关闭
  1519. * @param callbackFunc 回调函数
  1520. */
  1521. putBucketAccessStyleMode(bucket: string, mode: number, callbackFunc?: callback): Promise<httpc.ResponseWrapper<void>>
  1522. /**
  1523. * 设置缓存策略的 max-age 属性
  1524. * @param bucket
  1525. * @param options
  1526. * @param options.maxAge 为 0 或者负数表示为默认值(31536000)
  1527. * @param callbackFunc 回调函数
  1528. */
  1529. putBucketMaxAge(
  1530. bucket: string,
  1531. options: {
  1532. maxAge: number
  1533. },
  1534. callbackFunc?: callback
  1535. ): Promise<httpc.ResponseWrapper<void>>
  1536. /**
  1537. * 设置空间私有属性
  1538. * @param bucket
  1539. * @param options
  1540. * @param options.private 为 0 表示公开,为 1 表示私有,默认为 0
  1541. * @param callbackFunc
  1542. */
  1543. putBucketAccessMode(
  1544. bucket: string,
  1545. options?: {
  1546. private?: number
  1547. },
  1548. callbackFunc?: callback
  1549. ): Promise<httpc.ResponseWrapper<void>>
  1550. /**
  1551. * 设置配额
  1552. * @param bucket 空间名称,不支持授权空间
  1553. * @param options
  1554. * @param options.size 空间存储量配额,参数传入 0 或不传表示不更改当前配置,传入 -1 表示取消限额,新创建的空间默认没有限额。
  1555. * @param options.count 空间文件数配额,参数含义同<size>
  1556. * @param callbackFunc 回调函数
  1557. */
  1558. putBucketQuota(
  1559. bucket: string,
  1560. options?: {
  1561. size?: number,
  1562. count?: number
  1563. },
  1564. callbackFunc?: callback
  1565. ): Promise<httpc.ResponseWrapper<void>>
  1566. /**
  1567. * 获取配额
  1568. * @param bucket 空间名称,不支持授权空间
  1569. * @param callbackFunc 回调函数
  1570. */
  1571. getBucketQuota(
  1572. bucket: string,
  1573. callbackFunc?: callback
  1574. ): Promise<httpc.ResponseWrapper<GetBucketQuotaResult>>
  1575. }
  1576. /**
  1577. *
  1578. * @param bucket
  1579. * @param key
  1580. */
  1581. function statOp(bucket: string, key: string): string;
  1582. /**
  1583. *
  1584. * @param bucket
  1585. * @param key
  1586. */
  1587. function deleteOp(bucket: string, key: string): string;
  1588. /**
  1589. *
  1590. * @param bucket
  1591. * @param key
  1592. * @param days
  1593. */
  1594. function deleteAfterDaysOp(bucket: string, key: string, days: number): string;
  1595. /**
  1596. *
  1597. * @param bucket
  1598. * @param key
  1599. * @param newMime
  1600. */
  1601. function changeMimeOp(bucket: string, key: string, newMime: string): string;
  1602. /**
  1603. *
  1604. * @param bucket
  1605. * @param key
  1606. * @param headers
  1607. */
  1608. function changeHeadersOp(bucket: string, key: string, headers: { [k: string]: string }): string;
  1609. /**
  1610. *
  1611. * @param bucket
  1612. * @param key
  1613. * @param newType
  1614. */
  1615. function changeTypeOp(bucket: string, key: string, newType: number): string;
  1616. /**
  1617. *
  1618. * @param srcBucket
  1619. * @param srcKey
  1620. * @param destBucket
  1621. * @param destKey
  1622. * @param options
  1623. */
  1624. function moveOp(srcBucket: string, srcKey: string, destBucket: string, destKey: string, options?: {
  1625. force?: boolean
  1626. }): string;
  1627. /**
  1628. *
  1629. * @param srcBucket
  1630. * @param srcKey
  1631. * @param destBucket
  1632. * @param destKey
  1633. * @param options
  1634. */
  1635. function copyOp(srcBucket: string, srcKey: string, destBucket: string, destKey: string, options?: {
  1636. force?: boolean
  1637. }): string;
  1638. interface PutPolicyOptions {
  1639. scope?: string;
  1640. isPrefixalScope?: number;
  1641. expires?: number;
  1642. insertOnly?: number;
  1643. saveKey?: string;
  1644. forceSaveKey?: boolean;
  1645. endUser?: string;
  1646. returnUrl?: string;
  1647. returnBody?: string;
  1648. callbackUrl?: string;
  1649. callbackHost?: string;
  1650. callbackBody?: string;
  1651. callbackBodyType?: string;
  1652. callbackFetchKey?: number;
  1653. persistentOps?: string;
  1654. persistentNotifyUrl?: string;
  1655. persistentPipeline?: string;
  1656. persistentType?: number;
  1657. persistentWorkflowTemplateID?: string;
  1658. fsizeLimit?: number;
  1659. fsizeMin?: number;
  1660. mimeLimit?: string;
  1661. detectMime?: number;
  1662. deleteAfterDays?: number;
  1663. fileType?: number;
  1664. // @deprecated
  1665. transform?: string;
  1666. // @deprecated
  1667. transformFallbackMode?: string;
  1668. // @deprecated
  1669. transformFallbackKey?: string;
  1670. [key: string]: string | number | boolean | undefined;
  1671. }
  1672. class PutPolicy {
  1673. [k: string]: string | number | boolean | Function;
  1674. constructor(options?: PutPolicyOptions);
  1675. getFlags(): any;
  1676. uploadToken(mac?: auth.digest.Mac): string;
  1677. }
  1678. }
  1679. export declare namespace sms {
  1680. namespace message {
  1681. /**
  1682. * 发送短信 (POST Message)
  1683. * @link https://developer.qiniu.com/sms/5897/sms-api-send-message#1
  1684. * @param reqBody
  1685. * @param mac
  1686. * @param callback
  1687. */
  1688. function sendMessage(
  1689. reqBody: {
  1690. "template_id": string,
  1691. "mobiles": string[],
  1692. "parameters"?: Record<string, string>
  1693. },
  1694. mac: auth.digest.Mac,
  1695. callback: Callback<{ job_id: string }>
  1696. ): void;
  1697. /**
  1698. * 发送单条短信 (POST Single Message)
  1699. * @link https://developer.qiniu.com/sms/5897/sms-api-send-message#2
  1700. * @param reqBody
  1701. * @param mac
  1702. * @param callback
  1703. */
  1704. function sendSingleMessage(
  1705. reqBody: {
  1706. "template_id": string,
  1707. "mobile": string,
  1708. "parameters"?: Record<string, string>
  1709. },
  1710. mac: auth.digest.Mac,
  1711. callback: Callback<{ message_id: string }>
  1712. ): void;
  1713. /**
  1714. * 发送国际/港澳台短信 (POST Oversea Message)
  1715. * @link https://developer.qiniu.com/sms/5897/sms-api-send-message#3
  1716. * @param reqBody
  1717. * @param mac
  1718. * @param callback
  1719. */
  1720. function sendOverseaMessage(
  1721. reqBody: {
  1722. "template_id": string,
  1723. "mobile": string,
  1724. "parameters"?: Record<string, string>
  1725. },
  1726. mac: auth.digest.Mac,
  1727. callback: Callback<{ message_id: string }>
  1728. ): void;
  1729. /**
  1730. * 发送全文本短信(不需要传模版 ID) (POST Fulltext Message)
  1731. * @link https://developer.qiniu.com/sms/5897/sms-api-send-message#4
  1732. * @param reqBody
  1733. * @param mac
  1734. * @param callback
  1735. */
  1736. function sendFulltextMessage(
  1737. reqBody: {
  1738. "mobiles": string[],
  1739. "content": string,
  1740. "template_type": string
  1741. },
  1742. mac: auth.digest.Mac,
  1743. callback: Callback<{ job_id: string }>
  1744. ): void;
  1745. }
  1746. }