Class ContentExtensions
The is the implementation to the content functionality of the Confluence API
Inheritance
Inherited Members
Namespace: Dapplo.Confluence
Assembly: Dapplo.Confluence.dll
Syntax
public static class ContentExtensions
Methods
| Improve this Doc View SourceAddLabelsAsync(IContentDomain, Int64, IEnumerable<Label>, CancellationToken)
Add Labels to content see here
Declaration
public static async Task AddLabelsAsync(this IContentDomain confluenceClient, long contentId, IEnumerable<Label> labels, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
IContentDomain | confluenceClient | IContentDomain to bind the extension method to |
System.Int64 | contentId | content id |
IEnumerable<Label> | labels | IEnumerable labels |
CancellationToken | cancellationToken | CancellationToken |
Returns
Type | Description |
---|---|
Task | Task |
CopyAsync(IContentDomain, Int64, CopyContent, IEnumerable<String>, CancellationToken)
Copy the content specified by the contentId using the information from the CopyContent Documentation for this can be found here
Declaration
public static async Task<Content> CopyAsync(this IContentDomain confluenceClient, long contentId, CopyContent copyContent, IEnumerable<string> expandCopy = null, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
IContentDomain | confluenceClient | IContentDomain to bind the extension method to |
System.Int64 | contentId | long with the Content ID to copy |
CopyContent | copyContent | CopyContent describing how and where to copy the specified content |
IEnumerable<System.String> | expandCopy | strings with the optional expand values |
CancellationToken | cancellationToken | CancellationToken |
Returns
Type | Description |
---|---|
Task<Content> | Content |
CreateAsync(IContentDomain, Content, CancellationToken)
Create content
Declaration
public static async Task<Content> CreateAsync(this IContentDomain confluenceClient, Content content, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
IContentDomain | confluenceClient | IContentDomain to bind the extension method to |
Content | content | Content (e.g. Page) to create |
CancellationToken | cancellationToken | CancellationToken |
Returns
Type | Description |
---|---|
Task<Content> | Content |
CreateAsync(IContentDomain, ContentTypes, String, String, Body, Nullable<Int64>, CancellationToken)
Create content
Declaration
public static Task<Content> CreateAsync(this IContentDomain confluenceClient, ContentTypes contentType, string title, string spaceKey, Body body, long? ancestorId = null, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
IContentDomain | confluenceClient | IContentDomain to bind the extension method to |
ContentTypes | contentType | Type of content, usually page |
System.String | title | Title for the content |
System.String | spaceKey | Key of the space to add the content to |
Body | body | Body |
System.Nullable<System.Int64> | ancestorId | Optional ID for the ancestor (parent) |
CancellationToken | cancellationToken | CancellationToken |
Returns
Type | Description |
---|---|
Task<Content> | Content |
CreateAsync(IContentDomain, ContentTypes, String, String, String, Nullable<Int64>, CancellationToken)
Create content
Declaration
public static Task<Content> CreateAsync(this IContentDomain confluenceClient, ContentTypes contentType, string title, string spaceKey, string body, long? ancestorId = null, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
IContentDomain | confluenceClient | IContentDomain to bind the extension method to |
ContentTypes | contentType | Type of content, usually page |
System.String | title | Title for the content |
System.String | spaceKey | Key of the space to add the content to |
System.String | body | the complete body (HTML) |
System.Nullable<System.Int64> | ancestorId | Optional ID for the ancestor (parent) |
CancellationToken | cancellationToken | CancellationToken |
Returns
Type | Description |
---|---|
Task<Content> | Content |
DeleteAsync(IContentDomain, Int64, Boolean, CancellationToken)
Delete content (attachments are also content)
Declaration
public static async Task DeleteAsync(this IContentDomain confluenceClient, long contentId, bool isTrashed = false, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
IContentDomain | confluenceClient | IContentDomain to bind the extension method to |
System.Int64 | contentId | ID for the content which needs to be deleted |
System.Boolean | isTrashed | If the content is trash-able, you will need to call DeleteAsync twice, second time with isTrashed = true |
CancellationToken | cancellationToken | CancellationToken |
Returns
Type | Description |
---|---|
Task |
DeleteLabelAsync(IContentDomain, Int64, String, CancellationToken)
Delete Label for content see here
Declaration
public static async Task DeleteLabelAsync(this IContentDomain confluenceClient, long contentId, string label, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
IContentDomain | confluenceClient | IContentDomain to bind the extension method to |
System.Int64 | contentId | content id |
System.String | label | Name of label |
CancellationToken | cancellationToken | CancellationToken |
Returns
Type | Description |
---|---|
Task | Task |
GetAsync(IContentDomain, Int64, IEnumerable<String>, CancellationToken)
Get Content information see here
Declaration
public static async Task<Content> GetAsync(this IContentDomain confluenceClient, long contentId, IEnumerable<string> expandGetContent = null, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
IContentDomain | confluenceClient | IContentDomain to bind the extension method to |
System.Int64 | contentId | content id (as content implements an implicit cast, you can also pass the content instance) |
IEnumerable<System.String> | expandGetContent | Specify the expand values, if null the default from the configuration is used |
CancellationToken | cancellationToken | CancellationToken |
Returns
Type | Description |
---|---|
Task<Content> | Content |
GetByTitleAsync(IContentDomain, String, String, PagingInformation, CancellationToken)
Get content by title See: https://docs.atlassian.com/confluence/REST/latest/#d2e4539
Declaration
public static async Task<Result<Content>> GetByTitleAsync(this IContentDomain confluenceClient, string spaceKey, string title, PagingInformation pagingInformation = null, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
IContentDomain | confluenceClient | IContentDomain to bind the extension method to |
System.String | spaceKey | Space key |
System.String | title | Title of the content |
PagingInformation | pagingInformation | PagingInformation used for paging |
CancellationToken | cancellationToken | CancellationToken |
Returns
Type | Description |
---|---|
Task<Result<Content>> | Results with content items |
GetChildrenAsync(IContentDomain, Int64, PagingInformation, Nullable<Int32>, CancellationToken)
Get Content information see here
Declaration
public static async Task<Result<Content>> GetChildrenAsync(this IContentDomain confluenceClient, long contentId, PagingInformation pagingInformation = null, int? parentVersion = null, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
IContentDomain | confluenceClient | IContentDomain to bind the extension method to |
System.Int64 | contentId | content id |
PagingInformation | pagingInformation | PagingInformation |
System.Nullable<System.Int32> | parentVersion | int representing the version of the content to retrieve children for. |
CancellationToken | cancellationToken | CancellationToken |
Returns
Type | Description |
---|---|
Task<Result<Content>> | List with Content |
GetHistoryAsync(IContentDomain, Int64, CancellationToken)
Get Content History information see here
Declaration
public static async Task<History> GetHistoryAsync(this IContentDomain confluenceClient, long contentId, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
IContentDomain | confluenceClient | IContentDomain to bind the extension method to |
System.Int64 | contentId | content id |
CancellationToken | cancellationToken | CancellationToken |
Returns
Type | Description |
---|---|
Task<History> | Content |
GetLabelsAsync(IContentDomain, Int64, CancellationToken)
Get Labels for content see here
Declaration
public static async Task<Result<Label>> GetLabelsAsync(this IContentDomain confluenceClient, long contentId, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
IContentDomain | confluenceClient | IContentDomain to bind the extension method to |
System.Int64 | contentId | content id |
CancellationToken | cancellationToken | CancellationToken |
Returns
Type | Description |
---|---|
Task<Result<Label>> | Result with labels |
MoveAsync(IContentDomain, Int64, Positions, Int64, CancellationToken)
Move the content specified by the contentId to the position relative to the targetContentId. Documentation for this can be found here
Declaration
public static async Task<string> MoveAsync(this IContentDomain confluenceClient, long contentId, Positions position, long targetContentId, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
IContentDomain | confluenceClient | IContentDomain to bind the extension method to |
System.Int64 | contentId | long with the content ID to move |
Positions | position | Positions with position describing how to move to the targetContentId. Check the enum documentation for the possibilities and their effect. |
System.Int64 | targetContentId | long with the target content ID, that is where the content needs to be moved to using the position for the relation. |
CancellationToken | cancellationToken | CancellationToken |
Returns
Type | Description |
---|---|
Task<System.String> | string with the contentId |
SearchAsync(IContentDomain, IFinalClause, String, PagingInformation, IEnumerable<String>, CancellationToken)
Possible since 5.7 Search for issues, with a CQL (e.g. from a filter) see here
Declaration
public static Task<Result<Content>> SearchAsync(this IContentDomain confluenceClient, IFinalClause cqlClause, string cqlContext = null, PagingInformation pagingInformation = null, IEnumerable<string> expandSearch = null, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
IContentDomain | confluenceClient | IContentDomain to bind the extension method to |
IFinalClause | cqlClause | Confluence Query Language, like SQL, for the search |
System.String | cqlContext | the execution context for CQL functions, provides current space key and content id. If this is not provided some CQL functions will not be available. |
PagingInformation | pagingInformation | PagingInformation |
IEnumerable<System.String> | expandSearch | The expand value for the search, when null the value from the ConfluenceClientConfig.ExpandSearch is taken |
CancellationToken | cancellationToken | CancellationToken |
Returns
Type | Description |
---|---|
Task<Result<Content>> | Result with content items |
SearchAsync(IContentDomain, SearchDetails, CancellationToken)
Possible since 5.7 Search for issues, with a CQL (e.g. from a filter) see here
Declaration
public static async Task<Result<Content>> SearchAsync(this IContentDomain confluenceClient, SearchDetails searchDetails, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
IContentDomain | confluenceClient | IContentDomain to bind the extension method to |
SearchDetails | searchDetails | All the details needed for a search |
CancellationToken | cancellationToken | CancellationToken |
Returns
Type | Description |
---|---|
Task<Result<Content>> | Result with content items |
UpdateAsync(IContentDomain, Content, CancellationToken)
Update content
Declaration
public static async Task<Content> UpdateAsync(this IContentDomain confluenceClient, Content content, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
IContentDomain | confluenceClient | IContentDomain to bind the extension method to |
Content | content | Content to update |
CancellationToken | cancellationToken | CancellationToken |
Returns
Type | Description |
---|---|
Task<Content> | Content |