feat: add delete phone endpoint to v2 api (#8321)

# Which Problems Are Solved

- Adds delete phone endpoint to v2 api

# How the Problems Are Solved

- Adds new endpoint with DELETE method to /v2beta/users/:userId/phone
which removes currently set phone number

# Additional Changes

- Added integration test for new endpoint.

# Additional Context

- Solves
https://discord.com/channels/927474939156643850/1255557862286032996
This commit is contained in:
Joey Biscoglia
2024-07-24 09:46:07 -04:00
committed by GitHub
parent 8d13247413
commit f34897a8c8
5 changed files with 209 additions and 0 deletions

View File

@@ -305,6 +305,30 @@ service UserService {
};
}
rpc RemovePhone(RemovePhoneRequest) returns (RemovePhoneResponse) {
option (google.api.http) = {
delete: "/v2beta/users/{user_id}/phone"
body: "*"
};
option (zitadel.protoc_gen_zitadel.v2.options) = {
auth_option: {
permission: "authenticated"
}
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Delete the user phone";
description: "Delete the phone number of a user."
responses: {
key: "200"
value: {
description: "OK";
}
};
};
}
rpc ResendPhoneCode (ResendPhoneCodeRequest) returns (ResendPhoneCodeResponse) {
option (google.api.http) = {
post: "/v2beta/users/{user_id}/phone/resend"
@@ -1124,6 +1148,22 @@ message SetPhoneResponse{
optional string verification_code = 2;
}
message RemovePhoneRequest{
string user_id = 1 [
(validate.rules).string = {min_len: 1, max_len: 200},
(google.api.field_behavior) = REQUIRED,
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
min_length: 1;
max_length: 200;
example: "\"69629026806489455\"";
}
];
}
message RemovePhoneResponse{
zitadel.object.v2beta.Details details = 1;
}
message ResendPhoneCodeRequest{
string user_id = 1 [
(validate.rules).string = {min_len: 1, max_len: 200},