{
"init" => [
[ "set", "$P0.boundary", "Amgrmg43ghg3g39glv0k2ldk"]
],
"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/", "$S0.pageId", "/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"],
[ "string.concat", "$L0.url", "https://graph.facebook.com/v2.8/", "$S0.pageId", "/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"],
[ "string.concat", "$L0.url", "https://graph-video.facebook.com/v2.8/", "$S0.pageId", "/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" => [
],
"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"]
],
"checkAuthentication" => [
[ "if==than", "$S0.accessToken", nil, 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=manage_pages%2Cpublish_pages%2Cpages_show_list"],
[ "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"],
[ "callFunc", "getPageCredentials", "$P0", "$L2.access_token"]
],
"getPageCredentials" => [
[ "create", "$L0", "Object"],
[ "set", "$L0.method", "GET"],
[ "string.concat", "$L0.url", "https://graph.facebook.com/v2.8/me/accounts", "?access_token=", "$P1"],
[ "http.requestCall", "$L1", "$L0"],
[ "callFunc", "validateResponse", "$P0", "$L1"],
[ "json.parse", "$L2", "$L1.responseBody"],
[ "set", "$L3", "$L2.data"],
[ "size", "$L4", "$L3"],
[ "create", "$L5", "Number", 0],
[ "if<than", "$L5", "$L4", 7],
[ "get", "$L6", "$L3", "$L5"],
[ "if==than", "$L6.name", "$P0.pageName", 3],
[ "set", "$S0.accessToken", "$L6.access_token"],
[ "set", "$S0.pageId", "$L6.id"],
[ "jumpRel", 2],
[ "math.add", "$L5", "$L5", 1],
[ "jumpRel", -8],
[ "if==than", "$S0.accessToken", nil, 2],
[ "create", "$L7", "Error", "The page was not found or the signed in user is not an admin of that page.", "IllegalArgument"],
[ "throwError", "$L7"]
],
"validateResponse" => [
[ "if>=than", "$P1.code", 400, 3],
[ "stream.streamToString", "$L2", "$P1.responseBody"],
[ "create", "$L3", "Error", "$L2", "Http"],
[ "throwError", "$L3"]
]
}