Initial commit
This commit is contained in:
46
app_code/lib/models/auth/login_response_model.dart
Normal file
46
app_code/lib/models/auth/login_response_model.dart
Normal file
@@ -0,0 +1,46 @@
|
||||
// To parse this JSON data, do
|
||||
//
|
||||
// final loginResponse = loginResponseFromJson(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:grostore/models/common/user_info.dart';
|
||||
|
||||
LoginResponse loginResponseFromJson(String str) => LoginResponse.fromJson(json.decode(str));
|
||||
LoginResponse loginResponseDefaultValue() => LoginResponse(result: false, message: "Faild", accessToken: "", tokenType: "",user: UserInfo.init());
|
||||
|
||||
String loginResponseToJson(LoginResponse data) => json.encode(data.toJson());
|
||||
|
||||
class LoginResponse {
|
||||
bool result;
|
||||
String message;
|
||||
String accessToken;
|
||||
String tokenType;
|
||||
UserInfo user;
|
||||
|
||||
|
||||
LoginResponse({
|
||||
required this.result,
|
||||
required this.message,
|
||||
required this.accessToken,
|
||||
required this.tokenType,
|
||||
required this.user
|
||||
|
||||
});
|
||||
|
||||
factory LoginResponse.fromJson(Map<String, dynamic> json) => LoginResponse(
|
||||
result: json["result"],
|
||||
message: json["message"],
|
||||
accessToken: json["access_token"],
|
||||
tokenType: json["token_type"],
|
||||
user: UserInfo.fromJson(json["user"]),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"result": result,
|
||||
"message": message,
|
||||
"access_token": accessToken,
|
||||
"token_type": tokenType,
|
||||
"user": user.toJson(),
|
||||
};
|
||||
}
|
||||
117
app_code/lib/models/auth/registration_response_model.dart
Normal file
117
app_code/lib/models/auth/registration_response_model.dart
Normal file
@@ -0,0 +1,117 @@
|
||||
// To parse this JSON data, do
|
||||
//
|
||||
// final registrationResponse = registrationResponseFromJson(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:grostore/models/common/user_info.dart';
|
||||
|
||||
RegistrationResponse registrationResponseFromJson(String str) =>RegistrationResponse.fromJson(json.decode(str));
|
||||
|
||||
RegistrationResponses registrationResFromJson(String str) =>RegistrationResponses.fromJson(json.decode(str));
|
||||
|
||||
RegistrationResp registrationRespFromJson(String str) =>RegistrationResp.fromJson(json.decode(str));
|
||||
|
||||
RegistrationResp registrationRespDefault() =>RegistrationResp.fromJson(json.decode('''{
|
||||
"result": false,
|
||||
"message": "",
|
||||
"code":1}'''));
|
||||
|
||||
RegistrationResponse registrationResponseDefault() =>RegistrationResponse.fromJson(json.decode('''{
|
||||
"result": false,
|
||||
"message": "",
|
||||
"access_token": "",
|
||||
"token_type": ""
|
||||
}'''));
|
||||
|
||||
RegistrationResponses registrationResponsesDefault() => RegistrationResponses.fromJson(json.decode('''{
|
||||
"result": false,
|
||||
"message": "",
|
||||
"access_token": "",
|
||||
"token_type": ""
|
||||
}'''));
|
||||
|
||||
String registrationResponseToJson(RegistrationResponse data) =>json.encode(data.toJson());
|
||||
|
||||
|
||||
class RegistrationResponse {
|
||||
bool result;
|
||||
String message;
|
||||
String accessToken;
|
||||
String tokenType;
|
||||
UserInfo user;
|
||||
|
||||
RegistrationResponse(
|
||||
{required this.result,
|
||||
required this.message,
|
||||
required this.accessToken,
|
||||
required this.tokenType,
|
||||
required this.user});
|
||||
|
||||
factory RegistrationResponse.fromJson(Map<String, dynamic> json) =>
|
||||
RegistrationResponse(
|
||||
result: json["result"],
|
||||
message: json["message"],
|
||||
accessToken: json["access_token"],
|
||||
tokenType: json["token_type"],
|
||||
user: UserInfo.fromJson(json["user"]),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"result": result,
|
||||
"message": message,
|
||||
"access_token": accessToken,
|
||||
"token_type": tokenType,
|
||||
"user": user.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
class RegistrationResponses {
|
||||
bool result;
|
||||
var message;
|
||||
String accessToken;
|
||||
String tokenType;
|
||||
|
||||
RegistrationResponses({
|
||||
required this.result,
|
||||
required this.message,
|
||||
required this.accessToken,
|
||||
required this.tokenType,
|
||||
});
|
||||
|
||||
factory RegistrationResponses.fromJson(Map<String, dynamic> json) =>
|
||||
RegistrationResponses(
|
||||
result: json["result"],
|
||||
message: json["message"],
|
||||
accessToken: json["access_token"],
|
||||
tokenType: json["token_type"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"result": result,
|
||||
"message": message,
|
||||
"access_token": accessToken,
|
||||
"token_type": tokenType,
|
||||
};
|
||||
}
|
||||
|
||||
class RegistrationResp {
|
||||
bool result;
|
||||
String message;
|
||||
int code;
|
||||
|
||||
RegistrationResp({required this.result, required this.message, required this.code});
|
||||
|
||||
factory RegistrationResp.fromJson(Map<String, dynamic> json) =>
|
||||
RegistrationResp(
|
||||
result: json["result"],
|
||||
message: json["message"],
|
||||
code: json["code"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"result": result,
|
||||
"message": message,
|
||||
"code": code,
|
||||
};
|
||||
}
|
||||
34
app_code/lib/models/auth/token_check_response.dart
Normal file
34
app_code/lib/models/auth/token_check_response.dart
Normal file
@@ -0,0 +1,34 @@
|
||||
// To parse this JSON data, do
|
||||
//
|
||||
// final tokenCheckResponse = tokenCheckResponseFromJson(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:grostore/models/common/user_info.dart';
|
||||
|
||||
TokenCheckResponse tokenCheckResponseFromJson(String str) => TokenCheckResponse.fromJson(json.decode(str));
|
||||
|
||||
String tokenCheckResponseToJson(TokenCheckResponse data) => json.encode(data.toJson());
|
||||
|
||||
class TokenCheckResponse {
|
||||
bool result;
|
||||
UserInfo user;
|
||||
|
||||
TokenCheckResponse({
|
||||
required this.result,
|
||||
required this.user,
|
||||
});
|
||||
|
||||
factory TokenCheckResponse.fromJson(Map<String, dynamic> json) => TokenCheckResponse(
|
||||
result: json["result"],
|
||||
user: UserInfo.fromJson(json["user"]),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"result": result,
|
||||
"user": user.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user