Documentation
¶
Index ¶
Constants ¶
View Source
const APIKeyPath = "storj/apikey"
APIKeyPath is the path for storj api keys.
View Source
const UserPath = "storj/account"
UserPath is the path for storj users.
Variables ¶
View Source
var ( // ErrPrivateKey is error type of private key. ErrPrivateKey = errs.Class("private key") // ErrAPIURL is error type of api url. ErrAPIURL = errs.Class("api url") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client makes requests to Valdi API.
func (*Client) CreateAPIKey ¶
func (c *Client) CreateAPIKey(ctx context.Context, email string) (_ *CreateAPIKeyResponse, status int, err error)
CreateAPIKey creates a valdi API key.
func (*Client) CreateUser ¶
func (c *Client) CreateUser(ctx context.Context, createUserData UserCreationData) (statusCode int, err error)
CreateUser creates a user in Valdi.
type Config ¶
type Config struct { APIBaseURL string `help:"base url of valdi external API" releaseDefault:"https://api.valdi.ai" devDefault:"http://localhost:1234"` RSAKeyPath string `help:"path to RSA private key for signing valdi requests" default:""` SignRequests bool `help:"whether to sign valdi requests with valdi RSA key" releaseDefault:"true" devDefault:"false" hidden:"true"` }
Config holds configuration of Client.
type CreateAPIKeyResponse ¶
type CreateAPIKeyResponse struct { APIKey string `json:"api_key"` SecretAccessToken string `json:"secret_access_token"` }
CreateAPIKeyResponse is what Valdi returns when api key is created.
type ErrorMessage ¶
type ErrorMessage struct {
Detail string `json:"detail"`
}
ErrorMessage contains error message returned by Valdi.
type UserCreationData ¶
type UserCreationData struct { Email string `json:"email"` Username string `json:"username"` Country string `json:"country"` }
UserCreationData contains necessary data to create a storj user in Valdi.
Click to show internal directories.
Click to hide internal directories.