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: 10 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 Service

type Service interface {
	// API Key Management
	// GenerateAPIKey creates a new API key for a developer.
	// It returns the created APIKey model and the raw, unhashed key.
	// The raw key should only be shown once to the developer.
	GenerateAPIKey(ctx context.Context, developerID string, name string) (*model.APIKey, string, error)
	// GetAPIKeys retrieves all active API keys for a specific developer.
	GetAPIKeys(ctx context.Context, developerID string) ([]model.APIKey, error)
	// RevokeAPIKey deactivates an API key, making it unusable for authentication.
	RevokeAPIKey(ctx context.Context, developerID, keyID string) error
	// ValidateAPIKey validates a raw API key against stored hashed keys.
	// It returns the APIKey model if valid and active, otherwise an error.
	// This method is typically used by authentication middleware.
	ValidateAPIKey(ctx context.Context, rawKey string) (*model.APIKey, error)

	// Webhook Subscription Management
	// CreateWebhookSubscription creates a new webhook endpoint for a developer.
	CreateWebhookSubscription(ctx context.Context, developerID string, url string, events []string, secret string) (*model.WebhookSubscription, error)
	// GetWebhookSubscriptions retrieves all webhook subscriptions for a specific developer.
	GetWebhookSubscriptions(ctx context.Context, developerID string) ([]model.WebhookSubscription, error)
	// UpdateWebhookSubscription modifies an existing webhook subscription.
	// Pointers are used for optional fields that may or may not be updated.
	UpdateWebhookSubscription(ctx context.Context, developerID, subscriptionID string, url *string, events *[]string, secret *string, isActive *bool) (*model.WebhookSubscription, error)
	// DeleteWebhookSubscription removes a webhook subscription.
	DeleteWebhookSubscription(ctx context.Context, developerID, subscriptionID string) error
}

Service defines the interface for developer-related operations, specifically managing webhook subscriptions and API keys.

func NewService

NewService creates a new developer service with the given repository, logger, and API key hasher.

Jump to

Keyboard shortcuts

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