From d8ca1420f94c9914ddf77754d4849a532cf8fe6f Mon Sep 17 00:00:00 2001 From: Livio Spring Date: Mon, 10 Feb 2025 11:30:23 +0100 Subject: [PATCH] some cleanup --- .../v2/authorization_service.proto | 2 +- proto/zitadel/metadata/v2/metadata.proto | 41 +++-- proto/zitadel/user/v2/user_service.proto | 170 +++++++++--------- 3 files changed, 110 insertions(+), 103 deletions(-) diff --git a/proto/zitadel/authorizations/v2/authorization_service.proto b/proto/zitadel/authorizations/v2/authorization_service.proto index 03380f2da3..a9d6467e3c 100644 --- a/proto/zitadel/authorizations/v2/authorization_service.proto +++ b/proto/zitadel/authorizations/v2/authorization_service.proto @@ -4,8 +4,8 @@ package zitadel.authorizations.v2; import "google/protobuf/timestamp.proto"; import "validate/validate.proto"; -import "zitadel/object/v2/object.proto"; import "zitadel/authorizations/v2/authorization.proto"; +import "zitadel/object/v2/object.proto"; option go_package = "github.com/zitadel/zitadel/pkg/grpc/authorizations/v2;authorizations"; diff --git a/proto/zitadel/metadata/v2/metadata.proto b/proto/zitadel/metadata/v2/metadata.proto index 4957abd152..6b8f106070 100644 --- a/proto/zitadel/metadata/v2/metadata.proto +++ b/proto/zitadel/metadata/v2/metadata.proto @@ -1,30 +1,37 @@ syntax = "proto3"; -import "zitadel/object.proto"; -import "validate/validate.proto"; - package zitadel.metadata.v2; -option go_package ="github.com/zitadel/zitadel/pkg/grpc/metadata/v2"; +import "google/protobuf/timestamp.proto"; +import "validate/validate.proto"; +import "zitadel/object.proto"; + +option go_package = "github.com/zitadel/zitadel/pkg/grpc/metadata/v2;metadata"; message Metadata { - //zitadel.v1.ObjectDetails details = 1; TODO? - string key = 2; - bytes value = 3; + // Timestamp of the creation of the metadata. + google.protobuf.Timestamp creation_date = 1; + // Timestamp of the last change of the metadata. + // In case the metadata was not changed, this field is equal to the creation date. + google.protobuf.Timestamp change_date = 2; + // Key of the metadata. This is the unique identifier of the metadata. + string key = 3; + // Value of the metadata. + bytes value = 4; } message MetadataQuery { - oneof query { - option (validate.required) = true; - MetadataKeyQuery key_query = 1; - } + oneof query { + option (validate.required) = true; + MetadataKeyQuery key_query = 1; + } } message MetadataKeyQuery { - string key = 1 [ - (validate.rules).string = {max_len: 200} - ]; - zitadel.v1.TextQueryMethod method = 2 [ - (validate.rules).enum.defined_only = true - ]; + // Specify the the key of the metadata to search for. + string key = 1 [(validate.rules).string = {max_len: 200}]; + // Specify the method to use for the search. Default is EQUALS. + // For example, if you want to search for a key that starts with a specific string, + // use STARTS_WITH or STARTS_WITH_IGNORE_CASE. + zitadel.v1.TextQueryMethod method = 2 [(validate.rules).enum.defined_only = true]; } diff --git a/proto/zitadel/user/v2/user_service.proto b/proto/zitadel/user/v2/user_service.proto index 7cd10d8bc3..989f2c0849 100644 --- a/proto/zitadel/user/v2/user_service.proto +++ b/proto/zitadel/user/v2/user_service.proto @@ -1285,91 +1285,6 @@ service UserService { rpc RemoveMetadata (RemoveMetadataRequest) returns (RemoveMetadataResponse) {} } -message ListMetadataRequest{ - // The user ID of the user you like to get the metadata from. - string user_id = 1 [(validate.rules).string = {min_len: 1, max_len: 200}]; - // Paginate through the results using a limit. - zitadel.object.v2.ListQuery query = 2; - // Filter the metadata to be returned. - repeated zitadel.metadata.v2.MetadataQuery queries = 3; -} - -message ListMetadataResponse{ - zitadel.object.v2.ListDetails details = 1; - repeated zitadel.metadata.v2.Metadata result = 2; -} - -message GetMetadataRequest{ - // The user ID of the user you like to get the metadata from. - string user_id = 1 [(validate.rules).string = {min_len: 1, max_len: 200}]; - // Metadata key is the unique identifier of the metadata entry. - string metadata_key = 2 [(validate.rules).string = {min_len: 1, max_len: 200}]; -} - -message GetMetadataResponse{ - zitadel.metadata.v2.Metadata metadata = 1; -} - -message AddMetadataRequest{ - // The user ID of the user you like to add the metadata to. - string user_id = 1 [(validate.rules).string = {min_len: 1, max_len: 200}]; - // Metadata key is the unique identifier of the metadata entry. - // If an entry with the same key already exists, an error is returned. - string metadata_key = 2 [(validate.rules).string = {min_len: 1, max_len: 200}]; - // Metadata value is the value of the metadata entry. - bytes metadata_value = 3 [(validate.rules).bytes = {min_len: 1, max_len: 500000}]; -} - -message AddMetadataResponse{ - // CreationDate is the timestamp the metadata entry was created. - google.protobuf.Timestamp creation_date = 1; -} - -message UpdateMetadataRequest{ - // The user ID of the user you like to update the metadata from. - string user_id = 1 [(validate.rules).string = {min_len: 1, max_len: 200}]; - // Metadata key is the unique identifier of the metadata entry. - // If an entry with the same key does not exist, an error is returned. - string metadata_key = 2 [(validate.rules).string = {min_len: 1, max_len: 200}]; - // Metadata value is the value of the metadata entry. - bytes metadata_value = 3 [(validate.rules).bytes = {min_len: 1, max_len: 500000}]; -} - -message UpdateMetadataResponse{ - // ChangeDate is the the timestamp the metadata entry was last updated. - google.protobuf.Timestamp change_date = 1; -} - -message SetMetadataRequest{ - // The user ID of the user you like to set the metadata from. - string user_id = 1 [(validate.rules).string = {min_len: 1, max_len: 200}]; - // Metadata key is the unique identifier of the metadata entry. - // An existing entry with the same key will be updated. The key cannot be changed. - // If you need to change the key, remove the existing entry and create a new one. - string metadata_key = 2 [(validate.rules).string = {min_len: 1, max_len: 200}]; - // Metadata value is the value of the metadata entry. - bytes metadata_value = 3 [(validate.rules).bytes = {min_len: 1, max_len: 500000}]; -} - -message SetMetadataResponse{ - // ChangeDate is the the timestamp the metadata entry was last set, either created or updated. - google.protobuf.Timestamp change_date = 2; -} - -message RemoveMetadataRequest{ - // The user ID of the user you like to remove the metadata from. - string user_id = 1 [(validate.rules).string = {min_len: 1, max_len: 200}]; - // Metadata key is the unique identifier of the metadata entry. - string metadata_key = 2 [(validate.rules).string = {min_len: 1, max_len: 200}]; -} - -message RemoveMetadataResponse{ - // DeletionDate is the timestamp the metadata entry was deleted. - // Note that the deletion date is only guaranteed to be set if the deletion was successful during the request. - // In case the deletion occurred in a previous request, the deletion date might not be set. - google.protobuf.Timestamp deletion_date = 1; -} - message AddHumanUserRequest{ reserved 3; reserved "organisation"; @@ -2514,3 +2429,88 @@ message HumanMFAInitSkippedRequest { message HumanMFAInitSkippedResponse { zitadel.object.v2.Details details = 1; } + +message ListMetadataRequest{ + // The user ID of the user you like to get the metadata from. + string user_id = 1 [(validate.rules).string = {min_len: 1, max_len: 200}]; + // Paginate through the results using a limit. + zitadel.object.v2.ListQuery query = 2; + // Filter the metadata to be returned. + repeated zitadel.metadata.v2.MetadataQuery queries = 3; +} + +message ListMetadataResponse{ + zitadel.object.v2.ListDetails details = 1; + repeated zitadel.metadata.v2.Metadata result = 2; +} + +message GetMetadataRequest{ + // The user ID of the user you like to get the metadata from. + string user_id = 1 [(validate.rules).string = {min_len: 1, max_len: 200}]; + // Metadata key is the unique identifier of the metadata entry. + string metadata_key = 2 [(validate.rules).string = {min_len: 1, max_len: 200}]; +} + +message GetMetadataResponse{ + zitadel.metadata.v2.Metadata metadata = 1; +} + +message AddMetadataRequest{ + // The user ID of the user you like to add the metadata to. + string user_id = 1 [(validate.rules).string = {min_len: 1, max_len: 200}]; + // Metadata key is the unique identifier of the metadata entry. + // If an entry with the same key already exists, an error is returned. + string metadata_key = 2 [(validate.rules).string = {min_len: 1, max_len: 200}]; + // Metadata value is the value of the metadata entry. + bytes metadata_value = 3 [(validate.rules).bytes = {min_len: 1, max_len: 500000}]; +} + +message AddMetadataResponse{ + // CreationDate is the timestamp the metadata entry was created. + google.protobuf.Timestamp creation_date = 1; +} + +message UpdateMetadataRequest{ + // The user ID of the user you like to update the metadata from. + string user_id = 1 [(validate.rules).string = {min_len: 1, max_len: 200}]; + // Metadata key is the unique identifier of the metadata entry. + // If an entry with the same key does not exist, an error is returned. + string metadata_key = 2 [(validate.rules).string = {min_len: 1, max_len: 200}]; + // Metadata value is the value of the metadata entry. + bytes metadata_value = 3 [(validate.rules).bytes = {min_len: 1, max_len: 500000}]; +} + +message UpdateMetadataResponse{ + // ChangeDate is the the timestamp the metadata entry was last updated. + google.protobuf.Timestamp change_date = 1; +} + +message SetMetadataRequest{ + // The user ID of the user you like to set the metadata from. + string user_id = 1 [(validate.rules).string = {min_len: 1, max_len: 200}]; + // Metadata key is the unique identifier of the metadata entry. + // An existing entry with the same key will be updated. The key cannot be changed. + // If you need to change the key, remove the existing entry and create a new one. + string metadata_key = 2 [(validate.rules).string = {min_len: 1, max_len: 200}]; + // Metadata value is the value of the metadata entry. + bytes metadata_value = 3 [(validate.rules).bytes = {min_len: 1, max_len: 500000}]; +} + +message SetMetadataResponse{ + // ChangeDate is the the timestamp the metadata entry was last set, either created or updated. + google.protobuf.Timestamp change_date = 2; +} + +message RemoveMetadataRequest{ + // The user ID of the user you like to remove the metadata from. + string user_id = 1 [(validate.rules).string = {min_len: 1, max_len: 200}]; + // Metadata key is the unique identifier of the metadata entry. + string metadata_key = 2 [(validate.rules).string = {min_len: 1, max_len: 200}]; +} + +message RemoveMetadataResponse{ + // DeletionDate is the timestamp the metadata entry was deleted. + // Note that the deletion date is only guaranteed to be set if the deletion was successful during the request. + // In case the deletion occurred in a previous request, the deletion date might not be set. + google.protobuf.Timestamp deletion_date = 1; +}