pub struct PersonServerClient { /* private fields */ }client only.Expand description
The agent’s side of a Person Server conversation.
Every call is signed as the agent. A 5xx, a 429 or a transport
failure is an Error::Http, never an Answer::Denied, so a dropped
connection is not mistaken for a refusal.
Implementations§
Source§impl PersonServerClient
impl PersonServerClient
Sourcepub fn new(http: Client, reach: Reach) -> Self
pub fn new(http: Client, reach: Reach) -> Self
A client over http. Use super::guarded_client’s when Person
Server URLs come from someone else.
Sourcepub async fn metadata(&self, issuer: &str) -> Result<PersonServerMetadata>
pub async fn metadata(&self, issuer: &str) -> Result<PersonServerMetadata>
The Person Server’s aauth-person.json. It must name issuer, and
every endpoint in it must be on the issuer’s own origin.
Sourcepub async fn call(
&self,
agent: &Agent<'_>,
method: Method,
url: &str,
body: Option<&Value>,
) -> Result<Answer>
pub async fn call( &self, agent: &Agent<'_>, method: Method, url: &str, body: Option<&Value>, ) -> Result<Answer>
A signed POST of JSON body, or a GET or DELETE with none, to url.
Sourcepub async fn person_token(
&self,
agent: &Agent<'_>,
metadata: &PersonServerMetadata,
resource: &str,
person: &Person<'_>,
mission_s256: Option<&str>,
) -> Result<Answer>
pub async fn person_token( &self, agent: &Agent<'_>, metadata: &PersonServerMetadata, resource: &str, person: &Person<'_>, mission_s256: Option<&str>, ) -> Result<Answer>
Ask for a person token for resource, under a mission when mission_s256 names one.
Sourcepub async fn auth_token(
&self,
agent: &Agent<'_>,
metadata: &PersonServerMetadata,
resource_token: &str,
presented_token: &str,
person: &Person<'_>,
) -> Result<Answer>
pub async fn auth_token( &self, agent: &Agent<'_>, metadata: &PersonServerMetadata, resource_token: &str, presented_token: &str, person: &Person<'_>, ) -> Result<Answer>
Exchange a resource token for an auth token, presenting the token the resource token was issued against.
Sourcepub async fn propose_mission(
&self,
agent: &Agent<'_>,
metadata: &PersonServerMetadata,
proposal: &Value,
person: &Person<'_>,
) -> Result<Answer>
pub async fn propose_mission( &self, agent: &Agent<'_>, metadata: &PersonServerMetadata, proposal: &Value, person: &Person<'_>, ) -> Result<Answer>
Propose a mission: {"description": …, "resources": [...]}.
Sourcepub async fn mission_action(
&self,
agent: &Agent<'_>,
metadata: &PersonServerMetadata,
s256: &str,
action: &Value,
) -> Result<Answer>
pub async fn mission_action( &self, agent: &Agent<'_>, metadata: &PersonServerMetadata, s256: &str, action: &Value, ) -> Result<Answer>
Act on a mission: {"action": "update", "description": …}, or
{"action": "completion", "summary": …}.