fivestar_support 1.1.3
fivestar_support: ^1.1.3 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.
Features #
- Server-Side Customer ID Generation: Secure customer IDs generated by the server
- Response Types: Fetch available feedback categories (bug, feature request, etc.)
- Feedback Submission: Submit bug reports and feature requests
- Dart-native: Written in pure Dart with no platform dependencies
Installation #
Add this to your package's pubspec.yaml file:
dependencies:
fivestar_support: ^1.1.3
Then run:
flutter pub get
Quick Start #
import 'package:fivestar_support/fivestar_support.dart';
// Initialize the client
final client = FiveStarClient(FiveStarClientConfig(
clientId: 'your-client-uuid',
platform: 'flutter',
appVersion: '1.0.0',
));
// Generate a customer ID from the server
final result = await client.generateCustomerId();
final customerId = result.customerId;
// Register the customer
await client.registerCustomer(
customerId,
RegisterCustomerOptions(email: 'user@example.com', name: 'John Doe'),
);
// Submit feedback
final types = await client.getResponseTypes();
await client.submitResponse(SubmitResponseOptions(
customerId: customerId,
title: 'Feature request: Dark mode',
description: 'Please add a dark mode to the application',
typeId: types[0].id,
));
Usage #
Initialize the Client #
final client = FiveStarClient(FiveStarClientConfig(
clientId: 'your-client-uuid',
apiUrl: 'https://fivestar.support', // optional
platform: 'flutter', // optional
appVersion: '1.0.0', // optional
deviceModel: 'iPhone', // optional
osVersion: '16.0', // optional
));
Generate Customer ID #
Customer IDs are now generated server-side with cryptographic signing:
final result = await client.generateCustomerId();
print('Customer ID: ${result.customerId}');
print('Expires At: ${result.expiresAt}');
print('Device ID: ${result.deviceId}');
Register Customer #
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(
customerId: customerId,
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}');
}
Verify Customer ID #
final result = await client.verifyCustomer(customerId);
if (result.valid) {
print('Customer ID is valid and registered');
} else {
print('Verification failed: ${result.message}');
}
Get Public URL #
// Get default public URL
final url = client.getPublicUrl();
// Get localized public URL
final frenchUrl = client.getPublicUrl('fr');
API Reference #
FiveStarClient #
Main client class for interacting with the FiveStar Support API.
Methods
| Method | Description |
|---|---|
Future<List<ResponseType>> getResponseTypes() |
Get all response types |
Future<GenerateCustomerIdResult> generateCustomerId() |
Generate a new customer ID from server |
Future<RegisterCustomerResult> registerCustomer(String, [RegisterCustomerOptions?]) |
Register a customer ID |
Future<VerifyCustomerResult> verifyCustomer(String) |
Verify a customer ID |
Future<SubmitResponseResult> submitResponse(SubmitResponseOptions) |
Submit feedback |
String getPublicUrl([String?]) |
Get public feedback URL |
Data Models #
GenerateCustomerIdResult
class GenerateCustomerIdResult {
final String customerId; // The server-generated customer ID
final String expiresAt; // ISO datetime when ID expires
final String deviceId; // Short device identifier
}
RegisterCustomerOptions
class RegisterCustomerOptions {
final String? email; // Optional: Customer email
final String? name; // Optional: Customer name
}
SubmitResponseOptions
class SubmitResponseOptions {
final String customerId; // Required: Customer ID
final String title; // Required: Feedback title
final String description; // Required: Feedback description
final String typeId; // Required: Response type ID
final String? email; // Optional: Customer email
final String? name; // Optional: Customer name
}
VerifyCustomerResult
class VerifyCustomerResult {
final bool valid; // Whether the customer ID is valid
final String? message; // Optional message
}
ResponseType
class ResponseType {
final String id;
final String name;
final String slug;
final String color;
final String icon;
}
Customer ID Generation #
final result = await client.generateCustomerId();
final customerId = result.customerId;
Registration #
// Same API, but customerId now comes from server
await client.registerCustomer(customerId);
License #
MIT © Ryan Weber Ltd