FewchursClient class
Client for the Fewchurs API (/api/v1). Reads and votes are retried on
network and server errors; new content never is.
Constructors
- FewchursClient({required String apiKey, String? baseUrl, Client? httpClient, DeviceIdentity? identity, String sdkHeader = 'dart/$fewchursCoreVersion', String? localeProvider()?, FewchursLogger logger = const FewchursLogger(), Duration timeout = const Duration(seconds: 15), int maxRetries = 2, Duration retryDelay = const Duration(milliseconds: 400), void onEvent(FewchursEvent event)?})
Properties
- apiKey → String
-
final
- baseUrl → String
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- identity → DeviceIdentity
-
final
- localeProvider → String? Function()?
-
final
- logger → FewchursLogger
-
final
- maxRetries → int
-
final
- onEvent → void Function(FewchursEvent event)?
-
final
- retryDelay → Duration
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sdkHeader → String
-
final
- timeout → Duration
-
final
Methods
-
addComment(
String featureId, {required String text, String? authorName}) → Future< Comment> - Posts a comment, with an optional display name.
-
close(
) → void - Closes the HTTP client if this client created it.
-
follow(
String featureId, {required String email}) → Future< void> -
Emails
emailwhen the request changes. -
getConfig(
{bool refresh = false}) → Future< RemoteConfig> -
Server settings for this app, cached until
refreshistrue. -
getFeature(
String featureId) → Future< Feature> - Fetches one request, e.g. for a deep link or a notification. A request hidden by the board's plan is returned only to the device that submitted it; everyone else gets a FewchursNotFoundException.
-
listComments(
String featureId, {int limit = 20, String? cursor}) → Future< CommentPage> - Lists comments, oldest first.
-
listFeatures(
{FeatureSort sort = FeatureSort.top, int limit = 20, String? cursor, Set< FeatureStatus> ? statuses}) → Future<FeaturePage> -
Lists requests.
statusesfilters by status;cursorpages. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
submitFeature(
{required String title, String description = '', String? email, bool? isSubscriber}) → Future< Feature> - Submits a request. Input is validated before sending.
-
toString(
) → String -
A string representation of this object.
inherited
-
unfollow(
String featureId) → Future< void> - Stops the emails for this device.
-
unvote(
String featureId) → Future< VoteResult> - Removes this device's vote.
-
vote(
String featureId) → Future< VoteResult> - Adds this device's vote.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
isValidEmail(
String email) → bool -
Whether
emaillooks like an email address.
Constants
- commentMax → const int
- defaultBaseUrl → const String
- The live Fewchurs API.
- descriptionMax → const int
- titleMax → const int
- titleMin → const int