initial
Some checks failed
Build Android App / build (push) Failing after 32m54s

This commit is contained in:
ImBenji
2026-01-02 12:05:49 +00:00
parent 4808116608
commit 7a88585b6e
12 changed files with 1356 additions and 367 deletions

View File

@@ -3,6 +3,29 @@ import "dart:typed_data";
import "package:http/http.dart" as http;
class QuoteEngagement {
final int? likes;
final int? retweets;
final int? replies;
final int? views;
QuoteEngagement({
this.likes,
this.retweets,
this.replies,
this.views,
});
Map<String, dynamic> toJson() {
return {
if (likes != null) "likes": likes,
if (retweets != null) "retweets": retweets,
if (replies != null) "replies": replies,
if (views != null) "views": views,
};
}
}
class QuoteRequest {
final String? displayName;
final String? username;
@@ -10,6 +33,8 @@ class QuoteRequest {
final String? text;
final dynamic imageUrl; // can be String or Uint8List
final int? timestamp;
final bool? verified;
final QuoteEngagement? engagement;
QuoteRequest({
this.displayName,
@@ -18,6 +43,8 @@ class QuoteRequest {
this.text,
this.imageUrl,
this.timestamp,
this.verified,
this.engagement,
});
@@ -40,6 +67,8 @@ class QuoteRequest {
"text": text,
"imageUrl": _encodeImage(imageUrl),
"timestamp": timestamp,
if (verified != null) "verified": verified,
if (engagement != null) "engagement": engagement!.toJson(),
};
}
@@ -58,13 +87,20 @@ class QuoteRequest {
if (timestamp != null) params["timestamp"] = timestamp.toString();
if (verified != null) params["verified"] = verified.toString();
// engagment is complex obj, better suited for POST reqests
if (engagement != null) {
params["engagement"] = jsonEncode(engagement!.toJson());
}
return Uri(queryParameters: params).query;
}
}
class QuoteGeneratorApi {
static const String _baseUrl = "https://quotes.imbenji.net";
// static const String _baseUrl = "http://localhost:3000";
// static const String _baseUrl = "https://quotes.imbenji.net";
static const String _baseUrl = "http://localhost:3000";
// genrate a quote image using POST