跳转到正文

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 ServiceCallContext

SDK 说明:

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 Services

Services.__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__ 中设置。

Neomega · 使用、开发与参考文档