Skip to content
This repository was archived by the owner on Jul 2, 2025. It is now read-only.

Update generated code #33

Merged
merged 1 commit into from
May 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions adminapi/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ type Users interface {
//
// If the user already exists, this is a no-op.
ImportAccount(ctx context.Context, userId string, input *UserImportAccountInput) (*adminv1.User, error)
// Report a user action.
//
// If the `<externalId>@<connectionId>` user identifier syntax is
// used and the user doesn't exist, they will be imported.
//
// By default, the action is processed asynchronously.
ReportAction(ctx context.Context, userId string, input *UserReportActionInput) (*adminv1.ReportUserActionResponse, error)
// Create a User API session.
CreateApiSession(ctx context.Context, userId string, input *UserCreateApiSessionInput) (*adminv1.CreateApiSessionResponse, error)
// Create a Portal session.
Expand Down Expand Up @@ -730,6 +737,54 @@ func (n *usersImpl) ImportAccount(ctx context.Context, userId string, input *Use
return model, nil
}

// UserReportActionInput is the input param for the ReportAction method.
type UserReportActionInput struct {
// The type of action.
Action string
// Process the user action synchronously.
//
// Otherwise the action is processed in the background and errors
// won't be returned.
Wait bool
}

func (n *usersImpl) ReportAction(ctx context.Context, userId string, input *UserReportActionInput) (*adminv1.ReportUserActionResponse, error) {
req := internal.NewRequest(
"admin.users.reportAction",
"POST",
fmt.Sprintf("/admin/v1/users/%s:reportAction",
url.PathEscape(userId),
),
)

body := map[string]any{}

if input != nil {
if !internal.IsEmpty(input.Action) {
body["action"] = input.Action
}
if !internal.IsEmpty(input.Wait) {
body["wait"] = input.Wait
}
}

req.SetBody(body)

res, err := n.transport.Execute(ctx, req)
if err != nil {
return nil, err
}

model := &adminv1.ReportUserActionResponse{}

err = res.DecodeBody(&model)
if err != nil {
return nil, err
}

return model, nil
}

// UserCreateApiSessionInput is the input param for the CreateApiSession method.
type UserCreateApiSessionInput struct {
}
Expand Down
2 changes: 0 additions & 2 deletions adminv1/builtin_email_connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@ package adminv1

// The builtin email specific connection data.
type BuiltinEmailConnection struct {
// The allowed email list.
AllowedEmails []string `json:"allowedEmails"`
}
2 changes: 0 additions & 2 deletions adminv1/postmark_connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,4 @@ type PostmarkConnection struct {
From *commonv1.Email `json:"from"`
// The reply to email address.
ReplyTo *commonv1.Email `json:"replyTo"`
// The allowed email list.
AllowedEmails []string `json:"allowedEmails"`
}
7 changes: 7 additions & 0 deletions adminv1/report_user_action_response.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Code generated. DO NOT EDIT.

package adminv1

// Response message for ReportUserAction.
type ReportUserActionResponse struct {
}
4 changes: 2 additions & 2 deletions internal/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
const (
ApiBaseUrl = "https://api.userhub.com"
ApiVersion = "2025-05-01"
UserAgent = "UserHub-Go/0.8.0"
Version = "0.8.0"
UserAgent = "UserHub-Go/0.8.1"
Version = "0.8.1"

AuthHeader = "Authorization"
ApiKeyHeader = "UserHub-Api-Key"
Expand Down