9b8e099963
* generate new REST client * implement MQTT Generate Token * add test case * ignore check spell words * update changelog * update changelog * update latest version * update changelog * add EOL * change field name to webpubsub_client_access * rename to webpubsub_client_protocol * rename to client_protocol * update changelog --------- Co-authored-by: chuongnguyen <chuongnguyen@microsoft.com> |
||
---|---|---|
.. | ||
README.md |
README.md
Azure WebPubsub for Python
Setup
Install Autorest v3
npm install -g autorest
Generation
cd <swagger-folder>
autorest
Settings
input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/webpubsub/data-plane/WebPubSub/stable/2024-01-01/webpubsub.json
output-folder: ../
namespace: azure.messaging.webpubsubservice
package-name: azure-messaging-webpubsubservice
license-header: MICROSOFT_MIT_NO_VERSION
python: true
title: WebPubSubServiceClient
head-as-boolean: true
package-version: 1.1.0
add-credential: true
credential-scopes: https://webpubsub.azure.com/.default
package-mode: dataplane
package-pprint-name: Azure WebPubSub Service
Here's the directive to delete the health api operation that we don't need / want
directive:
- from: swagger-document
where: $["paths"]["/api/health"]
transform: >
delete $["head"];
Here's the directive to move the operations from the webpubsub operation group directly onto the client
directive:
- from: swagger-document
where: $["paths"][*]
transform: >
for (var op of Object.values($)) {
if (op["operationId"].includes("WebPubSub_")) {
op["operationId"] = op["operationId"].replace("WebPubSub_", "");
}
}
directive:
- from: swagger-document
where: $["paths"]["/api/hubs/{hub}/:generateToken"].post.parameters
transform: >
$[2]["x-ms-client-name"] = "roles"
- from: swagger-document
where: $["paths"]["/api/hubs/{hub}/:generateToken"].post.parameters
transform: >
$[5]["x-ms-client-name"] = "groups"
directive:
- from: swagger-document
where: $["paths"]["/api/hubs/{hub}/permissions/{permission}/connections/{connectionId}"].head
transform: $["operationId"] = "HasPermission"
directive:
- from: swagger-document
where: $["paths"]["/api/hubs/{hub}/:generateToken"].post
transform: $["operationId"] = "GetClientAccessToken"
Add hub to client on generate token
directive:
- from: swagger-document
where: $.paths["/api/hubs/{hub}/:generateToken"].post.parameters["0"]
transform: $["x-ms-parameter-location"] = "client"
SendToAll
directive:
- from: swagger-document
where: $.paths["/api/hubs/{hub}/:send"].post.parameters["0"]
transform: $["x-ms-parameter-location"] = "client"
ConnectionExistsImpl
directive:
- from: swagger-document
where: $.paths["/api/hubs/{hub}/connections/{connectionId}"].head.parameters["0"]
transform: $["x-ms-parameter-location"] = "client"
CloseConnection
directive:
- from: swagger-document
where: $.paths["/api/hubs/{hub}/connections/{connectionId}"].delete.parameters["0"]
transform: $["x-ms-parameter-location"] = "client"
SendToConnection
directive:
- from: swagger-document
where: $.paths["/api/hubs/{hub}/connections/{connectionId}/:send"].post.parameters["0"]
transform: $["x-ms-parameter-location"] = "client"
GroupExistsImpl
directive:
- from: swagger-document
where: $.paths["/api/hubs/{hub}/groups/{group}"].head.parameters["0"]
transform: $["x-ms-parameter-location"] = "client"
SendToGroup
directive:
- from: swagger-document
where: $.paths["/api/hubs/{hub}/groups/{group}/:send"].post.parameters["0"]
transform: $["x-ms-parameter-location"] = "client"
AddConnectionToGroup
directive:
- from: swagger-document
where: $.paths["/api/hubs/{hub}/groups/{group}/connections/{connectionId}"].put.parameters["0"]
transform: $["x-ms-parameter-location"] = "client"
RemoveConnectionFromGroup
directive:
- from: swagger-document
where: $.paths["/api/hubs/{hub}/groups/{group}/connections/{connectionId}"].delete.parameters["0"]
transform: $["x-ms-parameter-location"] = "client"
RemoveConnectionFromAllGroup
directive:
- from: swagger-document
where: $.paths["/api/hubs/{hub}/connections/{connectionId}/groups"].delete.parameters["0"]
transform: $["x-ms-parameter-location"] = "client"
UserExistsImpl
directive:
- from: swagger-document
where: $.paths["/api/hubs/{hub}/users/{userId}"].head.parameters["0"]
transform: $["x-ms-parameter-location"] = "client"
SendToUser
directive:
- from: swagger-document
where: $.paths["/api/hubs/{hub}/users/{userId}/:send"].post.parameters["0"]
transform: $["x-ms-parameter-location"] = "client"
AddUserToGroup
directive:
- from: swagger-document
where: $.paths["/api/hubs/{hub}/users/{userId}/groups/{group}"].put.parameters["0"]
transform: $["x-ms-parameter-location"] = "client"
RemoveUserFromGroup
directive:
- from: swagger-document
where: $.paths["/api/hubs/{hub}/users/{userId}/groups/{group}"].delete.parameters["0"]
transform: $["x-ms-parameter-location"] = "client"
RemoveUserFromAllGroups
directive:
- from: swagger-document
where: $.paths["/api/hubs/{hub}/users/{userId}/groups"].delete.parameters["0"]
transform: $["x-ms-parameter-location"] = "client"
GrantPermission
directive:
- from: swagger-document
where: $.paths["/api/hubs/{hub}/permissions/{permission}/connections/{connectionId}"].put.parameters["0"]
transform: $["x-ms-parameter-location"] = "client"
RevokePermission
directive:
- from: swagger-document
where: $.paths["/api/hubs/{hub}/permissions/{permission}/connections/{connectionId}"].delete.parameters["0"]
transform: $["x-ms-parameter-location"] = "client"
CheckPermission
directive:
- from: swagger-document
where: $.paths["/api/hubs/{hub}/permissions/{permission}/connections/{connectionId}"].head.parameters["0"]
transform: $["x-ms-parameter-location"] = "client"
CloseAllConnections
directive:
- from: swagger-document
where: $.paths["/api/hubs/{hub}/:closeConnections"].post.parameters["0"]
transform: $["x-ms-parameter-location"] = "client"
CloseGroupConnections
directive:
- from: swagger-document
where: $.paths["/api/hubs/{hub}/groups/{group}/:closeConnections"].post.parameters["0"]
transform: $["x-ms-parameter-location"] = "client"
CloseUserConnections
directive:
- from: swagger-document
where: $.paths["/api/hubs/{hub}/users/{userId}/:closeConnections"].post.parameters["0"]
transform: $["x-ms-parameter-location"] = "client"