EventGridPublisherClient class

Client class for publishing events to the Event Grid Service.

Constructors

EventGridPublisherClient<T>(string, T, KeyCredential | SASCredential | TokenCredential, CommonClientOptions)

Creates an instance of EventGridPublisherClient which sends events using the Event Grid Schema.

Example usage:

import { EventGridPublisherClient, AzureKeyCredential } from "@azure/eventgrid";

const client = new EventGridPublisherClient(
   "<service endpoint>",
   "EventGrid",
   new AzureKeyCredential("<api key>")
);

Properties

apiVersion

The version of the Even Grid service.

endpointUrl

The URL to the Event Grid endpoint.

Methods

send(InputSchemaToInputTypeMap[T][], InputSchemaToOptionsTypeMap[T])

Sends events to a topic.

Constructor Details

EventGridPublisherClient<T>(string, T, KeyCredential | SASCredential | TokenCredential, CommonClientOptions)

Creates an instance of EventGridPublisherClient which sends events using the Event Grid Schema.

Example usage:

import { EventGridPublisherClient, AzureKeyCredential } from "@azure/eventgrid";

const client = new EventGridPublisherClient(
   "<service endpoint>",
   "EventGrid",
   new AzureKeyCredential("<api key>")
);
new EventGridPublisherClient(endpointUrl: string, inputSchema: T, credential: KeyCredential | SASCredential | TokenCredential, options?: CommonClientOptions)

Parameters

endpointUrl

string

The URL to the Event Grid endpoint, e.g. https://eg-topic.westus2-1.eventgrid.azure.net/api/events.

inputSchema

T

The schema that the Event Grid endpoint is configured to accept. One of "EventGrid", "CloudEvent", or "Custom".

credential

KeyCredential | SASCredential | TokenCredential

Used to authenticate requests to the service.

options
CommonClientOptions

Used to configure the Event Grid Client.

Property Details

apiVersion

The version of the Even Grid service.

apiVersion: string

Property Value

string

endpointUrl

The URL to the Event Grid endpoint.

endpointUrl: string

Property Value

string

Method Details

send(InputSchemaToInputTypeMap[T][], InputSchemaToOptionsTypeMap[T])

Sends events to a topic.

function send(events: InputSchemaToInputTypeMap[T][], options?: InputSchemaToOptionsTypeMap[T]): Promise<void>

Parameters

events

InputSchemaToInputTypeMap[T][]

The events to send. The events should be in the schema used when constructing the client.

options

InputSchemaToOptionsTypeMap[T]

Options to control the underlying operation.

Returns

Promise<void>