import type { KeyCredential, SASCredential } from "@azure/core-auth"; import type { OperationOptions, CommonClientOptions } from "@azure/core-client"; import type { SendCloudEventInput, SendEventGridEventInput } from "./models.js"; import type { CloudEvent as CloudEventWireModel, EventGridEvent as EventGridEventWireModel } from "./generated/models/index.js"; import type { TokenCredential } from "@azure/core-auth"; /** * Options for the Event Grid Client. */ export type EventGridPublisherClientOptions = CommonClientOptions; /** * Options for the send events operation. */ export type SendOptions = OperationOptions; /** * Options for the send events operation, when the input schema is cloud event. */ export interface CloudEventSendOptions extends SendOptions { /** * The name of the channel to send the event to (only valid for Partner Namespaces and Topics). */ channelName?: string; } /** * A map of input schema names to shapes of the input for the send method on EventGridPublisherClient. */ export interface InputSchemaToInputTypeMap { /** * The shape of the input to `send` when the client is configured to send events using the Event Grid schema. */ EventGrid: SendEventGridEventInput; /** * The shape of the input to `send` when the client is configured to send events using the Cloud Event schema. */ CloudEvent: SendCloudEventInput; /** * The shape of the input to `send` when the client is configured to send events using a custom schema. */ Custom: Record; } /** * A map of input schema names to shapes of the options bag for the send method on EventGridPublisherClient. */ export interface InputSchemaToOptionsTypeMap { /** * The shape of the options parameter for `send` when the client is configured to send events using the Event Grid schema. */ EventGrid: SendOptions; /** * The shape of the options parameter for `send` when the client is configured to send events using the Cloud Event schema. */ CloudEvent: CloudEventSendOptions; /** * The shape of the options parameter for `send` when the client is configured to send events using a custom schema. */ Custom: SendOptions; } /** * Allowed schema types, to be used when constructing the EventGridPublisherClient. */ export type InputSchema = keyof InputSchemaToInputTypeMap; /** * Client class for publishing events to the Event Grid Service. */ export declare class EventGridPublisherClient { /** * The URL to the Event Grid endpoint. */ readonly endpointUrl: string; /** * The version of the Even Grid service. */ readonly apiVersion: string; /** * The AutoRest generated client for the EventGrid dataplane. */ private readonly client; /** * The schema that will be used when sending events. */ private readonly inputSchema; /** * Creates an instance of EventGridPublisherClient which sends events using the Event Grid Schema. * * Example usage: * ```ts snippet:ReadmeSampleCreateClient_KeyCredential * import { EventGridPublisherClient, AzureKeyCredential } from "@azure/eventgrid"; * * const client = new EventGridPublisherClient( * "", * "EventGrid", * new AzureKeyCredential(""), * ); * ``` * * @param endpointUrl - The URL to the Event Grid endpoint, e.g. https://eg-topic.westus2-1.eventgrid.azure.net/api/events. * @param inputSchema - The schema that the Event Grid endpoint is configured to accept. One of "EventGrid", "CloudEvent", or "Custom". * @param credential - Used to authenticate requests to the service. * @param options - Used to configure the Event Grid Client. */ constructor(endpointUrl: string, inputSchema: T, credential: KeyCredential | SASCredential | TokenCredential, options?: EventGridPublisherClientOptions); /** * Sends events to a topic. * * @param events - The events to send. The events should be in the schema used when constructing the client. * @param options - Options to control the underlying operation. */ send(events: InputSchemaToInputTypeMap[T][], options?: InputSchemaToOptionsTypeMap[T]): Promise; } /** * @internal */ export declare function convertEventGridEventToModelType(event: SendEventGridEventInput): EventGridEventWireModel; /** * @internal */ export declare function convertCloudEventToModelType(event: SendCloudEventInput): CloudEventWireModel; //# sourceMappingURL=eventGridClient.d.ts.map