Class CommentClient
Implements
Inherited Members
Namespace: Noxum.Nova.Cms.Client
Assembly: Noxum.Nova.Cms.Client.dll
Syntax
public class CommentClient : ICommentClient
Constructors
CommentClient(string, HttpClient)
Declaration
public CommentClient(string baseUrl, HttpClient httpClient)
Parameters
| Type | Name | Description |
|---|---|---|
| string | baseUrl | |
| HttpClient | httpClient |
Properties
BaseUrl
Declaration
public string BaseUrl { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
JsonSerializerSettings
Declaration
protected JsonSerializerOptions JsonSerializerSettings { get; }
Property Value
| Type | Description |
|---|---|
| JsonSerializerOptions |
ReadResponseAsString
Declaration
public bool ReadResponseAsString { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
CreateCommentAsync(CreateCommentRequest, string, CancellationToken)
Create a comment.
Declaration
public virtual Task<CmsComment> CreateCommentAsync(CreateCommentRequest request, string username = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CreateCommentRequest | request | The model describing the comment that shall be created. |
| string | username | The username this transaction is committed for. This must be set for internal access, otherwise, the transaction will be committed as the user who is currently logged in. |
| CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
| Type | Description |
|---|---|
| Task<CmsComment> | OK |
Exceptions
| Type | Condition |
|---|---|
| CmsApiException | A server side error occurred. |
DeleteCommentAsync(long, string, CancellationToken)
Deletes a comment.
Declaration
public virtual Task DeleteCommentAsync(long commentId, string username = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| long | commentId | The comment's id. |
| string | username | The username this transaction is committed for. This must be set for internal access, otherwise, the transaction will be committed as the user who is currently logged in. |
| CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
| Type | Description |
|---|---|
| Task | OK |
Exceptions
| Type | Condition |
|---|---|
| CmsApiException | A server side error occurred. |
GetCommentAsync(long, CancellationToken)
Get a single comment by ID
Declaration
public virtual Task<CmsComment> GetCommentAsync(long commentId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| long | commentId | The comment's ID. |
| CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
| Type | Description |
|---|---|
| Task<CmsComment> | OK |
Exceptions
| Type | Condition |
|---|---|
| CmsApiException | A server side error occurred. |
GetCommentsAsync(int?, int?, string, bool?, string, int?, CancellationToken)
Get multiple comments, sorted by id, descending.
Declaration
public virtual Task<CmsCommentList> GetCommentsAsync(int? branchRef = null, int? objectRef = null, string user = null, bool? isDeleted = null, string @continue = null, int? take = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int? | branchRef | The id of the branch. |
| int? | objectRef | The id of object the comment refers to. |
| string | user | The user who wrote the comment. If not null, only comments created by the specified user will be included. |
| bool? | isDeleted | If true, include only deleted, if false include only not-deleted, if null include all comments. |
| string | continue | An opaque token that encapsulates information how to continue the list request |
| int? | take | The number of comments to take. |
| CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
| Type | Description |
|---|---|
| Task<CmsCommentList> | OK |
Exceptions
| Type | Condition |
|---|---|
| CmsApiException | A server side error occurred. |
ReadObjectResponseAsync<T>(HttpResponseMessage, IReadOnlyDictionary<string, IEnumerable<string>>, CancellationToken)
Declaration
protected virtual Task<CommentClient.ObjectResponseResult<T>> ReadObjectResponseAsync<T>(HttpResponseMessage response, IReadOnlyDictionary<string, IEnumerable<string>> headers, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| HttpResponseMessage | response | |
| IReadOnlyDictionary<string, IEnumerable<string>> | headers | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<CommentClient.ObjectResponseResult<T>> |
Type Parameters
| Name | Description |
|---|---|
| T |
UpdateCommentAsync(long, UpdateCommentRequest, string, CancellationToken)
Updates a comment.
Declaration
public virtual Task UpdateCommentAsync(long commentId, UpdateCommentRequest request, string username = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| long | commentId | The comment id. |
| UpdateCommentRequest | request | The update request model |
| string | username | The username this transaction is committed for. This must be set for internal access, otherwise, the transaction will be committed as the user who is currently logged in. |
| CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
| Type | Description |
|---|---|
| Task | OK |
Exceptions
| Type | Condition |
|---|---|
| CmsApiException | A server side error occurred. |