util

package
v0.0.0-...-cb8e146 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	XRHIDENTITY      = "x-rh-identity"
	LAST_VISITED_MAX = 10
	IDENTITY_CTX_KEY = "identity"
	USER_CTX_KEY     = "user"
	GET_ALL_PARAM    = "getAll"   // Used for searching ALL favorited pages
	DEFAULT_PARAM    = "archived" // Used as default value for active favorited pages
	FAVORITE_PARAM   = "favorite"
)
View Source
const ProjectName = "chrome-service-backend"

Variables

View Source
var (
	ErrNotAuthorized                      = errors.New("not authorized")
	BaseTemplates    models.BaseTemplates = models.BaseTemplates{
		"landingPage": models.BaseDashboardTemplate{
			Name:        "landingPage",
			DisplayName: "Landing Page",
			TemplateConfig: models.TemplateConfig{
				Sm: convertToJson(landingPageSm),
				Md: convertToJson(landingPageMd),
				Lg: convertToJson(landingPageLg),
				Xl: convertToJson(landingPageXl),
			},
		},
	}
)

Functions

func LoadEnv

func LoadEnv() error

func ParseXRHIdentityHeader

func ParseXRHIdentityHeader(identityHeader string) (*identity.XRHID, error)

Types

type DecodedToken

type DecodedToken struct {
	UserId        string `json:"user_id"`
	OrgId         string `json:"org_id"`
	AccountNumber string `json:"account_number"`
}

func ParseJWTToken

func ParseJWTToken(tokenString string) (DecodedToken, error)

Adaptation of chrome UI token parsing as we can't yse the JWT decode, because we do not have the decode key

type EntityResponse

type EntityResponse[T interface{}] struct {
	Data T `json:"data"`
}

type ErrorResponse

type ErrorResponse struct {
	Errors []string `json:"errors"`
}

type ListMeta

type ListMeta struct {
	Count  int `json:"count,omitempty"`
	Total  int `json:"total,omitempty"`
	Limit  int `json:"limit,omitempty"`
	Offset int `json:"offset,omitempty"`
}

type ListResponse

type ListResponse[T interface{}] struct {
	Data []T      `json:"data"`
	Meta ListMeta `json:"meta"`
}

Jump to

Keyboard shortcuts

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