Skip to content

Commit 86e50f3

Browse files
author
serverpod_cloud
committed
feat(gc): 7a92bc643bc7f8eba0ff251f059991f132616ab9
1 parent 6f72d55 commit 86e50f3

5 files changed

Lines changed: 213 additions & 128 deletions

File tree

ground_control_client/lib/src/protocol/client.dart

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ class EndpointAdminProcurement extends _i1.EndpointRef {
106106
{'userEmail': userEmail},
107107
);
108108

109+
@Deprecated(
110+
'This endpoint to migrate to hackathon plan is no longer supported.',
111+
)
109112
_i2.Future<void> moveToHackathonPlan({required String userEmail}) =>
110113
caller.callServerEndpoint<void>(
111114
'adminProcurement',
@@ -659,6 +662,14 @@ class EndpointPlans extends _i1.EndpointRef {
659662
'planName': planName,
660663
});
661664

665+
/// Cancels the primary plan subscription of the user.
666+
///
667+
/// - Throws [ProcurementCancellationException] if the cancellation fails,
668+
/// e.g. if the subscription still has active resources.
669+
/// - Throws [NoSubscriptionException] if the user has no subscription.
670+
_i2.Future<void> cancelPlan() =>
671+
caller.callServerEndpoint<void>('plans', 'cancelPlan', {});
672+
662673
/// Fetches the names of the procured subscription plans.
663674
_i2.Future<List<String>> listProcuredPlanNames() => caller
664675
.callServerEndpoint<List<String>>('plans', 'listProcuredPlanNames', {});

ground_control_client/lib/src/protocol/protocol.dart

Lines changed: 97 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -67,35 +67,37 @@ import 'shared/exceptions/models/duplicate_entry_exception.dart' as _i51;
6767
import 'shared/exceptions/models/invalid_value_exception.dart' as _i52;
6868
import 'shared/exceptions/models/no_subscription_exception.dart' as _i53;
6969
import 'shared/exceptions/models/not_found_exception.dart' as _i54;
70-
import 'shared/exceptions/models/procurement_denied_exception.dart' as _i55;
71-
import 'shared/exceptions/models/unauthenticated_exception.dart' as _i56;
72-
import 'shared/exceptions/models/unauthorized_exception.dart' as _i57;
73-
import 'shared/models/serverpod_region.dart' as _i58;
74-
import 'shared/services/pubsub/registry/pubsub_entry.dart' as _i59;
70+
import 'shared/exceptions/models/procurement_cancellation_exception.dart'
71+
as _i55;
72+
import 'shared/exceptions/models/procurement_denied_exception.dart' as _i56;
73+
import 'shared/exceptions/models/unauthenticated_exception.dart' as _i57;
74+
import 'shared/exceptions/models/unauthorized_exception.dart' as _i58;
75+
import 'shared/models/serverpod_region.dart' as _i59;
76+
import 'shared/services/pubsub/registry/pubsub_entry.dart' as _i60;
7577
import 'package:ground_control_client/src/protocol/features/projects/models/project.dart'
76-
as _i60;
77-
import 'package:ground_control_client/src/protocol/features/projects/models/project_info/project_info.dart'
7878
as _i61;
79-
import 'package:ground_control_client/src/protocol/domains/status/models/deploy_attempt.dart'
79+
import 'package:ground_control_client/src/protocol/features/projects/models/project_info/project_info.dart'
8080
as _i62;
81-
import 'package:ground_control_client/src/protocol/domains/users/models/user.dart'
81+
import 'package:ground_control_client/src/protocol/domains/status/models/deploy_attempt.dart'
8282
as _i63;
83-
import 'package:ground_control_client/src/protocol/features/auth/models/required_terms.dart'
83+
import 'package:ground_control_client/src/protocol/domains/users/models/user.dart'
8484
as _i64;
85-
import 'package:ground_control_client/src/protocol/features/auth/models/accepted_terms_dto.dart'
85+
import 'package:ground_control_client/src/protocol/features/auth/models/required_terms.dart'
8686
as _i65;
87-
import 'package:ground_control_client/src/protocol/domains/billing/models/payment_method.dart'
87+
import 'package:ground_control_client/src/protocol/features/auth/models/accepted_terms_dto.dart'
8888
as _i66;
89-
import 'package:ground_control_client/src/protocol/domains/environment_variables/models/variable.dart'
89+
import 'package:ground_control_client/src/protocol/domains/billing/models/payment_method.dart'
9090
as _i67;
91-
import 'package:ground_control_client/src/protocol/features/projects/models/role.dart'
91+
import 'package:ground_control_client/src/protocol/domains/environment_variables/models/variable.dart'
9292
as _i68;
93-
import 'package:ground_control_client/src/protocol/domains/status/models/deploy_attempt_stage.dart'
93+
import 'package:ground_control_client/src/protocol/features/projects/models/role.dart'
9494
as _i69;
95-
import 'package:serverpod_auth_idp_client/serverpod_auth_idp_client.dart'
95+
import 'package:ground_control_client/src/protocol/domains/status/models/deploy_attempt_stage.dart'
9696
as _i70;
97-
import 'package:serverpod_auth_core_client/serverpod_auth_core_client.dart'
97+
import 'package:serverpod_auth_idp_client/serverpod_auth_idp_client.dart'
9898
as _i71;
99+
import 'package:serverpod_auth_core_client/serverpod_auth_core_client.dart'
100+
as _i72;
99101
export 'domains/billing/models/billing_customer_type.dart';
100102
export 'domains/billing/models/billing_info.dart';
101103
export 'domains/billing/models/billing_mapping_type.dart';
@@ -149,6 +151,7 @@ export 'shared/exceptions/models/duplicate_entry_exception.dart';
149151
export 'shared/exceptions/models/invalid_value_exception.dart';
150152
export 'shared/exceptions/models/no_subscription_exception.dart';
151153
export 'shared/exceptions/models/not_found_exception.dart';
154+
export 'shared/exceptions/models/procurement_cancellation_exception.dart';
152155
export 'shared/exceptions/models/procurement_denied_exception.dart';
153156
export 'shared/exceptions/models/unauthenticated_exception.dart';
154157
export 'shared/exceptions/models/unauthorized_exception.dart';
@@ -346,20 +349,23 @@ class Protocol extends _i1.SerializationManager {
346349
if (t == _i54.NotFoundException) {
347350
return _i54.NotFoundException.fromJson(data) as T;
348351
}
349-
if (t == _i55.ProcurementDeniedException) {
350-
return _i55.ProcurementDeniedException.fromJson(data) as T;
352+
if (t == _i55.ProcurementCancellationException) {
353+
return _i55.ProcurementCancellationException.fromJson(data) as T;
351354
}
352-
if (t == _i56.UnauthenticatedException) {
353-
return _i56.UnauthenticatedException.fromJson(data) as T;
355+
if (t == _i56.ProcurementDeniedException) {
356+
return _i56.ProcurementDeniedException.fromJson(data) as T;
354357
}
355-
if (t == _i57.UnauthorizedException) {
356-
return _i57.UnauthorizedException.fromJson(data) as T;
358+
if (t == _i57.UnauthenticatedException) {
359+
return _i57.UnauthenticatedException.fromJson(data) as T;
357360
}
358-
if (t == _i58.ServerpodRegion) {
359-
return _i58.ServerpodRegion.fromJson(data) as T;
361+
if (t == _i58.UnauthorizedException) {
362+
return _i58.UnauthorizedException.fromJson(data) as T;
360363
}
361-
if (t == _i59.PubsubEntry) {
362-
return _i59.PubsubEntry.fromJson(data) as T;
364+
if (t == _i59.ServerpodRegion) {
365+
return _i59.ServerpodRegion.fromJson(data) as T;
366+
}
367+
if (t == _i60.PubsubEntry) {
368+
return _i60.PubsubEntry.fromJson(data) as T;
363369
}
364370
if (t == _i1.getType<_i2.BillingCustomerType?>()) {
365371
return (data != null ? _i2.BillingCustomerType.fromJson(data) : null)
@@ -544,27 +550,33 @@ class Protocol extends _i1.SerializationManager {
544550
if (t == _i1.getType<_i54.NotFoundException?>()) {
545551
return (data != null ? _i54.NotFoundException.fromJson(data) : null) as T;
546552
}
547-
if (t == _i1.getType<_i55.ProcurementDeniedException?>()) {
553+
if (t == _i1.getType<_i55.ProcurementCancellationException?>()) {
548554
return (data != null
549-
? _i55.ProcurementDeniedException.fromJson(data)
555+
? _i55.ProcurementCancellationException.fromJson(data)
550556
: null)
551557
as T;
552558
}
553-
if (t == _i1.getType<_i56.UnauthenticatedException?>()) {
559+
if (t == _i1.getType<_i56.ProcurementDeniedException?>()) {
554560
return (data != null
555-
? _i56.UnauthenticatedException.fromJson(data)
561+
? _i56.ProcurementDeniedException.fromJson(data)
556562
: null)
557563
as T;
558564
}
559-
if (t == _i1.getType<_i57.UnauthorizedException?>()) {
560-
return (data != null ? _i57.UnauthorizedException.fromJson(data) : null)
565+
if (t == _i1.getType<_i57.UnauthenticatedException?>()) {
566+
return (data != null
567+
? _i57.UnauthenticatedException.fromJson(data)
568+
: null)
561569
as T;
562570
}
563-
if (t == _i1.getType<_i58.ServerpodRegion?>()) {
564-
return (data != null ? _i58.ServerpodRegion.fromJson(data) : null) as T;
571+
if (t == _i1.getType<_i58.UnauthorizedException?>()) {
572+
return (data != null ? _i58.UnauthorizedException.fromJson(data) : null)
573+
as T;
565574
}
566-
if (t == _i1.getType<_i59.PubsubEntry?>()) {
567-
return (data != null ? _i59.PubsubEntry.fromJson(data) : null) as T;
575+
if (t == _i1.getType<_i59.ServerpodRegion?>()) {
576+
return (data != null ? _i59.ServerpodRegion.fromJson(data) : null) as T;
577+
}
578+
if (t == _i1.getType<_i60.PubsubEntry?>()) {
579+
return (data != null ? _i60.PubsubEntry.fromJson(data) : null) as T;
568580
}
569581
if (t == List<String>) {
570582
return (data as List).map((e) => deserialize<String>(e)).toList() as T;
@@ -685,49 +697,49 @@ class Protocol extends _i1.SerializationManager {
685697
)
686698
as T;
687699
}
688-
if (t == List<_i60.Project>) {
689-
return (data as List).map((e) => deserialize<_i60.Project>(e)).toList()
700+
if (t == List<_i61.Project>) {
701+
return (data as List).map((e) => deserialize<_i61.Project>(e)).toList()
690702
as T;
691703
}
692-
if (t == List<_i61.ProjectInfo>) {
704+
if (t == List<_i62.ProjectInfo>) {
693705
return (data as List)
694-
.map((e) => deserialize<_i61.ProjectInfo>(e))
706+
.map((e) => deserialize<_i62.ProjectInfo>(e))
695707
.toList()
696708
as T;
697709
}
698-
if (t == List<_i62.DeployAttempt>) {
710+
if (t == List<_i63.DeployAttempt>) {
699711
return (data as List)
700-
.map((e) => deserialize<_i62.DeployAttempt>(e))
712+
.map((e) => deserialize<_i63.DeployAttempt>(e))
701713
.toList()
702714
as T;
703715
}
704-
if (t == List<_i63.User>) {
705-
return (data as List).map((e) => deserialize<_i63.User>(e)).toList() as T;
716+
if (t == List<_i64.User>) {
717+
return (data as List).map((e) => deserialize<_i64.User>(e)).toList() as T;
706718
}
707-
if (t == List<_i64.RequiredTerms>) {
719+
if (t == List<_i65.RequiredTerms>) {
708720
return (data as List)
709-
.map((e) => deserialize<_i64.RequiredTerms>(e))
721+
.map((e) => deserialize<_i65.RequiredTerms>(e))
710722
.toList()
711723
as T;
712724
}
713-
if (t == List<_i65.AcceptedTermsDTO>) {
725+
if (t == List<_i66.AcceptedTermsDTO>) {
714726
return (data as List)
715-
.map((e) => deserialize<_i65.AcceptedTermsDTO>(e))
727+
.map((e) => deserialize<_i66.AcceptedTermsDTO>(e))
716728
.toList()
717729
as T;
718730
}
719731
if (t == List<String>) {
720732
return (data as List).map((e) => deserialize<String>(e)).toList() as T;
721733
}
722-
if (t == List<_i66.PaymentMethod>) {
734+
if (t == List<_i67.PaymentMethod>) {
723735
return (data as List)
724-
.map((e) => deserialize<_i66.PaymentMethod>(e))
736+
.map((e) => deserialize<_i67.PaymentMethod>(e))
725737
.toList()
726738
as T;
727739
}
728-
if (t == List<_i67.EnvironmentVariable>) {
740+
if (t == List<_i68.EnvironmentVariable>) {
729741
return (data as List)
730-
.map((e) => deserialize<_i67.EnvironmentVariable>(e))
742+
.map((e) => deserialize<_i68.EnvironmentVariable>(e))
731743
.toList()
732744
as T;
733745
}
@@ -737,26 +749,26 @@ class Protocol extends _i1.SerializationManager {
737749
: null)
738750
as T;
739751
}
740-
if (t == List<_i68.Role>) {
741-
return (data as List).map((e) => deserialize<_i68.Role>(e)).toList() as T;
752+
if (t == List<_i69.Role>) {
753+
return (data as List).map((e) => deserialize<_i69.Role>(e)).toList() as T;
742754
}
743755
if (t == Map<String, String>) {
744756
return (data as Map).map(
745757
(k, v) => MapEntry(deserialize<String>(k), deserialize<String>(v)),
746758
)
747759
as T;
748760
}
749-
if (t == List<_i69.DeployAttemptStage>) {
761+
if (t == List<_i70.DeployAttemptStage>) {
750762
return (data as List)
751-
.map((e) => deserialize<_i69.DeployAttemptStage>(e))
763+
.map((e) => deserialize<_i70.DeployAttemptStage>(e))
752764
.toList()
753765
as T;
754766
}
755767
try {
756-
return _i70.Protocol().deserialize<T>(data, t);
768+
return _i71.Protocol().deserialize<T>(data, t);
757769
} on _i1.DeserializationTypeNotFoundException catch (_) {}
758770
try {
759-
return _i71.Protocol().deserialize<T>(data, t);
771+
return _i72.Protocol().deserialize<T>(data, t);
760772
} on _i1.DeserializationTypeNotFoundException catch (_) {}
761773
return super.deserialize<T>(data, t);
762774
}
@@ -818,11 +830,13 @@ class Protocol extends _i1.SerializationManager {
818830
_i52.InvalidValueException => 'InvalidValueException',
819831
_i53.NoSubscriptionException => 'NoSubscriptionException',
820832
_i54.NotFoundException => 'NotFoundException',
821-
_i55.ProcurementDeniedException => 'ProcurementDeniedException',
822-
_i56.UnauthenticatedException => 'UnauthenticatedException',
823-
_i57.UnauthorizedException => 'UnauthorizedException',
824-
_i58.ServerpodRegion => 'ServerpodRegion',
825-
_i59.PubsubEntry => 'PubsubEntry',
833+
_i55.ProcurementCancellationException =>
834+
'ProcurementCancellationException',
835+
_i56.ProcurementDeniedException => 'ProcurementDeniedException',
836+
_i57.UnauthenticatedException => 'UnauthenticatedException',
837+
_i58.UnauthorizedException => 'UnauthorizedException',
838+
_i59.ServerpodRegion => 'ServerpodRegion',
839+
_i60.PubsubEntry => 'PubsubEntry',
826840
_ => null,
827841
};
828842
}
@@ -946,22 +960,24 @@ class Protocol extends _i1.SerializationManager {
946960
return 'NoSubscriptionException';
947961
case _i54.NotFoundException():
948962
return 'NotFoundException';
949-
case _i55.ProcurementDeniedException():
963+
case _i55.ProcurementCancellationException():
964+
return 'ProcurementCancellationException';
965+
case _i56.ProcurementDeniedException():
950966
return 'ProcurementDeniedException';
951-
case _i56.UnauthenticatedException():
967+
case _i57.UnauthenticatedException():
952968
return 'UnauthenticatedException';
953-
case _i57.UnauthorizedException():
969+
case _i58.UnauthorizedException():
954970
return 'UnauthorizedException';
955-
case _i58.ServerpodRegion():
971+
case _i59.ServerpodRegion():
956972
return 'ServerpodRegion';
957-
case _i59.PubsubEntry():
973+
case _i60.PubsubEntry():
958974
return 'PubsubEntry';
959975
}
960-
className = _i70.Protocol().getClassNameForObject(data);
976+
className = _i71.Protocol().getClassNameForObject(data);
961977
if (className != null) {
962978
return 'serverpod_auth_idp.$className';
963979
}
964-
className = _i71.Protocol().getClassNameForObject(data);
980+
className = _i72.Protocol().getClassNameForObject(data);
965981
if (className != null) {
966982
return 'serverpod_auth_core.$className';
967983
}
@@ -1135,28 +1151,31 @@ class Protocol extends _i1.SerializationManager {
11351151
if (dataClassName == 'NotFoundException') {
11361152
return deserialize<_i54.NotFoundException>(data['data']);
11371153
}
1154+
if (dataClassName == 'ProcurementCancellationException') {
1155+
return deserialize<_i55.ProcurementCancellationException>(data['data']);
1156+
}
11381157
if (dataClassName == 'ProcurementDeniedException') {
1139-
return deserialize<_i55.ProcurementDeniedException>(data['data']);
1158+
return deserialize<_i56.ProcurementDeniedException>(data['data']);
11401159
}
11411160
if (dataClassName == 'UnauthenticatedException') {
1142-
return deserialize<_i56.UnauthenticatedException>(data['data']);
1161+
return deserialize<_i57.UnauthenticatedException>(data['data']);
11431162
}
11441163
if (dataClassName == 'UnauthorizedException') {
1145-
return deserialize<_i57.UnauthorizedException>(data['data']);
1164+
return deserialize<_i58.UnauthorizedException>(data['data']);
11461165
}
11471166
if (dataClassName == 'ServerpodRegion') {
1148-
return deserialize<_i58.ServerpodRegion>(data['data']);
1167+
return deserialize<_i59.ServerpodRegion>(data['data']);
11491168
}
11501169
if (dataClassName == 'PubsubEntry') {
1151-
return deserialize<_i59.PubsubEntry>(data['data']);
1170+
return deserialize<_i60.PubsubEntry>(data['data']);
11521171
}
11531172
if (dataClassName.startsWith('serverpod_auth_idp.')) {
11541173
data['className'] = dataClassName.substring(19);
1155-
return _i70.Protocol().deserializeByClassName(data);
1174+
return _i71.Protocol().deserializeByClassName(data);
11561175
}
11571176
if (dataClassName.startsWith('serverpod_auth_core.')) {
11581177
data['className'] = dataClassName.substring(20);
1159-
return _i71.Protocol().deserializeByClassName(data);
1178+
return _i72.Protocol().deserializeByClassName(data);
11601179
}
11611180
return super.deserializeByClassName(data);
11621181
}

0 commit comments

Comments
 (0)