|
1 | 1 | using Grpc.Core; |
2 | 2 | using Grpc.Net.Client; |
3 | 3 |
|
| 4 | +using Zitadel.Action.V2; |
4 | 5 | using Zitadel.Admin.V1; |
| 6 | +using Zitadel.Analytics.V2beta; |
| 7 | +using Zitadel.Application.V2; |
5 | 8 | using Zitadel.Auth.V1; |
6 | 9 | using Zitadel.Authentication; |
| 10 | +using Zitadel.Authorization.V2; |
| 11 | +using Zitadel.Feature.V2; |
| 12 | +using Zitadel.Idp.V2; |
| 13 | +using Zitadel.Instance.V2; |
| 14 | +using Zitadel.InternalPermission.V2; |
7 | 15 | using Zitadel.Management.V1; |
8 | 16 | using Zitadel.Oidc.V2; |
9 | 17 | using Zitadel.Org.V2; |
| 18 | +using Zitadel.Project.V2; |
| 19 | +using Zitadel.Saml.V2; |
10 | 20 | using Zitadel.Session.V2; |
11 | 21 | using Zitadel.Settings.V2; |
12 | 22 | using Zitadel.System.V1; |
13 | 23 | using Zitadel.User.V2; |
| 24 | +using Zitadel.Webkey.V2; |
14 | 25 |
|
15 | 26 | namespace Zitadel.Api; |
16 | 27 |
|
17 | 28 | /// <summary> |
18 | | -/// Helper class to instantiate (gRPC) api service clients for the ZITADEL API with correct settings. |
19 | | -/// All other versions are still available, but the latest version is used by default. |
| 29 | +/// Provides static methods to create and configure instances of gRPC API service clients for the ZITADEL API. |
| 30 | +/// The clients are instantiated with default or specified options to ensure proper connectivity and authentication. |
20 | 31 | /// </summary> |
21 | 32 | public static class Clients |
22 | 33 | { |
@@ -44,6 +55,70 @@ public static AuthService.AuthServiceClient AuthService(Options options) => |
44 | 55 | public static ManagementService.ManagementServiceClient ManagementService(Options options) => |
45 | 56 | GetClient<ManagementService.ManagementServiceClient>(options); |
46 | 57 |
|
| 58 | + /// <summary> |
| 59 | + /// Create a service client for the application service. |
| 60 | + /// </summary> |
| 61 | + /// <param name="options">Options for the client, including endpoint and authorization method.</param> |
| 62 | + /// <returns>The <see cref="Application.V2.ApplicationService.ApplicationServiceClient"/>.</returns> |
| 63 | + public static ApplicationService.ApplicationServiceClient ApplicationService(Options options) => |
| 64 | + GetClient<ApplicationService.ApplicationServiceClient>(options); |
| 65 | + |
| 66 | + /// <summary> |
| 67 | + /// Create a service client for the project service. |
| 68 | + /// </summary> |
| 69 | + /// <param name="options">Options for the client like authorization method.</param> |
| 70 | + /// <returns>The <see cref="Project.V2.ProjectService.ProjectServiceClient"/>.</returns> |
| 71 | + public static ProjectService.ProjectServiceClient ProjectService(Options options) => |
| 72 | + GetClient<ProjectService.ProjectServiceClient>(options); |
| 73 | + |
| 74 | + /// <summary> |
| 75 | + /// Create a service client for the action service. |
| 76 | + /// </summary> |
| 77 | + /// <param name="options">Options for the client like authorization method.</param> |
| 78 | + /// <returns>The <see cref="Action.V2.ActionService.ActionServiceClient"/>.</returns> |
| 79 | + public static ActionService.ActionServiceClient ActionService(Options options) => |
| 80 | + GetClient<ActionService.ActionServiceClient>(options); |
| 81 | + |
| 82 | + /// <summary> |
| 83 | + /// Create a service client for the authorization service. |
| 84 | + /// </summary> |
| 85 | + /// <param name="options">Options for the client like authorization method.</param> |
| 86 | + /// <returns>The <see cref="Authorization.V2.AuthorizationService.AuthorizationServiceClient"/>.</returns> |
| 87 | + public static AuthorizationService.AuthorizationServiceClient AuthorizationService(Options options) => |
| 88 | + GetClient<AuthorizationService.AuthorizationServiceClient>(options); |
| 89 | + |
| 90 | + /// <summary> |
| 91 | + /// Create a service client for the feature service. |
| 92 | + /// </summary> |
| 93 | + /// <param name="options">Options for the client like authorization method.</param> |
| 94 | + /// <returns>The <see cref="Feature.V2.FeatureService.FeatureServiceClient"/>.</returns> |
| 95 | + public static FeatureService.FeatureServiceClient FeatureService(Options options) => |
| 96 | + GetClient<FeatureService.FeatureServiceClient>(options); |
| 97 | + |
| 98 | + /// <summary> |
| 99 | + /// Create a service client for the telemetry service. |
| 100 | + /// </summary> |
| 101 | + /// <param name="options">Options for the client like authorization method.</param> |
| 102 | + /// <returns>The <see cref="TelemetryService.TelemetryServiceClient"/>.</returns> |
| 103 | + public static TelemetryService.TelemetryServiceClient TelemetryService(Options options) => |
| 104 | + GetClient<TelemetryService.TelemetryServiceClient>(options); |
| 105 | + |
| 106 | + /// <summary> |
| 107 | + /// Create a service client for the SAML service. |
| 108 | + /// </summary> |
| 109 | + /// <param name="options">Options for the client like authorization method.</param> |
| 110 | + /// <returns>The <see cref="Saml.V2.SAMLService.SAMLServiceClient"/>.</returns> |
| 111 | + public static SAMLService.SAMLServiceClient SAMLService(Options options) => |
| 112 | + GetClient<SAMLService.SAMLServiceClient>(options); |
| 113 | + |
| 114 | + /// <summary> |
| 115 | + /// Create a service client for the web key service. |
| 116 | + /// </summary> |
| 117 | + /// <param name="options">Options for the client like authorization method.</param> |
| 118 | + /// <returns>The <see cref="Webkey.V2.WebKeyService.WebKeyServiceClient"/>.</returns> |
| 119 | + public static WebKeyService.WebKeyServiceClient WebKeyService(Options options) => |
| 120 | + GetClient<WebKeyService.WebKeyServiceClient>(options); |
| 121 | + |
47 | 122 | /// <summary> |
48 | 123 | /// Create a service client for the oidc service. |
49 | 124 | /// </summary> |
@@ -92,6 +167,31 @@ public static SystemService.SystemServiceClient SystemService(Options options) = |
92 | 167 | public static UserService.UserServiceClient UserService(Options options) => |
93 | 168 | GetClient<UserService.UserServiceClient>(options); |
94 | 169 |
|
| 170 | + /// <summary> |
| 171 | + /// Create a service client for the identity provider service. |
| 172 | + /// </summary> |
| 173 | + /// <param name="options">Options for the client like authorization method.</param> |
| 174 | + /// <returns>The <see cref="IdentityProviderService.IdentityProviderServiceClient"/>.</returns> |
| 175 | + public static IdentityProviderService.IdentityProviderServiceClient IdentityProviderService(Options options) => |
| 176 | + GetClient<IdentityProviderService.IdentityProviderServiceClient>(options); |
| 177 | + |
| 178 | + /// <summary> |
| 179 | + /// Create a service client for the instance service. |
| 180 | + /// </summary> |
| 181 | + /// <param name="options">Options for the client like authorization method.</param> |
| 182 | + /// <returns>The <see cref="Instance.V2.InstanceService.InstanceServiceClient"/>.</returns> |
| 183 | + public static InstanceService.InstanceServiceClient InstanceService(Options options) => |
| 184 | + GetClient<InstanceService.InstanceServiceClient>(options); |
| 185 | + |
| 186 | + /// <summary> |
| 187 | + /// Create a service client for the internal permission service. |
| 188 | + /// </summary> |
| 189 | + /// <param name="options">Options for the client like authorization method.</param> |
| 190 | + /// <returns>The <see cref="InternalPermission.V2.InternalPermissionService.InternalPermissionServiceClient"/>.</returns> |
| 191 | + public static InternalPermissionService.InternalPermissionServiceClient |
| 192 | + InternalPermissionService(Options options) => |
| 193 | + GetClient<InternalPermissionService.InternalPermissionServiceClient>(options); |
| 194 | + |
95 | 195 | private static TClient GetClient<TClient>(Options options) |
96 | 196 | where TClient : ClientBase<TClient> |
97 | 197 | { |
|
0 commit comments