2022-08-02 09:55:19 -05:00
|
|
|
package apikey
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Service interface {
|
2023-03-21 07:26:33 -05:00
|
|
|
GetAPIKeys(ctx context.Context, query *GetApiKeysQuery) (res []*APIKey, err error)
|
2022-08-23 10:01:35 -05:00
|
|
|
GetAllAPIKeys(ctx context.Context, orgID int64) ([]*APIKey, error)
|
2022-08-04 07:19:09 -05:00
|
|
|
DeleteApiKey(ctx context.Context, cmd *DeleteCommand) error
|
2023-03-21 07:26:33 -05:00
|
|
|
AddAPIKey(ctx context.Context, cmd *AddCommand) (res *APIKey, err error)
|
|
|
|
GetApiKeyById(ctx context.Context, query *GetByIDQuery) (res *APIKey, err error)
|
|
|
|
GetApiKeyByName(ctx context.Context, query *GetByNameQuery) (res *APIKey, err error)
|
2022-08-04 07:19:09 -05:00
|
|
|
GetAPIKeyByHash(ctx context.Context, hash string) (*APIKey, error)
|
2022-08-02 09:55:19 -05:00
|
|
|
UpdateAPIKeyLastUsedDate(ctx context.Context, tokenID int64) error
|
2023-03-03 10:12:34 -06:00
|
|
|
// IsDisabled returns true if the API key is not available for use.
|
|
|
|
IsDisabled(ctx context.Context, orgID int64) (bool, error)
|
2022-08-02 09:55:19 -05:00
|
|
|
}
|