{
method: "GET",
path: "/me",
deprecated: false,
description: "Get player information of mine",
call: {
action: "player.get",
params: {
id: "@context.user.player.id",
},
},
},
GET /players/me 요청이 player.get 액션을 { id: <인증 컨텍스트의 player.id> } 정보로부터 페이로드와 함께 호출하고 성공시 그 결과를 반환합니다.
Map
{
method: "GET",
path: "/me",
deprecated: false,
description: "Get player information of mine",
map: `({ path, query, body, context }) => context.user.player`,
},
또는 map 커넥터 (Inline JavaScript Function String)를 통해 인증 컨텍스트의 player 객체를 바로 반환 할 수 있습니다. 이후에 다시 다루는 Inline JavaScript Function String은 API Gateway의 Node.js VM 샌드박스에서 해석됩니다.
REST API의 params 맵핑에는 @path, @body, @query, @context 객체를 이용 할 수 있습니다.
// @body 객체 전체를 페이로드로 전달하거나 스트림을 전달 할 때 이용됩니다.
params: "@body",
// @ 문자열로 시작되지 않는 값들은 해석되지 않고 그대로 전달됩니다.
params: {
foo: "@path.foo", // will bar parsed
bar: "query.bar", // will be "query.bar"
zzz: ["any", { obj: "ject", can: "be", "use": 2 }],
},
// 항상 string 타입을 갖는 @query, @path 객체의 속성들에 한해서 타입을 boolean이나 number로 변환 할 수 있습니다.
params: {
foo: "@path.foo:number",
bar: "@query.bar:boolean",
},