Skip to content

Commit 483de87

Browse files
feat: [google-cloud-support] AddGetAttachmentRequest and GetComment (#14208)
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 792747515 Source-Link: googleapis/googleapis@1dfb2b3 Source-Link: googleapis/googleapis-gen@466335a Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXN1cHBvcnQvLk93bEJvdC55YW1sIiwiaCI6IjQ2NjMzNWEzNTU0MTliNWUzZmJiMGVlZmNmNWI2OGMxMzhlNTFkMGEifQ== --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent e8feca7 commit 483de87

31 files changed

+3346
-167
lines changed

packages/google-cloud-support/google/cloud/support/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "0.1.18" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-support/google/cloud/support_v2/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "0.1.18" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-support/google/cloud/support_v2beta/__init__.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@
2727
from .services.feed_service import FeedServiceAsyncClient, FeedServiceClient
2828
from .types.actor import Actor
2929
from .types.attachment import Attachment
30-
from .types.attachment_service import ListAttachmentsRequest, ListAttachmentsResponse
30+
from .types.attachment_service import (
31+
GetAttachmentRequest,
32+
ListAttachmentsRequest,
33+
ListAttachmentsResponse,
34+
)
3135
from .types.case import Case, CaseClassification, Product, ProductLine
3236
from .types.case_service import (
3337
CloseCaseRequest,
@@ -45,6 +49,7 @@
4549
from .types.comment import Comment
4650
from .types.comment_service import (
4751
CreateCommentRequest,
52+
GetCommentRequest,
4853
ListCommentsRequest,
4954
ListCommentsResponse,
5055
)
@@ -75,7 +80,9 @@
7580
"Escalation",
7681
"FeedItem",
7782
"FeedServiceClient",
83+
"GetAttachmentRequest",
7884
"GetCaseRequest",
85+
"GetCommentRequest",
7986
"ListAttachmentsRequest",
8087
"ListAttachmentsResponse",
8188
"ListCasesRequest",

packages/google-cloud-support/google/cloud/support_v2beta/gapic_metadata.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
"grpc": {
1111
"libraryClient": "CaseAttachmentServiceClient",
1212
"rpcs": {
13+
"GetAttachment": {
14+
"methods": [
15+
"get_attachment"
16+
]
17+
},
1318
"ListAttachments": {
1419
"methods": [
1520
"list_attachments"
@@ -20,6 +25,11 @@
2025
"grpc-async": {
2126
"libraryClient": "CaseAttachmentServiceAsyncClient",
2227
"rpcs": {
28+
"GetAttachment": {
29+
"methods": [
30+
"get_attachment"
31+
]
32+
},
2333
"ListAttachments": {
2434
"methods": [
2535
"list_attachments"
@@ -30,6 +40,11 @@
3040
"rest": {
3141
"libraryClient": "CaseAttachmentServiceClient",
3242
"rpcs": {
43+
"GetAttachment": {
44+
"methods": [
45+
"get_attachment"
46+
]
47+
},
3348
"ListAttachments": {
3449
"methods": [
3550
"list_attachments"
@@ -188,6 +203,11 @@
188203
"create_comment"
189204
]
190205
},
206+
"GetComment": {
207+
"methods": [
208+
"get_comment"
209+
]
210+
},
191211
"ListComments": {
192212
"methods": [
193213
"list_comments"
@@ -203,6 +223,11 @@
203223
"create_comment"
204224
]
205225
},
226+
"GetComment": {
227+
"methods": [
228+
"get_comment"
229+
]
230+
},
206231
"ListComments": {
207232
"methods": [
208233
"list_comments"
@@ -218,6 +243,11 @@
218243
"create_comment"
219244
]
220245
},
246+
"GetComment": {
247+
"methods": [
248+
"get_comment"
249+
]
250+
},
221251
"ListComments": {
222252
"methods": [
223253
"list_comments"

packages/google-cloud-support/google/cloud/support_v2beta/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "0.1.18" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-support/google/cloud/support_v2beta/services/case_attachment_service/async_client.py

Lines changed: 120 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,10 @@
4444
except AttributeError: # pragma: NO COVER
4545
OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore
4646

47+
from google.protobuf import timestamp_pb2 # type: ignore
48+
4749
from google.cloud.support_v2beta.services.case_attachment_service import pagers
48-
from google.cloud.support_v2beta.types import attachment, attachment_service
50+
from google.cloud.support_v2beta.types import actor, attachment, attachment_service
4951

5052
from .client import CaseAttachmentServiceClient
5153
from .transports.base import DEFAULT_CLIENT_INFO, CaseAttachmentServiceTransport
@@ -428,6 +430,123 @@ async def sample_list_attachments():
428430
# Done; return the response.
429431
return response
430432

433+
async def get_attachment(
434+
self,
435+
request: Optional[Union[attachment_service.GetAttachmentRequest, dict]] = None,
436+
*,
437+
name: Optional[str] = None,
438+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
439+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
440+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
441+
) -> attachment.Attachment:
442+
r"""Retrieve an attachment.
443+
444+
.. code-block:: python
445+
446+
# This snippet has been automatically generated and should be regarded as a
447+
# code template only.
448+
# It will require modifications to work:
449+
# - It may require correct/in-range values for request initialization.
450+
# - It may require specifying regional endpoints when creating the service
451+
# client as shown in:
452+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
453+
from google.cloud import support_v2beta
454+
455+
async def sample_get_attachment():
456+
# Create a client
457+
client = support_v2beta.CaseAttachmentServiceAsyncClient()
458+
459+
# Initialize request argument(s)
460+
request = support_v2beta.GetAttachmentRequest(
461+
name="name_value",
462+
)
463+
464+
# Make the request
465+
response = await client.get_attachment(request=request)
466+
467+
# Handle the response
468+
print(response)
469+
470+
Args:
471+
request (Optional[Union[google.cloud.support_v2beta.types.GetAttachmentRequest, dict]]):
472+
The request object. Request for getting an attachment.
473+
name (:class:`str`):
474+
Required. The name of the attachment
475+
to get.
476+
477+
This corresponds to the ``name`` field
478+
on the ``request`` instance; if ``request`` is provided, this
479+
should not be set.
480+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
481+
should be retried.
482+
timeout (float): The timeout for this request.
483+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
484+
sent along with the request as metadata. Normally, each value must be of type `str`,
485+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
486+
be of type `bytes`.
487+
488+
Returns:
489+
google.cloud.support_v2beta.types.Attachment:
490+
An Attachment contains metadata about a file that was uploaded to a
491+
case - it is NOT a file itself. That being said, the
492+
name of an Attachment object can be used to download
493+
its accompanying file through the media.download
494+
endpoint.
495+
496+
While attachments can be uploaded in the console at
497+
the same time as a comment, they're associated on a
498+
"case" level, not a "comment" level.
499+
500+
"""
501+
# Create or coerce a protobuf request object.
502+
# - Quick check: If we got a request object, we should *not* have
503+
# gotten any keyword arguments that map to the request.
504+
flattened_params = [name]
505+
has_flattened_params = (
506+
len([param for param in flattened_params if param is not None]) > 0
507+
)
508+
if request is not None and has_flattened_params:
509+
raise ValueError(
510+
"If the `request` argument is set, then none of "
511+
"the individual field arguments should be set."
512+
)
513+
514+
# - Use the request object if provided (there's no risk of modifying the input as
515+
# there are no flattened fields), or create one.
516+
if not isinstance(request, attachment_service.GetAttachmentRequest):
517+
request = attachment_service.GetAttachmentRequest(request)
518+
519+
# If we have keyword arguments corresponding to fields on the
520+
# request, apply these.
521+
if name is not None:
522+
request.name = name
523+
524+
# Wrap the RPC method; this adds retry and timeout information,
525+
# and friendly error handling.
526+
rpc = self._client._transport._wrapped_methods[
527+
self._client._transport.get_attachment
528+
]
529+
530+
# Certain fields should be provided within the metadata header;
531+
# add these here.
532+
metadata = tuple(metadata) + (
533+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
534+
)
535+
536+
# Validate the universe domain.
537+
self._client._validate_universe_domain()
538+
539+
# Send the request.
540+
response = await rpc(
541+
request,
542+
retry=retry,
543+
timeout=timeout,
544+
metadata=metadata,
545+
)
546+
547+
# Done; return the response.
548+
return response
549+
431550
async def __aenter__(self) -> "CaseAttachmentServiceAsyncClient":
432551
return self
433552

packages/google-cloud-support/google/cloud/support_v2beta/services/case_attachment_service/client.py

Lines changed: 117 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,10 @@
6161

6262
_LOGGER = std_logging.getLogger(__name__)
6363

64+
from google.protobuf import timestamp_pb2 # type: ignore
65+
6466
from google.cloud.support_v2beta.services.case_attachment_service import pagers
65-
from google.cloud.support_v2beta.types import attachment, attachment_service
67+
from google.cloud.support_v2beta.types import actor, attachment, attachment_service
6668

6769
from .transports.base import DEFAULT_CLIENT_INFO, CaseAttachmentServiceTransport
6870
from .transports.grpc import CaseAttachmentServiceGrpcTransport
@@ -862,6 +864,120 @@ def sample_list_attachments():
862864
# Done; return the response.
863865
return response
864866

867+
def get_attachment(
868+
self,
869+
request: Optional[Union[attachment_service.GetAttachmentRequest, dict]] = None,
870+
*,
871+
name: Optional[str] = None,
872+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
873+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
874+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
875+
) -> attachment.Attachment:
876+
r"""Retrieve an attachment.
877+
878+
.. code-block:: python
879+
880+
# This snippet has been automatically generated and should be regarded as a
881+
# code template only.
882+
# It will require modifications to work:
883+
# - It may require correct/in-range values for request initialization.
884+
# - It may require specifying regional endpoints when creating the service
885+
# client as shown in:
886+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
887+
from google.cloud import support_v2beta
888+
889+
def sample_get_attachment():
890+
# Create a client
891+
client = support_v2beta.CaseAttachmentServiceClient()
892+
893+
# Initialize request argument(s)
894+
request = support_v2beta.GetAttachmentRequest(
895+
name="name_value",
896+
)
897+
898+
# Make the request
899+
response = client.get_attachment(request=request)
900+
901+
# Handle the response
902+
print(response)
903+
904+
Args:
905+
request (Union[google.cloud.support_v2beta.types.GetAttachmentRequest, dict]):
906+
The request object. Request for getting an attachment.
907+
name (str):
908+
Required. The name of the attachment
909+
to get.
910+
911+
This corresponds to the ``name`` field
912+
on the ``request`` instance; if ``request`` is provided, this
913+
should not be set.
914+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
915+
should be retried.
916+
timeout (float): The timeout for this request.
917+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
918+
sent along with the request as metadata. Normally, each value must be of type `str`,
919+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
920+
be of type `bytes`.
921+
922+
Returns:
923+
google.cloud.support_v2beta.types.Attachment:
924+
An Attachment contains metadata about a file that was uploaded to a
925+
case - it is NOT a file itself. That being said, the
926+
name of an Attachment object can be used to download
927+
its accompanying file through the media.download
928+
endpoint.
929+
930+
While attachments can be uploaded in the console at
931+
the same time as a comment, they're associated on a
932+
"case" level, not a "comment" level.
933+
934+
"""
935+
# Create or coerce a protobuf request object.
936+
# - Quick check: If we got a request object, we should *not* have
937+
# gotten any keyword arguments that map to the request.
938+
flattened_params = [name]
939+
has_flattened_params = (
940+
len([param for param in flattened_params if param is not None]) > 0
941+
)
942+
if request is not None and has_flattened_params:
943+
raise ValueError(
944+
"If the `request` argument is set, then none of "
945+
"the individual field arguments should be set."
946+
)
947+
948+
# - Use the request object if provided (there's no risk of modifying the input as
949+
# there are no flattened fields), or create one.
950+
if not isinstance(request, attachment_service.GetAttachmentRequest):
951+
request = attachment_service.GetAttachmentRequest(request)
952+
# If we have keyword arguments corresponding to fields on the
953+
# request, apply these.
954+
if name is not None:
955+
request.name = name
956+
957+
# Wrap the RPC method; this adds retry and timeout information,
958+
# and friendly error handling.
959+
rpc = self._transport._wrapped_methods[self._transport.get_attachment]
960+
961+
# Certain fields should be provided within the metadata header;
962+
# add these here.
963+
metadata = tuple(metadata) + (
964+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
965+
)
966+
967+
# Validate the universe domain.
968+
self._validate_universe_domain()
969+
970+
# Send the request.
971+
response = rpc(
972+
request,
973+
retry=retry,
974+
timeout=timeout,
975+
metadata=metadata,
976+
)
977+
978+
# Done; return the response.
979+
return response
980+
865981
def __enter__(self) -> "CaseAttachmentServiceClient":
866982
return self
867983

0 commit comments

Comments
 (0)