Skip to content
80 changes: 45 additions & 35 deletions api/grpc/users/v1/users.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 21 additions & 4 deletions apidocs/openapi/clients.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -943,10 +943,14 @@ components:
example: bb7edb32-2eac-4aad-aebe-ed96fe073879
minimum: 8
description: Free-form account secret used for acquiring auth token(s).
metadata:
public_metadata:
type: object
example: { "model": "example" }
description: Arbitrary, object-encoded client's data.
metadata:
type: object
example: { "model": "example" }
description: Arbitrary, object-encoded client's data, private to the client.
status:
type: string
description: Client Status
Expand Down Expand Up @@ -1001,10 +1005,14 @@ components:
type: string
example: bb7edb32-2eac-4aad-aebe-ed96fe073879
description: Client secret password.
metadata:
public_metadata:
type: object
example: { "model": "example" }
description: Arbitrary, object-encoded client's data.
metadata:
type: object
example: { "model": "example" }
description: Arbitrary, object-encoded client's data, private to the client.
status:
type: string
description: Client Status
Expand Down Expand Up @@ -1058,10 +1066,14 @@ components:
type: string
example: ""
description: Client secret password.
metadata:
public_metadata:
type: object
example: { "model": "example" }
description: Arbitrary, object-encoded client's data.
metadata:
type: object
example: { "model": "example" }
description: Arbitrary, object-encoded client's data, private to the client.
status:
type: string
description: Client Status
Expand Down Expand Up @@ -1113,9 +1125,14 @@ components:
metadata:
type: object
example: { "role": "general" }
description: Arbitrary, object-encoded client's data.
description: Arbitrary, object-encoded client's data, private to the client.
public_metadata:
type: object
example: { "role": "general" }
description: Arbitrary, object-encoded client's data.
required:
- name
- public_metadata
- metadata

ClientTags:
Expand Down
12 changes: 10 additions & 2 deletions apidocs/openapi/users.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,10 @@ components:
- username
- secret
metadata:
type: object
example: { "domain": "example.com" }
description: Arbitrary, object-encoded user's data private to the user.
public_metadata:
type: object
example: { "domain": "example.com" }
description: Arbitrary, object-encoded user's data.
Expand Down Expand Up @@ -768,6 +772,10 @@ components:
example: john_doe
description: User's username for example john_doe for Mr John Doe.
metadata:
type: object
example: { "address": "example" }
description: Arbitrary, object-encoded user's data private to the user.
public_metadata:
type: object
example: { "address": "example" }
description: Arbitrary, object-encoded user's data.
Expand Down Expand Up @@ -1252,7 +1260,7 @@ components:

Metadata:
name: metadata
description: Metadata filter. Filtering is performed matching the parameter with metadata on top level. Parameter is json.
description: Metadata filter. Filtering is performed matching the parameter with public metadata on top level. Parameter is json.
in: query
schema:
type: object
Expand Down Expand Up @@ -1334,7 +1342,7 @@ components:
$ref: "#/components/schemas/UserReqObj"

UserUpdateReq:
description: JSON-formated document describing the metadata and name of user to be update
description: JSON-formated document describing the name, metadata and public_metadata of user to be update
required: true
content:
application/json:
Expand Down
24 changes: 21 additions & 3 deletions cli/clients_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,26 @@ func TestUpdateClientCmd(t *testing.T) {
client smqsdk.Client
logType outputLog
}{
{
desc: "update client name and public metadata successfully",
args: []string{
client.ID,
updateCmd,
newNameandMeta,
domainID,
token,
},
client: smqsdk.Client{
Name: "clientName",
PublicMetadata: map[string]any{
"role": "general",
},
ID: client.ID,
DomainID: client.DomainID,
Status: client.Status,
},
logType: entityLog,
},
{
desc: "update client name and metadata successfully",
args: []string{
Expand All @@ -317,9 +337,7 @@ func TestUpdateClientCmd(t *testing.T) {
client: smqsdk.Client{
Name: "clientName",
Metadata: map[string]any{
"metadata": map[string]any{
"role": "general",
},
"role": "general",
},
ID: client.ID,
DomainID: client.DomainID,
Expand Down
2 changes: 1 addition & 1 deletion cli/users_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ Available update options:
case len(tc.args) == 4: // Basic user update
sdkCall = sdkMock.On("UpdateUser", mock.Anything, mgsdk.User{
FirstName: "new name",
Metadata: mgsdk.Metadata{
PublicMetadata: mgsdk.Metadata{
"key": "value",
},
}, tc.args[3]).Return(tc.user, tc.sdkErr)
Expand Down
7 changes: 4 additions & 3 deletions clients/api/http/endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,10 @@ func updateClientEndpoint(svc clients.Service) endpoint.Endpoint {
}

cli := clients.Client{
ID: req.id,
Name: req.Name,
Metadata: req.Metadata,
ID: req.id,
Name: req.Name,
Metadata: req.Metadata,
PublicMetadata: req.PublicMetadata,
}
client, err := svc.Update(ctx, session, cli)
if err != nil {
Expand Down
Loading
Loading