길드 조회
길드 목록을 조회하는 API입니다.
URL 확인
이 API는 service-api.playnanoo.com 도메인을 사용합니다.
API 정보
- URL:
https://service-api.playnanoo.com/guild/v20230101/search - Method:
PUT - 인증 필요: 예
요청 파라미터
| 파라미터 | 타입 | 필수 | 설명 |
|---|---|---|---|
| table_code | string | 필수 | 테이블 코드 |
| sort_condition | string | 필수 | 정렬 조건 (random, point, indate) |
| sort_type | string | 필수 | 정렬 타입 (asc, desc) |
| auto_join | string | 필수 | 자동 가입 필터 (Y, N) |
| limit | int | 필수 | 조회할 길드 수 |
DeviceInfo 상속
이 API의 Req 클래스는 DeviceInfo를 상속받습니다. DeviceInfo의 모든 속성이 자동으로 포함됩니다.
응답 데이터
Res 클래스
| 필드 | 타입 | 설명 |
|---|---|---|
| Items | List\<SearchItemModel> | 길드 목록 |
SearchItemModel 구조
| 필드 | 타입 | 설명 |
|---|---|---|
| TableCode | string | 테이블 코드 |
| Uid | string | 길드 고유 ID |
| Name | string | 길드 이름 |
| Point | double | 길드 포인트 |
| MasterUuid | string | 마스터 UUID |
| MasterNickname | string | 마스터 닉네임 |
| Country | string | 국가 코드 |
| MemberCount | int | 현재 멤버 수 |
| MemberLimit | int | 멤버 제한 수 |
| AutoJoin | string | 자동 가입 여부 |
| ExtraData | string | 추가 데이터 |
| InDate | string | 길드 생성 일시 |
Unity C# 구현
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
public class GuildSearch
{
static string path = "https://service-api.playnanoo.com/guild/v20230101/search";
[Serializable]
public class Req : DeviceInfo
{
public string table_code;
public string sort_condition;
public string sort_type;
public string auto_join;
public int limit;
public IEnumerator Send(
string tableCode,
string sortCondition, //random : 랜덤검색, point : 포인트, indate : 등록일자
string sortType, // asc : 오름차순, desc : 내림차순
bool autoJoin,
int limit,
Action<Res> onSuccess,
Action<BaseResponse> onError
)
{
if (!string.IsNullOrEmpty(tableCode)) this.table_code = tableCode;
if (!string.IsNullOrEmpty(sortCondition)) this.sort_condition = sortCondition;
if (!string.IsNullOrEmpty(sortType)) this.sort_type = sortType;
this.auto_join = autoJoin ? "Y" : "N";
this.limit = limit;
yield return HttpClient.Send<Req, Res>(
UnityWebRequest.kHttpVerbPUT,
path,
requireToken: true,
body: this,
onSuccess: onSuccess,
onError: onError
);
}
}
[Serializable]
public class Res : BaseResponse
{
public List<SearchItemModel> Items;
}
[Serializable]
public class SearchItemModel
{
public string TableCode;
public string Uid;
public string Name;
public double Point;
public string MasterUuid;
public string MasterNickname;
public string Country;
public int MemberCount;
public int MemberLimit;
public string AutoJoin;
public string ExtraData;
public string InDate;
}
}
사용 예제
public void SearchGuilds()
{
GuildSearch.Req req = new GuildSearch.Req();
StartCoroutine(req.Send(
tableCode: "guild_table",
sortCondition: "point",
sortType: "desc",
autoJoin: true,
limit: 10,
onSuccess: res =>
{
foreach (var item in res.Items)
{
Debug.Log($"Uid: {item.Uid}, Name: {item.Name}");
Debug.Log($"Point: {item.Point}, MemberCount: {item.MemberCount}/{item.MemberLimit}");
Debug.Log($"Master: {item.MasterNickname}");
}
},
onError: (error) =>
{
Debug.LogError($"길드 조회 실패: [{error.ErrorCode}] {error.Message}");
}
));
}