@azure/eventgrid-namespaces 1.0.0-alpha.20240606.2 → 1.0.0-alpha.20240607.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +32 -13
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -8,7 +8,7 @@ Key links:
8
8
 
9
9
  - [Source code](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/eventgrid/eventgrid-namespaces/)
10
10
  - [Package (NPM)](https://www.npmjs.com/package/@azure/eventgrid-namespaces)
11
- - [API reference documentation](https://docs.microsoft.com/javascript/api/@azure/eventgrid/)
11
+ - [API reference documentation](https://docs.microsoft.com/javascript/api/@azure/eventgrid-namespaces/)
12
12
  - [Product documentation](https://docs.microsoft.com/azure/event-grid/)
13
13
  - [Samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/eventgrid/eventgrid-namespaces/samples)
14
14
 
@@ -48,9 +48,9 @@ Install the Azure Event Grid Namespaces client library for JavaScript with `npm`
48
48
  npm install @azure/eventgrid-namespaces
49
49
  ```
50
50
 
51
- ### Create and authenticate a `EventGridNamespacesClient`
51
+ ### Create and authenticate Namespace clients
52
52
 
53
- To create a client object to access the Event Grid Namespaces API, you will need the `endpoint` of your Event Grid topic and a `credential`. The Event Grid client can use an Access Key.
53
+ To create a client object to access the Event Grid Namespaces API, you will need the `endpoint` of your Event Grid topic and a `credential`. The Event Grid Namespaces clients can use an Access Key.
54
54
 
55
55
  You can find the endpoint for your Event Grid topic either in the [Azure Portal][azure_portal] or by using the [Azure CLI][azure_cli] snippet below:
56
56
 
@@ -69,9 +69,14 @@ az eventgrid topic key list --resource-group <your-resource-group-name> --name <
69
69
  Once you have an API key and endpoint, you can use the `AzureKeyCredential` class to authenticate the client as follows:
70
70
 
71
71
  ```js
72
- const { EventGridClient, AzureKeyCredential } = require("@azure/eventgrid-namespaces");
72
+ const { EventGridSenderClient, EventGridReceiverClient, AzureKeyCredential } = require("@azure/eventgrid-namespaces");
73
73
 
74
- const client = new EventGridClient(
74
+ const eventGridSenderClient = new EventGridSenderClient(
75
+ "<endpoint>",
76
+ new AzureKeyCredential("<Access Key>")
77
+ );
78
+
79
+ const eventGridReceiverClient = new EventGridReceiverClient(
75
80
  "<endpoint>",
76
81
  new AzureKeyCredential("<Access Key>")
77
82
  );
@@ -86,10 +91,15 @@ With the `@azure/identity` package, you can seamlessly authorize requests in bot
86
91
  For example, use can use `DefaultAzureCredential` to construct a client which will authenticate using Azure Active Directory:
87
92
 
88
93
  ```js
89
- const { EventGridClient } = require("@azure/eventgrid-namespaces");
94
+ const { EventGridSenderClient, EventGridReceiverClient } = require("@azure/eventgrid-namespaces");
90
95
  const { DefaultAzureCredential } = require("@azure/identity");
91
96
 
92
- const client = new EventGridClient(
97
+ const eventGridSenderClient = new EventGridSenderClient(
98
+ "<endpoint>",
99
+ new DefaultAzureCredential()
100
+ );
101
+
102
+ const eventGridReceiverClient = new EventGridReceiverClient(
93
103
  "<endpoint>",
94
104
  new DefaultAzureCredential()
95
105
  );
@@ -97,12 +107,21 @@ const client = new EventGridClient(
97
107
 
98
108
  ## Key concepts
99
109
 
100
- ### EventGridNamespacesClient
110
+ ### Sending and Receiving Events
111
+
112
+ `EventGridSenderClient` can be used for sending events to an Event Grid. You can initialize it as:
113
+
114
+ ```js
115
+ const eventGridSenderClient = new EventGridSenderClient(
116
+ "<endpoint>",
117
+ new AzureKeyCredential("<API Key>")
118
+ );
119
+ ```
101
120
 
102
- `EventGridNamespacesClient` is used sending events to an Event Grid. You can initialize it as:
121
+ `EventGridReceiverClient` can be used for receiving events from an Event Grid. You can initialize it as:
103
122
 
104
123
  ```js
105
- const client = new EventGridClient(
124
+ const eventGridReceiverClient = new EventGridReceiverClient(
106
125
  "<endpoint>",
107
126
  new AzureKeyCredential("<API Key>")
108
127
  );
@@ -121,9 +140,9 @@ This library has been tested and validated on [Kubernetes using Azure Arc][event
121
140
  ### Publish an Event to an Event Grid Topic
122
141
 
123
142
  ```js
124
- const { EventGridClient, AzureKeyCredential } = require("@azure/eventgrid-namespaces");
143
+ const { EventGridSenderClient, AzureKeyCredential } = require("@azure/eventgrid-namespaces");
125
144
 
126
- const client = new EventGridClient(
145
+ const client = new EventGridSenderClient(
127
146
  "<endpoint>",
128
147
  new AzureKeyCredential("<API key>")
129
148
  );
@@ -139,7 +158,7 @@ const cloudEvent: CloudEvent = {
139
158
  specversion: "1.0",
140
159
  };
141
160
  // Publish the Cloud Event
142
- await client.publishCloudEvent(cloudEvent, topicName);
161
+ await client.sendEvents(cloudEvent, topicName);
143
162
  ```
144
163
 
145
164
  ## Troubleshooting
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "sdk-type": "client",
4
4
  "author": "Microsoft Corporation",
5
5
  "description": "An isomorphic client library for the Azure Event Grid service.",
6
- "version": "1.0.0-alpha.20240606.2",
6
+ "version": "1.0.0-alpha.20240607.3",
7
7
  "keywords": [
8
8
  "node",
9
9
  "azure",
@@ -47,7 +47,7 @@
47
47
  "audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit",
48
48
  "build:browser": "tsc -p . && dev-tool run bundle",
49
49
  "build:node": "tsc -p . && dev-tool run bundle",
50
- "build:samples": "echo Obsolete",
50
+ "build:samples": "dev-tool samples publish -f",
51
51
  "build:test": "tsc -p . && dev-tool run bundle",
52
52
  "build": "npm run clean && tsc -p . && dev-tool run bundle && dev-tool run extract-api",
53
53
  "check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",