Files

158 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.
*/
/*
* AccountApi.h
*
*
*/
#ifndef HANZO_API_AccountApi_H_
#define HANZO_API_AccountApi_H_
#include "hanzo/ApiClient.h"
#include "hanzo/model/ApiKeyList.h"
#include "hanzo/model/Appearance.h"
#include "hanzo/model/CsrfResp.h"
#include "hanzo/model/EmbedStatusResp.h"
#include "hanzo/model/KeyTypeIn.h"
#include "hanzo/model/MintedKey.h"
#include "hanzo/model/OnboardReq.h"
#include "hanzo/model/OnboardResp.h"
#include "hanzo/model/RevokedKey.h"
#include <cpprest/details/basic_types.h>
#include <boost/optional.hpp>
namespace hanzo {
namespace api {
using namespace hanzo::model;
class AccountApi
{
public:
explicit AccountApi( std::shared_ptr<const ApiClient> apiClient );
virtual ~AccountApi();
/// <summary>
/// Revokes the caller&#39;s own API key of the requested class.
/// </summary>
/// <remarks>
/// Revokes the caller&#39;s own API key of the requested class. The class is the same field mint takes — &#x60;?type&#x3D;publishable&#x60;, defaulting to secret — so revoking the key that ships in a browser bundle does not sign its holder out of their own API: the other key keeps working. Revoking is how a key is replaced when it does not need replacing; minting the same class again rotates it in one step. IAM drops the credential immediately, but the gateway caches keys for a few minutes, so a request that beat the cache expiry may still be served. For callers written against the older shape, the class is also accepted in a JSON request body, read only when &#x60;?type&#x3D;&#x60; is absent.
/// </remarks>
/// <param name="type">Type is the key class to act on: \&quot;secret\&quot; (sk-, session-equivalent, belongs on a server) or \&quot;publishable\&quot; (pk-, org-identifying, safe in a browser bundle). Omitted means secret, which is what every existing caller means. (optional, default to utility::conversions::to_string_t(&quot;&quot;))</param>
pplx::task<std::shared_ptr<RevokedKey>> deleteAccountKeys(
boost::optional<utility::string_t> type
) const;
/// <summary>
/// Returns the signed-in caller&#39;s own appearance preference — text size, density and accent — read from their IAM account so it is the same on every device and every Hanzo surface.
/// </summary>
/// <remarks>
/// Returns the signed-in caller&#39;s own appearance preference — text size, density and accent — read from their IAM account so it is the same on every device and every Hanzo surface. An unset preference is an empty object. A transient IAM read failure reports the empty preference rather than a 5xx, so a surface applies its published default and never error-toasts on load — the same fail-soft the key read uses.
/// </remarks>
pplx::task<std::shared_ptr<Appearance>> getAccountAppearance(
) const;
/// <summary>
/// Fetch a profile photo
/// </summary>
/// <remarks>
/// Streams a profile photo&#39;s raw BYTES. This is the address stored on the user&#39;s IAM record and rendered directly by an &#x60;&lt;img&gt;&#x60;, so it takes no credentials — the 64-hex content digest in the path is the capability, and it can only be produced by someone who already has the image. The Content-Type is derived from the stored bytes and the response carries nosniff, so only a real raster image is ever served and only under its true type. Anything else — a miss, a malformed path, an object that is not an image — is one 404, and a hit caches for a year because the address is the content.
/// </remarks>
/// <param name="org"></param>
/// <param name="user"></param>
/// <param name="digest"></param>
pplx::task<void> getAccountAvatarByOrgByUserByDigest(
utility::string_t org,
utility::string_t user,
utility::string_t digest
) const;
/// <summary>
/// IssueCSRFToken mints the anti-forgery token a browser echoes as X-CSRF-Token on every change it asks for.
/// </summary>
/// <remarks>
/// IssueCSRFToken mints the anti-forgery token a browser echoes as X-CSRF-Token on every change it asks for. The token is bound to the caller&#39;s validated identity and expires, so one minted for one identity cannot authorize a change as another. It is answered no-store, so it is never cached by a shared proxy. This is the same-origin endpoint the embedded console reads — the Same-Origin Policy is what stops a cross-site page from reading the response and forging a change.
/// </remarks>
pplx::task<std::shared_ptr<CsrfResp>> getAccountCsrf(
) const;
/// <summary>
/// Reports whether one of this brand&#39;s shared embedded apps (cms, erp, help) may be framed by the caller and is actually running, so a console module can choose between the embed and the provision panel.
/// </summary>
/// <remarks>
/// Reports whether one of this brand&#39;s shared embedded apps (cms, erp, help) may be framed by the caller and is actually running, so a console module can choose between the embed and the provision panel. It answers two questions the browser cannot answer for itself. ENTITLEMENT is server-authoritative: each app is a single shared per-BRAND instance, so only a member of the owning brand org — or a SuperAdmin — is given the embed URL; every other caller gets phase \&quot;not-entitled\&quot; and no URL. REACHABILITY is a probe of that origin, which a cross-origin page cannot read for itself. The probed host is always &lt;app&gt;.&lt;this deployment&#39;s own brand domain&gt;: no part of it comes from the request, so this can never be steered into probing an arbitrary origin.
/// </remarks>
/// <param name="app">App is the embedded app to report on: cms (Content Studio), erp or help. (optional, default to utility::conversions::to_string_t(&quot;&quot;))</param>
pplx::task<std::shared_ptr<EmbedStatusResp>> getAccountEmbed(
boost::optional<utility::string_t> app
) const;
/// <summary>
/// Returns the caller&#39;s own API keys — every type they hold, read AUTHORITATIVELY from IAM rather than from the session claim, which lags a key minted moments ago.
/// </summary>
/// <remarks>
/// Returns the caller&#39;s own API keys — every type they hold, read AUTHORITATIVELY from IAM rather than from the session claim, which lags a key minted moments ago. No secret material comes back: a secret key is represented by its prefix, and only a publishable key (public by construction) carries its full value. A transient IAM read failure reports an empty set rather than a 5xx, so the page shows the honest empty state and never a fabricated key.
/// </remarks>
pplx::task<std::shared_ptr<ApiKeyList>> getAccountKeys(
) const;
/// <summary>
/// Stores the caller&#39;s appearance preference on their IAM account, preserving every other field of the row.
/// </summary>
/// <remarks>
/// Stores the caller&#39;s appearance preference on their IAM account, preserving every other field of the row. The accent is validated as a real colour token before it is stored; an unset or invalid axis is dropped rather than stored.
/// </remarks>
/// <param name="appearance"></param>
pplx::task<std::shared_ptr<Appearance>> postAccountAppearance(
std::shared_ptr<Appearance> appearance
) const;
/// <summary>
/// Set your profile photo
/// </summary>
/// <remarks>
/// Stores one image as the signed-in user&#39;s profile photo and answers the URL it is served from, which is also written to the user&#39;s IAM record — so every surface that already renders &#x60;avatar&#x60; picks it up with no further call. The body is a multipart form with a &#x60;file&#x60; part. The format is decided by the BYTES, never the filename or the part&#39;s Content-Type: png, jpeg, gif and webp are accepted and everything else is refused with 415, so an SVG cannot be stored as a picture and later served as a program. Over 8 MiB is 413; empty is 400. The photo is addressed by the sha256 of its bytes, so setting a new one yields a new URL rather than a stale cache of the old face. The caller is taken from the validated identity ONLY — there is no way to name a different subject — so this always sets your own photo, and a caller with no organization yet is refused.
/// </remarks>
pplx::task<void> postAccountAvatar(
) const;
/// <summary>
/// Creates — or rotates — the caller&#39;s API key of the requested type and returns it ONCE.
/// </summary>
/// <remarks>
/// Creates — or rotates — the caller&#39;s API key of the requested type and returns it ONCE. A real IAM failure surfaces as 502, never a fabricated key. Rotating is what creating means here: a user holds one key per type, so the endpoint is idempotent by (caller, type) and the superseded credential stops working. Two live secrets for one user would make \&quot;revoke my key\&quot; a lie.
/// </remarks>
/// <param name="keyTypeIn"></param>
pplx::task<std::shared_ptr<MintedKey>> postAccountKeys(
std::shared_ptr<KeyTypeIn> keyTypeIn
) const;
/// <summary>
/// Onboard creates the caller&#39;s organization.
/// </summary>
/// <remarks>
/// Onboard creates the caller&#39;s organization. Two flows, keyed on whether the caller already has a home org (mirrors app/onboard/route.ts): - FIRST-RUN (no home org): create + MOVE the user in as admin, so their next JWT carries the new owner and the cloud scopes everything to it. This is the path a fresh OAuth sign-up takes, from the sign-up application&#39;s org. - ADDITIONAL (owner set): create the org but do NOT move the user — a move changes their IAM owner (stripping a SuperAdmin&#39;s status + orphaning their current org). They reach the new org via the OrgSwitcher, which re-scopes X-Org-Id without touching IAM membership. A personal-org request from someone who already has an org is meaningless → 409.
/// </remarks>
/// <param name="onboardReq"></param>
pplx::task<std::shared_ptr<OnboardResp>> postAccountOrgs(
std::shared_ptr<OnboardReq> onboardReq
) const;
protected:
std::shared_ptr<const ApiClient> m_ApiClient;
};
}
}
#endif /* HANZO_API_AccountApi_H_ */