示例#1
0
        /// <summary>
        /// Uploads the given file to the File Manager
        /// Set hidden = true when using for attachments to engagements
        /// </summary>
        /// <param name="entity">The file to upload</param>
        /// <returns>The uploaded file</returns>
        public async Task <FileListHubSpotModel <FileHubSpotModel> > UploadAsync(FileHubSpotModel entity, CancellationToken cancellationToken = default)
        {
            var path = $"{GetRoute<FileHubSpotModel>()}/files";
            var data = await _client.ExecuteMultipartAsync <FileListHubSpotModel <FileHubSpotModel> >(path, entity.File, entity.Name,
                                                                                                      new Dictionary <string, string>()
            {
                { "overwrite", entity.Overwrite.ToString() },
                { "hidden", entity.Hidden.ToString() },
                { "folder_paths", entity.FolderPaths }
            }, cancellationToken : cancellationToken);

            return(data);
        }