Skip to content

Commit 9b03e37

Browse files
author
serverpod_cloud
committed
feat: 8e46ac969236eea7633c0f35d09ee5b5f87338cc
1 parent ee7b9e7 commit 9b03e37

3 files changed

Lines changed: 561 additions & 429 deletions

File tree

ground_control_client/lib/src/protocol/client.dart

Lines changed: 88 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -29,36 +29,38 @@ import 'package:ground_control_client/src/protocol/domains/billing/models/owner.
2929
as _i10;
3030
import 'package:ground_control_client/src/protocol/domains/billing/models/billing_info.dart'
3131
as _i11;
32-
import 'package:ground_control_client/src/protocol/features/custom_domain_name/models/view_models/custom_domain_name_with_default_domains.dart'
32+
import 'package:ground_control_client/src/protocol/domains/billing/models/payment_setup_intent.dart'
3333
as _i12;
34-
import 'package:ground_control_client/src/protocol/features/custom_domain_name/models/domain_name_target.dart'
34+
import 'package:ground_control_client/src/protocol/features/custom_domain_name/models/view_models/custom_domain_name_with_default_domains.dart'
3535
as _i13;
36-
import 'package:ground_control_client/src/protocol/features/custom_domain_name/models/custom_domain_name_list.dart'
36+
import 'package:ground_control_client/src/protocol/features/custom_domain_name/models/domain_name_target.dart'
3737
as _i14;
38-
import 'package:ground_control_client/src/protocol/features/custom_domain_name/models/domain_name_status.dart'
38+
import 'package:ground_control_client/src/protocol/features/custom_domain_name/models/custom_domain_name_list.dart'
3939
as _i15;
40-
import 'package:ground_control_client/src/protocol/features/environment_variables/models/environment_variable.dart'
40+
import 'package:ground_control_client/src/protocol/features/custom_domain_name/models/domain_name_status.dart'
4141
as _i16;
42-
import 'package:ground_control_client/src/protocol/domains/logs/models/log_record.dart'
42+
import 'package:ground_control_client/src/protocol/features/environment_variables/models/environment_variable.dart'
4343
as _i17;
44-
import 'package:ground_control_client/src/protocol/features/database/models/database_connection.dart'
44+
import 'package:ground_control_client/src/protocol/domains/logs/models/log_record.dart'
4545
as _i18;
46-
import 'package:ground_control_client/src/protocol/features/project/models/project_config.dart'
46+
import 'package:ground_control_client/src/protocol/features/database/models/database_connection.dart'
4747
as _i19;
48-
import 'package:ground_control_client/src/protocol/features/project/models/role.dart'
48+
import 'package:ground_control_client/src/protocol/features/project/models/project_config.dart'
4949
as _i20;
50-
import 'package:ground_control_client/src/protocol/domains/status/models/deploy_attempt.dart'
50+
import 'package:ground_control_client/src/protocol/features/project/models/role.dart'
5151
as _i21;
52-
import 'package:ground_control_client/src/protocol/domains/status/models/deploy_attempt_stage.dart'
52+
import 'package:ground_control_client/src/protocol/domains/status/models/deploy_attempt.dart'
5353
as _i22;
54-
import 'package:serverpod_auth_idp_client/serverpod_auth_idp_client.dart'
54+
import 'package:ground_control_client/src/protocol/domains/status/models/deploy_attempt_stage.dart'
5555
as _i23;
56-
import 'package:serverpod_auth_migration_client/serverpod_auth_migration_client.dart'
56+
import 'package:serverpod_auth_idp_client/serverpod_auth_idp_client.dart'
5757
as _i24;
58-
import 'package:serverpod_auth_bridge_client/serverpod_auth_bridge_client.dart'
58+
import 'package:serverpod_auth_migration_client/serverpod_auth_migration_client.dart'
5959
as _i25;
60-
import 'package:serverpod_auth_client/serverpod_auth_client.dart' as _i26;
61-
import 'protocol.dart' as _i27;
60+
import 'package:serverpod_auth_bridge_client/serverpod_auth_bridge_client.dart'
61+
as _i26;
62+
import 'package:serverpod_auth_client/serverpod_auth_client.dart' as _i27;
63+
import 'protocol.dart' as _i28;
6264

6365
/// Endpoint for global administrator to handle procurement for users.
6466
/// {@category Endpoint}
@@ -345,6 +347,31 @@ class EndpointBilling extends _i1.EndpointRef {
345347
'billingInfo': billingInfo,
346348
},
347349
);
350+
351+
/// Creates a setup intent for collecting payment methods.
352+
///
353+
/// This endpoint creates a setup intent that can be used by the client
354+
/// to collect payment method details (e.g., card information) from the user.
355+
/// The setup intent is associated with the authenticated user's payment customer.
356+
///
357+
/// The client can use the returned [PaymentSetupIntent] to:
358+
/// 1. Display a payment form to the user
359+
/// 2. Collect payment method details (card number, expiry, etc.)
360+
/// 3. Confirm the setup intent with the payment provider
361+
/// 4. Save the payment method for future use
362+
///
363+
/// Returns a [PaymentSetupIntent] containing:
364+
/// - [id]: The setup intent ID
365+
/// - [clientSecret]: Secret for client-side confirmation
366+
/// - [status]: Current status of the setup intent
367+
///
368+
/// Throws [NotFoundException] if the user is not found or has no payment customer.
369+
_i2.Future<_i12.PaymentSetupIntent> createSetupIntent() =>
370+
caller.callServerEndpoint<_i12.PaymentSetupIntent>(
371+
'billing',
372+
'createSetupIntent',
373+
{},
374+
);
348375
}
349376

350377
/// {@category Endpoint}
@@ -354,12 +381,12 @@ class EndpointCustomDomainName extends _i1.EndpointRef {
354381
@override
355382
String get name => 'customDomainName';
356383

357-
_i2.Future<_i12.CustomDomainNameWithDefaultDomains> add({
384+
_i2.Future<_i13.CustomDomainNameWithDefaultDomains> add({
358385
required String domainName,
359-
required _i13.DomainNameTarget target,
386+
required _i14.DomainNameTarget target,
360387
required String cloudCapsuleId,
361388
}) =>
362-
caller.callServerEndpoint<_i12.CustomDomainNameWithDefaultDomains>(
389+
caller.callServerEndpoint<_i13.CustomDomainNameWithDefaultDomains>(
363390
'customDomainName',
364391
'add',
365392
{
@@ -382,19 +409,19 @@ class EndpointCustomDomainName extends _i1.EndpointRef {
382409
},
383410
);
384411

385-
_i2.Future<_i14.CustomDomainNameList> list(
412+
_i2.Future<_i15.CustomDomainNameList> list(
386413
{required String cloudCapsuleId}) =>
387-
caller.callServerEndpoint<_i14.CustomDomainNameList>(
414+
caller.callServerEndpoint<_i15.CustomDomainNameList>(
388415
'customDomainName',
389416
'list',
390417
{'cloudCapsuleId': cloudCapsuleId},
391418
);
392419

393-
_i2.Future<_i15.DomainNameStatus> refreshRecord({
420+
_i2.Future<_i16.DomainNameStatus> refreshRecord({
394421
required String domainName,
395422
required String cloudCapsuleId,
396423
}) =>
397-
caller.callServerEndpoint<_i15.DomainNameStatus>(
424+
caller.callServerEndpoint<_i16.DomainNameStatus>(
398425
'customDomainName',
399426
'refreshRecord',
400427
{
@@ -429,12 +456,12 @@ class EndpointEnvironmentVariables extends _i1.EndpointRef {
429456

430457
/// Creates a new [EnvironmentVariable] with the specified [name] and [value].
431458
/// Throws a [DuplicateEntryException] if an environment variable with the same name already exists.
432-
_i2.Future<_i16.EnvironmentVariable> create(
459+
_i2.Future<_i17.EnvironmentVariable> create(
433460
String name,
434461
String value,
435462
String cloudCapsuleId,
436463
) =>
437-
caller.callServerEndpoint<_i16.EnvironmentVariable>(
464+
caller.callServerEndpoint<_i17.EnvironmentVariable>(
438465
'environmentVariables',
439466
'create',
440467
{
@@ -446,11 +473,11 @@ class EndpointEnvironmentVariables extends _i1.EndpointRef {
446473

447474
/// Fetches the specified environment variable.
448475
/// Throws a [NotFoundException] if the environment variable is not found.
449-
_i2.Future<_i16.EnvironmentVariable> read({
476+
_i2.Future<_i17.EnvironmentVariable> read({
450477
required String name,
451478
required String cloudCapsuleId,
452479
}) =>
453-
caller.callServerEndpoint<_i16.EnvironmentVariable>(
480+
caller.callServerEndpoint<_i17.EnvironmentVariable>(
454481
'environmentVariables',
455482
'read',
456483
{
@@ -460,21 +487,21 @@ class EndpointEnvironmentVariables extends _i1.EndpointRef {
460487
);
461488

462489
/// Gets the list of environment variables for the given [cloudCapsuleId].
463-
_i2.Future<List<_i16.EnvironmentVariable>> list(String cloudCapsuleId) =>
464-
caller.callServerEndpoint<List<_i16.EnvironmentVariable>>(
490+
_i2.Future<List<_i17.EnvironmentVariable>> list(String cloudCapsuleId) =>
491+
caller.callServerEndpoint<List<_i17.EnvironmentVariable>>(
465492
'environmentVariables',
466493
'list',
467494
{'cloudCapsuleId': cloudCapsuleId},
468495
);
469496

470497
/// Creates a new [EnvironmentVariable] with the specified [name] and [value].
471498
/// Throws a [NotFoundException] if the environment variable is not found.
472-
_i2.Future<_i16.EnvironmentVariable> update({
499+
_i2.Future<_i17.EnvironmentVariable> update({
473500
required String name,
474501
required String value,
475502
required String cloudCapsuleId,
476503
}) =>
477-
caller.callServerEndpoint<_i16.EnvironmentVariable>(
504+
caller.callServerEndpoint<_i17.EnvironmentVariable>(
478505
'environmentVariables',
479506
'update',
480507
{
@@ -486,11 +513,11 @@ class EndpointEnvironmentVariables extends _i1.EndpointRef {
486513

487514
/// Permanently deletes an environment variable.
488515
/// Throws a [NotFoundException] if the environment variable is not found.
489-
_i2.Future<_i16.EnvironmentVariable> delete({
516+
_i2.Future<_i17.EnvironmentVariable> delete({
490517
required String cloudCapsuleId,
491518
required String name,
492519
}) =>
493-
caller.callServerEndpoint<_i16.EnvironmentVariable>(
520+
caller.callServerEndpoint<_i17.EnvironmentVariable>(
494521
'environmentVariables',
495522
'delete',
496523
{
@@ -509,15 +536,15 @@ class EndpointLogs extends _i1.EndpointRef {
509536
String get name => 'logs';
510537

511538
/// Fetches log records from the specified project.
512-
_i2.Stream<_i17.LogRecord> fetchRecords({
539+
_i2.Stream<_i18.LogRecord> fetchRecords({
513540
String? cloudProjectId,
514541
String? cloudCapsuleId,
515542
DateTime? beforeTime,
516543
DateTime? afterTime,
517544
int? limit,
518545
}) =>
519-
caller.callStreamingServerEndpoint<_i2.Stream<_i17.LogRecord>,
520-
_i17.LogRecord>(
546+
caller.callStreamingServerEndpoint<_i2.Stream<_i18.LogRecord>,
547+
_i18.LogRecord>(
521548
'logs',
522549
'fetchRecords',
523550
{
@@ -533,13 +560,13 @@ class EndpointLogs extends _i1.EndpointRef {
533560
/// Tails log records from the specified project.
534561
/// Continues until the client unsubscribes, [limit] is reached,
535562
/// or the internal max limit is reached.
536-
_i2.Stream<_i17.LogRecord> tailRecords({
563+
_i2.Stream<_i18.LogRecord> tailRecords({
537564
String? cloudProjectId,
538565
String? cloudCapsuleId,
539566
int? limit,
540567
}) =>
541-
caller.callStreamingServerEndpoint<_i2.Stream<_i17.LogRecord>,
542-
_i17.LogRecord>(
568+
caller.callStreamingServerEndpoint<_i2.Stream<_i18.LogRecord>,
569+
_i18.LogRecord>(
543570
'logs',
544571
'tailRecords',
545572
{
@@ -551,14 +578,14 @@ class EndpointLogs extends _i1.EndpointRef {
551578
);
552579

553580
/// Fetches the build log records for the specified deploy attempt.
554-
_i2.Stream<_i17.LogRecord> fetchBuildLog({
581+
_i2.Stream<_i18.LogRecord> fetchBuildLog({
555582
String? cloudProjectId,
556583
String? cloudCapsuleId,
557584
required String attemptId,
558585
int? limit,
559586
}) =>
560-
caller.callStreamingServerEndpoint<_i2.Stream<_i17.LogRecord>,
561-
_i17.LogRecord>(
587+
caller.callStreamingServerEndpoint<_i2.Stream<_i18.LogRecord>,
588+
_i18.LogRecord>(
562589
'logs',
563590
'fetchBuildLog',
564591
{
@@ -612,9 +639,9 @@ class EndpointDatabase extends _i1.EndpointRef {
612639
@override
613640
String get name => 'database';
614641

615-
_i2.Future<_i18.DatabaseConnection> getConnectionDetails(
642+
_i2.Future<_i19.DatabaseConnection> getConnectionDetails(
616643
{required String cloudCapsuleId}) =>
617-
caller.callServerEndpoint<_i18.DatabaseConnection>(
644+
caller.callServerEndpoint<_i19.DatabaseConnection>(
618645
'database',
619646
'getConnectionDetails',
620647
{'cloudCapsuleId': cloudCapsuleId},
@@ -711,9 +738,9 @@ class EndpointProjects extends _i1.EndpointRef {
711738
{'cloudProjectId': cloudProjectId},
712739
);
713740

714-
_i2.Future<_i19.ProjectConfig> fetchProjectConfig(
741+
_i2.Future<_i20.ProjectConfig> fetchProjectConfig(
715742
{required String cloudProjectId}) =>
716-
caller.callServerEndpoint<_i19.ProjectConfig>(
743+
caller.callServerEndpoint<_i20.ProjectConfig>(
717744
'projects',
718745
'fetchProjectConfig',
719746
{'cloudProjectId': cloudProjectId},
@@ -814,9 +841,9 @@ class EndpointRoles extends _i1.EndpointRef {
814841
String get name => 'roles';
815842

816843
/// Fetches the user roles for a project.
817-
_i2.Future<List<_i20.Role>> fetchRolesForProject(
844+
_i2.Future<List<_i21.Role>> fetchRolesForProject(
818845
{required String cloudProjectId}) =>
819-
caller.callServerEndpoint<List<_i20.Role>>(
846+
caller.callServerEndpoint<List<_i21.Role>>(
820847
'roles',
821848
'fetchRolesForProject',
822849
{'cloudProjectId': cloudProjectId},
@@ -874,11 +901,11 @@ class EndpointStatus extends _i1.EndpointRef {
874901

875902
/// Gets deploy attempts of the specified capsule.
876903
/// Gets the recent-most attempts, up till [limit] if specified.
877-
_i2.Future<List<_i21.DeployAttempt>> getDeployAttempts({
904+
_i2.Future<List<_i22.DeployAttempt>> getDeployAttempts({
878905
required String cloudCapsuleId,
879906
int? limit,
880907
}) =>
881-
caller.callServerEndpoint<List<_i21.DeployAttempt>>(
908+
caller.callServerEndpoint<List<_i22.DeployAttempt>>(
882909
'status',
883910
'getDeployAttempts',
884911
{
@@ -888,11 +915,11 @@ class EndpointStatus extends _i1.EndpointRef {
888915
);
889916

890917
/// Gets the specified deploy attempt status of the a capsule.
891-
_i2.Future<List<_i22.DeployAttemptStage>> getDeployAttemptStatus({
918+
_i2.Future<List<_i23.DeployAttemptStage>> getDeployAttemptStatus({
892919
required String cloudCapsuleId,
893920
required String attemptId,
894921
}) =>
895-
caller.callServerEndpoint<List<_i22.DeployAttemptStage>>(
922+
caller.callServerEndpoint<List<_i23.DeployAttemptStage>>(
896923
'status',
897924
'getDeployAttemptStatus',
898925
{
@@ -944,20 +971,20 @@ class EndpointUsers extends _i1.EndpointRef {
944971

945972
class Modules {
946973
Modules(Client client) {
947-
serverpod_auth_idp = _i23.Caller(client);
948-
serverpod_auth_migration = _i24.Caller(client);
949-
serverpod_auth_bridge = _i25.Caller(client);
950-
auth = _i26.Caller(client);
974+
serverpod_auth_idp = _i24.Caller(client);
975+
serverpod_auth_migration = _i25.Caller(client);
976+
serverpod_auth_bridge = _i26.Caller(client);
977+
auth = _i27.Caller(client);
951978
serverpod_auth_core = _i8.Caller(client);
952979
}
953980

954-
late final _i23.Caller serverpod_auth_idp;
981+
late final _i24.Caller serverpod_auth_idp;
955982

956-
late final _i24.Caller serverpod_auth_migration;
983+
late final _i25.Caller serverpod_auth_migration;
957984

958-
late final _i25.Caller serverpod_auth_bridge;
985+
late final _i26.Caller serverpod_auth_bridge;
959986

960-
late final _i26.Caller auth;
987+
late final _i27.Caller auth;
961988

962989
late final _i8.Caller serverpod_auth_core;
963990
}
@@ -978,7 +1005,7 @@ class Client extends _i1.ServerpodClientShared {
9781005
bool? disconnectStreamsOnLostInternetConnection,
9791006
}) : super(
9801007
host,
981-
_i27.Protocol(),
1008+
_i28.Protocol(),
9821009
securityContext: securityContext,
9831010
authenticationKeyManager: authenticationKeyManager,
9841011
streamingConnectionTimeout: streamingConnectionTimeout,

0 commit comments

Comments
 (0)