Class AttachmentDomain
All attachment related extension methods
Inheritance
Inherited Members
Namespace: Dapplo.Confluence
Assembly: Dapplo.Confluence.dll
Syntax
public static class AttachmentDomain
Methods
| Improve this Doc View SourceAttachAsync<TContent>(IAttachmentDomain, Int64, TContent, String, String, String, CancellationToken)
Add an attachment to the specified content
Declaration
public static async Task<Result<Content>> AttachAsync<TContent>(this IAttachmentDomain confluenceClient, long contentId, TContent content, string filename, string comment = null, string contentType = null, CancellationToken cancellationToken = null)
where TContent : class
Parameters
| Type | Name | Description |
|---|---|---|
| IAttachmentDomain | confluenceClient | IAttachmentDomain to bind the extension method to |
| System.Int64 | contentId | content to add the attachment to |
| TContent | content | content of type TContent for the attachment |
| System.String | filename | Filename of the attachment |
| System.String | comment | Comment in the attachments information |
| System.String | contentType | Content-Type for the content, or null |
| CancellationToken | cancellationToken | CancellationToken |
Returns
| Type | Description |
|---|---|
| Task<Result<Content>> | Result with Attachment |
Type Parameters
| Name | Description |
|---|---|
| TContent | The content to upload |
AttachAsync<TContent>(IAttachmentDomain, String, TContent, String, String, String, CancellationToken)
Obsolete: this AttachAsync is a wrapper for the new signature, which only excepts a long for the ID.
Declaration
public static Task<Result<Content>> AttachAsync<TContent>(this IAttachmentDomain confluenceClient, string contentId, TContent content, string filename, string comment = null, string contentType = null, CancellationToken cancellationToken = null)
where TContent : class
Parameters
| Type | Name | Description |
|---|---|---|
| IAttachmentDomain | confluenceClient | IAttachmentDomain |
| System.String | contentId | string |
| TContent | content | TContent |
| System.String | filename | string |
| System.String | comment | string |
| System.String | contentType | string |
| CancellationToken | cancellationToken | CancellationToken |
Returns
| Type | Description |
|---|---|
| Task<Result<Content>> | Result with Content |
Type Parameters
| Name | Description |
|---|---|
| TContent | Type of the content |
DeleteAsync(IAttachmentDomain, Content, CancellationToken)
Delete attachment Can't work yet, see CONF-36015
Declaration
public static async Task DeleteAsync(this IAttachmentDomain confluenceClient, Content attachment, CancellationToken cancellationToken = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IAttachmentDomain | confluenceClient | IAttachmentDomain to bind the extension method to |
| Content | attachment | Attachment which needs to be deleted |
| CancellationToken | cancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
DeleteAsync(IAttachmentDomain, Int64, Boolean, CancellationToken)
Delete content (attachments are also content)
Declaration
public static async Task DeleteAsync(this IAttachmentDomain confluenceClient, long attachtmentId, bool isTrashed = false, CancellationToken cancellationToken = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IAttachmentDomain | confluenceClient | IAttachmentDomain to bind the extension method to |
| System.Int64 | attachtmentId | ID for the content which needs to be deleted |
| System.Boolean | isTrashed | If the content is trashable, you will need to call DeleteAsyc twice, second time with isTrashed = true |
| CancellationToken | cancellationToken | CancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
GetAttachmentsAsync(IAttachmentDomain, Int64, CancellationToken)
Retrieve the attachments for the specified content
Declaration
public static async Task<Result<Content>> GetAttachmentsAsync(this IAttachmentDomain confluenceClient, long contentId, CancellationToken cancellationToken = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IAttachmentDomain | confluenceClient | IAttachmentDomain to bind the extension method to |
| System.Int64 | contentId | string with the content id |
| CancellationToken | cancellationToken | CancellationToken |
Returns
| Type | Description |
|---|---|
| Task<Result<Content>> | Result with Attachment(s) |
GetAttachmentsAsync(IAttachmentDomain, String, CancellationToken)
Obsolete: this GetAttachmentsAsync is a wrapper for the new signature, which only excepts a long for the ID.
Declaration
public static Task<Result<Content>> GetAttachmentsAsync(this IAttachmentDomain confluenceClient, string contentId, CancellationToken cancellationToken = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IAttachmentDomain | confluenceClient | IAttachmentDomain |
| System.String | contentId | string |
| CancellationToken | cancellationToken | CancellationToken |
Returns
| Type | Description |
|---|---|
| Task<Result<Content>> | Result with Content |
GetContentAsync<TResponse>(IAttachmentDomain, Content, CancellationToken)
Retrieve the attachment for the supplied Attachment entity
Declaration
public static async Task<TResponse> GetContentAsync<TResponse>(this IAttachmentDomain confluenceClient, Content attachment, CancellationToken cancellationToken = null)
where TResponse : class
Parameters
| Type | Name | Description |
|---|---|---|
| IAttachmentDomain | confluenceClient | IAttachmentDomain to bind the extension method to |
| Content | attachment | Attachment |
| CancellationToken | cancellationToken | CancellationToken |
Returns
| Type | Description |
|---|---|
| Task<TResponse> | Bitmap,BitmapSource or MemoryStream (etc) depending on TResponse |
Type Parameters
| Name | Description |
|---|---|
| TResponse | the type to return the result into. e.g. Bitmap,BitmapSource or MemoryStream |
UpdateAsync(IAttachmentDomain, Content, CancellationToken)
Update the attachment information
Declaration
public static async Task<Content> UpdateAsync(this IAttachmentDomain confluenceClient, Content attachment, CancellationToken cancellationToken = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IAttachmentDomain | confluenceClient | IAttachmentDomain to bind the extension method to |
| Content | attachment | Attachment |
| CancellationToken | cancellationToken | CancellationToken |
Returns
| Type | Description |
|---|---|
| Task<Content> | Attachment |
UpdateDataAsync<TContent>(IAttachmentDomain, Int64, Int64, TContent, String, String, String, CancellationToken)
Update data (Content) of existing attachment
Declaration
public static async Task<Result<Content>> UpdateDataAsync<TContent>(this IAttachmentDomain confluenceClient, long contentId, long attachmentId, TContent content, string filename, string comment = null, string contentType = null, CancellationToken cancellationToken = null)
where TContent : class
Parameters
| Type | Name | Description |
|---|---|---|
| IAttachmentDomain | confluenceClient | IAttachmentDomain to bind the extension method to |
| System.Int64 | contentId | content to add the attachment to |
| System.Int64 | attachmentId | Id of attachment to update |
| TContent | content | content of type TContent for the attachment |
| System.String | filename | Filename of the attachment |
| System.String | comment | Comment in the attachments information |
| System.String | contentType | Content-Type for the content, or null |
| CancellationToken | cancellationToken | CancellationToken |
Returns
| Type | Description |
|---|---|
| Task<Result<Content>> |
Type Parameters
| Name | Description |
|---|---|
| TContent | The content to upload |