Skip to content

Commit

Permalink
feat: Add support for REST transport (#68)
Browse files Browse the repository at this point in the history
* feat: enable REST transport for Python Preview clients

PiperOrigin-RevId: 474571730

Source-Link: googleapis/googleapis@5a9ee4d

Source-Link: googleapis/googleapis-gen@ceafe52
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiY2VhZmU1MjFmMTM3NjgwZmRlZTJmOWNhOWUxOTQ3Y2RkODI1MDcwZCJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* fix(deps): require google-api-core>=1.33.1,>=2.8.0

* fix(deps): require protobuf >= 3.20.1

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
  • Loading branch information
3 people authored Sep 16, 2022
1 parent 057cec5 commit 9d3ca48
Show file tree
Hide file tree
Showing 12 changed files with 1,183 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,21 @@
]
}
}
},
"rest": {
"libraryClient": "PublisherClient",
"rpcs": {
"PublishChannelConnectionEvents": {
"methods": [
"publish_channel_connection_events"
]
},
"PublishEvents": {
"methods": [
"publish_events"
]
}
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
from .transports.base import PublisherTransport, DEFAULT_CLIENT_INFO
from .transports.grpc import PublisherGrpcTransport
from .transports.grpc_asyncio import PublisherGrpcAsyncIOTransport
from .transports.rest import PublisherRestTransport


class PublisherClientMeta(type):
Expand All @@ -51,6 +52,7 @@ class PublisherClientMeta(type):
_transport_registry = OrderedDict() # type: Dict[str, Type[PublisherTransport]]
_transport_registry["grpc"] = PublisherGrpcTransport
_transport_registry["grpc_asyncio"] = PublisherGrpcAsyncIOTransport
_transport_registry["rest"] = PublisherRestTransport

def get_transport_class(
cls,
Expand Down Expand Up @@ -346,6 +348,9 @@ def __init__(
transport (Union[str, PublisherTransport]): The
transport to use. If set to None, a transport is chosen
automatically.
NOTE: "rest" transport functionality is currently in a
beta state (preview). We welcome your feedback via an
issue in this library's source repository.
client_options (google.api_core.client_options.ClientOptions): Custom options for the
client. It won't take effect if a ``transport`` instance is provided.
(1) The ``api_endpoint`` property can be used to override the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,20 @@
from .base import PublisherTransport
from .grpc import PublisherGrpcTransport
from .grpc_asyncio import PublisherGrpcAsyncIOTransport
from .rest import PublisherRestTransport
from .rest import PublisherRestInterceptor


# Compile a registry of transports.
_transport_registry = OrderedDict() # type: Dict[str, Type[PublisherTransport]]
_transport_registry["grpc"] = PublisherGrpcTransport
_transport_registry["grpc_asyncio"] = PublisherGrpcAsyncIOTransport
_transport_registry["rest"] = PublisherRestTransport

__all__ = (
"PublisherTransport",
"PublisherGrpcTransport",
"PublisherGrpcAsyncIOTransport",
"PublisherRestTransport",
"PublisherRestInterceptor",
)
Loading

0 comments on commit 9d3ca48

Please sign in to comment.