@davoodmehraban89 / LifeMate / commits / c84a99c
Fork 0

LifeMate — Personal, Family & Learning Companion

fix: implement phase 4 Flutter API methods

davoodmehraban89 committed Oct 5, 2026 at 16:14 UTC c84a99c95711cae13d26e79634e02e223d0add0e
1 file changed +85
apps/lifemate/lib/api.dart
+85
@@ -526,4 +526,89 @@ class HttpIdentityApi implements IdentityApi {
526 body: {'mutations': mutations},
527 );
528
529 + @override
530 + Future<Map<String, dynamic>> createLearningGoal({
531 + required String title,
532 + String? target,
533 + String? subjectId,
534 + }) =>
535 + _json('POST', '/v1/learning/goals', auth: true, body: {
536 + 'title': title,
537 + if (target != null) 'target': target,
538 + if (subjectId != null) 'subjectId': subjectId,
539 + });
540 +
541 + @override
542 + Future<List<Map<String, dynamic>>> listLearningGoals() async {
543 + final result = await _json('GET', '/v1/learning/goals', auth: true);
544 + return (result['items'] as List<dynamic>? ?? const [])
545 + .map((item) => Map<String, dynamic>.from(item as Map))
546 + .toList();
547 + }
548 +
549 + @override
550 + Future<Map<String, dynamic>> createLearningCheckin({
551 + String? learningGoalId,
552 + required int confidence,
553 + required int difficulty,
554 + String? note,
555 + }) =>
556 + _json('POST', '/v1/learning/checkins', auth: true, body: {
557 + if (learningGoalId != null) 'learningGoalId': learningGoalId,
558 + 'confidence': confidence,
559 + 'difficulty': difficulty,
560 + if (note != null) 'note': note,
561 + });
562 +
563 + @override
564 + Future<Map<String, dynamic>> createWellbeingCheckin({
565 + required int mood,
566 + required int energy,
567 + required int stress,
568 + String? note,
569 + String visibility = 'private',
570 + }) =>
571 + _json('POST', '/v1/wellbeing/checkins', auth: true, body: {
572 + 'mood': mood,
573 + 'energy': energy,
574 + 'stress': stress,
575 + if (note != null) 'note': note,
576 + 'visibility': visibility,
577 + });
578 +
579 + @override
580 + Future<List<Map<String, dynamic>>> listWellbeingCheckins() async {
581 + final result = await _json('GET', '/v1/wellbeing/checkins', auth: true);
582 + return (result['items'] as List<dynamic>? ?? const [])
583 + .map((item) => Map<String, dynamic>.from(item as Map))
584 + .toList();
585 + }
586 +
587 + @override
588 + Future<Map<String, dynamic>> createAiSession(String kind) =>
589 + _json('POST', '/v1/ai/sessions', auth: true, body: {'kind': kind});
590 +
591 + @override
592 + Future<Map<String, dynamic>> sendAiMessage(
593 + String sessionId,
594 + String message,
595 + ) =>
596 + _json(
597 + 'POST',
598 + '/v1/ai/sessions/$sessionId/messages',
599 + auth: true,
600 + body: {'message': message},
601 + );
602 +
603 + @override
604 + Future<Map<String, dynamic>> getGuardianWellbeingSummary(
605 + String familyId,
606 + String minorUserId,
607 + ) =>
608 + _json(
609 + 'GET',
610 + '/v1/families/$familyId/children/$minorUserId/wellbeing-summary',
611 + auth: true,
612 + );
613 +
614 }