Пример #1
0
        public async Task <ThreeSixtySharp.Objects.File> GetFileMetadataAsync(AuthTicket ticket, Project project, string document_id, int revision_number)
        {
            var request = new RestRequest(Method.POST);

            request.Resource = "api/library/file/{id}/{type}/{rev}";
            request.AddParameter("ticket", ticket.Ticket);
            request.AddParameter("project_id", project.Project_ID);
            request.AddParameter("id", document_id, ParameterType.UrlSegment);
            request.AddParameter("type", "metadata", ParameterType.UrlSegment);
            request.AddParameter("rev", revision_number, ParameterType.UrlSegment);
            request.RootElement = "document";

            Task <ThreeSixtySharp.Objects.File> fileMetaDataTask = ExecuteAsync <ThreeSixtySharp.Objects.File>(request);

            ThreeSixtySharp.Objects.File metaDataFile = await fileMetaDataTask;
            if (metaDataFile.Tags != null)
            {
                //This is a janky short term fix.  BIM 360 Field returns Tags as an
                //array of strings and a custom deserializer needs to be made to parse this
                //into this list of strings.  This should be ok for now.
                List <string> parsedTags = metaDataFile.Tags[0].Split(',').ToList();
                metaDataFile.Tags = parsedTags;
            }

            return(metaDataFile);
        }
Пример #2
0
        /// <summary>
        /// Delete all revisions of a given file.
        /// </summary>
        /// <param name="ticket">ThreeSixtySharp.Objects.AuthTicket instance for current user.</param>
        /// <param name="project">ThreeSixtySharp.Objects.Project instance to return files from.</param>
        /// <param name="doc">ThreeSixtySharp.Objects.File instance to delete.</param>
        public void DeleteAllRevisions(AuthTicket ticket, Project project, ThreeSixtySharp.Objects.File doc)
        {
            var request = new RestRequest(Method.POST);

            request.Resource = "api/library/delete";
            request.AddParameter("ticket", ticket.Ticket);
            request.AddParameter("project_id", project.Project_ID);
            request.AddParameter("id", doc.Document_Id);
            request.AddParameter("rev", "nil");

            Execute(request);
        }