UNPKG

tencentcloud-sdk-nodejs-intl-en

Version:
376 lines (317 loc) • 10.3 kB
/* * Copyright (c) 2018 Tencent. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ const AbstractModel = require("../../common/abstract_model"); /** * ImageTranslateLLM request structure. * @class */ class ImageTranslateLLMRequest extends AbstractModel { constructor(){ super(); /** * <p>Base64 string of the image data, no more than 9M after Base64 encoding. A resolution of 600*800 or higher is recommended. PNG, JPG, and JPEG formats are supported.</p> * @type {string || null} */ this.Data = null; /** * <p>Target language, supported languages:</p><ul><li>Chinese: zh</li><li>Traditional (Taiwan): zh-TW</li><li>Traditional (Hong Kong (China)): zh-HK</li><li>English: en</li><li>Japanese: ja</li><li>Korean: ko</li><li>Thai: th</li><li>Vietnamese: vi</li><li>Russian: ru</li><li>German: de</li><li>French: fr</li><li>Arabic: ar</li><li>Spanish: es</li><li>Italian: it</li><li>Indonesian: id</li><li>Malay language: ms</li><li>Portuguese: pt</li><li>Turkish: tr<br>-</li></ul> * @type {string || null} */ this.Target = null; /** * <p>Enter image Url. When using a Url, the Data parameter requires the input of "". Image restrictions: less than 10MB, resolution recommendation 600*800 or higher, format support jpg, jpeg, png.</p> * @type {string || null} */ this.Url = null; /** * <p>Invocation method.</p><p>Enumeration value:</p><ul><li>0: End-to-end image translation large model pro version</li><li>1: End-to-end image translation large model lite version</li></ul><p>Default value: 0</p> * @type {number || null} */ this.Mode = null; } /** * @private */ deserialize(params) { if (!params) { return; } this.Data = 'Data' in params ? params.Data : null; this.Target = 'Target' in params ? params.Target : null; this.Url = 'Url' in params ? params.Url : null; this.Mode = 'Mode' in params ? params.Mode : null; } } /** * ImageTranslateLLM response structure. * @class */ class ImageTranslateLLMResponse extends AbstractModel { constructor(){ super(); /** * <p>Base64 string of the image data. The output format is JPG.</p> * @type {string || null} */ this.Data = null; /** * <p>Primary source language.</p> * @type {string || null} */ this.Source = null; /** * <p>Target translation language.</p> * @type {string || null} */ this.Target = null; /** * <p>All original text in the image.</p> * @type {string || null} */ this.SourceText = null; /** * <p>All translations in the image.</p> * @type {string || null} */ this.TargetText = null; /** * <p>Image angle counterclockwise, value range 0-359</p> * @type {number || null} */ this.Angle = null; /** * <p>Translation detailed information</p> * @type {Array.<TransDetail> || null} */ this.TransDetails = null; /** * The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem. * @type {string || null} */ this.RequestId = null; } /** * @private */ deserialize(params) { if (!params) { return; } this.Data = 'Data' in params ? params.Data : null; this.Source = 'Source' in params ? params.Source : null; this.Target = 'Target' in params ? params.Target : null; this.SourceText = 'SourceText' in params ? params.SourceText : null; this.TargetText = 'TargetText' in params ? params.TargetText : null; this.Angle = 'Angle' in params ? params.Angle : null; if (params.TransDetails) { this.TransDetails = new Array(); for (let z in params.TransDetails) { let obj = new TransDetail(); obj.deserialize(params.TransDetails[z]); this.TransDetails.push(obj); } } this.RequestId = 'RequestId' in params ? params.RequestId : null; } } /** * Coordinate details * @class */ class Coord extends AbstractModel { constructor(){ super(); /** * X coordinate * @type {number || null} */ this.X = null; /** * Y-axis coordinate * @type {number || null} */ this.Y = null; } /** * @private */ deserialize(params) { if (!params) { return; } this.X = 'X' in params ? params.X : null; this.Y = 'Y' in params ? params.Y : null; } } /** * Large model image translation detailed information * @class */ class TransDetail extends AbstractModel { constructor(){ super(); /** * <p>Original text of the current row</p> * @type {string || null} */ this.SourceLineText = null; /** * <p>Translation of the current row</p> * @type {string || null} */ this.TargetLineText = null; /** * <p>Paragraph text box location</p> * @type {BoundingBox || null} */ this.BoundingBox = null; /** * <p>Row count</p> * @type {number || null} */ this.LinesCount = null; /** * <p>Line height.</p><p>Unit: px.</p> * @type {number || null} */ this.LineHeight = null; /** * <p>The spam_code field is 0 in a normal paragraph; if the spam_code field exists and its value is above 0 (1: hit garbage check; 2: hit security policy; 3: another.), then the security check hit is filtered.</p> * @type {number || null} */ this.SpamCode = null; /** * <p>Rotation information of paragraph text. Coordinates are valid only when valid is true.</p> * @type {RotateParagraphRect || null} */ this.RotateParagraphRect = null; } /** * @private */ deserialize(params) { if (!params) { return; } this.SourceLineText = 'SourceLineText' in params ? params.SourceLineText : null; this.TargetLineText = 'TargetLineText' in params ? params.TargetLineText : null; if (params.BoundingBox) { let obj = new BoundingBox(); obj.deserialize(params.BoundingBox) this.BoundingBox = obj; } this.LinesCount = 'LinesCount' in params ? params.LinesCount : null; this.LineHeight = 'LineHeight' in params ? params.LineHeight : null; this.SpamCode = 'SpamCode' in params ? params.SpamCode : null; if (params.RotateParagraphRect) { let obj = new RotateParagraphRect(); obj.deserialize(params.RotateParagraphRect) this.RotateParagraphRect = obj; } } } /** * Paragraph text box location: x, y represent the top-left corner, width and height represent width and height. * @class */ class BoundingBox extends AbstractModel { constructor(){ super(); /** * <p>x-coordinate of the top-left corner</p> * @type {number || null} */ this.X = null; /** * <p>y-coordinate of the top-left corner</p> * @type {number || null} */ this.Y = null; /** * <p>Width.</p><p>Unit: px.</p> * @type {number || null} */ this.Width = null; /** * <p>High.</p><p>Unit: px.</p> * @type {number || null} */ this.Height = null; } /** * @private */ deserialize(params) { if (!params) { return; } this.X = 'X' in params ? params.X : null; this.Y = 'Y' in params ? params.Y : null; this.Width = 'Width' in params ? params.Width : null; this.Height = 'Height' in params ? params.Height : null; } } /** * Paragraph text rotation information * @class */ class RotateParagraphRect extends AbstractModel { constructor(){ super(); /** * Paragraph text coordinates * @type {Array.<Coord> || null} */ this.Coord = null; /** * Rotation angle * @type {number || null} */ this.TiltAngle = null; /** * Whether the paragraph text information is valid * @type {boolean || null} */ this.Valid = null; } /** * @private */ deserialize(params) { if (!params) { return; } if (params.Coord) { this.Coord = new Array(); for (let z in params.Coord) { let obj = new Coord(); obj.deserialize(params.Coord[z]); this.Coord.push(obj); } } this.TiltAngle = 'TiltAngle' in params ? params.TiltAngle : null; this.Valid = 'Valid' in params ? params.Valid : null; } } module.exports = { ImageTranslateLLMRequest: ImageTranslateLLMRequest, ImageTranslateLLMResponse: ImageTranslateLLMResponse, Coord: Coord, TransDetail: TransDetail, BoundingBox: BoundingBox, RotateParagraphRect: RotateParagraphRect, }