public Model SetModelAndVersion(Project project, Model model, string message, string modelFileName, string modelPath, string coverImageName, string coverImagePath) { // Read model file data FileStream modelFs = new FileStream(modelPath, FileMode.Open, FileAccess.Read); byte[] modelData = new byte[modelFs.Length]; modelFs.Read(modelData, 0, modelData.Length); modelFs.Close(); // Read coverImage data FileStream imageFs = new FileStream(coverImagePath, FileMode.Open, FileAccess.Read); byte[] imageData = new byte[imageFs.Length]; imageFs.Read(imageData, 0, imageData.Length); imageFs.Close(); // Generate post objects Dictionary<string, object> postParameters = new Dictionary<string, object>(); postParameters.Add("message", message); postParameters.Add("file", new FileParameter(modelData, modelFileName)); postParameters.Add("cover_img", new FileParameter(imageData, coverImageName)); //make the request String modelJson = this.PostMultiPartFormDataPostRequest("projects/" + project.id + "/models/"+model.id, postParameters); NewModel returnModel = JsonConvert.DeserializeObject<NewModel>(modelJson); return returnModel.model; }
public Version getModelVersion(Project project, Model model, string id) { string versionJson = this.GetRequest("projects/" + project.id + "/models/" + model.id + "/versions/"+id); Version version = JsonConvert.DeserializeObject<Version>(versionJson); return version; }
public string SetModel(Project project, Model model, string filePath, string fileName) { string response = this.UploadFile("projects/" + project.id + "/models/" + model.id, filePath, fileName); return response; }
///<Summary> ///Create a Model Reference (Metamodel) to a Model ///</Summary> public MetaModel CreateModelReference(Project project, Space space, Model model) { string modelData = "{\"modelId\": \"" + model.id + "\"}"; string modelJson = this.PostRequest("projects/" + project.id + "/spaces/" + space.id + "/metamodels", modelData); MetaModel modelReference = JsonConvert.DeserializeObject<MetaModel>(modelJson); return modelReference; }