mirror of
https://github.com/hanzo-cpp/sdk.git
synced 2026-11-20 19:55:32 +00:00
The lock sat at 574d1f1d while the product moved on. The team surface stopped at rooms — no messages path, no way to open one — so anything built on this client had to reach past it with its own HTTP calls, which is the duplication a generated client exists to prevent.
236 lines
16 KiB
C++
236 lines
16 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.
|
|
*/
|
|
|
|
/*
|
|
* FrameworkApi.h
|
|
*
|
|
*
|
|
*/
|
|
|
|
#ifndef HANZO_API_FrameworkApi_H_
|
|
#define HANZO_API_FrameworkApi_H_
|
|
|
|
|
|
|
|
#include "hanzo/ApiClient.h"
|
|
|
|
#include "hanzo/model/DocType.h"
|
|
#include "hanzo/model/DocTypeList.h"
|
|
#include "hanzo/model/DocumentList.h"
|
|
#include "hanzo/model/Install.h"
|
|
#include "hanzo/model/ModuleList.h"
|
|
#include "hanzo/model/ModuleState.h"
|
|
#include "hanzo/Object.h"
|
|
#include "hanzo/model/SummaryView.h"
|
|
#include <map>
|
|
#include <cpprest/details/basic_types.h>
|
|
#include <boost/optional.hpp>
|
|
|
|
namespace hanzo {
|
|
namespace api {
|
|
|
|
using namespace hanzo::model;
|
|
|
|
|
|
|
|
class FrameworkApi
|
|
{
|
|
public:
|
|
|
|
explicit FrameworkApi( std::shared_ptr<const ApiClient> apiClient );
|
|
|
|
virtual ~FrameworkApi();
|
|
|
|
/// <summary>
|
|
/// Removes one document, after its on_trash hooks agree.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Removes one document, after its on_trash hooks agree. A SUBMITTED document cannot be deleted — cancel it first. Answers 204.
|
|
/// </remarks>
|
|
/// <param name="doctype">DocType is the document's DocType, by ADDRESS — \"module.name\", from the path.</param>
|
|
/// <param name="name">Name is the document's name — its key within the DocType — from the path. A name containing a space arrives percent-encoded and is decoded before it is matched against the stored one.</param>
|
|
pplx::task<void> deleteFrameworkByDoctypeByName(
|
|
utility::string_t doctype,
|
|
utility::string_t name
|
|
) const;
|
|
/// <summary>
|
|
/// Removes a DocType and every document stored under it.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Removes a DocType and every document stored under it. The definition and its data go together — a document with no schema can be neither validated nor read back — so there is no undo. Manager-only. Answers 204.
|
|
/// </remarks>
|
|
/// <param name="name">Name is the DocType's ADDRESS — \"module.name\", e.g. \"kb.page\". A name containing a space (\"erp.Sales Invoice\") arrives percent-encoded and is decoded before it is matched against the stored one.</param>
|
|
pplx::task<void> deleteFrameworkDoctypesByName(
|
|
utility::string_t name
|
|
) const;
|
|
/// <summary>
|
|
/// Returns the caller org's documents of one DocType, filtered, ordered and projected by the query.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Returns the caller org's documents of one DocType, filtered, ordered and projected by the query. The DocType is resolved FIRST — through the same permission gate the list itself uses — because the query is validated against its schema: a filter, sort or field name the DocType does not declare is refused rather than reaching the store.
|
|
/// </remarks>
|
|
/// <param name="doctype">DocType is the DocType to list, by ADDRESS — \"module.name\", from the path.</param>
|
|
/// <param name="filters">Filters is a JSON object of equality matches, e.g. {\"priority\":\"High\"}. Every key must be a field the DocType declares (or the managed name / docstatus); an undeclared one is refused rather than silently ignored. (optional, default to utility::conversions::to_string_t(""))</param>
|
|
/// <param name="fields">Fields projects the response to a subset — a JSON array [\"a\",\"b\"] or a comma list \"a,b\". The envelope keys are always returned. (optional, default to utility::conversions::to_string_t(""))</param>
|
|
/// <param name="orderBy">OrderBy is \"<field> [asc|desc]\". Empty means most-recently-updated first. (optional, default to utility::conversions::to_string_t(""))</param>
|
|
/// <param name="limit">Limit caps the rows returned. Anything that is not a positive integer leaves the engine's default in place. (optional, default to utility::conversions::to_string_t(""))</param>
|
|
pplx::task<std::shared_ptr<DocumentList>> getFrameworkByDoctype(
|
|
utility::string_t doctype,
|
|
boost::optional<utility::string_t> filters,
|
|
boost::optional<utility::string_t> fields,
|
|
boost::optional<utility::string_t> orderBy,
|
|
boost::optional<utility::string_t> limit
|
|
) const;
|
|
/// <summary>
|
|
/// Returns one document by name, with Password fields redacted.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Returns one document by name, with Password fields redacted.
|
|
/// </remarks>
|
|
/// <param name="doctype">DocType is the document's DocType, by ADDRESS — \"module.name\", from the path.</param>
|
|
/// <param name="name">Name is the document's name — its key within the DocType — from the path. A name containing a space arrives percent-encoded and is decoded before it is matched against the stored one.</param>
|
|
pplx::task<std::map<utility::string_t, std::shared_ptr<Object>>> getFrameworkByDoctypeByName(
|
|
utility::string_t doctype,
|
|
utility::string_t name
|
|
) const;
|
|
/// <summary>
|
|
/// Returns every DocType defined in the caller's org.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Returns every DocType defined in the caller's org. Another tenant's definitions are never included: the org is part of the store key.
|
|
/// </remarks>
|
|
pplx::task<std::shared_ptr<DocTypeList>> getFrameworkDoctypes(
|
|
) const;
|
|
/// <summary>
|
|
/// Returns one DocType definition — its fields, naming rule, permissions and lifecycle flags.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Returns one DocType definition — its fields, naming rule, permissions and lifecycle flags. Scoped to the caller's org, so another tenant's DocType of the same name is simply not found.
|
|
/// </remarks>
|
|
/// <param name="name">Name is the DocType's ADDRESS — \"module.name\", e.g. \"kb.page\". A name containing a space (\"erp.Sales Invoice\") arrives percent-encoded and is decoded before it is matched against the stored one.</param>
|
|
pplx::task<std::shared_ptr<DocType>> getFrameworkDoctypesByName(
|
|
utility::string_t name
|
|
) const;
|
|
/// <summary>
|
|
/// Returns every app lane compiled into this deployment and the DocTypes each one installs.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Returns every app lane compiled into this deployment and the DocTypes each one installs. It describes the BINARY, not the org: what a given org has actually installed is the per-module state below.
|
|
/// </remarks>
|
|
pplx::task<std::shared_ptr<ModuleList>> getFrameworkModules(
|
|
) const;
|
|
/// <summary>
|
|
/// Returns one app lane's install state for the caller's org: the DocTypes the lane declares, and which of them already exist in the org.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Returns one app lane's install state for the caller's org: the DocTypes the lane declares, and which of them already exist in the org. That is the honest \"set up\" versus \"installed\" answer a console renders.
|
|
/// </remarks>
|
|
/// <param name="module">Module is the lane's registered name (\"cms\", \"erp\"), from the path.</param>
|
|
pplx::task<std::shared_ptr<ModuleState>> getFrameworkModulesByModule(
|
|
utility::string_t module
|
|
) const;
|
|
/// <summary>
|
|
/// Reports how much of the DocType surface the caller's org uses: how many DocTypes it has defined, and how many documents exist across them.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Reports how much of the DocType surface the caller's org uses: how many DocTypes it has defined, and how many documents exist across them.
|
|
/// </remarks>
|
|
pplx::task<std::shared_ptr<SummaryView>> getFrameworkSummary(
|
|
) const;
|
|
/// <summary>
|
|
/// Create one document of a DocType, from that DocType's own fields.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// The body is the DOCUMENT'S field data: a flat JSON object whose properties are the fieldnames the DocType declares, not a fixed envelope. That is why this operation publishes no request schema — the shape is metadata the DocType defines at run time, and no Go struct both accepts it verbatim and describes it, so nothing is asserted rather than something false. The engine validates and coerces every field against the DocType, runs the before_insert and before_save hooks (either may reject the write), stores the document, then runs the after hooks. It answers 201 with the stored document: the field data plus the managed envelope — `name`, `doctype`, `docstatus`, `createdAt`, `updatedAt`. A Password field comes back as a fixed redaction marker and is dropped when empty; its stored value is never returned by this or any other read on this surface. `name` in the body is the REQUESTED DOCUMENT NAME, not a data field. A DocType with an autoname rule names the document itself and ignores it; a prompt-named DocType takes it. This collision is also why the two path segments cannot be folded into the body, and so why the route stays untyped. Scoped to the org of the validated principal, and the engine's own permission calculus decides the rest: the caller needs create rights on this DocType through a role it holds, or a platform admin bit. A caller with no validated principal reaches the engine as the zero Caller and is refused before any store is opened — a forged org header alone buys nothing. A DocType declared Single has exactly ONE document per org, so this writes that one instance instead of adding a row. The body is size-bounded by the engine, the same bound on every host.
|
|
/// </remarks>
|
|
/// <param name="doctype"></param>
|
|
pplx::task<void> postFrameworkByDoctype(
|
|
utility::string_t doctype
|
|
) const;
|
|
/// <summary>
|
|
/// Moves a submitted document to cancelled (docstatus 1 → 2) after its on_cancel hooks agree.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Moves a submitted document to cancelled (docstatus 1 → 2) after its on_cancel hooks agree. Cancelling is terminal — a cancelled document cannot be re-submitted — but it CAN then be deleted.
|
|
/// </remarks>
|
|
/// <param name="doctype">DocType is the document's DocType, by ADDRESS — \"module.name\", from the path.</param>
|
|
/// <param name="name">Name is the document's name — its key within the DocType — from the path. A name containing a space arrives percent-encoded and is decoded before it is matched against the stored one.</param>
|
|
pplx::task<std::map<utility::string_t, std::shared_ptr<Object>>> postFrameworkByDoctypeByNameCancel(
|
|
utility::string_t doctype,
|
|
utility::string_t name
|
|
) const;
|
|
/// <summary>
|
|
/// Moves a draft to submitted (docstatus 0 → 1) after its on_submit hooks agree.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Moves a draft to submitted (docstatus 0 → 1) after its on_submit hooks agree. A submitted document is IMMUTABLE: further writes and deletes are refused until it is cancelled. Only a submittable DocType has this lifecycle; any other docstatus is an illegal transition.
|
|
/// </remarks>
|
|
/// <param name="doctype">DocType is the document's DocType, by ADDRESS — \"module.name\", from the path.</param>
|
|
/// <param name="name">Name is the document's name — its key within the DocType — from the path. A name containing a space arrives percent-encoded and is decoded before it is matched against the stored one.</param>
|
|
pplx::task<std::map<utility::string_t, std::shared_ptr<Object>>> postFrameworkByDoctypeByNameSubmit(
|
|
utility::string_t doctype,
|
|
utility::string_t name
|
|
) const;
|
|
/// <summary>
|
|
/// Defines a DocType in the caller's org: the metadata that gives a document surface its fields, its naming rule, whether it has a submit/cancel lifecycle, and which role may do what to it.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Defines a DocType in the caller's org: the metadata that gives a document surface its fields, its naming rule, whether it has a submit/cancel lifecycle, and which role may do what to it. Manager-only — on a fresh org the first caller to administer it is seeded as its System Manager, after which only a System Manager (or a platform admin) may define. Answers 201.
|
|
/// </remarks>
|
|
/// <param name="docType"></param>
|
|
pplx::task<std::shared_ptr<DocType>> postFrameworkDoctypes(
|
|
std::shared_ptr<DocType> docType
|
|
) const;
|
|
/// <summary>
|
|
/// Creates an app lane's DocTypes in the caller's org.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Creates an app lane's DocTypes in the caller's org. Idempotent and create-if-absent: a DocType the org already has is reported as existing and never replaced, so re-installing cannot clobber a definition the org has since edited. Manager-only.
|
|
/// </remarks>
|
|
/// <param name="module">Module is the lane's registered name (\"cms\", \"erp\"), from the path.</param>
|
|
pplx::task<std::shared_ptr<Install>> postFrameworkModulesByModuleInstall(
|
|
utility::string_t module
|
|
) const;
|
|
/// <summary>
|
|
/// Replace a draft document's field data wholesale.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// PUT semantics: the stored field data BECOMES the body, so a field the body omits is not left at its previous value. The body is the document's own field data — the same metadata-defined open object the create takes, and the same reason this operation publishes no request schema. Only a DRAFT can be edited. A document that has been submitted or cancelled is immutable and the write is refused as a conflict, so the submit lifecycle cannot be bypassed by a plain update — cancel it first, and note that a cancelled document can be deleted but never re-submitted or re-edited. The engine validates the new data against the DocType, runs before_save (which may reject), writes, then runs the after hooks, and answers 200 with the stored document plus its managed envelope, Password fields redacted. The document name in the path is percent-decoded before it is matched, so a name containing a space is addressed as it is stored. An unknown DocType or document is not found, and the same answer covers a document that exists in another tenant: the org comes from the validated principal and is part of the store key, so a caller cannot learn that another org's document exists. Write rights on the DocType are required, decided by the engine's permission calculus. For a Single DocType the path name is ignored — there is one instance per org and this writes it.
|
|
/// </remarks>
|
|
/// <param name="doctype"></param>
|
|
/// <param name="name"></param>
|
|
pplx::task<void> putFrameworkByDoctypeByName(
|
|
utility::string_t doctype,
|
|
utility::string_t name
|
|
) const;
|
|
/// <summary>
|
|
/// Replaces a DocType definition wholesale (PUT semantics): the stored definition becomes the body.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Replaces a DocType definition wholesale (PUT semantics): the stored definition becomes the body. The name in the URL is authoritative over the body's, and documents already stored under the DocType are left intact. Manager-only.
|
|
/// </remarks>
|
|
/// <param name="name"></param>
|
|
/// <param name="docType"></param>
|
|
pplx::task<std::shared_ptr<DocType>> putFrameworkDoctypesByName(
|
|
utility::string_t name,
|
|
std::shared_ptr<DocType> docType
|
|
) const;
|
|
|
|
protected:
|
|
std::shared_ptr<const ApiClient> m_ApiClient;
|
|
};
|
|
|
|
}
|
|
}
|
|
|
|
#endif /* HANZO_API_FrameworkApi_H_ */
|
|
|