Skip to content

Commit

Permalink
Akhil/1396/multi user level authentication poc (deriv-com#344)
Browse files Browse the repository at this point in the history
* added loginId for account status

* fixed the test case for account status

* reverted previous changes

* updated topup functionality

* updated contract details API calls

* removed unnecessary import

* added loginId for account status

* added formatting for loginid

* added loginid account status receive methods

* added trailing comma

* fixed two error exception errors

---------

Co-authored-by: akhil-deriv <[email protected]>
  • Loading branch information
waqas-younas-deriv and akhil-deriv authored Sep 26, 2024
1 parent 84b9319 commit 8503b1f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
13 changes: 9 additions & 4 deletions lib/api/response/get_account_status_response_result.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@ class GetAccountStatusResponse extends GetAccountStatusResponseModel {
///
/// For parameters information refer to [GetAccountStatusRequest].
/// Throws an [BaseAPIException] if API response contains an error.
static Future<GetAccountStatusReceive> fetchAccountStatusRaw() async {
static Future<GetAccountStatusReceive> fetchAccountStatusRaw({
String? loginId,
}) async {
final GetAccountStatusReceive response = await _api.call(
request: const GetAccountStatusRequest(),
request: GetAccountStatusRequest(loginid: loginId),
);

checkException(
Expand All @@ -73,8 +75,11 @@ class GetAccountStatusResponse extends GetAccountStatusResponseModel {
///
/// For parameters information refer to [GetAccountStatusRequest].
/// Throws an [BaseAPIException] if API response contains an error.
static Future<GetAccountStatusResponse> fetchAccountStatus() async {
final GetAccountStatusReceive response = await fetchAccountStatusRaw();
static Future<GetAccountStatusResponse> fetchAccountStatus({
String? loginId,
}) async {
final GetAccountStatusReceive response =
await fetchAccountStatusRaw(loginId: loginId);

return GetAccountStatusResponse.fromJson(response.getAccountStatus);
}
Expand Down
7 changes: 5 additions & 2 deletions lib/api/response/p2p_advert_create_response_result.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import

import 'package:equatable/equatable.dart';

import 'package:flutter_deriv_api/api/exceptions/p2p_advert_exception.dart';
import 'package:flutter_deriv_api/api/exceptions/base_api_exception.dart';
import 'package:flutter_deriv_api/api/models/base_exception_model.dart';
import 'package:flutter_deriv_api/basic_api/generated/p2p_advert_create_receive.dart';
import 'package:flutter_deriv_api/basic_api/generated/p2p_advert_create_send.dart';
Expand Down Expand Up @@ -239,6 +238,7 @@ enum VisibilityStatusItemEnum {
/// advertiser_temp_ban.
advertiserTempBan,
}

/// P2p advert create model class.
abstract class P2pAdvertCreateModel {
/// Initializes P2p advert create model class .
Expand Down Expand Up @@ -742,6 +742,7 @@ class P2pAdvertCreate extends P2pAdvertCreateModel {
visibilityStatus: visibilityStatus ?? this.visibilityStatus,
);
}

/// Advertiser details model class.
abstract class AdvertiserDetailsModel {
/// Initializes Advertiser details model class .
Expand Down Expand Up @@ -892,6 +893,7 @@ class AdvertiserDetails extends AdvertiserDetailsModel {
totalCompletionRate: totalCompletionRate ?? this.totalCompletionRate,
);
}

/// Payment method details property model class.
abstract class PaymentMethodDetailsPropertyModel {
/// Initializes Payment method details property model class .
Expand Down Expand Up @@ -1020,6 +1022,7 @@ class PaymentMethodDetailsProperty extends PaymentMethodDetailsPropertyModel {
usedByOrders: usedByOrders ?? this.usedByOrders,
);
}

/// Fields property model class.
abstract class FieldsPropertyModel {
/// Initializes Fields property model class .
Expand Down
6 changes: 4 additions & 2 deletions lib/api/response/p2p_advert_list_response_result.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import

import 'package:equatable/equatable.dart';

import 'package:flutter_deriv_api/api/exceptions/p2p_advert_exception.dart';
import 'package:flutter_deriv_api/api/exceptions/base_api_exception.dart';
import 'package:flutter_deriv_api/api/models/base_exception_model.dart';
import 'package:flutter_deriv_api/basic_api/generated/p2p_advert_list_receive.dart';
import 'package:flutter_deriv_api/basic_api/generated/p2p_advert_list_send.dart';
Expand Down Expand Up @@ -226,6 +225,7 @@ enum VisibilityStatusItemEnum {
/// advertiser_temp_ban.
advertiserTempBan,
}

/// P2p advert list model class.
abstract class P2pAdvertListModel {
/// Initializes P2p advert list model class .
Expand Down Expand Up @@ -274,6 +274,7 @@ class P2pAdvertList extends P2pAdvertListModel {
list: list ?? this.list,
);
}

/// List item model class.
abstract class ListItemModel {
/// Initializes List item model class .
Expand Down Expand Up @@ -817,6 +818,7 @@ class ListItem extends ListItemModel {
visibilityStatus: visibilityStatus ?? this.visibilityStatus,
);
}

/// Advertiser details model class.
abstract class AdvertiserDetailsModel {
/// Initializes Advertiser details model class .
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"methods": "static final BaseAPI _api = Injector()<BaseAPI>(); \n \n /// Gets the account's status. \n /// \n /// For parameters information refer to [GetAccountStatusRequest]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future<GetAccountStatusReceive> fetchAccountStatusRaw() async { \n final GetAccountStatusReceive response = await _api.call( \n request: const GetAccountStatusRequest(), \n ); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Gets the account's status. \n /// \n /// For parameters information refer to [GetAccountStatusRequest]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future<GetAccountStatusResponse> fetchAccountStatus() async { \n final GetAccountStatusReceive response = await fetchAccountStatusRaw(); \n \n return GetAccountStatusResponse.fromJson(response.getAccountStatus); \n }",
"methods": "static final BaseAPI _api = Injector()<BaseAPI>(); \n \n /// Gets the account's status. \n /// \n /// For parameters information refer to [GetAccountStatusRequest]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future<GetAccountStatusReceive> fetchAccountStatusRaw({String? loginId,}) async { \n final GetAccountStatusReceive response = await _api.call( \n request: GetAccountStatusRequest(loginid: loginId), \n ); \n \n checkException( \n response: response, \n exceptionCreator: ({BaseExceptionModel? baseExceptionModel}) => \n BaseAPIException(baseExceptionModel: baseExceptionModel), \n ); \n \n return response; \n } \n \n /// Gets the account's status. \n /// \n /// For parameters information refer to [GetAccountStatusRequest]. \n /// Throws an [BaseAPIException] if API response contains an error. \n static Future<GetAccountStatusResponse> fetchAccountStatus({String? loginId,}) async { \n final GetAccountStatusReceive response = await fetchAccountStatusRaw(loginId: loginId); \n \n return GetAccountStatusResponse.fromJson(response.getAccountStatus); \n }",
"imports": "import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';\nimport 'package:flutter_deriv_api/api/models/base_exception_model.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/get_account_status_receive.dart';\nimport 'package:flutter_deriv_api/basic_api/generated/get_account_status_send.dart';\nimport 'package:flutter_deriv_api/helpers/helpers.dart';\nimport 'package:flutter_deriv_api/services/connection/api_manager/base_api.dart';\nimport 'package:deriv_dependency_injector/dependency_injector.dart';\n"
}

0 comments on commit 8503b1f

Please sign in to comment.