orgtokens

package
v0.72.2 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const CSVContentType = "text/csv"

Variables

View Source
var ErrNoContent = errors.New("no content")

Functions

This section is empty.

Types

type AggregatedToken

type AggregatedToken struct {
	Amount      int64     `rql:"name=amount,type=number"`
	Type        string    `rql:"name=type,type=string"`
	Description string    `rql:"name=description,type=string"`
	UserID      string    `rql:"name=user_id,type=string"`
	UserTitle   string    `rql:"name=user_title,type=string"`
	UserAvatar  string    `rql:"name=user_avatar,type=string"`
	CreatedAt   time.Time `rql:"name=created_at,type=datetime"`
	OrgID       string    `rql:"name=org_id,type=string"`
}

type CSVExport

type CSVExport struct {
	Amount      string `csv:"Amount"`
	Type        string `csv:"Type"`
	Description string `csv:"Description"`
	UserID      string `csv:"User ID"`
	UserTitle   string `csv:"User Title"`
	CreatedAt   string `csv:"Created At"`
	OrgID       string `csv:"Organization ID"`
}

CSVExport represents the structure for CSV export of organization tokens

func NewCSVExport

func NewCSVExport(token AggregatedToken) CSVExport

NewCSVExport converts AggregatedToken to CSVExport

func (CSVExport) GetHeaders

func (c CSVExport) GetHeaders() []string

GetHeaders returns the CSV headers based on struct tags

func (CSVExport) ToRow

func (c CSVExport) ToRow() []string

ToRow converts the struct to a string slice for CSV writing

type OrganizationTokens

type OrganizationTokens struct {
	Tokens     []AggregatedToken `json:"tokens"`
	Pagination Page              `json:"pagination"`
}

type Page

type Page struct {
	Limit  int `json:"limit"`
	Offset int `json:"offset"`
}

type Repository

type Repository interface {
	Search(ctx context.Context, orgID string, query *rql.Query) (OrganizationTokens, error)
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(repository Repository) *Service

func (Service) Export

func (s Service) Export(ctx context.Context, orgID string) ([]byte, string, error)

Export generates a CSV file containing organization tokens data

func (Service) Search

func (s Service) Search(ctx context.Context, orgID string, query *rql.Query) (OrganizationTokens, error)

Jump to

Keyboard shortcuts

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