版博士V2.0程序
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 

78 строки
1.8 KiB

  1. /// <reference types="node" />
  2. import IResponse from './IResponse';
  3. import IBlob from '../file/IBlob';
  4. import IDocument from '../nodes/document/IDocument';
  5. import * as NodeFetch from 'node-fetch';
  6. /**
  7. * Fetch response.
  8. */
  9. export default class Response extends NodeFetch.Response implements IResponse {
  10. static _ownerDocument: IDocument;
  11. readonly _ownerDocument: IDocument;
  12. /**
  13. * Constructor.
  14. *
  15. * @param [body] An object defining a body for the response (can be omitted)
  16. * @param [init] An options object containing any custom settings that you want to apply to the response, or an empty object (which is the default value)
  17. */
  18. constructor(body?: NodeFetch.BodyInit, init?: NodeFetch.ResponseInit);
  19. /**
  20. * Returns array buffer.
  21. *
  22. * @returns Array buffer.
  23. */
  24. arrayBuffer(): Promise<ArrayBuffer>;
  25. /**
  26. * Returns blob.
  27. *
  28. * @returns Blob.
  29. */
  30. blob(): Promise<IBlob>;
  31. /**
  32. * Returns buffer.
  33. *
  34. * @returns Buffer.
  35. */
  36. buffer(): Promise<Buffer>;
  37. /**
  38. * Returns json.
  39. *
  40. * @returns JSON.
  41. */
  42. json(): Promise<unknown>;
  43. /**
  44. * Returns json.
  45. *
  46. * @returns JSON.
  47. */
  48. text(): Promise<string>;
  49. /**
  50. * Returns json.
  51. *
  52. * @returns JSON.
  53. */
  54. textConverted(): Promise<string>;
  55. /**
  56. * Handles promise start.
  57. *
  58. * @returns Task ID.
  59. */
  60. private _handlePromiseStart;
  61. /**
  62. * Handles promise end.
  63. *
  64. * @param resolve Resolve.
  65. * @param reject Reject.
  66. * @param taskID Task ID.
  67. * @param response Response.
  68. */
  69. private _handlePromiseEnd;
  70. /**
  71. * Handles promise error.
  72. *
  73. * @param error
  74. * @param reject
  75. */
  76. private _handlePromiseError;
  77. }