Class: TencentCloud::Aiart::V20221229::Client

Inherits:
Common::AbstractClient
  • Object
show all
Defined in:
lib/v20221229/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(credential, region, profile = nil) ⇒ Client

Returns a new instance of Client.



24
25
26
27
28
29
# File 'lib/v20221229/client.rb', line 24

def initialize(credential, region, profile = nil)
    api_version = '2022-12-29'
    api_endpoint = 'aiart.tencentcloudapi.com'
    sdk_version = 'AIART_' + File.read(File.expand_path('../VERSION', __dir__)).strip
    super(credential, region, api_version, api_endpoint, sdk_version, profile)
end

Instance Method Details

#ChangeClothes(request) ⇒ Object

@rtype: :class:‘Tencentcloud::aiart::V20221229::ChangeClothesResponse`

Parameters:

  • request:

    Request instance for ChangeClothes.



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/v20221229/client.rb', line 39

def ChangeClothes(request)
  body = send_request('ChangeClothes', request.serialize)
  response = JSON.parse(body)
  if response['Response'].key?('Error') == false
    model = ChangeClothesResponse.new
    model.deserialize(response['Response'])
    model
  else
    code = response['Response']['Error']['Code']
    message = response['Response']['Error']['Message']
    reqid = response['Response']['RequestId']
    raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
  end
rescue TencentCloud::Common::TencentCloudSDKException => e
  raise e
rescue StandardError => e
  raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end

#GenerateAvatar(request) ⇒ Object

@rtype: :class:‘Tencentcloud::aiart::V20221229::GenerateAvatarResponse`

Parameters:

  • request:

    Request instance for GenerateAvatar.



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/v20221229/client.rb', line 64

def GenerateAvatar(request)
  body = send_request('GenerateAvatar', request.serialize)
  response = JSON.parse(body)
  if response['Response'].key?('Error') == false
    model = GenerateAvatarResponse.new
    model.deserialize(response['Response'])
    model
  else
    code = response['Response']['Error']['Code']
    message = response['Response']['Error']['Message']
    reqid = response['Response']['RequestId']
    raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
  end
rescue TencentCloud::Common::TencentCloudSDKException => e
  raise e
rescue StandardError => e
  raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end

#ImageToImage(request) ⇒ Object

@rtype: :class:‘Tencentcloud::aiart::V20221229::ImageToImageResponse`

Parameters:

  • request:

    Request instance for ImageToImage.



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/v20221229/client.rb', line 89

def ImageToImage(request)
  body = send_request('ImageToImage', request.serialize)
  response = JSON.parse(body)
  if response['Response'].key?('Error') == false
    model = ImageToImageResponse.new
    model.deserialize(response['Response'])
    model
  else
    code = response['Response']['Error']['Code']
    message = response['Response']['Error']['Message']
    reqid = response['Response']['RequestId']
    raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
  end
rescue TencentCloud::Common::TencentCloudSDKException => e
  raise e
rescue StandardError => e
  raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end

#QueryDrawPortraitJob(request) ⇒ Object

@rtype: :class:‘Tencentcloud::aiart::V20221229::QueryDrawPortraitJobResponse`

Parameters:

  • request:

    Request instance for QueryDrawPortraitJob.



119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/v20221229/client.rb', line 119

def QueryDrawPortraitJob(request)
  body = send_request('QueryDrawPortraitJob', request.serialize)
  response = JSON.parse(body)
  if response['Response'].key?('Error') == false
    model = QueryDrawPortraitJobResponse.new
    model.deserialize(response['Response'])
    model
  else
    code = response['Response']['Error']['Code']
    message = response['Response']['Error']['Message']
    reqid = response['Response']['RequestId']
    raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
  end
rescue TencentCloud::Common::TencentCloudSDKException => e
  raise e
rescue StandardError => e
  raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end

#QueryTextToImageProJob(request) ⇒ Object

@rtype: :class:‘Tencentcloud::aiart::V20221229::QueryTextToImageProJobResponse`

Parameters:

  • request:

    Request instance for QueryTextToImageProJob.



147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# File 'lib/v20221229/client.rb', line 147

def QueryTextToImageProJob(request)
  body = send_request('QueryTextToImageProJob', request.serialize)
  response = JSON.parse(body)
  if response['Response'].key?('Error') == false
    model = QueryTextToImageProJobResponse.new
    model.deserialize(response['Response'])
    model
  else
    code = response['Response']['Error']['Code']
    message = response['Response']['Error']['Message']
    reqid = response['Response']['RequestId']
    raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
  end
rescue TencentCloud::Common::TencentCloudSDKException => e
  raise e
rescue StandardError => e
  raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end

#QueryTrainPortraitModelJob(request) ⇒ Object

@rtype: :class:‘Tencentcloud::aiart::V20221229::QueryTrainPortraitModelJobResponse`

Parameters:

  • request:

    Request instance for QueryTrainPortraitModelJob.



178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
# File 'lib/v20221229/client.rb', line 178

def QueryTrainPortraitModelJob(request)
  body = send_request('QueryTrainPortraitModelJob', request.serialize)
  response = JSON.parse(body)
  if response['Response'].key?('Error') == false
    model = QueryTrainPortraitModelJobResponse.new
    model.deserialize(response['Response'])
    model
  else
    code = response['Response']['Error']['Code']
    message = response['Response']['Error']['Message']
    reqid = response['Response']['RequestId']
    raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
  end
rescue TencentCloud::Common::TencentCloudSDKException => e
  raise e
rescue StandardError => e
  raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end

#ReplaceBackground(request) ⇒ Object

@rtype: :class:‘Tencentcloud::aiart::V20221229::ReplaceBackgroundResponse`

Parameters:

  • request:

    Request instance for ReplaceBackground.



204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
# File 'lib/v20221229/client.rb', line 204

def ReplaceBackground(request)
  body = send_request('ReplaceBackground', request.serialize)
  response = JSON.parse(body)
  if response['Response'].key?('Error') == false
    model = ReplaceBackgroundResponse.new
    model.deserialize(response['Response'])
    model
  else
    code = response['Response']['Error']['Code']
    message = response['Response']['Error']['Message']
    reqid = response['Response']['RequestId']
    raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
  end
rescue TencentCloud::Common::TencentCloudSDKException => e
  raise e
rescue StandardError => e
  raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end

#SketchToImage(request) ⇒ Object

@rtype: :class:‘Tencentcloud::aiart::V20221229::SketchToImageResponse`

Parameters:

  • request:

    Request instance for SketchToImage.



229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
# File 'lib/v20221229/client.rb', line 229

def SketchToImage(request)
  body = send_request('SketchToImage', request.serialize)
  response = JSON.parse(body)
  if response['Response'].key?('Error') == false
    model = SketchToImageResponse.new
    model.deserialize(response['Response'])
    model
  else
    code = response['Response']['Error']['Code']
    message = response['Response']['Error']['Message']
    reqid = response['Response']['RequestId']
    raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
  end
rescue TencentCloud::Common::TencentCloudSDKException => e
  raise e
rescue StandardError => e
  raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end

#SubmitDrawPortraitJob(request) ⇒ Object

@rtype: :class:‘Tencentcloud::aiart::V20221229::SubmitDrawPortraitJobResponse`

Parameters:

  • request:

    Request instance for SubmitDrawPortraitJob.



260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
# File 'lib/v20221229/client.rb', line 260

def SubmitDrawPortraitJob(request)
  body = send_request('SubmitDrawPortraitJob', request.serialize)
  response = JSON.parse(body)
  if response['Response'].key?('Error') == false
    model = SubmitDrawPortraitJobResponse.new
    model.deserialize(response['Response'])
    model
  else
    code = response['Response']['Error']['Code']
    message = response['Response']['Error']['Message']
    reqid = response['Response']['RequestId']
    raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
  end
rescue TencentCloud::Common::TencentCloudSDKException => e
  raise e
rescue StandardError => e
  raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end

#SubmitTextToImageProJob(request) ⇒ Object

@rtype: :class:‘Tencentcloud::aiart::V20221229::SubmitTextToImageProJobResponse`

Parameters:

  • request:

    Request instance for SubmitTextToImageProJob.



288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
# File 'lib/v20221229/client.rb', line 288

def SubmitTextToImageProJob(request)
  body = send_request('SubmitTextToImageProJob', request.serialize)
  response = JSON.parse(body)
  if response['Response'].key?('Error') == false
    model = SubmitTextToImageProJobResponse.new
    model.deserialize(response['Response'])
    model
  else
    code = response['Response']['Error']['Code']
    message = response['Response']['Error']['Message']
    reqid = response['Response']['RequestId']
    raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
  end
rescue TencentCloud::Common::TencentCloudSDKException => e
  raise e
rescue StandardError => e
  raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end

#SubmitTrainPortraitModelJob(request) ⇒ Object

@rtype: :class:‘Tencentcloud::aiart::V20221229::SubmitTrainPortraitModelJobResponse`

Parameters:

  • request:

    Request instance for SubmitTrainPortraitModelJob.



319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
# File 'lib/v20221229/client.rb', line 319

def SubmitTrainPortraitModelJob(request)
  body = send_request('SubmitTrainPortraitModelJob', request.serialize)
  response = JSON.parse(body)
  if response['Response'].key?('Error') == false
    model = SubmitTrainPortraitModelJobResponse.new
    model.deserialize(response['Response'])
    model
  else
    code = response['Response']['Error']['Code']
    message = response['Response']['Error']['Message']
    reqid = response['Response']['RequestId']
    raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
  end
rescue TencentCloud::Common::TencentCloudSDKException => e
  raise e
rescue StandardError => e
  raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end

#TextToImage(request) ⇒ Object

@rtype: :class:‘Tencentcloud::aiart::V20221229::TextToImageResponse`

Parameters:

  • request:

    Request instance for TextToImage.



347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
# File 'lib/v20221229/client.rb', line 347

def TextToImage(request)
  body = send_request('TextToImage', request.serialize)
  response = JSON.parse(body)
  if response['Response'].key?('Error') == false
    model = TextToImageResponse.new
    model.deserialize(response['Response'])
    model
  else
    code = response['Response']['Error']['Code']
    message = response['Response']['Error']['Message']
    reqid = response['Response']['RequestId']
    raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
  end
rescue TencentCloud::Common::TencentCloudSDKException => e
  raise e
rescue StandardError => e
  raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end

#UploadTrainPortraitImages(request) ⇒ Object

@rtype: :class:‘Tencentcloud::aiart::V20221229::UploadTrainPortraitImagesResponse`

Parameters:

  • request:

    Request instance for UploadTrainPortraitImages.



378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
# File 'lib/v20221229/client.rb', line 378

def UploadTrainPortraitImages(request)
  body = send_request('UploadTrainPortraitImages', request.serialize)
  response = JSON.parse(body)
  if response['Response'].key?('Error') == false
    model = UploadTrainPortraitImagesResponse.new
    model.deserialize(response['Response'])
    model
  else
    code = response['Response']['Error']['Code']
    message = response['Response']['Error']['Message']
    reqid = response['Response']['RequestId']
    raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
  end
rescue TencentCloud::Common::TencentCloudSDKException => e
  raise e
rescue StandardError => e
  raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end