fivestar_support 1.0.0
fivestar_support: ^1.0.0 copied to clipboard
Flutter SDK for FiveStar Support - Customer feedback platform. Submit bug reports, feature requests, and gather customer feedback easily.
fivestar_support #
Flutter SDK for FiveStar Support - Customer feedback platform.
Installation #
Add this to your package's pubspec.yaml file:
dependencies:
fivestar_support: ^1.0.0
Then run:
flutter pub get
Features #
- Customer ID Generation: Generate secure, client-specific customer IDs
- Feedback Submission: Submit bug reports, feature requests, and general feedback
- Voting: Upvote/downvote responses
- Comments: Post comments on feedback items
- Dart-native: Written in pure Dart with no platform dependencies
Quick Start #
import 'package:fivestar_support/fivestar_support.dart';
// Initialize the client
final client = FiveStarClient(FiveStarClientConfig(
clientId: 'your-client-uuid', // Get this from your FiveStar dashboard
apiUrl: 'https://fivestar.support', // Optional, defaults to fivestar.support
));
// Generate a customer ID for your user
final customerId = generateCustomerId(client.clientId);
// Register the customer (recommended on first launch)
await client.registerCustomer(customerId);
// Submit feedback
final types = await client.getResponseTypes();
await client.submitResponse(SubmitResponseOptions(
title: 'Feature request: Dark mode',
description: 'Please add a dark mode to the application',
typeId: types[0].id,
));
Usage #
Initialize the Client #
import 'package:fivestar_support/fivestar_support.dart';
final client = FiveStarClient(FiveStarClientConfig(
clientId: 'your-client-uuid',
apiUrl: 'https://fivestar.support', // optional
));
Generate and Register Customer ID #
// Generate a customer ID unique to this client
final customerId = generateCustomerId(client.clientId);
// Register the customer with your app
final result = await client.registerCustomer(
customerId,
RegisterCustomerOptions(
email: 'user@example.com',
name: 'John Doe',
),
);
if (result.success) {
print('Customer registered: ${result.customer?.id}');
}
Get Response Types #
final types = await client.getResponseTypes();
for (final type in types) {
print('${type.name}: ${type.id}');
}
Submit Feedback #
final result = await client.submitResponse(SubmitResponseOptions(
title: 'Feature request',
description: 'Please add dark mode support',
typeId: types.first.id,
email: 'user@example.com',
name: 'John Doe',
));
if (result.success) {
print('Response submitted: ${result.responseId}');
}
Vote on a Response #
final result = await client.vote(
responseId,
customerId,
'up', // or 'down'
);
print('Votes: ${result.votesUp} up, ${result.votesDown} down');
Comment on a Response #
final result = await client.comment(
responseId,
customerId,
'This would be very useful!',
);
Get Comments #
final comments = await client.getComments(responseId);
for (final comment in comments.comments) {
print(comment['content']);
}
Get Public URL #
// Get default public URL
final url = client.getPublicUrl();
// Get localized public URL
final frenchUrl = client.getPublicUrl('fr');
Customer ID Format #
Customer IDs are 26-character strings using the Crockford base32 alphabet. They are encoded using a client-specific XOR cipher to prevent forgery.
- Format: 26 characters,
[0-9A-HJKMNPQRSTVWXYZ] - Client-specific: Each client generates unique customer IDs
- Verifiable: IDs can be verified against a client ID
Validation #
// Check format validity
if (isValidCustomerIdFormat(customerId)) {
// Verify against client
final isValid = verifyCustomerId(customerId, clientId);
print('Valid: $isValid');
}
// Decode to get original ULID
final ulid = decodeCustomerId(customerId, clientId);
print('Original ULID: $ulid');
API Reference #
FiveStarClient #
Main client class for interacting with the FiveStar Support API.
Methods
Future<List<ResponseType>> getResponseTypes()- Get all response typesFuture<SubmitResponseResult> submitResponse(SubmitResponseOptions)- Submit feedbackFuture<RegisterCustomerResult> registerCustomer(String, [RegisterCustomerOptions?])- Register customerFuture<VerifyCustomerResult> verifyCustomer(String)- Verify customer IDFuture<VoteResult> vote(String, String, String)- Vote on responseFuture<CommentResult> comment(String, String, String)- Post commentFuture<CommentsResult> getComments(String)- Get commentsString getPublicUrl([String?])- Get public feedback URL
Customer ID Functions #
String generateCustomerId(String)- Generate client-specific customer IDbool verifyCustomerId(String, String)- Verify customer ID for clientString? decodeCustomerId(String, String)- Decode customer ID to ULIDbool isValidCustomerIdFormat(String)- Validate customer ID format
License #
MIT © Ryan Weber Ltd