1// Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved. 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15package v20201014 16 17import ( 18 "encoding/json" 19 "errors" 20 21 tchttp "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http" 22) 23 24type ChangeRoomPlayerProfileRequest struct { 25 *tchttp.BaseRequest 26 27 // 游戏资源Id。 28 GameId *string `json:"GameId,omitempty" name:"GameId"` 29 30 // 发起修改的玩家Id。 31 PlayerId *string `json:"PlayerId,omitempty" name:"PlayerId"` 32 33 // 需要修改的玩家自定义属性。 34 CustomProfile *string `json:"CustomProfile,omitempty" name:"CustomProfile"` 35} 36 37func (r *ChangeRoomPlayerProfileRequest) ToJsonString() string { 38 b, _ := json.Marshal(r) 39 return string(b) 40} 41 42// It is highly **NOT** recommended to use this function 43// because it has no param check, nor strict type check 44func (r *ChangeRoomPlayerProfileRequest) FromJsonString(s string) error { 45 f := make(map[string]interface{}) 46 if err := json.Unmarshal([]byte(s), &f); err != nil { 47 return err 48 } 49 delete(f, "GameId") 50 delete(f, "PlayerId") 51 delete(f, "CustomProfile") 52 if len(f) > 0 { 53 return errors.New("ChangeRoomPlayerProfileRequest has unknown keys!") 54 } 55 return json.Unmarshal([]byte(s), &r) 56} 57 58type ChangeRoomPlayerProfileResponse struct { 59 *tchttp.BaseResponse 60 Response *struct { 61 62 // 房间信息。 63 Room *Room `json:"Room,omitempty" name:"Room"` 64 65 // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 66 RequestId *string `json:"RequestId,omitempty" name:"RequestId"` 67 } `json:"Response"` 68} 69 70func (r *ChangeRoomPlayerProfileResponse) ToJsonString() string { 71 b, _ := json.Marshal(r) 72 return string(b) 73} 74 75// It is highly **NOT** recommended to use this function 76// because it has no param check, nor strict type check 77func (r *ChangeRoomPlayerProfileResponse) FromJsonString(s string) error { 78 return json.Unmarshal([]byte(s), &r) 79} 80 81type ChangeRoomPlayerStatusRequest struct { 82 *tchttp.BaseRequest 83 84 // 游戏资源Id。 85 GameId *string `json:"GameId,omitempty" name:"GameId"` 86 87 // 玩家自定义状态。 88 CustomStatus *uint64 `json:"CustomStatus,omitempty" name:"CustomStatus"` 89 90 // 玩家id。 91 PlayerId *string `json:"PlayerId,omitempty" name:"PlayerId"` 92} 93 94func (r *ChangeRoomPlayerStatusRequest) ToJsonString() string { 95 b, _ := json.Marshal(r) 96 return string(b) 97} 98 99// It is highly **NOT** recommended to use this function 100// because it has no param check, nor strict type check 101func (r *ChangeRoomPlayerStatusRequest) FromJsonString(s string) error { 102 f := make(map[string]interface{}) 103 if err := json.Unmarshal([]byte(s), &f); err != nil { 104 return err 105 } 106 delete(f, "GameId") 107 delete(f, "CustomStatus") 108 delete(f, "PlayerId") 109 if len(f) > 0 { 110 return errors.New("ChangeRoomPlayerStatusRequest has unknown keys!") 111 } 112 return json.Unmarshal([]byte(s), &r) 113} 114 115type ChangeRoomPlayerStatusResponse struct { 116 *tchttp.BaseResponse 117 Response *struct { 118 119 // 房间信息 120 Room *Room `json:"Room,omitempty" name:"Room"` 121 122 // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 123 RequestId *string `json:"RequestId,omitempty" name:"RequestId"` 124 } `json:"Response"` 125} 126 127func (r *ChangeRoomPlayerStatusResponse) ToJsonString() string { 128 b, _ := json.Marshal(r) 129 return string(b) 130} 131 132// It is highly **NOT** recommended to use this function 133// because it has no param check, nor strict type check 134func (r *ChangeRoomPlayerStatusResponse) FromJsonString(s string) error { 135 return json.Unmarshal([]byte(s), &r) 136} 137 138type DescribePlayerRequest struct { 139 *tchttp.BaseRequest 140 141 // 游戏资源Id。 142 GameId *string `json:"GameId,omitempty" name:"GameId"` 143 144 // 玩家OpenId。 145 OpenId *string `json:"OpenId,omitempty" name:"OpenId"` 146 147 // 玩家PlayerId,由后台分配,当OpenId不传的时候,PlayerId必传,传入PlayerId可以查询当前PlayerId的玩家信息,当OpenId传入的时候,PlayerId可不传,按照OpenId查询玩家信息。 148 PlayerId *string `json:"PlayerId,omitempty" name:"PlayerId"` 149} 150 151func (r *DescribePlayerRequest) ToJsonString() string { 152 b, _ := json.Marshal(r) 153 return string(b) 154} 155 156// It is highly **NOT** recommended to use this function 157// because it has no param check, nor strict type check 158func (r *DescribePlayerRequest) FromJsonString(s string) error { 159 f := make(map[string]interface{}) 160 if err := json.Unmarshal([]byte(s), &f); err != nil { 161 return err 162 } 163 delete(f, "GameId") 164 delete(f, "OpenId") 165 delete(f, "PlayerId") 166 if len(f) > 0 { 167 return errors.New("DescribePlayerRequest has unknown keys!") 168 } 169 return json.Unmarshal([]byte(s), &r) 170} 171 172type DescribePlayerResponse struct { 173 *tchttp.BaseResponse 174 Response *struct { 175 176 // 玩家信息。 177 Player *Player `json:"Player,omitempty" name:"Player"` 178 179 // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 180 RequestId *string `json:"RequestId,omitempty" name:"RequestId"` 181 } `json:"Response"` 182} 183 184func (r *DescribePlayerResponse) ToJsonString() string { 185 b, _ := json.Marshal(r) 186 return string(b) 187} 188 189// It is highly **NOT** recommended to use this function 190// because it has no param check, nor strict type check 191func (r *DescribePlayerResponse) FromJsonString(s string) error { 192 return json.Unmarshal([]byte(s), &r) 193} 194 195type DescribeRoomRequest struct { 196 *tchttp.BaseRequest 197 198 // 游戏资源Id。 199 GameId *string `json:"GameId,omitempty" name:"GameId"` 200 201 // 玩家Id。当房间Id不传的时候,玩家Id必传,传入玩家Id可以查询当前玩家所在的房间信息,当房间Id传入的时候,优先按照房间Id查询房间信息。 202 PlayerId *string `json:"PlayerId,omitempty" name:"PlayerId"` 203 204 // 房间Id。 205 RoomId *string `json:"RoomId,omitempty" name:"RoomId"` 206} 207 208func (r *DescribeRoomRequest) ToJsonString() string { 209 b, _ := json.Marshal(r) 210 return string(b) 211} 212 213// It is highly **NOT** recommended to use this function 214// because it has no param check, nor strict type check 215func (r *DescribeRoomRequest) FromJsonString(s string) error { 216 f := make(map[string]interface{}) 217 if err := json.Unmarshal([]byte(s), &f); err != nil { 218 return err 219 } 220 delete(f, "GameId") 221 delete(f, "PlayerId") 222 delete(f, "RoomId") 223 if len(f) > 0 { 224 return errors.New("DescribeRoomRequest has unknown keys!") 225 } 226 return json.Unmarshal([]byte(s), &r) 227} 228 229type DescribeRoomResponse struct { 230 *tchttp.BaseResponse 231 Response *struct { 232 233 // 房间信息。 234 Room *Room `json:"Room,omitempty" name:"Room"` 235 236 // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 237 RequestId *string `json:"RequestId,omitempty" name:"RequestId"` 238 } `json:"Response"` 239} 240 241func (r *DescribeRoomResponse) ToJsonString() string { 242 b, _ := json.Marshal(r) 243 return string(b) 244} 245 246// It is highly **NOT** recommended to use this function 247// because it has no param check, nor strict type check 248func (r *DescribeRoomResponse) FromJsonString(s string) error { 249 return json.Unmarshal([]byte(s), &r) 250} 251 252type DismissRoomRequest struct { 253 *tchttp.BaseRequest 254 255 // 表示游戏资源唯一 ID, 由后台自动分配, 无法修改。 256 GameId *string `json:"GameId,omitempty" name:"GameId"` 257 258 // 表示游戏房间唯一ID。 259 RoomId *string `json:"RoomId,omitempty" name:"RoomId"` 260} 261 262func (r *DismissRoomRequest) ToJsonString() string { 263 b, _ := json.Marshal(r) 264 return string(b) 265} 266 267// It is highly **NOT** recommended to use this function 268// because it has no param check, nor strict type check 269func (r *DismissRoomRequest) FromJsonString(s string) error { 270 f := make(map[string]interface{}) 271 if err := json.Unmarshal([]byte(s), &f); err != nil { 272 return err 273 } 274 delete(f, "GameId") 275 delete(f, "RoomId") 276 if len(f) > 0 { 277 return errors.New("DismissRoomRequest has unknown keys!") 278 } 279 return json.Unmarshal([]byte(s), &r) 280} 281 282type DismissRoomResponse struct { 283 *tchttp.BaseResponse 284 Response *struct { 285 286 // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 287 RequestId *string `json:"RequestId,omitempty" name:"RequestId"` 288 } `json:"Response"` 289} 290 291func (r *DismissRoomResponse) ToJsonString() string { 292 b, _ := json.Marshal(r) 293 return string(b) 294} 295 296// It is highly **NOT** recommended to use this function 297// because it has no param check, nor strict type check 298func (r *DismissRoomResponse) FromJsonString(s string) error { 299 return json.Unmarshal([]byte(s), &r) 300} 301 302type ModifyRoomRequest struct { 303 *tchttp.BaseRequest 304 305 // 游戏资源Id。 306 GameId *string `json:"GameId,omitempty" name:"GameId"` 307 308 // 房间ID。 309 RoomId *string `json:"RoomId,omitempty" name:"RoomId"` 310 311 // 发起者的PlayerId。 312 PlayerId *string `json:"PlayerId,omitempty" name:"PlayerId"` 313 314 // 需要修改的房间选项,0表示房间名称,1表示房主,2表示是否允许观战,3表示是否支持邀请码/密码,4表示是否私有,5表示是否自定义房间属性,6表示是否禁止加人。 315 ChangeRoomOptionList []*int64 `json:"ChangeRoomOptionList,omitempty" name:"ChangeRoomOptionList" list` 316 317 // 房间名称。 318 RoomName *string `json:"RoomName,omitempty" name:"RoomName"` 319 320 // 变更房主。 321 Owner *string `json:"Owner,omitempty" name:"Owner"` 322 323 // 是否支持观战。 324 IsViewed *bool `json:"IsViewed,omitempty" name:"IsViewed"` 325 326 // 是否支持邀请码/密码。 327 IsInvited *bool `json:"IsInvited,omitempty" name:"IsInvited"` 328 329 // 是否私有。 330 IsPrivate *bool `json:"IsPrivate,omitempty" name:"IsPrivate"` 331 332 // 自定义房间属性。 333 CustomProperties *string `json:"CustomProperties,omitempty" name:"CustomProperties"` 334 335 // 房间是否禁止加人。 336 IsForbidJoin *bool `json:"IsForbidJoin,omitempty" name:"IsForbidJoin"` 337} 338 339func (r *ModifyRoomRequest) ToJsonString() string { 340 b, _ := json.Marshal(r) 341 return string(b) 342} 343 344// It is highly **NOT** recommended to use this function 345// because it has no param check, nor strict type check 346func (r *ModifyRoomRequest) FromJsonString(s string) error { 347 f := make(map[string]interface{}) 348 if err := json.Unmarshal([]byte(s), &f); err != nil { 349 return err 350 } 351 delete(f, "GameId") 352 delete(f, "RoomId") 353 delete(f, "PlayerId") 354 delete(f, "ChangeRoomOptionList") 355 delete(f, "RoomName") 356 delete(f, "Owner") 357 delete(f, "IsViewed") 358 delete(f, "IsInvited") 359 delete(f, "IsPrivate") 360 delete(f, "CustomProperties") 361 delete(f, "IsForbidJoin") 362 if len(f) > 0 { 363 return errors.New("ModifyRoomRequest has unknown keys!") 364 } 365 return json.Unmarshal([]byte(s), &r) 366} 367 368type ModifyRoomResponse struct { 369 *tchttp.BaseResponse 370 Response *struct { 371 372 // 房间信息 373 Room *Room `json:"Room,omitempty" name:"Room"` 374 375 // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 376 RequestId *string `json:"RequestId,omitempty" name:"RequestId"` 377 } `json:"Response"` 378} 379 380func (r *ModifyRoomResponse) ToJsonString() string { 381 b, _ := json.Marshal(r) 382 return string(b) 383} 384 385// It is highly **NOT** recommended to use this function 386// because it has no param check, nor strict type check 387func (r *ModifyRoomResponse) FromJsonString(s string) error { 388 return json.Unmarshal([]byte(s), &r) 389} 390 391type Player struct { 392 393 // 玩家 OpenId。最长不超过64个字符。 394 OpenId *string `json:"OpenId,omitempty" name:"OpenId"` 395 396 // 玩家昵称。最长不超过32个字符。 397 Name *string `json:"Name,omitempty" name:"Name"` 398 399 // 队伍 ID。最长不超过16个字符。 400 TeamId *string `json:"TeamId,omitempty" name:"TeamId"` 401 402 // 是否为机器人。 403 IsRobot *bool `json:"IsRobot,omitempty" name:"IsRobot"` 404 405 // 玩家 PlayerId。出参使用,由后端返回。 406 PlayerId *string `json:"PlayerId,omitempty" name:"PlayerId"` 407 408 // 自定义玩家状态。非负数,最大不超过4294967295。默认为0。 409 CustomPlayerStatus *uint64 `json:"CustomPlayerStatus,omitempty" name:"CustomPlayerStatus"` 410 411 // 自定义玩家属性。最长不超过256个字符。默认为空字符串。 412 CustomProfile *string `json:"CustomProfile,omitempty" name:"CustomProfile"` 413} 414 415type RemoveRoomPlayerRequest struct { 416 *tchttp.BaseRequest 417 418 // 游戏资源Id。 419 GameId *string `json:"GameId,omitempty" name:"GameId"` 420 421 // 被踢出房间的玩家Id。 422 RemovePlayerId *string `json:"RemovePlayerId,omitempty" name:"RemovePlayerId"` 423} 424 425func (r *RemoveRoomPlayerRequest) ToJsonString() string { 426 b, _ := json.Marshal(r) 427 return string(b) 428} 429 430// It is highly **NOT** recommended to use this function 431// because it has no param check, nor strict type check 432func (r *RemoveRoomPlayerRequest) FromJsonString(s string) error { 433 f := make(map[string]interface{}) 434 if err := json.Unmarshal([]byte(s), &f); err != nil { 435 return err 436 } 437 delete(f, "GameId") 438 delete(f, "RemovePlayerId") 439 if len(f) > 0 { 440 return errors.New("RemoveRoomPlayerRequest has unknown keys!") 441 } 442 return json.Unmarshal([]byte(s), &r) 443} 444 445type RemoveRoomPlayerResponse struct { 446 *tchttp.BaseResponse 447 Response *struct { 448 449 // 房间信息 450 Room *Room `json:"Room,omitempty" name:"Room"` 451 452 // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 453 RequestId *string `json:"RequestId,omitempty" name:"RequestId"` 454 } `json:"Response"` 455} 456 457func (r *RemoveRoomPlayerResponse) ToJsonString() string { 458 b, _ := json.Marshal(r) 459 return string(b) 460} 461 462// It is highly **NOT** recommended to use this function 463// because it has no param check, nor strict type check 464func (r *RemoveRoomPlayerResponse) FromJsonString(s string) error { 465 return json.Unmarshal([]byte(s), &r) 466} 467 468type Room struct { 469 470 // 表示房间名称。最长不超过32个字符。 471 Name *string `json:"Name,omitempty" name:"Name"` 472 473 // 表示房间最大玩家数量。最大不超过100人。 474 MaxPlayers *int64 `json:"MaxPlayers,omitempty" name:"MaxPlayers"` 475 476 // 表示房主OpenId。最长不超过16个字符。 477 OwnerOpenId *string `json:"OwnerOpenId,omitempty" name:"OwnerOpenId"` 478 479 // 表示是否私有,私有指的是不允许其他玩家通过匹配加入房间。 480 IsPrivate *bool `json:"IsPrivate,omitempty" name:"IsPrivate"` 481 482 // 表示玩家详情列表。 483 Players []*Player `json:"Players,omitempty" name:"Players" list` 484 485 // 表示团队属性列表。 486 Teams []*Team `json:"Teams,omitempty" name:"Teams" list` 487 488 // 表示房间 ID。出参用,由后端返回。 489 Id *string `json:"Id,omitempty" name:"Id"` 490 491 // 表示房间类型。最长不超过32个字符。 492 Type *string `json:"Type,omitempty" name:"Type"` 493 494 // 表示创建方式:0.单人主动发起创建房间请求;1.多人在线匹配请求分配房间;2. 直接创建满员房间。调用云API的创房请求默认为3,目前通过云API调用只支持第3种方式。 495 CreateType *int64 `json:"CreateType,omitempty" name:"CreateType"` 496 497 // 表示自定义房间属性,不传为空字符串。最长不超过1024个字符。 498 CustomProperties *string `json:"CustomProperties,omitempty" name:"CustomProperties"` 499 500 // 表示房间帧同步状态。0表示未开始帧同步,1表示已开始帧同步,用于出参。 501 FrameSyncState *int64 `json:"FrameSyncState,omitempty" name:"FrameSyncState"` 502 503 // 表示帧率。由控制台设置,用于出参。 504 FrameRate *int64 `json:"FrameRate,omitempty" name:"FrameRate"` 505 506 // 表示路由ID。用于出参。 507 RouteId *string `json:"RouteId,omitempty" name:"RouteId"` 508 509 // 表示房间创建的时间戳(单位:秒)。 510 CreateTime *int64 `json:"CreateTime,omitempty" name:"CreateTime"` 511 512 // 表示开始帧同步时的时间戳(单位:秒),未开始帧同步时返回为0。 513 StartGameTime *int64 `json:"StartGameTime,omitempty" name:"StartGameTime"` 514 515 // 表示是否禁止加入房间。出参使用,默认为False,通过SDK的ChangeRoom接口可以修改。 516 IsForbidJoin *bool `json:"IsForbidJoin,omitempty" name:"IsForbidJoin"` 517 518 // 表示房主PlayerId。 519 Owner *string `json:"Owner,omitempty" name:"Owner"` 520} 521 522type Team struct { 523 524 // 队伍ID。最长不超过16个字符。 525 Id *string `json:"Id,omitempty" name:"Id"` 526 527 // 队伍名称。最长不超过32个字符。 528 Name *string `json:"Name,omitempty" name:"Name"` 529 530 // 队伍最小人数。最大不超过100人。 531 MinPlayers *int64 `json:"MinPlayers,omitempty" name:"MinPlayers"` 532 533 // 队伍最大人数。最大不超过100人。 534 MaxPlayers *int64 `json:"MaxPlayers,omitempty" name:"MaxPlayers"` 535} 536