mirror of
https://github.com/hanzo-cpp/sdk.git
synced 2026-11-20 19:55:32 +00:00
The projection these were generated from was a month old and predated the compute migration, so every one of them described /v1/visor — which the API serves at zero paths now. That is why a hand-written console client and a generated one had drifted the same way at the same time. No /v1/visor path survives here. The word still appears as a source-plane value and inside gvisor and supervisor, which are not this rename.
150 lines
10 KiB
C++
150 lines
10 KiB
C++
/**
|
|
* Hanzo Cloud API
|
|
* The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
|
|
*
|
|
* The version of the OpenAPI document: v1
|
|
*
|
|
* NOTE: This class is auto generated by OpenAPI-Generator 7.14.0.
|
|
* https://openapi-generator.tech
|
|
* Do not edit the class manually.
|
|
*/
|
|
|
|
/*
|
|
* ChannelApi.h
|
|
*
|
|
*
|
|
*/
|
|
|
|
#ifndef HANZO_API_ChannelApi_H_
|
|
#define HANZO_API_ChannelApi_H_
|
|
|
|
|
|
|
|
#include "hanzo/ApiClient.h"
|
|
|
|
#include "hanzo/model/AllowlistPutIn.h"
|
|
#include "hanzo/model/AllowlistView.h"
|
|
#include "hanzo/model/ApprovePairingIn.h"
|
|
#include "hanzo/model/ChannelAgents.h"
|
|
#include "hanzo/model/ChannelAgentsPut.h"
|
|
#include "hanzo/model/ChatChannels.h"
|
|
#include "hanzo/model/InboxPage.h"
|
|
#include "hanzo/model/PairingApproved.h"
|
|
#include "hanzo/model/PairingQueue.h"
|
|
#include <cpprest/details/basic_types.h>
|
|
#include <boost/optional.hpp>
|
|
|
|
namespace hanzo {
|
|
namespace api {
|
|
|
|
using namespace hanzo::model;
|
|
|
|
|
|
|
|
class ChannelApi
|
|
{
|
|
public:
|
|
|
|
explicit ChannelApi( std::shared_ptr<const ApiClient> apiClient );
|
|
|
|
virtual ~ChannelApi();
|
|
|
|
/// <summary>
|
|
/// Reports every chat channel this org can send through, and whether it can send through it right now.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Reports every chat channel this org can send through, and whether it can send through it right now. A channel appears here whether or not it is connected — an empty list would leave a caller unable to tell \"this org has no Slack\" from \"Slack is down\", which are different problems with different fixes. Each entry carries the connection behind it, so the answer to \"why can I not post?\" is in the same response as the channel that cannot post.
|
|
/// </remarks>
|
|
pplx::task<std::shared_ptr<ChatChannels>> getChannel(
|
|
) const;
|
|
/// <summary>
|
|
/// Returns which agent answers the caller org's channel: the default and every room bound to another agent.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Returns which agent answers the caller org's channel: the default and every room bound to another agent.
|
|
/// </remarks>
|
|
/// <param name="channel">Channel is the transport: discord, github, linear, slack, teams, telegram or whatsapp. Required; an unknown value is a 404. (optional, default to utility::conversions::to_string_t(""))</param>
|
|
pplx::task<std::shared_ptr<ChannelAgents>> getChannelAgent(
|
|
boost::optional<utility::string_t> channel
|
|
) const;
|
|
/// <summary>
|
|
/// Returns the caller org's access policy for one channel: whether DMs are pairing-gated, allowlisted or open, whether group rooms are open, allowlisted or disabled, the config-managed DM and group allow entries, the senders approved through PAIRING (read-only here), and the org's named access groups.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Returns the caller org's access policy for one channel: whether DMs are pairing-gated, allowlisted or open, whether group rooms are open, allowlisted or disabled, the config-managed DM and group allow entries, the senders approved through PAIRING (read-only here), and the org's named access groups. An unknown channel is a 404.
|
|
/// </remarks>
|
|
/// <param name="channel">Channel is the transport to read: discord, github, linear, slack, teams, telegram or whatsapp. Required; an unknown value is a 404. (optional, default to utility::conversions::to_string_t(""))</param>
|
|
pplx::task<std::shared_ptr<AllowlistView>> getChannelAllowlist(
|
|
boost::optional<utility::string_t> channel
|
|
) const;
|
|
/// <summary>
|
|
/// Returns the messages people have sent to the caller org's connected chat bots, oldest first, in the portable envelope shape every transport normalises into.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Returns the messages people have sent to the caller org's connected chat bots, oldest first, in the portable envelope shape every transport normalises into. It is a CURSOR feed, not a search: pass the returned cursor back as `since` to get only what has arrived since. Only this org's messages are stored under this org, so the feed can never carry another tenant's chat.
|
|
/// </remarks>
|
|
/// <param name="since">Since is the exclusive cursor: only messages with a higher row id come back. Empty starts at the beginning. Must parse as an integer. (optional, default to utility::conversions::to_string_t(""))</param>
|
|
/// <param name="limit">Limit caps how many messages come back. Empty or 0 uses the store's default page size. Must parse as an integer. (optional, default to utility::conversions::to_string_t(""))</param>
|
|
pplx::task<std::shared_ptr<InboxPage>> getChannelInbox(
|
|
boost::optional<utility::string_t> since,
|
|
boost::optional<utility::string_t> limit
|
|
) const;
|
|
/// <summary>
|
|
/// Returns the pairing requests waiting for the caller org to approve — one per person who messaged a connected bot on a channel whose DM policy is \"pairing\" and who is not allowed yet.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Returns the pairing requests waiting for the caller org to approve — one per person who messaged a connected bot on a channel whose DM policy is \"pairing\" and who is not allowed yet. Each row carries the CODE an org admin passes to POST /v1/channel/pairing/approve. Expired requests are not returned. Codes are capability strings: they are shown here, and never logged.
|
|
/// </remarks>
|
|
pplx::task<std::shared_ptr<PairingQueue>> getChannelPairing(
|
|
) const;
|
|
/// <summary>
|
|
/// Send a message from your org's bot to one chat room
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Delivers text, attachments and actions to one room on a connected chat transport — discord, github, linear, slack, teams, telegram or whatsapp — and answers that transport's own receipt, the `messageId` it assigned and the Unix second it landed. An unknown channel is a 404. The body is the envelope's NARROW outbound projection: `room`, `text`, `attachments`, `actions`, `replyTo` and `idempotency`, and nothing else. Identity is not a field — the channel is the path segment and the sender is the caller's validated org — so a body carrying `sender`, `account` or `channel` is refused with 400 rather than having it silently dropped. `room.id` is required, and so is something to say: text, or at least one attachment. Requires a validated principal; 403 without one. The room must already belong to the caller's org — each transport verifies the binding itself, so a room this org has not bound is 403 and a room whose route the bot has never learned is 409, meaning someone has to message the bot there first. A route learned only so a pairing reply could be delivered lasts exactly as long as that pairing request does, so a room whose sender was never approved goes back to 409 within the hour. A transport that fails answers 502 carrying status and shape only, never a token. Sending is at-most-once only if you ask for it: pass an `idempotency` string and a replay answers 200 with the PRIOR receipt instead of sending twice, while a send that fails releases the key so the caller can re-attempt. Bodies over 1 MiB are refused. Every transport currently renders text only, so attachments and actions are flattened deterministically to one line each after the text rather than dropped.
|
|
/// </remarks>
|
|
/// <param name="channel"></param>
|
|
pplx::task<void> postChannelByChannelSend(
|
|
utility::string_t channel
|
|
) const;
|
|
/// <summary>
|
|
/// Turns one pending pairing code into a standing allow entry, so that person can DM the org's bot on that channel from now on.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Turns one pending pairing code into a standing allow entry, so that person can DM the org's bot on that channel from now on. It requires ORG ADMIN, not merely membership. The first approval an org makes on a channel also bootstraps that sender as the channel's owner, which the answer reports. An unknown or expired code is a 404, and a code always belongs to exactly one org, so it can never approve someone into another tenant.
|
|
/// </remarks>
|
|
/// <param name="approvePairingIn"></param>
|
|
pplx::task<std::shared_ptr<PairingApproved>> postChannelPairingApprove(
|
|
std::shared_ptr<ApprovePairingIn> approvePairingIn
|
|
) const;
|
|
/// <summary>
|
|
/// Binds agents to the caller org's channel and answers the bindings as GET would.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Binds agents to the caller org's channel and answers the bindings as GET would. It requires ORG ADMIN. The agent is named by its ref — the name an org gave it at POST /v1/agent, or a built-in such as dev, des or vi.
|
|
/// </remarks>
|
|
/// <param name="channelAgentsPut"></param>
|
|
pplx::task<std::shared_ptr<ChannelAgents>> putChannelAgent(
|
|
std::shared_ptr<ChannelAgentsPut> channelAgentsPut
|
|
) const;
|
|
/// <summary>
|
|
/// Edits the caller org's access policy for one channel and answers the policy as GET would, so both verbs return ONE shape.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Edits the caller org's access policy for one channel and answers the policy as GET would, so both verbs return ONE shape. It requires ORG ADMIN. Every field but `channel` is optional and applied only when provided: an empty policy string leaves that policy alone, an absent or null list leaves that list alone, and an EMPTY list clears it. It writes only CONFIG-sourced allow entries — senders approved through pairing belong to the approval flow, so a policy edit can never revoke one. An unknown channel is a 404.
|
|
/// </remarks>
|
|
/// <param name="allowlistPutIn"></param>
|
|
pplx::task<std::shared_ptr<AllowlistView>> putChannelAllowlist(
|
|
std::shared_ptr<AllowlistPutIn> allowlistPutIn
|
|
) const;
|
|
|
|
protected:
|
|
std::shared_ptr<const ApiClient> m_ApiClient;
|
|
};
|
|
|
|
}
|
|
}
|
|
|
|
#endif /* HANZO_API_ChannelApi_H_ */
|
|
|