@azure/eventgrid
Version:
An isomorphic client library for the Azure Event Grid service.
41 lines • 2.06 kB
TypeScript
import type { CloudEvent, EventGridEvent } from "./models.js";
/**
* EventGridDeserializer is used to aid in processing events delivered by EventGrid. It can deserialize a JSON encoded payload
* of either a single event or batch of events as well as be used to convert the result of `JSON.parse` into an
* `EventGridEvent` or `CloudEvent` like object.
*
* Unlike normal JSON deseralization, EventGridDeserializer does some additional conversions:
*
* - The consumer parses the event time property into a `Date` object, for ease of use.
* - When deserializing an event in the CloudEvent schema, if the event contains binary data, it is base64 decoded
* and returned as an instance of the `Uint8Array` type.
*/
export declare class EventGridDeserializer {
/**
* Deserializes events encoded in the Event Grid schema.
*
* @param encodedEvents - the JSON encoded representation of either a single event or an array of
* events, encoded in the Event Grid Schema.
*/
deserializeEventGridEvents(encodedEvents: string): Promise<EventGridEvent<unknown>[]>;
/**
* Deserializes events encoded in the Event Grid schema.
*
* @param encodedEvents - an object representing a single event, encoded in the Event Grid schema.
*/
deserializeEventGridEvents(encodedEvents: Record<string, unknown>): Promise<EventGridEvent<unknown>[]>;
/**
* Deserializes events encoded in the Cloud Events 1.0 schema.
*
* @param encodedEvents - the JSON encoded representation of either a single event or an array of
* events, encoded in the Cloud Events 1.0 Schema.
*/
deserializeCloudEvents(encodedEvents: string): Promise<CloudEvent<unknown>[]>;
/**
* Deserializes events encoded in the Cloud Events 1.0 schema.
*
* @param encodedEvents - an object representing a single event, encoded in the Cloud Events 1.0 schema.
*/
deserializeCloudEvents(encodedEvents: Record<string, unknown>): Promise<CloudEvent<unknown>[]>;
}
//# sourceMappingURL=consumer.d.ts.map