Skip to content

Latest commit

 

History

History
286 lines (215 loc) · 10.4 KB

MessagesApi.md

File metadata and controls

286 lines (215 loc) · 10.4 KB

waylay.services.data.MessagesApi

All URIs are relative to https://api.waylay.io

Method HTTP request Description
delete_messages DELETE /data/v1/messages/{resourceId} Remove Messages For Resource
get_latest_document GET /data/v1/messages/{resourceId}/current Retrieve Latest Message
get_latest_messages GET /data/v1/messages/{resourceId} Retrieve Messages For Resource
query_messages POST /data/v1/messages/query Query Messages

delete_messages

delete_messages( resource_id: str, headers ) -> DeleteMessages200Response

Remove Messages For Resource

Removes all messages associated with a resource.

Example

from pprint import pprint

# Import the waylay-client from the waylay-sdk-core package
from waylay.sdk.client import WaylayClient
from waylay.sdk.api.api_exceptions import ApiError

# Intialize a waylay client instance
waylay_client = WaylayClient.from_profile()

# Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-data-types` is installed
from waylay.services.data.models.delete_messages200_response import DeleteMessages200Response
try:
    # Remove Messages For Resource
    # calls `DELETE /data/v1/messages/{resourceId}`
    api_response = await waylay_client.data.messages.delete_messages(
        'resource_id_example', # resource_id | path param "resourceId"
    )
    print("The response of data.messages.delete_messages:\n")
    pprint(api_response)
except ApiError as e:
    print("Exception when calling data.messages.delete_messages: %s\n" % e)

Endpoint

DELETE /data/v1/messages/{resourceId}

Parameters

Name Type API binding Description Notes
resource_id str path parameter "resourceId" Uniquely identifies a resource.
headers HeaderTypes request headers

Return type

Selected path param Raw response param Return Type Description Links
Literal[""] (default) False (default) DeleteMessages200Response DeleteMessages200Response
str False (default) Any If any other string value for the selected path is provided, the exact type of the response will only be known at runtime.
/ True Response The raw http response object.

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful Response -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_latest_document

get_latest_document( resource_id: str, headers ) -> TimestampedEvent

Retrieve Latest Message

Retrieves the latest (i.e. most recent) message for a resource.

Example

from pprint import pprint

# Import the waylay-client from the waylay-sdk-core package
from waylay.sdk.client import WaylayClient
from waylay.sdk.api.api_exceptions import ApiError

# Intialize a waylay client instance
waylay_client = WaylayClient.from_profile()

# Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-data-types` is installed
from waylay.services.data.models.timestamped_event import TimestampedEvent
try:
    # Retrieve Latest Message
    # calls `GET /data/v1/messages/{resourceId}/current`
    api_response = await waylay_client.data.messages.get_latest_document(
        'resource_id_example', # resource_id | path param "resourceId"
    )
    print("The response of data.messages.get_latest_document:\n")
    pprint(api_response)
except ApiError as e:
    print("Exception when calling data.messages.get_latest_document: %s\n" % e)

Endpoint

GET /data/v1/messages/{resourceId}/current

Parameters

Name Type API binding Description Notes
resource_id str path parameter "resourceId" Uniquely identifies a resource.
headers HeaderTypes request headers

Return type

Selected path param Raw response param Return Type Description Links
Literal[""] (default) False (default) TimestampedEvent TimestampedEvent
str False (default) Any If any other string value for the selected path is provided, the exact type of the response will only be known at runtime.
/ True Response The raw http response object.

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful Response -
404 No Message Received Yet -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_latest_messages

get_latest_messages( resource_id: str, headers ) -> List[TimestampedEvent]

Retrieve Messages For Resource

Retrieves the last n messages for a resource.

Example

from pprint import pprint

# Import the waylay-client from the waylay-sdk-core package
from waylay.sdk.client import WaylayClient
from waylay.sdk.api.api_exceptions import ApiError

# Intialize a waylay client instance
waylay_client = WaylayClient.from_profile()

# Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-data-types` is installed
from waylay.services.data.models.timestamped_event import TimestampedEvent
try:
    # Retrieve Messages For Resource
    # calls `GET /data/v1/messages/{resourceId}`
    api_response = await waylay_client.data.messages.get_latest_messages(
        'resource_id_example', # resource_id | path param "resourceId"
    )
    print("The response of data.messages.get_latest_messages:\n")
    pprint(api_response)
except ApiError as e:
    print("Exception when calling data.messages.get_latest_messages: %s\n" % e)

Endpoint

GET /data/v1/messages/{resourceId}

Parameters

Name Type API binding Description Notes
resource_id str path parameter "resourceId" Uniquely identifies a resource.
headers HeaderTypes request headers

Return type

Selected path param Raw response param Return Type Description Links
Literal[""] (default) False (default) List[TimestampedEvent] List[TimestampedEvent]
str False (default) Any If any other string value for the selected path is provided, the exact type of the response will only be known at runtime.
/ True Response The raw http response object.

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful Response -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

query_messages

query_messages( headers ) -> MessageQueryResult

Query Messages

Executes an ad-hoc messages query.

Example

from pprint import pprint

# Import the waylay-client from the waylay-sdk-core package
from waylay.sdk.client import WaylayClient
from waylay.sdk.api.api_exceptions import ApiError

# Intialize a waylay client instance
waylay_client = WaylayClient.from_profile()

# Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-data-types` is installed
from waylay.services.data.models.message_query import MessageQuery
from waylay.services.data.models.message_query_result import MessageQueryResult
try:
    # Query Messages
    # calls `POST /data/v1/messages/query`
    api_response = await waylay_client.data.messages.query_messages(
        # json data: use a generated model or a json-serializable python data structure (dict, list)
        json = waylay.services.data.MessageQuery() # MessageQuery |  (optional)
    )
    print("The response of data.messages.query_messages:\n")
    pprint(api_response)
except ApiError as e:
    print("Exception when calling data.messages.query_messages: %s\n" % e)

Endpoint

POST /data/v1/messages/query

Parameters

Name Type API binding Description Notes
json MessageQuery json request body [optional]
headers HeaderTypes request headers

Return type

Selected path param Raw response param Return Type Description Links
Literal[""] (default) False (default) MessageQueryResult MessageQueryResult
str False (default) Any If any other string value for the selected path is provided, the exact type of the response will only be known at runtime.
/ True Response The raw http response object.

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful Query Result -
400 Error Response -

[Back to top] [Back to API list] [Back to Model list] [Back to README]