deserializationPolicy.d.ts 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import { HttpOperationResponse } from "../httpOperationResponse";
  2. import { WebResource } from "../webResource";
  3. import { BaseRequestPolicy, RequestPolicy, RequestPolicyFactory, RequestPolicyOptions } from "./requestPolicy";
  4. /**
  5. * The content-types that will indicate that an operation response should be deserialized in a
  6. * particular way.
  7. */
  8. export interface DeserializationContentTypes {
  9. /**
  10. * The content-types that indicate that an operation response should be deserialized as JSON.
  11. * Defaults to [ "application/json", "text/json" ].
  12. */
  13. json?: string[];
  14. /**
  15. * The content-types that indicate that an operation response should be deserialized as XML.
  16. * Defaults to [ "application/xml", "application/atom+xml" ].
  17. */
  18. xml?: string[];
  19. }
  20. /**
  21. * Create a new serialization RequestPolicyCreator that will serialized HTTP request bodies as they
  22. * pass through the HTTP pipeline.
  23. */
  24. export declare function deserializationPolicy(deserializationContentTypes?: DeserializationContentTypes): RequestPolicyFactory;
  25. export declare const defaultJsonContentTypes: string[];
  26. export declare const defaultXmlContentTypes: string[];
  27. /**
  28. * A RequestPolicy that will deserialize HTTP response bodies and headers as they pass through the
  29. * HTTP pipeline.
  30. */
  31. export declare class DeserializationPolicy extends BaseRequestPolicy {
  32. readonly jsonContentTypes: string[];
  33. readonly xmlContentTypes: string[];
  34. constructor(nextPolicy: RequestPolicy, deserializationContentTypes: DeserializationContentTypes | undefined, options: RequestPolicyOptions);
  35. sendRequest(request: WebResource): Promise<HttpOperationResponse>;
  36. }
  37. export declare function deserializeResponseBody(jsonContentTypes: string[], xmlContentTypes: string[], response: HttpOperationResponse): Promise<HttpOperationResponse>;
  38. //# sourceMappingURL=deserializationPolicy.d.ts.map