Files
zeekay 189ce08e51 Regenerate against the document the deployment answers for
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.
2026-09-05 18:07:13 -07:00

88 lines
6.2 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.
*/
/*
* TranslateApi.h
*
*
*/
#ifndef HANZO_API_TranslateApi_H_
#define HANZO_API_TranslateApi_H_
#include "hanzo/ApiClient.h"
#include "hanzo/model/MemoryEntry.h"
#include "hanzo/model/MemoryPage.h"
#include "hanzo/model/ReviewRequest.h"
#include <cpprest/details/basic_types.h>
#include <boost/optional.hpp>
namespace hanzo {
namespace api {
using namespace hanzo::model;
class TranslateApi
{
public:
explicit TranslateApi( std::shared_ptr<const ApiClient> apiClient );
virtual ~TranslateApi();
/// <summary>
/// List returns the org&#39;s own translation-memory entries, newest first, optionally narrowed to one target language and/or one position on the review ladder.
/// </summary>
/// <remarks>
/// List returns the org&#39;s own translation-memory entries, newest first, optionally narrowed to one target language and/or one position on the review ladder. It is the review lane&#39;s read: what a human reviewer works through. The org is ALWAYS the validated principal&#39;s org, never a request field, so one tenant can never read another&#39;s memory — the entries hold customer source text.
/// </remarks>
/// <param name="target">Target narrows to one target language tag (BCP-47, e.g. \&quot;es\&quot; or \&quot;pt-BR\&quot;). (optional, default to utility::conversions::to_string_t(&quot;&quot;))</param>
/// <param name="state">State narrows to one position on the review ladder: machine, suggested, approved or published. (optional, default to utility::conversions::to_string_t(&quot;&quot;))</param>
/// <param name="limit">Limit caps the rows returned. Non-positive or unparseable means the server default (200); the ceiling is 1000. (optional, default to 0L)</param>
pplx::task<std::shared_ptr<MemoryPage>> getTranslateMemory(
boost::optional<utility::string_t> target,
boost::optional<utility::string_t> state,
boost::optional<int64_t> limit
) const;
/// <summary>
/// Translate a string or a batch into one target language
/// </summary>
/// <remarks>
/// Returns one translation per input string, in input order, each carrying where it sits on the review ladder and whether it came from your memory rather than an engine — plus a usage block of REAL counts (strings, cached, translated, and the source characters that actually reached an engine). Send &#x60;text&#x60; for one string or &#x60;batch&#x60; for many, never both. When you name no &#x60;source&#x60;, the detected one is reported back. THE TRANSLATION MEMORY IS CONSULTED FIRST AND IT IS NORMATIVE, NOT A CACHE. Every string keys on (source text, target, glossary version, tier); a hit is returned VERBATIM and never re-translated, which is what makes a locale rebuild idempotent under a non-deterministic model and the bill proportional to what actually changed. Misses go to the engine and are written back at state &#x60;machine&#x60;. Editing a glossary term changes the key, so a stale rendering can never be served. IT CANNOT TRAMPLE REVIEWED WORK. A write from this route may create an entry or refresh one still at &#x60;machine&#x60;, and nothing else — a string a human moved to approved or published through the memory review lane survives every rebuild, and comes back here unchanged. The memory is the caller&#39;s OWN org&#39;s, a separate store per org: the source text you send is customer content and lands nowhere else. Read it back or review it at /v1/translate/memory. &#x60;tier&#x60; picks the engine and defaults to quality — the model plane, which carries context, terminology and tone, and which bills its own tokens, so nothing is charged twice here. &#x60;bulk&#x60; is the high-volume engine and is metered HERE, on the source characters that reached it: a fully-cached rebuild reports zero characters and costs zero. BULK NEVER FALLS BACK TO QUALITY — on a deployment that does not serve it the answer is 503 for that tier, so a caller is never quietly served, or charged, at a tier it did not ask for. A bulk request beyond its balance is refused with the nested {\&quot;error\&quot;:{\&quot;code\&quot;,\&quot;message\&quot;}} body at 402/503. &#x60;target&#x60; IS CHECKED FOR SHAPE, NOT FOR SUPPORT: anything BCP-47-shaped is accepted (&#x60;es&#x60;, &#x60;pt-BR&#x60;), anything else is 400. There is no unsupported-language error — a well-formed tag no engine can actually render is passed straight through, and whatever comes back is what gets stored and returned. &#x60;format&#x60; (text, html, markdown) tells the engine what markup to preserve; &#x60;glossary&#x60; fixes terms verbatim. Requires a validated principal — 401 without one, and the org is always that principal&#39;s. At most 512 strings per call and 32768 characters per string; an engine that fails or answers a reply that does not cover every input is 502, and nothing is stored.
/// </remarks>
pplx::task<void> postTranslate(
) const;
/// <summary>
/// Review records a human decision on one translation-memory entry, and returns the entry as stored.
/// </summary>
/// <remarks>
/// Review records a human decision on one translation-memory entry, and returns the entry as stored. A human write always wins over the stored value, and once it lands at approved or published no machine write can move it again — which is what makes a locale rebuild safe to run against reviewed work. The org is ALWAYS the validated principal&#39;s org, never a request field, so a review can only ever land in the caller&#39;s own memory.
/// </remarks>
/// <param name="reviewRequest"></param>
pplx::task<std::shared_ptr<MemoryEntry>> putTranslateMemory(
std::shared_ptr<ReviewRequest> reviewRequest
) const;
protected:
std::shared_ptr<const ApiClient> m_ApiClient;
};
}
}
#endif /* HANZO_API_TranslateApi_H_ */