string proxy = project.Variables["PROXY"].Value;
string API_KODE = project.Variables["API_KODE"].Value;
string title = project.Variables["TITLE"].Value;
string content = project.Variables["CONTENT"].Value;
string partner_url =project.Variables["URL_PARTNER"].Value;
string partner_ancor =project.Variables["ANCOR_PARTNER"].Value;
string autor_url =project.Variables["URL_AVTOR"].Value;
string autor_ancor =project.Variables["ANCOR_AVTOR"].Value;
string URL_IMG = project.Variables["URL_IMG"].Value;
var partner_href = new Dictionary<string,object>();
partner_href["href"] = partner_url;
partner_href["target"] = "_blank";
var partner_text = new Dictionary<string,object>();
partner_text["tag"] = "a";
partner_text["attrs"] = partner_href;
partner_text["children"] = new[]{ partner_ancor };
var partner = new Dictionary<string,object>();
partner["tag"] = "p";
partner["children"] = new Dictionary<string,object>[]{partner_text} ;
var content_text = new Dictionary<string,object>();
content_text["tag"] = "p";
content_text["children"] = new []{content};
var content_tag = new Dictionary<string,object>();
content_tag["tag"] = "figcaption";
content_tag["children"] = new[]{""};
var content_class = new Dictionary<string,object>();
content_class["class"] = "figure_wrapper";
var content_src = new Dictionary<string,object>();
content_src["src"] = URL_IMG;
var content_src_img = new Dictionary<string,object>();
content_src_img["tag"] = "img";
content_src_img["attrs"] = content_src;
var content_div = new Dictionary<string,object>();
content_div["tag"] = "div";
content_div["attrs"] = content_class;
content_div["children"] = new[]{content_src_img};
var content_image = new Dictionary<string,object>();
content_image["tag"] = "figure";
content_image["children"] = new Dictionary<string,object>[]{ content_div, content_tag} ;
var all_block = new List<object>();
all_block.Add(content_image);
all_block.Add(content_text);
all_block.Add(partner);
string url = "https://api.telegra.ph/createPage";
string content_type = @"application/json";
var form_params = new Dictionary<string, object>();
form_params.Add("access_token", API_KODE );
form_params.Add("title",title );
form_params.Add("author_name", autor_ancor);
form_params.Add("author_url", autor_url);
form_params.Add("content", all_block);
form_params.Add("return_content", "true");
string query = Global.ZennoLab.Json.JsonConvert.SerializeObject(form_params, Global.ZennoLab.Json.Formatting.None);
var method = ZennoLab.InterfacesLibrary.Enums.Http.HttpMethod.POST;
string encoding =Encoding.UTF8.WebName;
var type = ZennoLab.InterfacesLibrary.Enums.Http.ResponceType.BodyOnly;
string post = ZennoPoster.HTTP.Request(
method: method,
url: url,
content: query,
contentPostingType: content_type,
proxy: proxy,
Encoding: encoding,
respType: type,
Timeout: 180 * 1000,
UseRedirect: false,
MaxRedirectCount: 0,
UseOriginalUrl: true,
removeDefaultHeaders: true
);
return post;