Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@

See our [API docs](https://api-docs.gradient-labs.ai); chat to us for the password.


30 changes: 30 additions & 0 deletions src/gradient_labs/_handoff_target_get_default.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from dataclasses import dataclass
from dataclasses_json import dataclass_json

from ._http_client import HttpClient
from .conversation import ConversationChannel


@dataclass_json
@dataclass(frozen=True)
class GetDefaultHandOffTargetParams:
# channel is the conversation channel for which to get the default hand-off target.
channel: ConversationChannel


@dataclass_json
@dataclass(frozen=True)
class GetDefaultHandOffTargetResponse:
# id is the unique identifier for the default hand-off target.
# Empty string if no default is set.
id: str


def get_default_hand_off_target(
*, client: HttpClient, params: GetDefaultHandOffTargetParams
) -> GetDefaultHandOffTargetResponse:
rsp = client.get(
path="hand-off-targets/default",
query_params={"channel": params.channel.value},
)
return GetDefaultHandOffTargetResponse.from_dict(rsp)
17 changes: 17 additions & 0 deletions src/gradient_labs/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@
set_default_hand_off_target,
SetDefaultHandOffTargetParams,
)
from ._handoff_target_get_default import (
get_default_hand_off_target,
GetDefaultHandOffTargetParams,
GetDefaultHandOffTargetResponse,
)

from .procedure import Procedure
from ._procedure_read import read_procedure
Expand Down Expand Up @@ -321,6 +326,18 @@ def set_default_hand_off_target(
params=params,
)

def get_default_hand_off_target(
self, *, params: GetDefaultHandOffTargetParams
) -> GetDefaultHandOffTargetResponse:
"""get_default_hand_off_target gets the current default hand-off target for the company.
This can be retrieved by channel.

Note: requires a `Management` API key."""
return get_default_hand_off_target(
client=self.http_client,
params=params,
)

def delete_hand_off_target(self, *, params: DeleteHandOffTargetParams) -> None:
"""delete_hand_off_target deletes a hand-off target. This will fail if the hand off target
is in use - either in a procedure, or in an intent.
Expand Down