Exemplo n.º 1
0
async def sample_method_bidi_streaming():
    # Create a client
    client = mollusca_v1.SnippetsAsyncClient()

    # Initialize request argument(s)
    request = mollusca_v1.SignatureRequestOneRequiredField(
        my_string="my_string_value",
    )

    # This method expects an iterator which contains
    # 'mollusca_v1.SignatureRequestOneRequiredField' objects
    # Here we create a generator that yields a single `request` for
    # demonstrative purposes.
    requests = [request]

    def request_generator():
        for request in requests:
            yield request

    # Make the request
    stream = await client.method_bidi_streaming(requests=request_generator())

    # Handle the response
    async for response in stream:
        print(response)
async def sample_method_lro_signatures():
    # Create a client
    client = mollusca_v1.SnippetsAsyncClient()

    # Initialize request argument(s)
    my_message = mollusca_v1.MessageWithNesting()
    my_message.message.required_string = "required_string_value"
    my_message.my_int = 656

    request = mollusca_v1.SignatureRequest(
        my_string="my_string_value",
        my_int=656,
        my_bool=True,
        my_message=my_message,
        single_enum="DEFAULT",
    )

    # Make the request
    operation = client.method_lro_signatures(request=request)

    print("Waiting for operation to complete...")

    response = await operation.result()

    # Handle the response
    print(response)
Exemplo n.º 3
0
async def sample_method_server_streaming():
    """Snippet for method_server_streaming"""

    # Create a client
    client = mollusca_v1.SnippetsAsyncClient()

    # Initialize request argument(s)
    request = mollusca_v1.SignatureRequest()

    # Make the request
    stream = await client.method_server_streaming(request=request)
    async for response in stream:
        print("{}".format(response))
async def sample_method_one_signature():
    """Snippet for method_one_signature"""

    # Create a client
    client = mollusca_v1.SnippetsAsyncClient()

    # Initialize request argument(s)
    request = mollusca_v1.SignatureRequest()

    # Make the request
    response = await client.method_one_signature(request=request)

    # Handle response
    print("{}".format(response))
async def sample_one_of_method_required_field():
    # Create a client
    client = mollusca_v1.SnippetsAsyncClient()

    # Initialize request argument(s)
    request = mollusca_v1.OneOfRequestWithRequiredField(
        my_string="my_string_value",
        non_one_of_string="non_one_of_string_value",
    )

    # Make the request
    response = await client.one_of_method_required_field(request=request)

    # Handle the response
    print(response)
async def sample_list_resources():
    # Create a client
    client = mollusca_v1.SnippetsAsyncClient()

    # Initialize request argument(s)
    request = mollusca_v1.ListResourcesRequest(
        parent="parent_value",
        resource_with_wildcard="resource_with_wildcard_value",
    )

    # Make the request
    page_result = client.list_resources(request=request)

    # Handle the response
    async for response in page_result:
        print(response)
Exemplo n.º 7
0
async def sample_method_lro_signatures():
    """Snippet for method_lro_signatures"""

    # Create a client
    client = mollusca_v1.SnippetsAsyncClient()

    # Initialize request argument(s)
    request = mollusca_v1.SignatureRequest(
    )

    # Make the request
    operation = client.method_lro_signatures(request=request)

    print("Waiting for operation to complete...")

    response = await operation.result()
    print("{}".format(response))
Exemplo n.º 8
0
async def sample_method_server_streaming():
    # Create a client
    client = mollusca_v1.SnippetsAsyncClient()

    # Initialize request argument(s)
    my_message = mollusca_v1.MessageWithNesting()
    my_message.message.required_string = "required_string_value"
    my_message.my_int = 656

    request = mollusca_v1.SignatureRequest(
        my_string="my_string_value",
        my_int=656,
        my_bool=True,
        my_message=my_message,
        single_enum="DEFAULT",
    )

    # Make the request
    stream = await client.method_server_streaming(request=request)

    # Handle the response
    async for response in stream:
        print(response)