Skip to content

Files

Latest commit

25b8974 ยท Sep 21, 2024

History

History
307 lines (273 loc) ยท 9.81 KB

4_mago3D_API_Guide.md

File metadata and controls

307 lines (273 loc) ยท 9.81 KB

mago3D API ๊ฐ€์ด๋“œ

์†Œ๊ฐœ(Introduction)

mago3D๋ž€?

mago3D๋Š” 2D ๋ฐ 3D ๋ฐ์ดํ„ฐ๋ฅผ ์—…๋กœ๋“œํ•˜๊ณ , ์ด๋ฅผ ์ตœ์ ํ™”๋œ ํ˜•ํƒœ๋กœ ๋ณ€ํ™˜ํ•˜์—ฌ ์›น ๋ธŒ๋ผ์šฐ์ €๋ฅผ ํ†ตํ•ด 3์ฐจ์›์œผ๋กœ ์‹œ๊ฐํ™”ํ•  ์ˆ˜ ์žˆ๋Š” ์˜คํ”ˆ์†Œ์Šค ํ”Œ๋žซํผ์ž…๋‹ˆ๋‹ค. ๋‹ค์–‘ํ•œ ๊ณต๊ฐ„ ๋ฐ์ดํ„ฐ๋ฅผ ์†์‰ฝ๊ฒŒ ๊ด€๋ฆฌํ•˜๊ณ  ์‹œ๊ฐํ™”ํ•˜๋Š” ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•˜์—ฌ ๋„์‹œ ๊ณ„ํš, ์‹œ์„ค ๊ด€๋ฆฌ, ์žฌ๋‚œ ๊ด€๋ฆฌ ๋“ฑ ์—ฌ๋Ÿฌ ๋ถ„์•ผ์—์„œ ํ™œ์šฉ๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์ฃผ์š”๋ชฉ์ ์€ ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.

  • ๋ฐ์ดํ„ฐ์˜ ํ†ตํ•ฉ ์‹œ๊ฐํ™”: 2D ๋ฐ 3D ๊ณต๊ฐ„ ๋ฐ์ดํ„ฐ๋ฅผ ์›น ํ™˜๊ฒฝ์—์„œ ํ†ตํ•ฉ์ ์œผ๋กœ ์‹œ๊ฐํ™”ํ•˜์—ฌ ๋ณต์žกํ•œ ์ •๋ณด๋ฅผ ์ง๊ด€์ ์œผ๋กœ ์ดํ•ดํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•ฉ๋‹ˆ๋‹ค.
  • ๋ฐ์ดํ„ฐ ์ตœ์ ํ™” ๋ฐ ๋ณ€ํ™˜: ์‚ฌ์šฉ์ž๊ฐ€ ์—…๋กœ๋“œํ•œ ์›๋ณธ ๋ฐ์ดํ„ฐ๋ฅผ ์›น ํ™˜๊ฒฝ์—์„œ ํšจ์œจ์ ์œผ๋กœ ๋ Œ๋”๋งํ•  ์ˆ˜ ์žˆ๋„๋ก ์ตœ์ ํ™”๋œ 3D ํ˜•์‹์œผ๋กœ ๋ณ€ํ™˜ํ•ฉ๋‹ˆ๋‹ค.

mago3D API๋Š” ์‚ฌ์šฉ์ž๊ฐ€ ๋ฐ์ดํ„ฐ๋ฅผ ์—…๋กœ๋“œ, ๊ด€๋ฆฌ ๋ฐ ์‹œ๊ฐํ™”ํ•˜๋Š” ๋ฐ ํ•„์š”ํ•œ ๋‹ค์–‘ํ•œ ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.
API๋Š” ํฌ๊ฒŒ ์„ธ ๊ฐ€์ง€ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์œผ๋กœ ๊ตฌ์„ฑ๋˜์–ด ์žˆ์œผ๋ฉฐ, ๊ฐ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์€ ํŠน์ •ํ•œ ๊ธฐ๋Šฅ์„ ๋‹ด๋‹นํ•ฉ๋‹ˆ๋‹ค:

Dataset Application

  • ๋ฐ์ดํ„ฐ ๊ทธ๋ฃน ๊ด€๋ฆฌ: ๊ทธ๋ฃน ์ถ”๊ฐ€, ์ˆ˜์ •, ์‚ญ์ œ, ๋ชฉ๋ก ์กฐํšŒ ๋ฐ ๊ทธ๋ฃน๋ณ„ ๋ฐ์ดํ„ฐ ์กฐํšŒ ๊ธฐ๋Šฅ ์ œ๊ณต
  • ๋ฐ์ดํ„ฐ ๊ด€๋ฆฌ: 2D/3D ๋ฐ์ดํ„ฐ ์—…๋กœ๋“œ, ๋ฐ์ดํ„ฐ ๋ชฉ๋ก ์กฐํšŒ, ๊ฒ€์ƒ‰, ์ˆ˜์ • ๋ฐ ์‚ญ์ œ ๊ธฐ๋Šฅ์„ ์ œ๊ณต
  • ๋ฐ์ดํ„ฐ ๋ณ€ํ™˜: ์—…๋กœ๋“œ๋œ ๋ฐ์ดํ„ฐ๋ฅผ ์›น ํ™˜๊ฒฝ์—์„œ ํšจ๊ณผ์ ์œผ๋กœ ๋ Œ๋”๋งํ•  ์ˆ˜ ์žˆ๋„๋ก ์ตœ์ ํ™”๋œ ํ˜•์‹์œผ๋กœ ๋ณ€ํ™˜

Layerset Application

  • ๋ ˆ์ด์–ด ๊ทธ๋ฃน ๊ด€๋ฆฌ: ๊ทธ๋ฃน ์ถ”๊ฐ€, ์ˆ˜์ •, ์‚ญ์ œ ๋ฐ ๊ทธ๋ฃน๋ณ„ ๋ ˆ์ด์–ด ์กฐํšŒ ๊ธฐ๋Šฅ ์ œ๊ณต
  • ๋ ˆ์ด์–ด ๊ด€๋ฆฌ: ๋ ˆ์ด์–ด ๋“ฑ๋ก, ์ˆ˜์ •, ์‚ญ์ œ ๋ฐ ๋ ˆ์ด์–ด ๊ถŒํ•œ(๊ณต๊ฐœ/๋น„๊ณต๊ฐœ), ์ผœ์ง์—ฌ๋ถ€(์ผœ์ง/๊บผ์ง), ์‚ฌ์šฉ์—ฌ๋ถ€(์‚ฌ์šฉ/๋ฏธ์‚ฌ์šฉ) ์„ค์ • ๊ธฐ๋Šฅ ์ œ๊ณต
  • ๋ ˆ์ด์–ด ๋ฏธ๋ฆฌ๋ณด๊ธฐ: ๋ณ€ํ™˜๋œ ๋ ˆ์ด์–ด์˜ ๋ฏธ๋ฆฌ๋ณผ ์ˆ˜ ์žˆ๋Š” ๊ธฐ๋Šฅ ์ œ๊ณต
  • ๋ ˆ์ด์–ด ์Šคํƒ€์ผ: ๋ฒกํ„ฐ ๋ ˆ์ด์–ด์˜ ์ , ์„ , ๋ฉด, ์†์„ฑ๋ณ„ ์Šคํƒ€์ผ ๊ด€๋ฆฌ๊ธฐ๋Šฅ ์ œ๊ณต

Userset Application

  • ์‚ฌ์šฉ์ž ๊ด€๋ฆฌ: ์‚ฌ์šฉ์ž ๊ณ„์ • ์ƒ์„ฑ, ์ˆ˜์ •, ์‚ญ์ œ, ์กฐํšŒ์™€ ๊ฐ™์€ ๊ธฐ๋ณธ์ ์ธ ์‚ฌ์šฉ์ž ๊ด€๋ฆฌ ๊ธฐ๋Šฅ ์ œ๊ณต
  • ๊ถŒํ•œ ๊ด€๋ฆฌ: ๊ฐ ์‚ฌ์šฉ์ž ๊ทธ๋ฃน์— ๋Œ€ํ•œ ์ ‘์† ๊ถŒํ•œ ์„ค์ • ๊ธฐ๋Šฅ ์ œ๊ณต

GraphQL API

GraphQL์€ Facebook์ด ๊ฐœ๋ฐœํ•œ ๋ฐ์ดํ„ฐ ์ฟผ๋ฆฌ ์–ธ์–ด๋กœ, API๋ฅผ ํšจ์œจ์ ์œผ๋กœ ํ˜ธ์ถœํ•˜๊ณ  ๋ฐ์ดํ„ฐ ์š”์ฒญ์„ ์ตœ์ ํ™”ํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค.
REST API์™€ ๋‹ฌ๋ฆฌ, GraphQL์—์„œ๋Š” ํด๋ผ์ด์–ธํŠธ๊ฐ€ ํ•„์š”ํ•œ ๋ฐ์ดํ„ฐ์˜ ๊ตฌ์กฐ๋ฅผ ๋ช…ํ™•ํžˆ ์ •์˜ํ•  ์ˆ˜ ์žˆ์–ด ๊ณผ๋„ํ•œ ๋ฐ์ดํ„ฐ ์ „์†ก(over-fetching)์ด๋‚˜ ๋ถ€์กฑํ•œ ๋ฐ์ดํ„ฐ ์ „์†ก(under-fetching)์„ ๋ฐฉ์ง€ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

1. ์Šคํ‚ค๋งˆ (Schema)

  • ์Šคํ‚ค๋งˆ๋Š” GraphQL ์„œ๋ฒ„์˜ ๋ฐ์ดํ„ฐ ๊ตฌ์กฐ๋ฅผ ์ •์˜ํ•˜๋Š” ์—ญํ• ์„ ํ•ฉ๋‹ˆ๋‹ค. ์Šคํ‚ค๋งˆ๋Š” ์–ด๋–ค ๋ฐ์ดํ„ฐ๊ฐ€ ์กด์žฌํ•˜๊ณ , ๊ทธ ๋ฐ์ดํ„ฐ๋“ค ๊ฐ„์˜ ๊ด€๊ณ„๊ฐ€ ๋ฌด์—‡์ธ์ง€, ๊ทธ๋ฆฌ๊ณ  ํด๋ผ์ด์–ธํŠธ๊ฐ€ ์–ด๋–ค ์š”์ฒญ์„ ํ•  ์ˆ˜ ์žˆ๋Š”์ง€๋ฅผ ๋ช…ํ™•ํžˆ ์„ค๋ช…ํ•ฉ๋‹ˆ๋‹ค.
  • ์Šคํ‚ค๋งˆ์—๋Š” ํƒ€์ž…(Types), ์ฟผ๋ฆฌ(Queries), ๋ฎคํ…Œ์ด์…˜(Mutations)์ด ํฌํ•จ๋˜์–ด ์žˆ์œผ๋ฉฐ, ์ด ์Šคํ‚ค๋งˆ๋ฅผ ๋ฐ”ํƒ•์œผ๋กœ ํด๋ผ์ด์–ธํŠธ๋Š” ์–ด๋–ค ๋ฐ์ดํ„ฐ๋ฅผ ์š”์ฒญํ•  ์ˆ˜ ์žˆ๋Š”์ง€ ์•Œ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

2. ์ฟผ๋ฆฌ (Queries)

  • ์ฟผ๋ฆฌ๋Š” ํด๋ผ์ด์–ธํŠธ๊ฐ€ ๋ฐ์ดํ„ฐ๋ฅผ ์ฝ๊ธฐ ์œ„ํ•ด ์„œ๋ฒ„์— ์š”์ฒญ์„ ๋ณด๋‚ด๋Š” ๋ฐฉ์‹์ž…๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด, ํŠน์ • ์‚ฌ์šฉ์ž์˜ ์ •๋ณด๋ฅผ ์š”์ฒญํ•  ๋•Œ ์ฟผ๋ฆฌ๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.
  • REST์—์„œ GET ์š”์ฒญ๊ณผ ์œ ์‚ฌํ•˜์ง€๋งŒ, ํ•„์š”ํ•œ ๋ฐ์ดํ„ฐ ํ•„๋“œ๋งŒ ์„ ํƒํ•˜์—ฌ ์š”์ฒญํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด, ์‚ฌ์šฉ์ž์˜ ์ด๋ฆ„๊ณผ ์ด๋ฉ”์ผ๋งŒ ์š”์ฒญํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ฟผ๋ฆฌ ์˜ˆ์‹œ
query {
  asset(id: "1") {
    id
    name
    description
  }
}

์ด ์ฟผ๋ฆฌ๋Š” ID๊ฐ€ 1์ธ ์ž์‚ฐ์˜ ID, ์ด๋ฆ„, ์„ค๋ช…์„ ์š”์ฒญํ•ฉ๋‹ˆ๋‹ค.

3. ๋ฎคํ…Œ์ด์…˜ (Mutations)

  • ๋ฎคํ…Œ์ด์…˜์€ ์„œ๋ฒ„์˜ ๋ฐ์ดํ„ฐ๋ฅผ ์ƒ์„ฑ(Create), ์ˆ˜์ •(Update), ์‚ญ์ œ(Delete)ํ•  ๋•Œ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค. REST์˜ POST, PUT, DELETE์™€ ๋น„์Šทํ•œ ๊ฐœ๋…์ž…๋‹ˆ๋‹ค.
  • ๋ฎคํ…Œ์ด์…˜์„ ํ†ตํ•ด ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์— ๋ณ€๊ฒฝ์ด ์ผ์–ด๋‚œ ํ›„, ์š”์ฒญํ•œ ํด๋ผ์ด์–ธํŠธ์—๊ฒŒ ๋ณ€๊ฒฝ๋œ ๋ฐ์ดํ„ฐ๊ฐ€ ๋ฐ˜ํ™˜๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋ฎคํ…Œ์ด์…˜ ์˜ˆ์‹œ
mutation CreateGroup {
  createGroup(input: { name: "Group 1", description: "Group 1 description" }) {
    id
    name
    description
  }
}

์ด ๋ฎคํ…Œ์ด์…˜์€ ์ƒˆ๋กœ์šด ๊ทธ๋ฃน์„ ์ƒ์„ฑํ•˜๊ณ , ์ƒ์„ฑ๋œ ๊ทธ๋ฃน์˜ ID, ์ด๋ฆ„, ์„ค๋ช…์„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.

4. ํƒ€์ž… (Type)

  • GraphQL์˜ ๋ชจ๋“  ๋ฐ์ดํ„ฐ๋Š” ํƒ€์ž…์œผ๋กœ ์ •์˜๋ฉ๋‹ˆ๋‹ค. ํƒ€์ž…์€ ์Šคํ‚ค๋งˆ์—์„œ ๋ฐ์ดํ„ฐ๋ฅผ ์–ด๋–ป๊ฒŒ ๊ตฌ์„ฑํ• ์ง€ ๋‚˜ํƒ€๋‚ด๋ฉฐ, ๊ฐ ํƒ€์ž…์€ ํ•„๋“œ๋ฅผ ๊ฐ€์ง€๋ฉฐ ํ•„๋“œ๋งˆ๋‹ค ๋ฐ์ดํ„ฐ ์œ ํ˜•์ด ์žˆ์Šต๋‹ˆ๋‹ค.
  • ์˜ˆ๋ฅผ ๋“ค์–ด, User ํƒ€์ž…์€ ์‚ฌ์šฉ์ž์˜ ID, ์ด๋ฆ„, ์ด๋ฉ”์ผ ๋“ฑ์˜ ํ•„๋“œ๋ฅผ ๊ฐ€์งˆ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํƒ€์ž… ์˜ˆ์‹œ
type Asset {
    id: ID!
    name: String!
    description: String
}

์ด ํƒ€์ž… ์ •์˜๋Š” ID, ์ด๋ฆ„, ์„ค๋ช… ํ•„๋“œ๋ฅผ ๊ฐ€์ง€๋Š” Asset ํƒ€์ž…์„ ์ •์˜ํ•ฉ๋‹ˆ๋‹ค.

5. ํ•„๋“œ (Field)

  • GraphQL ์ฟผ๋ฆฌ์—์„œ ํ•„๋“œ๋Š” ๋ฐ์ดํ„ฐ๋ฅผ ์š”์ฒญํ•˜๋Š” ๋‹จ์œ„์ž…๋‹ˆ๋‹ค. ํด๋ผ์ด์–ธํŠธ๋Š” ํ•„์š”ํ•œ ํ•„๋“œ๋งŒ ์„ ํƒ์ ์œผ๋กœ ์š”์ฒญํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ, ์„œ๋ฒ„๋Š” ์„ ํƒ๋œ ํ•„๋“œ๋งŒ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. ์ด๋ฅผ ํ†ตํ•ด ๋ถˆํ•„์š”ํ•œ ๋ฐ์ดํ„ฐ๋ฅผ ์ฃผ๊ณ ๋ฐ›์ง€ ์•Š๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.

6. ํ•„ํ„ฐ๋ง, ํŽ˜์ด์ง•, ์ •๋ ฌ

  • GraphQL์€ ํด๋ผ์ด์–ธํŠธ๊ฐ€ ์ฟผ๋ฆฌ ์‹œ ๋‹ค์–‘ํ•œ ์กฐ๊ฑด์„ ๊ฑธ์–ด ๋ฐ์ดํ„ฐ๋ฅผ ํ•„ํ„ฐ๋งํ•˜๊ฑฐ๋‚˜ ํŽ˜์ด์ง•(ํŽ˜์ด์ง€ ๋‹จ์œ„๋กœ ๋ฐ์ดํ„ฐ๋ฅผ ๋‚˜๋ˆ ์„œ ์š”์ฒญ), ์ •๋ ฌ ๋“ฑ์„ ํ•  ์ˆ˜ ์žˆ๋Š” ์œ ์—ฐ์„ฑ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค. ์˜ˆ์‹œ
query Assets {
  assets(pageable: { page: 0, size: 10, sort: [CREATED_AT_DESC] }) {
    items {
      id
      name
      description
    }
  }
}

์ด ์ฟผ๋ฆฌ๋Š” assets๋ฅผ ์š”์ฒญํ•˜๊ณ , ํŽ˜์ด์ง€๋„ค์ด์…˜, ์ •๋ ฌ, ํ•„๋“œ ์„ ํƒ ๋“ฑ์„ ์ ์šฉํ•œ ์˜ˆ์‹œ์ž…๋‹ˆ๋‹ค.

GraphQL์˜ ์žฅ์ 

  • ํšจ์œจ์ ์ธ ๋ฐ์ดํ„ฐ ์ „์†ก: ํด๋ผ์ด์–ธํŠธ๋Š” ํ•„์š”ํ•œ ๋ฐ์ดํ„ฐ๋งŒ ์ •ํ™•ํ•˜๊ฒŒ ์š”์ฒญํ•  ์ˆ˜ ์žˆ๊ธฐ ๋•Œ๋ฌธ์—, ๋ถˆํ•„์š”ํ•œ ๋ฐ์ดํ„ฐ ์ „์†ก์„ ์ค„์ผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • ํ•˜๋‚˜์˜ ์—”๋“œํฌ์ธํŠธ: REST API์™€ ๋‹ฌ๋ฆฌ ์—ฌ๋Ÿฌ ์—”๋“œํฌ์ธํŠธ๋ฅผ ์‚ฌ์šฉํ•˜์ง€ ์•Š๊ณ , ํ•˜๋‚˜์˜ ์—”๋“œํฌ์ธํŠธ์—์„œ ๋‹ค์–‘ํ•œ ๋ฐ์ดํ„ฐ๋ฅผ ์š”์ฒญํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • ํƒ€์ž… ์‹œ์Šคํ…œ: ์Šคํ‚ค๋งˆ๋ฅผ ํ†ตํ•ด API์˜ ๊ตฌ์กฐ๊ฐ€ ๋ช…ํ™•ํžˆ ์ •์˜๋˜์–ด ์žˆ์–ด, ์š”์ฒญํ•˜๋Š” ๋ฐ์ดํ„ฐ์˜ ํƒ€์ž…์„ ์‰ฝ๊ฒŒ ์ดํ•ดํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ, ๊ฐœ๋ฐœ ์ค‘์— ์˜ค๋ฅ˜๋ฅผ ์ค„์ผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์‹œ์ž‘ํ•˜๊ธฐ(Getting Started)

  • API ์—”๋“œํฌ์ธํŠธ: {{app-server-url}}: https://dev.localhost/app

    • Dataset Application: {{app-server-url}}/api/dataset/graphql
    • Layerset Application: {{app-server-url}}/api/layerset/graphql
    • Userset Application: {{app-server-url}}/api/userset/graphql
  • ์ธ์ฆ ๋ฐฉ๋ฒ•: API ์‚ฌ์šฉ ์‹œ ํ•„์š”ํ•œ ์ธ์ฆ ๋ฐฉ์‹์€ JWT ํ† ํฐ ๋ฐฉ์‹ ์ž…๋‹ˆ๋‹ค, ์˜ˆ์ œ ์š”์ฒญ์€ ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค:
    {{auth-server-url}}/realms/{{auth-realm}}/protocol/openid-connect/token
    {{auth-server-url}}: https://dev.localhost/auth
    {{auth-realm}}: mago3d
    POST https://dev.localhost/auth/realms/mago3d/protocol/openid-connect/token

1. mago3d-front ํด๋ผ์ด์–ธํŠธ

{
  "grant_type": "password",
  "client_id": "mago3d-front",
  "username": "admin",
  "password": {{admin password}}
}

2. mago3d-api ํด๋ผ์ด์–ธํŠธ

{
  "grant_type": "client_credentials",
  "client_id": "mago3d-api",
  "client_secret": {{client secret key}}
}
{
    "access_token": {{access token}},
    "expires_in": 35999,
    "refresh_expires_in": 0,
    "token_type": "Bearer",
    "not-before-policy": 0,
    "scope": "profile email"
}
  • ์š”์ฒญ ๋ฐ ์‘๋‹ต ํ˜•์‹: GraphQL ์ฟผ๋ฆฌ ๋ฐ ๋ฎคํ…Œ์ด์…˜์˜ ์š”์ฒญ ํ˜•์‹๊ณผ ์„œ๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐ›๋Š” ์‘๋‹ต ํ˜•์‹์— ๋Œ€ํ•ด ์„ค๋ช…ํ•ฉ๋‹ˆ๋‹ค.

์ฟผ๋ฆฌ ์š”์ฒญ ์˜ˆ์‹œ

query Asset {
  asset(id: "1") {
    id
    name
    description
  }
}

์ฟผ๋ฆฌ ์‘๋‹ต ์˜ˆ์‹œ

{
  "data": {
    "asset": {
      "id": "1",
      "name": "Asset 1",
      "description": "This is asset 1"
    }
  }
}

๋ฎคํ…Œ์ด์…˜ ์š”์ฒญ ์˜ˆ์‹œ

mutation CreateGroup {
  createGroup(input: { name: "Group 1", description: "Group 1 description" }) {
    id
    name
    description
  }
}

๋ฎคํ…Œ์ด์…˜ ์‘๋‹ต ์˜ˆ์‹œ

{
  "data": {
    "createGroup": {
      "id": "1",
      "name": "Group 1",
      "description": "Group 1 description"
    }
  }
}

์—๋Ÿฌ์ฒ˜๋ฆฌ ์‘๋‹ต

GraphQL ์š”์ฒญ์ด ์‹คํŒจํ•˜๋ฉด, errors ํ•„๋“œ๋ฅผ ํฌํ•จํ•œ ์‘๋‹ต์ด ๋ฐ˜ํ™˜๋ฉ๋‹ˆ๋‹ค.

{
  "errors": [
    {
      "message": "AssetNotFound",
      "locations": [
        {
          "line": 2,
          "column": 5
        }
      ],
      "path": [
        "asset"
      ],
      "extensions": {
        "classification": "NOT_FOUND"
      }
    }
  ],
  "data": {
    "asset": null
  }
}

์Šคํ‚ค๋งˆ ๊ฐœ์š” (Schema Overview)

  • ํƒ€์ž… (Types)
  • ์ฟผ๋ฆฌ (Queries)
  • ๋ฎคํ…Œ์ด์…˜ (Mutations)

mago3D API ๋ฌธ์„œ ์ฐธ๊ณ 

์˜ˆ์ œ (Examples)

๋ฐ์ดํ„ฐ ๋ณ€ํ™˜

mutation CreateProcess {
    createProcess(
        input: {
            name: "convert 1"
            source: { assetId: [1] }
            context: { t3d: { inputType: FBX, recursive: true } }
        }
    ) {
        id
        name
        status
        createdBy
        createdAt
        updatedBy
        updatedAt
    }
}

๋ฐ์ดํ„ฐ ๋ณ€ํ™˜ ์ƒํƒœ ์กฐํšŒ

query Process {
    process(id: "1") {
        id
        name
        context
        status
    }
}

๋ ˆ์ด์–ด ๋ฐœํ–‰

mutation CreateAsset {
    createAsset(
        input: {
            name: "test"
            description: "test"
            context: { t3d: { dataAssetId: "1" } }
            type: TILES3D
        }
    ) {
        id
        name
        description
        type
        enabled
        visible
        access
        status
        order
    }
}

๋ ˆ์ด์–ด ๋ชฉ๋ก ์กฐํšŒ

query Assets {
  assets {
    id
    name
    description
    type
    enabled
    visible
    access
    status
    order
    properties
  }
}