CommentsClient class
High level client that wraps the HTTP API exposed by the Comments backend.
The client handles authentication, token caching, and JSON parsing so that you can focus on rendering comments in your Flutter app. Use a single instance per user session and call close when it is no longer needed.
Constructors
- CommentsClient({required String baseUrl, required String apiKey, required CommentsExternalUser externalUser, CommentsUserRole role = CommentsUserRole.user, Client? httpClient})
- Creates a new client configured for your Comments project.
Properties
- apiKey → String
-
Project API key used to exchange for short-lived tokens.
final
- baseUrl → String
-
Base URL of the Comments backend.
final
- externalUser → CommentsExternalUser
-
Representation of the current end-user used for token generation.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- role → CommentsUserRole
-
Permission level assigned to the generated tokens.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
close(
) → void - Releases the underlying HTTP client when you are done with the instance.
-
createComment(
{required String threadId, required String body, String? parentId, Map< String, dynamic> ? metadata, String? authorName, String? authorAvatarUrl}) → Future<Comment> - Creates a comment inside a thread.
-
listComments(
{required String threadId, String order = 'created_at.desc'}) → Future< List< Comment> > - Lists approved comments for a given thread.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
refreshToken(
) → Future< void> - Manually refreshes the cached token.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited