Skip to content

Commit 91fce8a

Browse files
author
serverpod_cloud
committed
feat(gc): 7cfe8055691ca62f3646a80bd4c77b2d21390c47
1 parent 4bf5e17 commit 91fce8a

4 files changed

Lines changed: 681 additions & 410 deletions

File tree

ground_control_client/lib/src/protocol/client.dart

Lines changed: 56 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -49,22 +49,24 @@ import 'package:ground_control_client/src/protocol/features/environment_variable
4949
as _i20;
5050
import 'package:ground_control_client/src/protocol/domains/logs/models/log_record.dart'
5151
as _i21;
52-
import 'package:ground_control_client/src/protocol/features/databases/models/database_connection.dart'
52+
import 'package:ground_control_client/src/protocol/domains/products/models/subscription_info.dart'
5353
as _i22;
54-
import 'package:ground_control_client/src/protocol/features/projects/models/project_config.dart'
54+
import 'package:ground_control_client/src/protocol/features/databases/models/database_connection.dart'
5555
as _i23;
56-
import 'package:ground_control_client/src/protocol/features/projects/models/role.dart'
56+
import 'package:ground_control_client/src/protocol/features/projects/models/project_config.dart'
5757
as _i24;
58-
import 'package:ground_control_client/src/protocol/domains/status/models/deploy_attempt_stage.dart'
58+
import 'package:ground_control_client/src/protocol/features/projects/models/role.dart'
5959
as _i25;
60-
import 'package:serverpod_auth_idp_client/serverpod_auth_idp_client.dart'
60+
import 'package:ground_control_client/src/protocol/domains/status/models/deploy_attempt_stage.dart'
6161
as _i26;
62-
import 'package:serverpod_auth_migration_client/serverpod_auth_migration_client.dart'
62+
import 'package:serverpod_auth_idp_client/serverpod_auth_idp_client.dart'
6363
as _i27;
64-
import 'package:serverpod_auth_bridge_client/serverpod_auth_bridge_client.dart'
64+
import 'package:serverpod_auth_migration_client/serverpod_auth_migration_client.dart'
6565
as _i28;
66-
import 'package:serverpod_auth_client/serverpod_auth_client.dart' as _i29;
67-
import 'protocol.dart' as _i30;
66+
import 'package:serverpod_auth_bridge_client/serverpod_auth_bridge_client.dart'
67+
as _i29;
68+
import 'package:serverpod_auth_client/serverpod_auth_client.dart' as _i30;
69+
import 'protocol.dart' as _i31;
6870

6971
/// Endpoint for global administrator to handle procurement for users.
7072
/// {@category Endpoint}
@@ -356,12 +358,13 @@ class EndpointBilling extends _i1.EndpointRef {
356358
@override
357359
String get name => 'billing';
358360

359-
/// Reads the owner's billing information.
361+
/// Reads the owner information.
360362
///
361-
/// This endpoint reads the owner's billing information, including the
362-
/// billing address and email addresses.
363+
/// Returns the [Owner] object,
364+
/// including the [User] object, and [BillingInfo] if it exists
365+
/// (including the billing address and email addresses).
363366
///
364-
/// Returns the [Owner] object.
367+
/// Throws a [NotFoundException] if the owner is not found.
365368
_i2.Future<_i12.Owner> readOwner() => caller.callServerEndpoint<_i12.Owner>(
366369
'billing',
367370
'readOwner',
@@ -683,11 +686,17 @@ class EndpointPlans extends _i1.EndpointRef {
683686
String get name => 'plans';
684687

685688
/// Procures a subscription plan.
686-
_i2.Future<void> procurePlan({required String planName}) =>
689+
_i2.Future<void> procurePlan({
690+
String? planProductName,
691+
String? planName,
692+
}) =>
687693
caller.callServerEndpoint<void>(
688694
'plans',
689695
'procurePlan',
690-
{'planName': planName},
696+
{
697+
'planProductName': planProductName,
698+
'planName': planName,
699+
},
691700
);
692701

693702
/// Fetches the names of the procured subscription plans.
@@ -698,15 +707,28 @@ class EndpointPlans extends _i1.EndpointRef {
698707
{},
699708
);
700709

710+
_i2.Future<_i22.SubscriptionInfo> getSubscriptionInfo() =>
711+
caller.callServerEndpoint<_i22.SubscriptionInfo>(
712+
'plans',
713+
'getSubscriptionInfo',
714+
{},
715+
);
716+
701717
/// Checks if a plan is available for procurement.
702718
///
703719
/// - Throws [NotFoundException] if the product is not found.
704720
/// - Throws [ProcurementDeniedException] if the product is not available.
705-
_i2.Future<void> checkPlanAvailability({required String planName}) =>
721+
_i2.Future<void> checkPlanAvailability({
722+
String? planProductName,
723+
String? planName,
724+
}) =>
706725
caller.callServerEndpoint<void>(
707726
'plans',
708727
'checkPlanAvailability',
709-
{'planName': planName},
728+
{
729+
'planProductName': planProductName,
730+
'planName': planName,
731+
},
710732
);
711733

712734
/// Fetches the names of the available subscription plans.
@@ -726,9 +748,9 @@ class EndpointDatabase extends _i1.EndpointRef {
726748
@override
727749
String get name => 'database';
728750

729-
_i2.Future<_i22.DatabaseConnection> getConnectionDetails(
751+
_i2.Future<_i23.DatabaseConnection> getConnectionDetails(
730752
{required String cloudCapsuleId}) =>
731-
caller.callServerEndpoint<_i22.DatabaseConnection>(
753+
caller.callServerEndpoint<_i23.DatabaseConnection>(
732754
'database',
733755
'getConnectionDetails',
734756
{'cloudCapsuleId': cloudCapsuleId},
@@ -856,9 +878,9 @@ class EndpointProjects extends _i1.EndpointRef {
856878
{'cloudProjectId': cloudProjectId},
857879
);
858880

859-
_i2.Future<_i23.ProjectConfig> fetchProjectConfig(
881+
_i2.Future<_i24.ProjectConfig> fetchProjectConfig(
860882
{required String cloudProjectId}) =>
861-
caller.callServerEndpoint<_i23.ProjectConfig>(
883+
caller.callServerEndpoint<_i24.ProjectConfig>(
862884
'projects',
863885
'fetchProjectConfig',
864886
{'cloudProjectId': cloudProjectId},
@@ -959,9 +981,9 @@ class EndpointRoles extends _i1.EndpointRef {
959981
String get name => 'roles';
960982

961983
/// Fetches the user roles for a project.
962-
_i2.Future<List<_i24.Role>> fetchRolesForProject(
984+
_i2.Future<List<_i25.Role>> fetchRolesForProject(
963985
{required String cloudProjectId}) =>
964-
caller.callServerEndpoint<List<_i24.Role>>(
986+
caller.callServerEndpoint<List<_i25.Role>>(
965987
'roles',
966988
'fetchRolesForProject',
967989
{'cloudProjectId': cloudProjectId},
@@ -1033,11 +1055,11 @@ class EndpointStatus extends _i1.EndpointRef {
10331055
);
10341056

10351057
/// Gets the specified deploy attempt status of the a capsule.
1036-
_i2.Future<List<_i25.DeployAttemptStage>> getDeployAttemptStatus({
1058+
_i2.Future<List<_i26.DeployAttemptStage>> getDeployAttemptStatus({
10371059
required String cloudCapsuleId,
10381060
required String attemptId,
10391061
}) =>
1040-
caller.callServerEndpoint<List<_i25.DeployAttemptStage>>(
1062+
caller.callServerEndpoint<List<_i26.DeployAttemptStage>>(
10411063
'status',
10421064
'getDeployAttemptStatus',
10431065
{
@@ -1089,20 +1111,20 @@ class EndpointUsers extends _i1.EndpointRef {
10891111

10901112
class Modules {
10911113
Modules(Client client) {
1092-
serverpod_auth_idp = _i26.Caller(client);
1093-
serverpod_auth_migration = _i27.Caller(client);
1094-
serverpod_auth_bridge = _i28.Caller(client);
1095-
auth = _i29.Caller(client);
1114+
serverpod_auth_idp = _i27.Caller(client);
1115+
serverpod_auth_migration = _i28.Caller(client);
1116+
serverpod_auth_bridge = _i29.Caller(client);
1117+
auth = _i30.Caller(client);
10961118
serverpod_auth_core = _i10.Caller(client);
10971119
}
10981120

1099-
late final _i26.Caller serverpod_auth_idp;
1121+
late final _i27.Caller serverpod_auth_idp;
11001122

1101-
late final _i27.Caller serverpod_auth_migration;
1123+
late final _i28.Caller serverpod_auth_migration;
11021124

1103-
late final _i28.Caller serverpod_auth_bridge;
1125+
late final _i29.Caller serverpod_auth_bridge;
11041126

1105-
late final _i29.Caller auth;
1127+
late final _i30.Caller auth;
11061128

11071129
late final _i10.Caller serverpod_auth_core;
11081130
}
@@ -1123,7 +1145,7 @@ class Client extends _i1.ServerpodClientShared {
11231145
bool? disconnectStreamsOnLostInternetConnection,
11241146
}) : super(
11251147
host,
1126-
_i30.Protocol(),
1148+
_i31.Protocol(),
11271149
securityContext: securityContext,
11281150
authenticationKeyManager: authenticationKeyManager,
11291151
streamingConnectionTimeout: streamingConnectionTimeout,
Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
/* AUTOMATICALLY GENERATED CODE DO NOT MODIFY */
2+
/* To generate run: "serverpod generate" */
3+
4+
// ignore_for_file: implementation_imports
5+
// ignore_for_file: library_private_types_in_public_api
6+
// ignore_for_file: non_constant_identifier_names
7+
// ignore_for_file: public_member_api_docs
8+
// ignore_for_file: type_literal_in_constant_pattern
9+
// ignore_for_file: use_super_parameters
10+
// ignore_for_file: invalid_use_of_internal_member
11+
12+
// ignore_for_file: no_leading_underscores_for_library_prefixes
13+
import 'package:serverpod_client/serverpod_client.dart' as _i1;
14+
15+
/// Information about a subscription.
16+
/// Contains information to be sent to the client.
17+
abstract class SubscriptionInfo implements _i1.SerializableModel {
18+
SubscriptionInfo._({
19+
required this.createdAt,
20+
required this.startDate,
21+
this.trialEndDate,
22+
required this.subscriptionId,
23+
required this.planProductId,
24+
required this.planName,
25+
this.planDescription,
26+
this.projectsLimit,
27+
});
28+
29+
factory SubscriptionInfo({
30+
required DateTime createdAt,
31+
required DateTime startDate,
32+
DateTime? trialEndDate,
33+
required String subscriptionId,
34+
required String planProductId,
35+
required String planName,
36+
String? planDescription,
37+
int? projectsLimit,
38+
}) = _SubscriptionInfoImpl;
39+
40+
factory SubscriptionInfo.fromJson(Map<String, dynamic> jsonSerialization) {
41+
return SubscriptionInfo(
42+
createdAt:
43+
_i1.DateTimeJsonExtension.fromJson(jsonSerialization['createdAt']),
44+
startDate:
45+
_i1.DateTimeJsonExtension.fromJson(jsonSerialization['startDate']),
46+
trialEndDate: jsonSerialization['trialEndDate'] == null
47+
? null
48+
: _i1.DateTimeJsonExtension.fromJson(
49+
jsonSerialization['trialEndDate']),
50+
subscriptionId: jsonSerialization['subscriptionId'] as String,
51+
planProductId: jsonSerialization['planProductId'] as String,
52+
planName: jsonSerialization['planName'] as String,
53+
planDescription: jsonSerialization['planDescription'] as String?,
54+
projectsLimit: jsonSerialization['projectsLimit'] as int?,
55+
);
56+
}
57+
58+
/// The date the subscription was created.
59+
DateTime createdAt;
60+
61+
/// The date the subscription starts billing.
62+
DateTime startDate;
63+
64+
/// Trial end date, if currently ongoing.
65+
DateTime? trialEndDate;
66+
67+
/// The id of the subscription.
68+
String subscriptionId;
69+
70+
/// The id of the plan's product.
71+
String planProductId;
72+
73+
/// The name of the plan.
74+
String planName;
75+
76+
/// The plan's description, if any.
77+
String? planDescription;
78+
79+
/// The limit on the number of projects the subscriber may own, if any.
80+
int? projectsLimit;
81+
82+
/// Returns a shallow copy of this [SubscriptionInfo]
83+
/// with some or all fields replaced by the given arguments.
84+
@_i1.useResult
85+
SubscriptionInfo copyWith({
86+
DateTime? createdAt,
87+
DateTime? startDate,
88+
DateTime? trialEndDate,
89+
String? subscriptionId,
90+
String? planProductId,
91+
String? planName,
92+
String? planDescription,
93+
int? projectsLimit,
94+
});
95+
@override
96+
Map<String, dynamic> toJson() {
97+
return {
98+
'createdAt': createdAt.toJson(),
99+
'startDate': startDate.toJson(),
100+
if (trialEndDate != null) 'trialEndDate': trialEndDate?.toJson(),
101+
'subscriptionId': subscriptionId,
102+
'planProductId': planProductId,
103+
'planName': planName,
104+
if (planDescription != null) 'planDescription': planDescription,
105+
if (projectsLimit != null) 'projectsLimit': projectsLimit,
106+
};
107+
}
108+
109+
@override
110+
String toString() {
111+
return _i1.SerializationManager.encode(this);
112+
}
113+
}
114+
115+
class _Undefined {}
116+
117+
class _SubscriptionInfoImpl extends SubscriptionInfo {
118+
_SubscriptionInfoImpl({
119+
required DateTime createdAt,
120+
required DateTime startDate,
121+
DateTime? trialEndDate,
122+
required String subscriptionId,
123+
required String planProductId,
124+
required String planName,
125+
String? planDescription,
126+
int? projectsLimit,
127+
}) : super._(
128+
createdAt: createdAt,
129+
startDate: startDate,
130+
trialEndDate: trialEndDate,
131+
subscriptionId: subscriptionId,
132+
planProductId: planProductId,
133+
planName: planName,
134+
planDescription: planDescription,
135+
projectsLimit: projectsLimit,
136+
);
137+
138+
/// Returns a shallow copy of this [SubscriptionInfo]
139+
/// with some or all fields replaced by the given arguments.
140+
@_i1.useResult
141+
@override
142+
SubscriptionInfo copyWith({
143+
DateTime? createdAt,
144+
DateTime? startDate,
145+
Object? trialEndDate = _Undefined,
146+
String? subscriptionId,
147+
String? planProductId,
148+
String? planName,
149+
Object? planDescription = _Undefined,
150+
Object? projectsLimit = _Undefined,
151+
}) {
152+
return SubscriptionInfo(
153+
createdAt: createdAt ?? this.createdAt,
154+
startDate: startDate ?? this.startDate,
155+
trialEndDate:
156+
trialEndDate is DateTime? ? trialEndDate : this.trialEndDate,
157+
subscriptionId: subscriptionId ?? this.subscriptionId,
158+
planProductId: planProductId ?? this.planProductId,
159+
planName: planName ?? this.planName,
160+
planDescription:
161+
planDescription is String? ? planDescription : this.planDescription,
162+
projectsLimit: projectsLimit is int? ? projectsLimit : this.projectsLimit,
163+
);
164+
}
165+
}

0 commit comments

Comments
 (0)