外观
services API
模块说明
text
Online plugin calls with explicit receipts; no retry or restart durability.ServiceIntent
python
@dataclass(frozen=True)
class ServiceIntent该类型另有以下内部字段,参与数据类声明但不建议直接读写;创建对象时优先使用专题中的工厂方法:
python
_json: str = field(repr=False)ServiceIntent.payload
python
def payload(self)ServiceUncertain
python
class ServiceUncertain(ProtocolError)ServiceUncertain.__init__
python
def __init__(self, intent)ServiceUncertain.intent
python
self.intent公开实例属性,在 __init__ 中设置。
ServiceWaitTimeout
python
class ServiceWaitTimeout(TimeoutError)ServiceWaitTimeout.__init__
python
def __init__(self, call_id)另继承外部类型 TimeoutError;其通用方法不在本 SDK 目录中重复展开。
ServiceWaitTimeout.call_id
python
self.call_id公开实例属性,在 __init__ 中设置。
ServiceFailed
python
class ServiceFailed(ProtocolError)ServiceFailed.__init__
python
def __init__(self, receipt)ServiceFailed.receipt
python
self.receipt公开实例属性,在 __init__ 中设置。
ServiceFailed.call_id
python
self.call_id公开实例属性,在 __init__ 中设置。
ServiceRejected
python
class ServiceRejected(Exception)SDK 说明:
text
An intentional business refusal that leaves the provider running.ServiceRejected.__init__
python
def __init__(self, code='business_rejected', *, receipt=None)另继承外部类型 Exception;其通用方法不在本 SDK 目录中重复展开。
ServiceRejected.code
python
self.code公开实例属性,在 __init__ 中设置。
ServiceRejected.receipt
python
self.receipt公开实例属性,在 __init__ 中设置。
ServiceRejected.call_id
python
self.call_id公开实例属性,在 __init__ 中设置。
ServiceCallContext
python
@dataclass(frozen=True)
class ServiceCallContextSDK 说明:
text
Host admission identity and times; does not delegate caller permissions.字段(包含继承字段):
ServiceCallContext.installation_id
python
installation_id: str数据类字段;声明于 services.ServiceCallContext。
ServiceCallContext.generation
python
generation: int数据类字段;声明于 services.ServiceCallContext。
ServiceCallContext.call_id
python
call_id: str数据类字段;声明于 services.ServiceCallContext。
ServiceCallContext.accepted_at
python
accepted_at: datetime数据类字段;声明于 services.ServiceCallContext。
ServiceCallContext.deadline
python
deadline: datetime数据类字段;声明于 services.ServiceCallContext。
service
python
def service(name, *, major=1, with_context=False)SDK 说明:
text
Declare (ctx, arguments), or (ctx, arguments, call_context) when opted in.Services
python
class ServicesServices.__init__
python
def __init__(self, peer)Services.prepare
python
def prepare(self, service, arguments, *, idempotency_key, deadline, major=1)Services.submit
python
async def submit(self, intent, *, timeout=10)Services.get
python
async def get(self, call_id, *, timeout=10)Services.wait
python
async def wait(self, call_id, *, timeout=5, poll_interval=0.05)Services.call
python
async def call(self, service, arguments, *, major=1, timeout=5, idempotency_key=None)SDK 说明:
text
One online call. Use prepare/submit/wait when retaining receipts matters.Services.peer
python
self.peer公开实例属性,在 __init__ 中设置。