public async Task <(bool?Status, string Msg)> ProjectExists(PublishChatProject project) { try { var resp = await HitGetAsync(CHECK_PROJECT_EXISTS_API.Replace("{business_id}", project.Id)); return(true, ""); //If 200; } catch (WebException ex) { if (ex.Response is HttpWebResponse hResp) { if (hResp.StatusCode == HttpStatusCode.NotFound) { return(false, "Project does not exist"); } } return(null, ex.Message); } catch (Exception ex) { Logger.Write(ex); return(null, ex.Message); } }
public async Task <(bool Status, string Msg)> Publish(PublishChatProject project, List <ChatNode> compiledChatFlow) { try { var resp = await HitPostAsync(PUBLISH_API, new { business_id = project.Id, business_name = project.Name, flow = compiledChatFlow }, StudioContext.PublishJsonSettings); return(true, ""); //If 200; } catch (Exception ex) { Logger.Write(ex); return(false, ex.Message); } }