hey-sdk 0.31.0

Rust client for the HEY API, generated from a Smithy model of the API
Documentation
// Generated by hey-sdk-generator from openapi.json and behavior-model.json. DO NOT EDIT.

#![allow(missing_docs, unreachable_pub, clippy::all, clippy::pedantic)]

use crate::client::Client;
use crate::error::Error;
use crate::generated::routes;
use crate::generated::types::*;

pub struct BulkReplies<'a> {
    client: &'a Client,
}

impl<'a> BulkReplies<'a> {
    pub(crate) fn new(client: &'a Client) -> Self {
        Self { client }
    }

    /// The client this service sends through.
    pub fn client(&self) -> &'a Client {
        self.client
    }

    /// Send one reply to every entry. Answers what was sent, not the replies themselves:
    /// delivery is queued, and delayed while undo is still possible.
    pub async fn create(
        &self,
        body: &BulkReplyRequestContent,
    ) -> Result<CreateBulkReplyResponseContent, Error> {
        let mut operation = self.client.operation(&routes::CREATE_BULK_REPLY, &[]);
        operation.json(body)?;
        self.client.send(operation).await
    }

    /// Work out which entries a bulk reply would answer. HEY replies to the last replyable
    /// entry of each thread, skipping threads with no reply address, so the postings you hold
    /// are not the entries you send to — this resolves them.
    pub async fn new_bulk_reply(
        &self,
        posting_ids: &str,
    ) -> Result<NewBulkReplyResponseContent, Error> {
        let mut operation = self.client.operation(&routes::NEW_BULK_REPLY, &[]);
        operation.query("posting_ids", posting_ids);
        self.client.send(operation).await
    }
}