Skip to content

Commit b0cb4e0

Browse files
kashifkhanlmazuel
andauthored
[Python] WebPubSub Migration to TypeSpec (#42131)
* initial gen files * generated model patch * support conn str and ordering * patch in multi content type ops * fix sync patch file * adjust pprint name * fix async patch * black formatting * regen for error code align * fix kwargs for tokens * regen to match api name * properties * change namespace val and generated pagedResult * regen * new regen * deleting generated code * new regen * new regen * test changing client ns * reset ns change * remove _models.py * readd models * remove dupe * fix model import in patch * Fix Sphinx duplicate object warning for GroupMember Remove duplicate export of GroupMember from main package level. GroupMember is now only available through the models subpackage (azure.messaging.webpubsubservice.models.GroupMember) which eliminates the duplicate object description warning in Sphinx. * update setup.py * import from _operation changes * fix tests * fix import * fix import * skip test * ignore query param order * add sanitizer to conftest * changes to add conn_id * update prop name * add in commit & repo info --------- Co-authored-by: Laurent Mazuel <[email protected]>
1 parent b54bba9 commit b0cb4e0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+4574
-1351
lines changed

sdk/webpubsub/azure-messaging-webpubsubservice/MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ include azure/messaging/webpubsubservice/py.typed
44
recursive-include tests *.py
55
recursive-include samples *.py *.md
66
include azure/__init__.py
7-
include azure/messaging/__init__.py
7+
include azure/messaging/__init__.py
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"apiVersion": "2024-12-01"
3+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{
2+
"CrossLanguagePackageId": "WebPubSubService",
3+
"CrossLanguageDefinitionId": {
4+
"azure.messaging.webpubsubservice.models.AddToGroupsRequest": "WebPubSubService.AddToGroupsRequest",
5+
"azure.messaging.webpubsubservice.models.ClientTokenResponse": "WebPubSubService.ClientTokenResponse",
6+
"azure.messaging.webpubsubservice.models.GroupMember": "WebPubSubService.GroupMember",
7+
"azure.messaging.webpubsubservice.models.RemoveFromGroupsRequest": "WebPubSubService.RemoveFromGroupsRequest",
8+
"azure.messaging.webpubsubservice.models.ResponseContentType": "WebPubSubService.ResponseContentType",
9+
"azure.messaging.webpubsubservice.models.WebPubSubClientType": "WebPubSubService.WebPubSubClientType",
10+
"azure.messaging.webpubsubservice.models.MessageContentType": "WebPubSubService.MessageContentType",
11+
"azure.messaging.webpubsubservice.models.WebPubSubPermission": "WebPubSubService.WebPubSubPermission",
12+
"azure.messaging.webpubsubservice.WebPubSubServiceClient.get_service_status": "WebPubSubService.getServiceStatus",
13+
"azure.messaging.webpubsubservice.aio.WebPubSubServiceClient.get_service_status": "WebPubSubService.getServiceStatus",
14+
"azure.messaging.webpubsubservice.WebPubSubServiceClient.add_connections_to_groups": "WebPubSubService.addConnectionsToGroups",
15+
"azure.messaging.webpubsubservice.aio.WebPubSubServiceClient.add_connections_to_groups": "WebPubSubService.addConnectionsToGroups",
16+
"azure.messaging.webpubsubservice.WebPubSubServiceClient.close_all_connections": "WebPubSubService.closeAllConnections",
17+
"azure.messaging.webpubsubservice.aio.WebPubSubServiceClient.close_all_connections": "WebPubSubService.closeAllConnections",
18+
"azure.messaging.webpubsubservice.WebPubSubServiceClient.get_client_access_token": "WebPubSubService.getClientAccessToken",
19+
"azure.messaging.webpubsubservice.aio.WebPubSubServiceClient.get_client_access_token": "WebPubSubService.getClientAccessToken",
20+
"azure.messaging.webpubsubservice.WebPubSubServiceClient.remove_connections_from_groups": "WebPubSubService.removeConnectionsFromGroups",
21+
"azure.messaging.webpubsubservice.aio.WebPubSubServiceClient.remove_connections_from_groups": "WebPubSubService.removeConnectionsFromGroups",
22+
"azure.messaging.webpubsubservice.WebPubSubServiceClient.send_to_all": "WebPubSubService.sendToAll",
23+
"azure.messaging.webpubsubservice.aio.WebPubSubServiceClient.send_to_all": "WebPubSubService.sendToAll",
24+
"azure.messaging.webpubsubservice.WebPubSubServiceClient.close_connection": "WebPubSubService.closeConnection",
25+
"azure.messaging.webpubsubservice.aio.WebPubSubServiceClient.close_connection": "WebPubSubService.closeConnection",
26+
"azure.messaging.webpubsubservice.WebPubSubServiceClient.connection_exists": "WebPubSubService.connectionExists",
27+
"azure.messaging.webpubsubservice.aio.WebPubSubServiceClient.connection_exists": "WebPubSubService.connectionExists",
28+
"azure.messaging.webpubsubservice.WebPubSubServiceClient.send_to_connection": "WebPubSubService.sendToConnection",
29+
"azure.messaging.webpubsubservice.aio.WebPubSubServiceClient.send_to_connection": "WebPubSubService.sendToConnection",
30+
"azure.messaging.webpubsubservice.WebPubSubServiceClient.remove_connection_from_all_groups": "WebPubSubService.removeConnectionFromAllGroups",
31+
"azure.messaging.webpubsubservice.aio.WebPubSubServiceClient.remove_connection_from_all_groups": "WebPubSubService.removeConnectionFromAllGroups",
32+
"azure.messaging.webpubsubservice.WebPubSubServiceClient.group_exists": "WebPubSubService.groupExists",
33+
"azure.messaging.webpubsubservice.aio.WebPubSubServiceClient.group_exists": "WebPubSubService.groupExists",
34+
"azure.messaging.webpubsubservice.WebPubSubServiceClient.close_group_connections": "WebPubSubService.closeGroupConnections",
35+
"azure.messaging.webpubsubservice.aio.WebPubSubServiceClient.close_group_connections": "WebPubSubService.closeGroupConnections",
36+
"azure.messaging.webpubsubservice.WebPubSubServiceClient.send_to_group": "WebPubSubService.sendToGroup",
37+
"azure.messaging.webpubsubservice.aio.WebPubSubServiceClient.send_to_group": "WebPubSubService.sendToGroup",
38+
"azure.messaging.webpubsubservice.WebPubSubServiceClient.list_connections": "WebPubSubService.listConnections",
39+
"azure.messaging.webpubsubservice.aio.WebPubSubServiceClient.list_connections": "WebPubSubService.listConnections",
40+
"azure.messaging.webpubsubservice.WebPubSubServiceClient.remove_connection_from_group": "WebPubSubService.removeConnectionFromGroup",
41+
"azure.messaging.webpubsubservice.aio.WebPubSubServiceClient.remove_connection_from_group": "WebPubSubService.removeConnectionFromGroup",
42+
"azure.messaging.webpubsubservice.WebPubSubServiceClient.add_connection_to_group": "WebPubSubService.addConnectionToGroup",
43+
"azure.messaging.webpubsubservice.aio.WebPubSubServiceClient.add_connection_to_group": "WebPubSubService.addConnectionToGroup",
44+
"azure.messaging.webpubsubservice.WebPubSubServiceClient.revoke_permission": "WebPubSubService.revokePermission",
45+
"azure.messaging.webpubsubservice.aio.WebPubSubServiceClient.revoke_permission": "WebPubSubService.revokePermission",
46+
"azure.messaging.webpubsubservice.WebPubSubServiceClient.has_permission": "WebPubSubService.hasPermission",
47+
"azure.messaging.webpubsubservice.aio.WebPubSubServiceClient.has_permission": "WebPubSubService.hasPermission",
48+
"azure.messaging.webpubsubservice.WebPubSubServiceClient.grant_permission": "WebPubSubService.grantPermission",
49+
"azure.messaging.webpubsubservice.aio.WebPubSubServiceClient.grant_permission": "WebPubSubService.grantPermission",
50+
"azure.messaging.webpubsubservice.WebPubSubServiceClient.user_exists": "WebPubSubService.userExists",
51+
"azure.messaging.webpubsubservice.aio.WebPubSubServiceClient.user_exists": "WebPubSubService.userExists",
52+
"azure.messaging.webpubsubservice.WebPubSubServiceClient.close_user_connections": "WebPubSubService.closeUserConnections",
53+
"azure.messaging.webpubsubservice.aio.WebPubSubServiceClient.close_user_connections": "WebPubSubService.closeUserConnections",
54+
"azure.messaging.webpubsubservice.WebPubSubServiceClient.send_to_user": "WebPubSubService.sendToUser",
55+
"azure.messaging.webpubsubservice.aio.WebPubSubServiceClient.send_to_user": "WebPubSubService.sendToUser",
56+
"azure.messaging.webpubsubservice.WebPubSubServiceClient.remove_user_from_all_groups": "WebPubSubService.removeUserFromAllGroups",
57+
"azure.messaging.webpubsubservice.aio.WebPubSubServiceClient.remove_user_from_all_groups": "WebPubSubService.removeUserFromAllGroups",
58+
"azure.messaging.webpubsubservice.WebPubSubServiceClient.remove_user_from_group": "WebPubSubService.removeUserFromGroup",
59+
"azure.messaging.webpubsubservice.aio.WebPubSubServiceClient.remove_user_from_group": "WebPubSubService.removeUserFromGroup",
60+
"azure.messaging.webpubsubservice.WebPubSubServiceClient.add_user_to_group": "WebPubSubService.addUserToGroup",
61+
"azure.messaging.webpubsubservice.aio.WebPubSubServiceClient.add_user_to_group": "WebPubSubService.addUserToGroup"
62+
}
63+
}

sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# --------------------------------------------------------------------------
33
# Copyright (c) Microsoft Corporation. All rights reserved.
44
# Licensed under the MIT License. See License.txt in the project root for license information.
5-
# Code generated by Microsoft (R) AutoRest Code Generator.
5+
# Code generated by Microsoft (R) Python Code Generator.
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88
# pylint: disable=wrong-import-position

sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_client.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# --------------------------------------------------------------------------
33
# Copyright (c) Microsoft Corporation. All rights reserved.
44
# Licensed under the MIT License. See License.txt in the project root for license information.
5-
# Code generated by Microsoft (R) AutoRest Code Generator.
5+
# Code generated by Microsoft (R) Python Code Generator.
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

@@ -15,31 +15,32 @@
1515
from azure.core.rest import HttpRequest, HttpResponse
1616

1717
from ._configuration import WebPubSubServiceClientConfiguration
18-
from ._operations import WebPubSubServiceClientOperationsMixin
18+
from ._operations import _WebPubSubServiceClientOperationsMixin
1919
from ._utils.serialization import Deserializer, Serializer
2020

2121
if TYPE_CHECKING:
2222
from azure.core.credentials import TokenCredential
2323

2424

25-
class WebPubSubServiceClient(WebPubSubServiceClientOperationsMixin):
25+
class WebPubSubServiceClient(_WebPubSubServiceClientOperationsMixin):
2626
"""WebPubSubServiceClient.
2727
28-
:param hub: Target hub name, which should start with alphabetic characters and only contain
29-
alpha-numeric characters or underscore. Required.
30-
:type hub: str
3128
:param endpoint: HTTP or HTTPS endpoint for the Web PubSub service instance. Required.
3229
:type endpoint: str
33-
:param credential: Credential needed for the client to connect to Azure. Required.
30+
:param credential: Credential used to authenticate requests to the service. Required.
3431
:type credential: ~azure.core.credentials.TokenCredential
35-
:keyword api_version: Api Version. Default value is "2024-12-01". Note that overriding this
36-
default value may result in unsupported behavior.
32+
:param hub: Target hub name, which should start with alphabetic characters and only contain
33+
alpha-numeric characters or underscore. Required.
34+
:type hub: str
35+
:keyword api_version: The API version to use for this operation. Default value is "2024-12-01".
36+
Note that overriding this default value may result in unsupported behavior.
3737
:paramtype api_version: str
3838
"""
3939

40-
def __init__(self, hub: str, endpoint: str, credential: "TokenCredential", **kwargs: Any) -> None:
40+
def __init__(self, endpoint: str, credential: "TokenCredential", hub: str, **kwargs: Any) -> None:
41+
super().__init__()
4142
_endpoint = "{endpoint}"
42-
self._config = WebPubSubServiceClientConfiguration(hub=hub, endpoint=endpoint, credential=credential, **kwargs)
43+
self._config = WebPubSubServiceClientConfiguration(endpoint=endpoint, credential=credential, hub=hub, **kwargs)
4344

4445
_policies = kwargs.pop("policies", None)
4546
if _policies is None:

sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_configuration.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# --------------------------------------------------------------------------
33
# Copyright (c) Microsoft Corporation. All rights reserved.
44
# Licensed under the MIT License. See License.txt in the project root for license information.
5-
# Code generated by Microsoft (R) AutoRest Code Generator.
5+
# Code generated by Microsoft (R) Python Code Generator.
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

@@ -22,31 +22,31 @@ class WebPubSubServiceClientConfiguration: # pylint: disable=too-many-instance-
2222
Note that all parameters used to create this instance are saved as instance
2323
attributes.
2424
25-
:param hub: Target hub name, which should start with alphabetic characters and only contain
26-
alpha-numeric characters or underscore. Required.
27-
:type hub: str
2825
:param endpoint: HTTP or HTTPS endpoint for the Web PubSub service instance. Required.
2926
:type endpoint: str
30-
:param credential: Credential needed for the client to connect to Azure. Required.
27+
:param credential: Credential used to authenticate requests to the service. Required.
3128
:type credential: ~azure.core.credentials.TokenCredential
32-
:keyword api_version: Api Version. Default value is "2024-12-01". Note that overriding this
33-
default value may result in unsupported behavior.
29+
:param hub: Target hub name, which should start with alphabetic characters and only contain
30+
alpha-numeric characters or underscore. Required.
31+
:type hub: str
32+
:keyword api_version: The API version to use for this operation. Default value is "2024-12-01".
33+
Note that overriding this default value may result in unsupported behavior.
3434
:paramtype api_version: str
3535
"""
3636

37-
def __init__(self, hub: str, endpoint: str, credential: "TokenCredential", **kwargs: Any) -> None:
37+
def __init__(self, endpoint: str, credential: "TokenCredential", hub: str, **kwargs: Any) -> None:
3838
api_version: str = kwargs.pop("api_version", "2024-12-01")
3939

40-
if hub is None:
41-
raise ValueError("Parameter 'hub' must not be None.")
4240
if endpoint is None:
4341
raise ValueError("Parameter 'endpoint' must not be None.")
4442
if credential is None:
4543
raise ValueError("Parameter 'credential' must not be None.")
44+
if hub is None:
45+
raise ValueError("Parameter 'hub' must not be None.")
4646

47-
self.hub = hub
4847
self.endpoint = endpoint
4948
self.credential = credential
49+
self.hub = hub
5050
self.api_version = api_version
5151
self.credential_scopes = kwargs.pop("credential_scopes", ["https://webpubsub.azure.com/.default"])
5252
kwargs.setdefault("sdk_moniker", "messaging-webpubsubservice/{}".format(VERSION))

sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_models.py

Lines changed: 0 additions & 35 deletions
This file was deleted.

sdk/webpubsub/azure-messaging-webpubsubservice/azure/messaging/webpubsubservice/_operations/__init__.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# --------------------------------------------------------------------------
33
# Copyright (c) Microsoft Corporation. All rights reserved.
44
# Licensed under the MIT License. See License.txt in the project root for license information.
5-
# Code generated by Microsoft (R) AutoRest Code Generator.
5+
# Code generated by Microsoft (R) Python Code Generator.
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88
# pylint: disable=wrong-import-position
@@ -12,14 +12,12 @@
1212
if TYPE_CHECKING:
1313
from ._patch import * # pylint: disable=unused-wildcard-import
1414

15-
from ._operations import WebPubSubServiceClientOperationsMixin # type: ignore
15+
from ._operations import _WebPubSubServiceClientOperationsMixin # type: ignore # pylint: disable=unused-import
1616

1717
from ._patch import __all__ as _patch_all
1818
from ._patch import *
1919
from ._patch import patch_sdk as _patch_sdk
2020

21-
__all__ = [
22-
"WebPubSubServiceClientOperationsMixin",
23-
]
21+
__all__ = []
2422
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
2523
_patch_sdk()

0 commit comments

Comments
 (0)