developer

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2025 License: Apache-2.0 Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIKey

type APIKey struct {
	ID          uuid.UUID  `json:"id"`                     // Unique identifier for the API key.
	DeveloperID uuid.UUID  `json:"developer_id"`           // The ID of the developer who owns this API key.
	Name        string     `json:"name"`                   // A user-friendly name for the API key (e.g., "My Production Key").
	Key         string     `json:"key"`                    // The actual API key string (should be stored hashed/encrypted in DB, not plaintext).
	Permissions []string   `json:"permissions"`            // List of permissions associated with this key (e.g., "read:users", "write:products").
	ExpiresAt   *time.Time `json:"expires_at,omitempty"`   // Optional expiration date for the key. Nil if it does not expire.
	Revoked     bool       `json:"revoked"`                // True if the key has been revoked and is no longer valid.
	CreatedAt   time.Time  `json:"created_at"`             // Timestamp when the API key was created.
	UpdatedAt   time.Time  `json:"updated_at"`             // Timestamp when the API key was last updated.
	LastUsedAt  *time.Time `json:"last_used_at,omitempty"` // Timestamp of the last time this key was used. Nil if never used.
}

APIKey represents a developer API key. It grants access to specific API resources and actions.

func NewAPIKey

func NewAPIKey(developerID uuid.UUID, name string, key string, permissions []string, expiresAt *time.Time) *APIKey

NewAPIKey creates a new APIKey instance with a generated ID, default revoked status, and timestamps. The 'key' parameter here is the raw key string, which should typically be hashed before persistence and never exposed directly in responses.

type Webhook

type Webhook struct {
	ID          uuid.UUID `json:"id"`           // Unique identifier for the webhook.
	DeveloperID uuid.UUID `json:"developer_id"` // The ID of the developer who owns this webhook.
	URL         string    `json:"url"`          // The URL endpoint to send events to.
	Events      []string  `json:"events"`       // List of event types this webhook subscribes to (e.g., "user.created", "order.updated").
	Secret      string    `json:"secret"`       // Secret used to sign webhook payloads for verification by the receiver.
	Status      string    `json:"status"`       // Current status of the webhook (e.g., "active", "disabled", "errored").
	CreatedAt   time.Time `json:"created_at"`   // Timestamp when the webhook was created.
	UpdatedAt   time.Time `json:"updated_at"`   // Timestamp when the webhook was last updated.
}

Webhook represents a developer webhook subscription. It defines an endpoint where events are sent to a developer's application.

func NewWebhook

func NewWebhook(developerID uuid.UUID, url string, events []string, secret string) *Webhook

NewWebhook creates a new Webhook instance with a generated ID, default status, and timestamps.

Jump to

Keyboard shortcuts

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