Documentation ¶
Index ¶
Constants ¶
View Source
const ( // available Sizes SmallSize = 50 MediumSize = 100 LargeSize = 150 )
View Source
const (
TokenName = "AccessToken"
)
Variables ¶
View Source
var ( // ErrInvalidArgument happens on request without valid arguments ErrInvalidArgument = errors.New("invalid Arguments") // ErrEmptyCity happens on request without defined city ErrEmptyCity = errors.New("bad Request, void City") )
ErrUnauthorized happens on not authorized
Functions ¶
func NewAuth ¶
func NewAuth(auth Authorizer, pubKey, privKey string, exp time.Duration, appName string) *defaultAuthService
NewAuth instantiates auth service
func NewDefaultStaticAuthorizer ¶
func NewDefaultStaticAuthorizer() *staticAuthorizer
NewDefaultStaticAuthorizer fake authorizer
Types ¶
type AuthService ¶
type AuthService interface { // Authorize user credentials and generate token on success Authorize(ctx context.Context, user, pass string) (token string, err error) // IsValidToken does token validation IsValidToken(ctx context.Context, token string) (bool, error) }
AuthService takes care on authentication features
type Authorizer ¶
type Authorizer interface { // ValidCredentials validates user and pass access ValidCredentials(user, pass string) (bool, error) }
Authorizer delegates credential validation
type DefaultService ¶
type DefaultService struct {
// contains filtered or unexported fields
}
DefaultService defines core service
func New ¶
func New(r provider.GithubRepository, rnk SearchedLocationsRanking) *DefaultService
New instantiates service
func (*DefaultService) GetTopContributors ¶
func (s *DefaultService) GetTopContributors(ctx context.Context, r provider.GithubTopRequest) ([]*provider.Contributor, error)
GetTopContributors returns github top by location
func (*DefaultService) GetTopSearchedLocations ¶
func (s *DefaultService) GetTopSearchedLocations(ctx context.Context, size int) ([]*provider.Location, error)
GetTopSearchedLocations return top Searched Locations
Click to show internal directories.
Click to hide internal directories.