public Translation Translate(string text, LangPair lang, OutputFormat?format = null, bool options = false) { RestRequest request = new RestRequest("translate"); request.AddParameter("key", _key); request.AddParameter("text", text); if (lang.OutputLang != Lang.None) { if (lang.InputLang == Lang.None) { request.AddParameter("lang", lang.OutputLang.ToString().ToLowerInvariant()); } else { request.AddParameter("lang", lang.ToString().ToLowerInvariant()); } } if (format.HasValue) { request.AddParameter("format", format.ToString().ToLowerInvariant()); } if (options) { request.AddParameter("options", "1"); } return(SendRequest <Translation>(request)); }
public DicResult Lookup(LangPair lang, string text, string ui = null, LookupOptions flags = 0) { RestRequest request = new RestRequest("lookup"); request.AddParameter("key", _key); request.AddParameter("lang", lang.ToString().ToLowerInvariant()); request.AddParameter("text", text); if (!string.IsNullOrEmpty(ui)) request.AddParameter("ui", ui); if (flags != 0) request.AddParameter("flags", (int)flags); return SendRequest<DicResult>(request); }
public DicResult Lookup(LangPair lang, string text, string ui = null, LookupOptions flags = 0) { RestRequest request = new RestRequest("lookup"); request.AddParameter("key", _key); request.AddParameter("lang", lang.ToString().ToLowerInvariant()); request.AddParameter("text", text); if (!string.IsNullOrEmpty(ui)) { request.AddParameter("ui", ui); } if (flags != 0) { request.AddParameter("flags", (int)flags); } return(SendRequest <DicResult>(request)); }
public Translation Translate(string text, LangPair lang, OutputFormat? format = null, bool options = false) { RestRequest request = new RestRequest("translate"); request.AddParameter("key", _key); request.AddParameter("text", text); if (lang.OutputLang != Lang.None) { if (lang.InputLang == Lang.None) request.AddParameter("lang", lang.OutputLang.ToString().ToLowerInvariant()); else request.AddParameter("lang", lang.ToString().ToLowerInvariant()); } if (format.HasValue) request.AddParameter("format", format.ToString().ToLowerInvariant()); if (options) request.AddParameter("options", "1"); return SendRequest<Translation>(request); }