dto

package
v0.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 19, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package dto provides data transfer objects for HTTP request and response handling.

Package dto provides data transfer objects for HTTP request and response handling.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuditLogResponse

type AuditLogResponse struct {
	ID         string         `json:"id"`
	RequestID  string         `json:"request_id"`
	ClientID   string         `json:"client_id"`
	Capability string         `json:"capability"`
	Path       string         `json:"path"`
	Metadata   map[string]any `json:"metadata,omitempty"`
	CreatedAt  time.Time      `json:"created_at"`
}

AuditLogResponse represents an audit log entry in API responses.

func MapAuditLogToResponse

func MapAuditLogToResponse(auditLog *authDomain.AuditLog) AuditLogResponse

MapAuditLogToResponse converts a domain audit log to an API response.

type ClientResponse

type ClientResponse struct {
	ID        string                      `json:"id"`
	Name      string                      `json:"name"`
	IsActive  bool                        `json:"is_active"`
	Policies  []authDomain.PolicyDocument `json:"policies"`
	CreatedAt time.Time                   `json:"created_at"`
}

ClientResponse represents a client in API responses (excludes secret).

func MapClientToResponse

func MapClientToResponse(client *authDomain.Client) ClientResponse

MapClientToResponse converts a domain client to an API response.

type CreateClientRequest

type CreateClientRequest struct {
	Name     string                      `json:"name"`
	IsActive bool                        `json:"is_active"`
	Policies []authDomain.PolicyDocument `json:"policies"`
}

CreateClientRequest contains the parameters for creating a new authentication client.

func (*CreateClientRequest) Validate

func (r *CreateClientRequest) Validate() error

Validate checks if the create client request is valid.

type CreateClientResponse

type CreateClientResponse struct {
	ID     string `json:"id"`
	Secret string `json:"secret"` //nolint:gosec // returned once on creation
}

CreateClientResponse contains the result of creating a new client. SECURITY: The secret is only returned once and must be saved securely.

type IssueTokenRequest

type IssueTokenRequest struct {
	ClientID     string `json:"client_id"`
	ClientSecret string `json:"client_secret"` //nolint:gosec // API authentication field
}

IssueTokenRequest contains the parameters for issuing an authentication token.

func (*IssueTokenRequest) Validate

func (r *IssueTokenRequest) Validate() error

Validate checks if the issue token request is valid.

type IssueTokenResponse

type IssueTokenResponse struct {
	Token     string    `json:"token"`
	ExpiresAt time.Time `json:"expires_at"`
}

IssueTokenResponse contains the result of issuing a token. SECURITY: The token is only returned once and must be saved securely.

type ListAuditLogsResponse

type ListAuditLogsResponse struct {
	AuditLogs []AuditLogResponse `json:"audit_logs"`
}

ListAuditLogsResponse represents a paginated list of audit logs in API responses.

func MapAuditLogsToListResponse

func MapAuditLogsToListResponse(auditLogs []*authDomain.AuditLog) ListAuditLogsResponse

MapAuditLogsToListResponse converts a slice of domain audit logs to a list API response.

type ListClientsResponse

type ListClientsResponse struct {
	Clients []ClientResponse `json:"clients"`
}

ListClientsResponse represents a paginated list of clients in API responses.

func MapClientsToListResponse

func MapClientsToListResponse(clients []*authDomain.Client) ListClientsResponse

MapClientsToListResponse converts a slice of domain clients to a list API response.

type UpdateClientRequest

type UpdateClientRequest struct {
	Name     string                      `json:"name"`
	IsActive bool                        `json:"is_active"`
	Policies []authDomain.PolicyDocument `json:"policies"`
}

UpdateClientRequest contains the parameters for updating an existing client.

func (*UpdateClientRequest) Validate

func (r *UpdateClientRequest) Validate() error

Validate checks if the update client request is valid.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL