appdata.getKeyData - GiGAGenie-ServiceSDK/UserGuide GitHub Wiki

gigagenie.appdata.getKeyData

API ์„ค๋ช…

  • ๋ฐ์ดํ„ฐ ์กฐํšŒ API
  • ํŠน์ • ์ด๋ฆ„์˜ ๋ฐ์ดํ„ฐ๋„ค์ž„์ŠคํŽ˜์ด์Šค์˜ Key์— ๋Œ€ํ•œ Data๋ฅผ ์กฐํšŒํ•œ๋‹ค.

API ๊ตฌ์กฐ

  • function getKeyData(options,callback)
  • options
    • namespace: (String, Mandatory) ์กฐํšŒํ•  appdata Namespace
    • key: (String, Mandatory) ํ•ด๋‹น NameSpace์—์„œ ์กฐํšŒํ•  ๋ฐ์ดํ„ฐ Key
  • result_cd
    • 200: ์„ฑ๊ณต
    • 403: ํ•ด๋‹น NameSpace๊ฐ€ ์กด์žฌํ•˜์ง€ ์•Š์Œ
    • 404: ํ•ด๋‹น Key๊ฐ€ ์กด์žฌํ•˜์ง€ ์•Š์Œ
    • 500: ์‹œ์Šคํ…œ Error
  • extra
    • data: (String, Mandatory) key์— ๋Œ€ํ•œ text ๋ฐ์ดํ„ฐ

์‚ฌ์šฉ ์˜ˆ์‹œ

// callback ๋ฐฉ์‹
var options = {};
options.namespace = 'userappprofile';
options.key = 'appusername';
gigagenie.appdata.getKeyData(options, function (result_cd, result_msg, extra) {
    if (result_cd === 200) {
        console.log(options.key + ":" + extra.data);
    } else {
        console.log("Error");
    }
});

// promise ๋ฐฉ์‹
var options = {};
options.namespace = 'userappprofile';
options.key = 'appusername';
gigagenie.appdata.getKeyData(options).then(function (extra) {
    console.log(options.key + ":" + extra.data);
}).catch(function (result_cd, result_msg, extra) {
    console.log("Error");
})