/// <summary> /// Update repository file /// </summary> /// <param name="restricted">indicates if file is restricted</param> /// <param name="sharedUser">indicates if file is shared</param> /// <param name="published">indicates if file is published</param> /// <param name="descr">description of the file</param> /// <param name="inputs">description of inputs to the script</param> /// <param name="outputs">description of outputs from the script</param> /// <returns>RRepositoryFile object</returns> /// <remarks></remarks> public RRepositoryFile update(String restricted, Boolean sharedUser, Boolean published, String descr, String inputs, String outputs) { RRepositoryFile returnValue = default(RRepositoryFile); StringBuilder data = new StringBuilder(); //set the url String uri = Constants.RREPOSITORYFILEUPDATE; //create the input String data.Append(Constants.FORMAT_JSON); data.Append("&filename=" + HttpUtility.UrlEncode(m_fileDetails.filename)); data.Append("&directory=" + HttpUtility.UrlEncode(m_fileDetails.directory)); data.Append("&shared=" + sharedUser.ToString()); data.Append("&published=" + published.ToString()); data.Append("&restricted=" + HttpUtility.UrlEncode(restricted)); data.Append("&descr=" + HttpUtility.UrlEncode(descr)); data.Append("&inputs=" + HttpUtility.UrlEncode(inputs)); data.Append("&outputs=" + HttpUtility.UrlEncode(outputs)); //call the server JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref m_client); if (!(jresponse.JSONMarkup["repository"] == null)) { JObject jrepo = jresponse.JSONMarkup["repository"].Value <JObject>(); if (!(jrepo["file"] == null)) { JObject jfile = jrepo["file"].Value <JObject>(); returnValue = new RRepositoryFile(new JSONResponse(jfile, true, "", 0), m_client); } } return(returnValue); }
static public RProject createProject(String name, String descr, ProjectCreationOptions options, RClient client, String uri) { StringBuilder data = new StringBuilder(); //create the input String data.Append(Constants.FORMAT_JSON); data.Append("&projectname=" + HttpUtility.UrlEncode(name)); data.Append("&projectdescr=" + HttpUtility.UrlEncode(descr)); if (!(options == null)) { data.Append("&blackbox=" + options.blackbox.ToString()); if (!(options.rinputs == null)) { if (options.rinputs.Count > 0) { data.Append("&inputs="); String sJSON = JSONSerialize.createJSONfromRData(options.rinputs); data.Append(HttpUtility.UrlEncode(sJSON)); if (HTTPUtilities.DEBUGMODE == true) { Console.Write(sJSON); } } } if (!(options.preloadDirectory == null)) { data.Append("&preloadfilename=" + HttpUtility.UrlEncode(options.preloadDirectory.filename)); data.Append("&preloadfiledirectory=" + HttpUtility.UrlEncode(options.preloadDirectory.directory)); data.Append("&preloadfileauthor=" + HttpUtility.UrlEncode(options.preloadDirectory.author)); data.Append("&preloadfileversion=" + HttpUtility.UrlEncode(options.preloadDirectory.version)); } if (!(options.preloadWorkspace == null)) { data.Append("&preloadobjectname=" + HttpUtility.UrlEncode(options.preloadWorkspace.filename)); data.Append("&preloadobjectdirectory=" + HttpUtility.UrlEncode(options.preloadWorkspace.directory)); data.Append("&preloadobjectauthor=" + HttpUtility.UrlEncode(options.preloadWorkspace.author)); data.Append("&preloadobjectversion=" + HttpUtility.UrlEncode(options.preloadWorkspace.version)); } if (!(options.adoptionOptions == null)) { data.Append("&adoptworkspace=" + HttpUtility.UrlEncode(options.adoptionOptions.adoptWorkspace)); data.Append("&adoptdirectory=" + HttpUtility.UrlEncode(options.adoptionOptions.adoptDirectory)); data.Append("&adoptpackages=" + HttpUtility.UrlEncode(options.adoptionOptions.adoptPackages)); } data.Append("&cluster=" + HttpUtility.UrlEncode(options.gridCluster)); } //call the server JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref client); RProject returnValue = new RProject(jresponse, client); return(returnValue); }
/// <summary> /// Grant repository file to another user /// </summary> /// <param name="newauthor">name of the user to grant authorship</param> /// <param name="revokeauthor">name of the user to revoke authorship</param> /// <returns>RRepositoryFile object</returns> /// <remarks></remarks> public RRepositoryFile grant(String newauthor, String revokeauthor) { RRepositoryFile returnValue = default(RRepositoryFile); StringBuilder data = new StringBuilder(); //set the url String uri = Constants.RREPOSITORYFILEGRANT; //create the input String data.Append(Constants.FORMAT_JSON); data.Append("&filename=" + HttpUtility.UrlEncode(m_fileDetails.filename)); data.Append("&directory=" + HttpUtility.UrlEncode(m_fileDetails.directory)); data.Append("&newauthor=" + HttpUtility.UrlEncode(newauthor)); data.Append("&revokeauthor=" + HttpUtility.UrlEncode(revokeauthor)); //call the server JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref m_client); if (!(jresponse.JSONMarkup["repository"] == null)) { JObject jrepo = jresponse.JSONMarkup["repository"].Value <JObject>(); if (!(jrepo["file"] == null)) { JObject jfile = jrepo["file"].Value <JObject>(); returnValue = new RRepositoryFile(new JSONResponse(jfile, true, "", 0), m_client); } } return(returnValue); }
static public RRepositoryFile storeObject(RProjectDetails details, String name, Boolean sharedUser, Boolean published, String restricted, String descr, Boolean versioning, RClient client, String uri) { RRepositoryFile returnValue = default(RRepositoryFile); StringBuilder data = new StringBuilder(); //create the input String data.Append(Constants.FORMAT_JSON); data.Append("&project=" + HttpUtility.UrlEncode(details.id)); data.Append("&name=" + HttpUtility.UrlEncode(name)); data.Append("&descr=" + HttpUtility.UrlEncode(descr)); data.Append("&version=" + versioning.ToString()); data.Append("&shared=" + sharedUser.ToString()); data.Append("&published=" + published.ToString()); data.Append("&restricted=" + HttpUtility.UrlEncode(restricted)); //call the server JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref client); if (!(jresponse.JSONMarkup["repository"] == null)) { JObject jrepo = jresponse.JSONMarkup["repository"].Value <JObject>(); if (!(jrepo["file"] == null)) { JObject jfile = jrepo["file"].Value <JObject>(); returnValue = new RRepositoryFile(new JSONResponse(jfile, true, "", 0), client); } } return(returnValue); }
/// <summary> /// Rename repository-managed user directory. /// </summary> /// <param name="destination">New name of the directory</param> /// <returns>RRepositoryDirectory object</returns> /// <remarks></remarks> public RRepositoryDirectory rename(String destination) { RRepositoryDirectory returnValue = default(RRepositoryDirectory); StringBuilder data = new StringBuilder(); //set the url String uri = Constants.RREPOSITORYDIRECTORYRENAME; //create the input String data.Append(Constants.FORMAT_JSON); data.Append("&directory=" + HttpUtility.UrlEncode(m_directoryDetails.name)); data.Append("&destination=" + HttpUtility.UrlEncode(destination.Trim())); //call the server JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref m_client); if (!(jresponse.JSONMarkup["repository"] == null)) { JObject jrepo = jresponse.JSONMarkup["repository"].Value <JObject>(); if (!(jrepo["directory"] == null)) { JObject jdir = jrepo["directory"].Value <JObject>(); returnValue = new RRepositoryDirectory(new JSONResponse(jdir, true, "", 0), m_client); } } return(returnValue); }
static public void copyDirectory(String source, String destination, List <RRepositoryFile> files, RClient client, String uri) { StringBuilder data = new StringBuilder(); StringBuilder filenames = new StringBuilder(); //create the input String data.Append(Constants.FORMAT_JSON); data.Append("&directory=" + HttpUtility.UrlEncode(source)); data.Append("&destination=" + HttpUtility.UrlEncode(destination)); if (!(files == null)) { foreach (var file in files) { if (filenames.Length != 0) { filenames.Append(","); filenames.Append(file.about().filename); } else { filenames.Append(file.about().filename); } } } data.Append("&filename=" + HttpUtility.UrlEncode(filenames.ToString())); //call the server JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref client); }
static public RProjectFile writeFile(RProjectDetails details, String text, DirectoryUploadOptions options, RClient client, String uri) { RProjectFile returnValue = default(RProjectFile); StringBuilder data = new StringBuilder(); //create the input String data.Append(Constants.FORMAT_JSON); data.Append("&project=" + HttpUtility.UrlEncode(details.id)); data.Append("&text=" + HttpUtility.UrlEncode(text)); if (!(options == null)) { data.Append("&filename=" + HttpUtility.UrlEncode(options.filename)); data.Append("&descr=" + HttpUtility.UrlEncode(options.descr)); data.Append("&overwrite=" + options.overwrite.ToString()); } //call the server JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref client); if (!(jresponse.JSONMarkup["directory"] == null)) { JObject jdir = jresponse.JSONMarkup["directory"].Value <JObject>(); if (!(jdir["file"] == null)) { JObject jfile = jdir["file"].Value <JObject>(); returnValue = new RProjectFile(new JSONResponse(jfile, true, "", 0), client, details.id); } } return(returnValue); }
static public RProjectFile loadFile(RProjectDetails details, RRepositoryFile file, RClient client, String uri) { RProjectFile returnValue = default(RProjectFile); StringBuilder data = new StringBuilder(); //create the input String data.Append(Constants.FORMAT_JSON); data.Append("&project=" + HttpUtility.UrlEncode(details.id)); data.Append("&filename=" + HttpUtility.UrlEncode(file.about().filename)); data.Append("&directory=" + HttpUtility.UrlEncode(file.about().directory)); data.Append("&author=" + HttpUtility.UrlEncode(file.about().author)); data.Append("&version=" + HttpUtility.UrlEncode(file.about().version)); //call the server JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref client); if (!(jresponse.JSONMarkup["directory"] == null)) { JObject jdir = jresponse.JSONMarkup["directory"].Value <JObject>(); if (!(jdir["file"] == null)) { JObject jfile = jdir["file"].Value <JObject>(); returnValue = new RProjectFile(new JSONResponse(jfile, true, "", 0), client, details.id); } } return(returnValue); }
static public RProject saveAs(RProjectDetails details, ProjectDropOptions options, RClient client, String uri) { StringBuilder data = new StringBuilder(); //create the input String data.Append(Constants.FORMAT_JSON); data.Append("&project=" + HttpUtility.UrlEncode(details.id)); data.Append("&name=" + HttpUtility.UrlEncode(details.name)); data.Append("&descr=" + HttpUtility.UrlEncode(details.descr)); data.Append("&longdescr=" + HttpUtility.UrlEncode(details.longdescr)); data.Append("&projectcookie=" + HttpUtility.UrlEncode(details.cookie)); data.Append("&shared=" + details.sharedUsers.ToString()); if (!(options == null)) { data.Append("&dropworkspace=" + options.dropWorkspace.ToString()); data.Append("&dropdirectory=" + options.dropDirectory.ToString()); data.Append("&drophistory=" + options.dropHistory.ToString()); } //call the server JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref client); RProject returnValue = default(RProject); returnValue = new RProject(jresponse, client); return(returnValue); }
static public void releaseProjects(RClient client, String uri) { StringBuilder data = new StringBuilder(); //create the input String data.Append(Constants.FORMAT_JSON); //call the server JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref client); }
static public void autosaveProjects(Boolean save, RClient client, String uri) { StringBuilder data = new StringBuilder(); //create the input String data.Append(Constants.FORMAT_JSON); data.Append("&enable=" + save.ToString().ToLower()); //call the server JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref client); }
static public void interruptExecution(RProjectDetails details, RClient client, String uri) { StringBuilder data = new StringBuilder(); //create the input String data.Append(Constants.FORMAT_JSON); data.Append("&project=" + HttpUtility.UrlEncode(details.id)); //call the server JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref client); }
/// <summary> /// Logout from the RevoDeployR server. /// </summary> /// <param name="user">The RUser object representing the user to logout</param> /// <remarks></remarks> public void logout(RUser user) { StringBuilder data = new StringBuilder(); String uri = Constants.RUSERLOGOUT; //create the input String data.Append(Constants.FORMAT_JSON); //call the server RClient client = this; JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref client); }
static public void transferObject(RProjectDetails details, String name, String url, RClient client, String uri) { StringBuilder data = new StringBuilder(); //create the input String data.Append(Constants.FORMAT_JSON); data.Append("&project=" + HttpUtility.UrlEncode(details.id)); data.Append("&name=" + HttpUtility.UrlEncode(name)); data.Append("&url=" + HttpUtility.UrlEncode(url)); //call the server JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref client); }
/// <summary> /// Delete repository-managed user directory. /// </summary> /// <remarks></remarks> public void delete() { StringBuilder data = new StringBuilder(); //set the url String uri = Constants.RREPOSITORYDIRECTORYDELETE; //create the input String data.Append(Constants.FORMAT_JSON); data.Append("&directory=" + HttpUtility.UrlEncode(m_directoryDetails.name)); //call the server JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref m_client); }
/// <summary> /// Deletes the job /// </summary> /// <remarks></remarks> public void delete() { StringBuilder data = new StringBuilder(); //set the url String uri = Constants.RJOBDELETE; //create the input String data.Append(Constants.FORMAT_JSON); data.Append("&job=" + HttpUtility.UrlEncode(m_jobDetails.id)); //call the server JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref m_client); }
/// <summary> /// Flushes this Execution /// </summary> /// <remarks></remarks> public void flush() { StringBuilder data = new StringBuilder(); //set the url String uri = Constants.RPROJECTEXECUTEFLUSH; //create the input String data.Append(Constants.FORMAT_JSON); data.Append("&execution=" + HttpUtility.UrlEncode(m_executionDetails.id)); data.Append("&project=" + HttpUtility.UrlEncode(m_projectDetails.id)); //call the server JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref m_client); }
static public RProject getProject(String name, RClient client, String uri) { StringBuilder data = new StringBuilder(); //create the input String data.Append(Constants.FORMAT_JSON); data.Append("&project=" + HttpUtility.UrlEncode(name)); //call the server JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref client); RProject returnValue = new RProject(jresponse, client); return(returnValue); }
/// <summary> /// Deletes this Project File /// </summary> /// <remarks></remarks> public void delete() { StringBuilder data = new StringBuilder(); //set the url String uri = Constants.RPROJECTDIRECTORYDELETE; //create the input String data.Append(Constants.FORMAT_JSON); data.Append("&project=" + m_project); data.Append("&name=" + HttpUtility.UrlEncode(m_fileDetails.filename)); //call the server JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref m_client); }
/// <summary> /// Cancels the job /// </summary> /// <returns>RJobDetails object</returns> /// <remarks></remarks> public RJobDetails cancel() { StringBuilder data = new StringBuilder(); //set the url String uri = Constants.RJOBCANCEL; //create the input String data.Append(Constants.FORMAT_JSON); data.Append("&job=" + HttpUtility.UrlEncode(m_jobDetails.id)); //call the server JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref m_client); parseJob(jresponse, ref m_jobDetails); return(m_jobDetails); }
static public RProjectDetails recycle(RProjectDetails details, RClient client, String uri) { StringBuilder data = new StringBuilder(); //create the input String data.Append(Constants.FORMAT_JSON); data.Append("&project=" + HttpUtility.UrlEncode(details.id)); //call the server JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref client); RProjectDetails returnValue = default(RProjectDetails); parseProject(jresponse, ref returnValue); return(returnValue); }
/// <summary> /// Authenticate with the RevoDeployR server /// </summary> /// <param name="authentication">A valid RAuthentication object</param> /// <param name="autosave">(optional) Flag indicating that autosave should be turned on/off for the user</param> /// <returns>RResponse object</returns> /// <remarks></remarks> public RUser login(RAuthentication authentication, Boolean autosave) { StringBuilder data = new StringBuilder(); String uri = Constants.RUSERLOGIN; //create the input String data.Append(Constants.FORMAT_JSON + "&username="******"&password="******"&save=" + HttpUtility.UrlEncode(autosave.ToString())); //call the server RClient client = this; JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref client); RUser returnValue = new RUser(jresponse, this); return(returnValue); }
/// <summary> /// Archive files found in repository-managed user directory. /// </summary> /// <param name="archiveDirectoryName">Name to be given to the archive directory</param> /// <param name="files">List of Repository file to archive</param> /// <returns>RRepositoryDirectory object</returns> /// <remarks></remarks> public RRepositoryDirectory archive(String archiveDirectoryName, List <RRepositoryFile> files) { RRepositoryDirectory returnValue = default(RRepositoryDirectory); StringBuilder data = new StringBuilder(); StringBuilder filenames = new StringBuilder(); //set the url String uri = Constants.RREPOSITORYDIRECTORYARCHIVE; //create the input String data.Append(Constants.FORMAT_JSON); data.Append("&archive=" + HttpUtility.UrlEncode(archiveDirectoryName)); data.Append("&directory=" + HttpUtility.UrlEncode(m_directoryDetails.name)); if (!(files == null)) { foreach (var file in files) { if (filenames.Length != 0) { filenames.Append(","); filenames.Append(file.about().filename); } else { filenames.Append(file.about().filename); } } } data.Append("&filename=" + HttpUtility.UrlEncode(filenames.ToString())); //call the server JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref m_client); if (!(jresponse.JSONMarkup["repository"] == null)) { JObject jrepo = jresponse.JSONMarkup["repository"].Value <JObject>(); if (!(jrepo["directory"] == null)) { JObject jdir = jrepo["directory"].Value <JObject>(); returnValue = new RRepositoryDirectory(new JSONResponse(jdir, true, "", 0), m_client); } } return(returnValue); }
static public void loadObject(RProjectDetails details, RRepositoryFile file, RClient client, String uri) { StringBuilder data = new StringBuilder(); //create the input String data.Append(Constants.FORMAT_JSON); data.Append("&project=" + HttpUtility.UrlEncode(details.id)); if (!(file == null)) { data.Append("&filename=" + HttpUtility.UrlEncode(file.about().filename)); data.Append("&directory=" + HttpUtility.UrlEncode(file.about().directory)); data.Append("&author=" + HttpUtility.UrlEncode(file.about().author)); data.Append("&version=" + HttpUtility.UrlEncode(file.about().version)); } //call the server JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref client); }
private List <String> executeShellImp(String shellName, String shellDirectory, String shellAuthor, String shellVersion, String args) { StringBuilder data = new StringBuilder(); String uri = Constants.RREPOSITORYSHELLEXECUTE; //create the input String data.Append(Constants.FORMAT_JSON); data.Append("&filename=" + HttpUtility.UrlEncode(shellName)); data.Append("&author=" + HttpUtility.UrlEncode(shellAuthor)); data.Append("&directory=" + HttpUtility.UrlEncode(shellDirectory)); data.Append("&version=" + HttpUtility.UrlEncode(shellVersion)); data.Append("&args=" + HttpUtility.UrlEncode(args)); //call the server RClient client = this; JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref client); List <String> console = new List <String>(); JArray jvalues; if (!(jresponse.JSONMarkup["repository"] == null)) { JObject jrepo = jresponse.JSONMarkup["repository"].Value <JObject>(); if (!(jrepo["shell"] == null)) { JObject jshell = jrepo["shell"].Value <JObject>();; if (!(jshell["console"] == null)) { jvalues = jshell["console"].Value <JArray>(); foreach (var j in jvalues) { if (j.Type != JTokenType.Null) { console.Add(j.Value <string>()); } } } } } return(console); }
/// <summary> /// Update project file details /// </summary> /// <param name="name">name of project file</param> /// <param name="descr">description of project file</param> /// <param name="overwrite">flag indicating if file should be overwritten</param> /// <returns>RRepositoryFile object</returns> /// <remarks></remarks> public RProjectFile update(String name, String descr, Boolean overwrite) { StringBuilder data = new StringBuilder(); //set the url String uri = Constants.RPROJECTDIRECTORYUPDATE; //create the input String data.Append(Constants.FORMAT_JSON); data.Append("&project=" + m_project); data.Append("&name=" + HttpUtility.UrlEncode(m_fileDetails.filename)); data.Append("&rename=" + HttpUtility.UrlEncode(name)); data.Append("&descr=" + HttpUtility.UrlEncode(descr)); //call the server JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref m_client); RProjectFile returnValue = new RProjectFile(jresponse, m_client, m_project); return(returnValue); }
static public List <RProjectPackage> attachPackage(RProjectDetails details, List <String> packageNames, String repo, RClient client, String uri) { StringBuilder data = new StringBuilder(); //create the input String data.Append(Constants.FORMAT_JSON); data.Append("&project=" + HttpUtility.UrlEncode(details.id)); data.Append("&repo=" + HttpUtility.UrlEncode(repo)); if (!(packageNames == null)) { if (packageNames.Count > 0) { data.Append("&name="); foreach (var s in packageNames) { data.Append(HttpUtility.UrlEncode(s) + ","); } data.Remove(data.Length - 1, 1); } } //call the server JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref client); List <RProjectPackage> returnValue = new List <RProjectPackage>(); if (!(jresponse.JSONMarkup["packages"] == null)) { JArray jvalues = jresponse.JSONMarkup["packages"].Value <JArray>(); foreach (var j in jvalues) { if (j.Type != JTokenType.Null) { returnValue.Add(new RProjectPackage(new JSONResponse(j.Value <JObject>(), true, "", 0), client)); } } } return(returnValue); }
static public RRepositoryFile transferFile(String url, RepoUploadOptions options, RClient client, String uri) { RRepositoryFile returnValue = default(RRepositoryFile); StringBuilder data = new StringBuilder(); //create the input String data.Append(Constants.FORMAT_JSON); data.Append("&url=" + HttpUtility.UrlEncode(url)); if (!(options == null)) { data.Append("&filename=" + HttpUtility.UrlEncode(options.filename)); data.Append("&directory=" + HttpUtility.UrlEncode(options.directory)); data.Append("&descr=" + HttpUtility.UrlEncode(options.descr)); data.Append("&shared=" + options.sharedUser.ToString()); data.Append("&published=" + options.published.ToString()); data.Append("&restricted=" + HttpUtility.UrlEncode(options.restricted)); data.Append("&inputs=" + HttpUtility.UrlEncode(options.inputs)); data.Append("&outputs=" + HttpUtility.UrlEncode(options.outputs)); data.Append("&newversion=" + options.newversion.ToString()); data.Append("&newversionmsg=" + HttpUtility.UrlEncode(options.newversionmsg)); } //call the server JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref client); if (!(jresponse.JSONMarkup["repository"] == null)) { JObject jrepo = jresponse.JSONMarkup["repository"].Value <JObject>(); if (!(jrepo["file"] == null)) { JObject jfile = jrepo["file"].Value <JObject>(); returnValue = new RRepositoryFile(new JSONResponse(jfile, true, "", 0), client); return(returnValue); } } return(returnValue); }
static public void close(RProjectDetails details, ProjectCloseOptions options, RClient client, String uri) { StringBuilder data = new StringBuilder(); //create the input String data.Append(Constants.FORMAT_JSON); data.Append("&project=" + HttpUtility.UrlEncode(details.id)); if (!(options == null)) { if (!(options.dropOptions == null)) { data.Append("&dropworkspace=" + options.dropOptions.dropWorkspace.ToString()); data.Append("&dropdirectory=" + options.dropOptions.dropDirectory.ToString()); data.Append("&drophistory=" + options.dropOptions.dropHistory.ToString()); } data.Append("&flushhistory=" + options.flushHistory.ToString()); data.Append("&disableautosave=" + options.disableAutosave.ToString()); data.Append("&projectcookie=" + options.cookie); } //call the server JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref client); }
static public void deleteObject(RProjectDetails details, List <String> objectNames, RClient client, String uri) { StringBuilder data = new StringBuilder(); //create the input String data.Append(Constants.FORMAT_JSON); data.Append("&project=" + HttpUtility.UrlEncode(details.id)); if (!(objectNames == null)) { if (objectNames.Count > 0) { data.Append("&name="); foreach (var s in objectNames) { data.Append(HttpUtility.UrlEncode(s) + ","); } data.Remove(data.Length - 1, 1); } } //call the server JSONResponse jresponse = HTTPUtilities.callRESTPost(uri, data.ToString(), ref client); }