{
"init" => [
[ "set", "$P0.boundary", "Amgrmg43ghg3g39glv0k2ldk"]
],
"AdvancedRequestSupporter:advancedRequest" => [
[ "create", "$L0", "Object"],
[ "create", "$L0.url", "String"],
[ "if!=than", "$P2.appendBaseUrl", 0, 1],
[ "set", "$L0.url", "https://graph.facebook.com"],
[ "string.concat", "$L0.url", "$L0.url", "$P2.url"],
[ "set", "$L0.requestHeaders", "$P2.headers"],
[ "set", "$L0.method", "$P2.method"],
[ "set", "$L0.requestBody", "$P2.body"],
[ "if!=than", "$P2.appendAuthorization", 0, 2],
[ "callFunc", "checkAuthentication", "$P0"],
[ "string.concat", "$L0.requestHeaders.Authorization", "Bearer ", "$S0.accessToken"],
[ "http.requestCall", "$L1", "$L0"],
[ "if!=than", "$P2.checkErrors", 0, 1],
[ "callFunc", "validateResponse", "$P0", "$L1"],
[ "create", "$P1", "AdvancedRequestResponse"],
[ "set", "$P1.status", "$L1.code"],
[ "set", "$P1.headers", "$L1.responseHeaders"],
[ "set", "$P1.body", "$L1.responseBody"]
],
"Social:postUpdate" => [
[ "if==than", "$P1", nil, 2],
[ "create", "$L0", "Error", "The content is not allowed to be null.", "IllegalArgument"],
[ "throwError", "$L0"],
[ "callFunc", "checkAuthentication", "$P0"],
[ "create", "$L3", "String"],
[ "string.urlEncode", "$L3", "$P1"],
[ "create", "$L0", "Object"],
[ "set", "$L0.method", "POST"],
[ "create", "$L1", "String"],
[ "string.concat", "$L1", "https://graph.facebook.com/v2.8/me/feed?message=", "$L3"],
[ "set", "$L0.url", "$L1"],
[ "create", "$L0.requestHeaders", "Object"],
[ "string.concat", "$L0.requestHeaders.Authorization", "Bearer ", "$S0.accessToken"],
[ "create", "$L2", "Object"],
[ "http.requestCall", "$L2", "$L0"],
[ "callFunc", "validateResponse", "$P0", "$L2"]
],
"Social:postImage" => [
[ "if==than", "$P1", nil, 2],
[ "create", "$L0", "Error", "The message is not allowed to be null.", "IllegalArgument"],
[ "throwError", "$L0"],
[ "if==than", "$P2", nil, 2],
[ "create", "$L0", "Error", "The image is not allowed to be null.", "IllegalArgument"],
[ "throwError", "$L0"],
[ "callFunc", "checkAuthentication", "$P0"],
[ "create", "$L0", "Object"],
[ "set", "$L0.method", "POST"],
[ "set", "$L0.url", "https://graph.facebook.com/v2.8/me/photos"],
[ "create", "$L0.requestHeaders", "Object"],
[ "string.concat", "$L0.requestHeaders.Content-Type", "multipart/form-data; boundary=", "$P0.boundary"],
[ "string.concat", "$L0.requestHeaders.Authorization", "Bearer ", "$S0.accessToken"],
[ "string.concat", "$L1", "--", "$P0.boundary", "\r\n"],
[ "string.concat", "$L1", "$L1", "Content-Disposition: form-data; name=\"caption\"\r\n\r\n"],
[ "string.concat", "$L1", "$L1", "$P1", "\r\n"],
[ "string.concat", "$L1", "$L1", "--", "$P0.boundary", "\r\n"],
[ "string.concat", "$L1", "$L1", "Content-Disposition: form-data; name=\"source\"; filename=\"somename\"\r\n"],
[ "string.concat", "$L1", "$L1", "Content-Transfer-Encoding: binary\r\n\r\n"],
[ "stream.stringToStream", "$L1", "$L1"],
[ "string.concat", "$L2", "\r\n--", "$P0.boundary", "--"],
[ "stream.stringToStream", "$L2", "$L2"],
[ "stream.makeJoinedStream", "$L0.requestBody", "$L1", "$P2", "$L2"],
[ "http.requestCall", "$L4", "$L0"],
[ "callFunc", "validateResponse", "$P0", "$L4"]
],
"Social:postVideo" => [
[ "if==than", "$P1", nil, 2],
[ "create", "$L0", "Error", "The message is not allowed to be null.", "IllegalArgument"],
[ "throwError", "$L0"],
[ "if==than", "$P2", nil, 2],
[ "create", "$L0", "Error", "The image is not allowed to be null.", "IllegalArgument"],
[ "throwError", "$L0"],
[ "callFunc", "checkAuthentication", "$P0"],
[ "create", "$L0", "Object"],
[ "set", "$L0.method", "POST"],
[ "set", "$L0.url", "https://graph-video.facebook.com/v2.8/me/videos"],
[ "string.indexOf", "$L20", "$P4", "/"],
[ "math.add", "$L20", "$L20", 1],
[ "string.substring", "$L21", "$P4", "$L20"],
[ "create", "$L0.requestHeaders", "Object"],
[ "string.concat", "$L0.requestHeaders.Content-Type", "multipart/form-data; boundary=", "$P0.boundary"],
[ "string.concat", "$L0.requestHeaders.Authorization", "Bearer ", "$S0.accessToken"],
[ "string.concat", "$L1", "--", "$P0.boundary", "\r\n"],
[ "string.concat", "$L1", "$L1", "Content-Disposition: form-data; name=\"description\"\r\n\r\n"],
[ "string.concat", "$L1", "$L1", "$P1", "\r\n"],
[ "string.concat", "$L1", "$L1", "--", "$P0.boundary", "\r\n"],
[ "string.concat", "$L1", "$L1", "Content-Disposition: form-data; name=\"source\"; filename=\"somename.", "$L21", "\"\r\n"],
[ "string.concat", "$L1", "$L1", "Content-Transfer-Encoding: binary\r\n\r\n"],
[ "stream.stringToStream", "$L1", "$L1"],
[ "string.concat", "$L2", "\r\n--", "$P0.boundary", "--"],
[ "stream.stringToStream", "$L2", "$L2"],
[ "stream.makeJoinedStream", "$L0.requestBody", "$L1", "$P2", "$L2"],
[ "http.requestCall", "$L4", "$L0"],
[ "callFunc", "validateResponse", "$P0", "$L4"]
],
"Social:getConnections" => [
[ "callFunc", "checkAuthentication", "$P0"],
[ "create", "$L0", "Object"],
[ "set", "$L0.method", "GET"],
[ "create", "$L1", "String"],
[ "string.concat", "$L1", "https://graph.facebook.com/v2.8/me/friends"],
[ "set", "$L0.url", "$L1"],
[ "create", "$L0.requestHeaders", "Object"],
[ "string.concat", "$L0.requestHeaders.Authorization", "Bearer ", "$S0.accessToken"],
[ "create", "$L2", "Object"],
[ "http.requestCall", "$L2", "$L0"],
[ "callFunc", "validateResponse", "$P0", "$L2"],
[ "create", "$L3", "String"],
[ "stream.streamToString", "$L3", "$L2.responseBody"],
[ "json.parse", "$L4", "$L3"],
[ "create", "$L9", "Number"],
[ "size", "$L9", "$L4.data"],
[ "create", "$P1", "Array"],
[ "if!=than", "$L9", 0, 11],
[ "set", "$L5", "$L4.data.items"],
[ "create", "$L6", "Number"],
[ "size", "$L6", "$L5"],
[ "create", "$L7", "Number", 0],
[ "if<than", "$L7", "$L6", 6],
[ "create", "$L8", "Object"],
[ "get", "$L8", "$L5", "$L7"],
[ "string.concat", "$L9", "facebook-", "$L8.id"],
[ "push", "$P1", "$L9"],
[ "math.add", "$L7", "$L7", 1],
[ "jumpRel", -7]
],
"Authenticating:login" => [
[ "callFunc", "checkAuthentication", "$P0"]
],
"Authenticating:logout" => [
[ "set", "$P0.userInfo", nil],
[ "if!=than", "$S0.accessToken", nil, 10],
[ "create", "$L0", "Object"],
[ "set", "$L0.method", "DELETE"],
[ "create", "$L1", "String"],
[ "string.concat", "$L1", "https://graph.facebook.com/v2.8/me/permissions"],
[ "set", "$L0.url", "$L1"],
[ "create", "$L0.requestHeaders", "Object"],
[ "string.concat", "$L0.requestHeaders.Authorization", "Bearer ", "$S0.accessToken"],
[ "create", "$L2", "Object"],
[ "http.requestCall", "$L2", "$L0"],
[ "callFunc", "validateResponse", "$P0", "$L2"]
],
"Profile:getIdentifier" => [
[ "callFunc", "checkUserInfo", "$P0"],
[ "string.concat", "$P1", "facebook-", "$P0.userInfo.id"]
],
"Profile:getFullName" => [
[ "callFunc", "checkUserInfo", "$P0"],
[ "if!=than", "$P0.userInfo.name", nil, 1],
[ "set", "$P1", "$P0.userInfo.name"]
],
"Profile:getEmail" => [
[ "callFunc", "checkUserInfo", "$P0"],
[ "if!=than", "$P0.userInfo.email", nil, 1],
[ "set", "$P1", "$P0.userInfo.email"]
],
"Profile:getGender" => [
[ "callFunc", "checkUserInfo", "$P0"],
[ "if!=than", "$P0.userInfo.gender", nil, 7],
[ "if==than", "$P0.userInfo.gender", "male", 2],
[ "set", "$P1", "$P0.userInfo.gender"],
[ "return"],
[ "if==than", "$P0.userInfo.gender", "female", 2],
[ "set", "$P1", "$P0.userInfo.gender"],
[ "return"],
[ "set", "$P1", "other"]
],
"Profile:getDescription" => [
[ "callFunc", "checkUserInfo", "$P0"],
[ "if!=than", "$P0.userInfo.about", nil, 1],
[ "set", "$P1", "$P0.userInfo.about"]
],
"Profile:getDateOfBirth" => [
[ "callFunc", "checkUserInfo", "$P0"],
[ "create", "$P1", "DateOfBirth"],
[ "if!=than", "$P0.userInfo.birthday", nil, 10],
[ "string.split", "$L0", "$P0.userInfo.birthday", "/"],
[ "get", "$L1", "$L0", 0],
[ "if!=than", "$L1", "00", 1],
[ "math.add", "$P1.month", "$L1", 0],
[ "get", "$L1", "$L0", 1],
[ "if!=than", "$L1", "00", 1],
[ "math.add", "$P1.day", "$L1", 0],
[ "get", "$L1", "$L0", 2],
[ "if!=than", "$L1", "0000", 1],
[ "math.add", "$P1.year", "$L1", 0]
],
"Profile:getLocale" => [
[ "callFunc", "checkUserInfo", "$P0"],
[ "if!=than", "$P0.userInfo.locale", nil, 3],
[ "create", "$L1", "String"],
[ "string.substring", "$L1", "$P0.userInfo.locale", 0, 2],
[ "set", "$P1", "$L1"]
],
"Profile:getPictureURL" => [
[ "callFunc", "checkUserInfo", "$P0"],
[ "if!=than", "$P0.userInfo.picture.data.url", nil, 1],
[ "set", "$P1", "$P0.userInfo.picture.data.url"]
],
"checkUserInfo" => [
[ "create", "$L0", "Date"],
[ "if!=than", "$P0.userInfo", nil, 2],
[ "if>than", "$P0.expirationTime", "$L0", 1],
[ "return"],
[ "callFunc", "checkAuthentication", "$P0"],
[ "create", "$L2", "Object"],
[ "set", "$L2.url", "https://graph.facebook.com/v2.8/me?fields=locale,gender,name,birthday,email,about"],
[ "create", "$L2.requestHeaders", "Object"],
[ "string.concat", "$L2.requestHeaders.Authorization", "Bearer ", "$S0.accessToken"],
[ "set", "$L2.method", "GET"],
[ "http.requestCall", "$L3", "$L2"],
[ "callFunc", "validateResponse", "$P0", "$L3"],
[ "json.parse", "$P0.userInfo", "$L3.responseBody"],
[ "create", "$L2", "Object"],
[ "set", "$L2.url", "https://graph.facebook.com/v2.8/me/picture?fields=url&type=large&redirect=false"],
[ "create", "$L2.requestHeaders", "Object"],
[ "string.concat", "$L2.requestHeaders.Authorization", "Bearer ", "$S0.accessToken"],
[ "set", "$L2.method", "GET"],
[ "http.requestCall", "$L3", "$L2"],
[ "callFunc", "validateResponse", "$P0", "$L3"],
[ "json.parse", "$L4", "$L3.responseBody"],
[ "set", "$P0.userInfo.picture", "$L4"],
[ "create", "$P0.expirationTime", "Date"],
[ "math.add", "$P0.expirationTime.time", "$P0.expirationTime.time", 60000]
],
"checkAuthentication" => [
[ "create", "$L0", "Date"],
[ "if==than", "$S0.accessToken", nil, 2],
[ "callFunc", "authenticate", "$P0"],
[ "return"],
[ "create", "$L1", "Date"],
[ "set", "$L1.time", "$S0.expireIn"],
[ "if<than", "$L1", "$L0", 1],
[ "callFunc", "authenticate", "$P0"]
],
"authenticate" => [
[ "create", "$L0", "String"],
[ "create", "$L1", "String"],
[ "string.urlEncode", "$L3", "$P0.redirectUri"],
[ "string.concat", "$L0", "https://www.facebook.com/dialog/oauth?response_type=code&client_id=", "$P0.clientID", "&redirect_uri=", "$L3", "&state=", "$P0.state", "&scope=public_profile%2Cemail%2Cuser_birthday%2Cuser_about_me%2Cpublish_actions%2Cuser_friends%2Cuser_photos"],
[ "awaitCodeRedirect", "$L2", "$L0"],
[ "string.concat", "$L1", "https://graph.facebook.com/v2.8/oauth/access_token?client_id=", "$P0.clientID", "&redirect_uri=", "$L3", "&client_secret=", "$P0.clientSecret", "&code=", "$L2"],
[ "create", "$L5", "Object"],
[ "set", "$L5.url", "$L1"],
[ "set", "$L5.method", "GET"],
[ "http.requestCall", "$L6", "$L5"],
[ "callFunc", "validateResponse", "$P0", "$L6"],
[ "stream.streamToString", "$L7", "$L6.responseBody"],
[ "json.parse", "$L8", "$L7"],
[ "set", "$S0.accessToken", "$L8.access_token"],
[ "create", "$L0", "Object"],
[ "set", "$L0.method", "GET"],
[ "string.concat", "$L0.url", "https://graph.facebook.com/v2.8/oauth/access_token?client_id=", "$P0.clientID", "&client_secret=", "$P0.clientSecret", "&grant_type=fb_exchange_token&fb_exchange_token=", "$S0.accessToken"],
[ "http.requestCall", "$L1", "$L0"],
[ "callFunc", "validateResponse", "$P0", "$L1"],
[ "json.parse", "$L2", "$L1.responseBody"],
[ "set", "$S0.accessToken", "$L2.access_token"],
[ "create", "$L10", "Date"],
[ "math.multiply", "$L9", 60, 24, 60, 60, 1000],
[ "math.add", "$L9", "$L9", "$L10.time", -60000],
[ "set", "$S0.expireIn", "$L9"]
],
"validateResponse" => [
[ "if>=than", "$P1.code", 400, 3],
[ "stream.streamToString", "$L2", "$P1.responseBody"],
[ "create", "$L3", "Error", "$L2", "Http"],
[ "throwError", "$L3"]
]
}