choreo endpoint for language list
This commit is contained in:
parent
2b1620643a
commit
0fb7bec48e
4 changed files with 613 additions and 700 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -13,7 +13,7 @@ class PApiUrls {
|
|||
static String choreoBaseApi = Environment.choreoApi;
|
||||
|
||||
/// ---------------------- Languages --------------------------------------
|
||||
static String getLanguages = "/language/list";
|
||||
static String getLanguages = "/languages";
|
||||
|
||||
/// ---------------------- Users --------------------------------------
|
||||
static String createUser = "/account/create";
|
||||
|
|
@ -25,20 +25,6 @@ class PApiUrls {
|
|||
/// ---------------------- Conversation Partner -------------------------
|
||||
static String searchUserProfiles = "/account/search";
|
||||
|
||||
/// ---------------------- Deprecated Class API -------------------------
|
||||
static String classListBySpaceIds = "/class/listbyspaceids";
|
||||
static String getClassByClassCode = "/class/class_by_code?class_code=";
|
||||
|
||||
/// ---------------------- Exchange -----------------------------------
|
||||
static String exchangeClassValidate = "/class/validate_exchange";
|
||||
static String exchangeClass = "/class/class_exchange";
|
||||
static String isExchange = "/class/get_exchange?exchange_pangea_id=";
|
||||
static String exchangeParticipantsStore = "/class/exchange/participant";
|
||||
static String exchangeInfoStore = "/class/exchange/create";
|
||||
static String fetchExchangeInfo = "/class/exchange/data?exchange_pangea_id=";
|
||||
static String exchangeAcceptRequest = "/class/exchange/accept";
|
||||
static String makeAdminInExchange = "/class/exchange/admin/create";
|
||||
|
||||
///-------------------------------- Deprecated analytics --------------------
|
||||
static String classAnalytics = "${Environment.choreoApi}/class_analytics";
|
||||
static String messageService = "/message_service";
|
||||
|
|
|
|||
|
|
@ -1,70 +0,0 @@
|
|||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:http/http.dart';
|
||||
|
||||
import 'package:fluffychat/pangea/models/class_email_invite_model.dart';
|
||||
import 'package:fluffychat/pangea/models/class_model.dart';
|
||||
import '../network/requests.dart';
|
||||
import '../network/urls.dart';
|
||||
|
||||
class PClassRepo {
|
||||
static classesBySpaceIds(String accessToken, List<String> spaceIds) async {
|
||||
final Requests req =
|
||||
Requests(baseUrl: PApiUrls.baseAPI, accessToken: accessToken);
|
||||
final Response res = await req
|
||||
.post(url: PApiUrls.classListBySpaceIds, body: {"class_ids": spaceIds});
|
||||
final json = jsonDecode(res.body);
|
||||
final List<ClassSettingsModel> pangeaClasses = json["results"]
|
||||
.map((e) {
|
||||
final ClassSettingsModel model = ClassSettingsModel.fromJson(e);
|
||||
return model;
|
||||
})
|
||||
.toList()
|
||||
.cast<ClassSettingsModel>();
|
||||
return pangeaClasses;
|
||||
}
|
||||
|
||||
//Question for Jordan - what happens if code is incorrect? statuscode 400?
|
||||
// what about if user is already in the class?
|
||||
//Question for Lala: In this widget, controller, repo framework, where are
|
||||
// errors handled? How are they passed?
|
||||
static Future<ClassSettingsModel?> getClassByCode(
|
||||
String classCode,
|
||||
String accessToken,
|
||||
) async {
|
||||
final Requests req =
|
||||
Requests(baseUrl: PApiUrls.baseAPI, accessToken: accessToken);
|
||||
final Response res =
|
||||
await req.get(url: PApiUrls.getClassByClassCode + classCode);
|
||||
|
||||
if (res.statusCode == 400) {
|
||||
return null;
|
||||
}
|
||||
final json = jsonDecode(res.body);
|
||||
|
||||
final classSettings = ClassSettingsModel.fromJson(json);
|
||||
|
||||
return classSettings;
|
||||
}
|
||||
|
||||
static searchClass(String text) async {}
|
||||
|
||||
static sendEmailToJoinClass(
|
||||
List<ClassEmailInviteData> data,
|
||||
String roomId,
|
||||
String teacherName,
|
||||
) async {}
|
||||
|
||||
static inviteAction(BuildContext context, String id, String roomId) async {}
|
||||
|
||||
static reportUser({
|
||||
String? classRoomNamedata,
|
||||
String? classTeacherNamedata,
|
||||
String? reportedUserdata,
|
||||
String? classTeacherEmaildata,
|
||||
String? offensivedata,
|
||||
String? reasondata,
|
||||
}) async {}
|
||||
}
|
||||
|
|
@ -1,19 +1,18 @@
|
|||
import 'dart:convert';
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
import 'package:http/http.dart';
|
||||
|
||||
import 'package:fluffychat/pangea/models/language_model.dart';
|
||||
import 'package:fluffychat/pangea/network/urls.dart';
|
||||
import 'package:fluffychat/pangea/utils/error_handler.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:http/http.dart';
|
||||
|
||||
import '../config/environment.dart';
|
||||
import '../network/requests.dart';
|
||||
|
||||
class LanguageRepo {
|
||||
static Future<List<LanguageModel>> fetchLanguages() async {
|
||||
final Requests req = Requests(baseUrl: Environment.baseAPI);
|
||||
final Requests req = Requests(baseUrl: Environment.choreoApi);
|
||||
final Response res = await req.get(url: PApiUrls.getLanguages);
|
||||
|
||||
final decodedBody =
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue