Documentation ¶
Index ¶
- Constants
- Variables
- type Auth
- func (a *Auth) DeleteUser(ctx context.Context, userID string) error
- func (a *Auth) ExchangeCode(ctx context.Context, opts ExchangeCodeOpts) (*AuthenticatedDetails, error)
- func (a *Auth) GetUserFromEmail(ctx context.Context, email string) (User, error)
- func (a *Auth) InviteUserByEmail(ctx context.Context, email string) (*User, error)
- func (a *Auth) RefreshUser(ctx context.Context, userToken string, refreshToken string) (*AuthenticatedDetails, error)
- func (a *Auth) ResetPasswordForEmail(ctx context.Context, email string) error
- func (a *Auth) SendMagicLink(ctx context.Context, email string) error
- func (a *Auth) SignIn(ctx context.Context, credentials UserCredentials) (*AuthenticatedDetails, error)
- func (a *Auth) SignInWithProvider(opts ProviderSignInOptions) (*ProviderSignInDetails, error)
- func (a *Auth) SignOut(ctx context.Context, userToken string) error
- func (a *Auth) SignUp(ctx context.Context, credentials UserCredentials) (*User, error)
- func (a *Auth) UpdateUser(ctx context.Context, userToken string, updateData map[string]interface{}) (*User, error)
- func (a *Auth) User(ctx context.Context, userToken string) (*User, error)
- type AuthenticatedDetails
- type Client
- type ErrorResponse
- type ExchangeCodeOpts
- type FileErrorResponse
- type FileObject
- type FileResponse
- type FileSearchOptions
- type FlowType
- type ListFileRequest
- type PKCEParams
- type ProviderSignInDetails
- type ProviderSignInOptions
- type SignedUrlResponse
- type SortBy
- type Storage
- func (s *Storage) CreateBucket(ctx context.Context, option bucketOption) (*bucket, error)
- func (s *Storage) DeleteBucket(ctx context.Context, id string) (*bucketResponse, error)
- func (s *Storage) EmptyBucket(ctx context.Context, id string) (*bucketMessage, error)
- func (s *Storage) From(bucketId string) *file
- func (s *Storage) GetBucket(ctx context.Context, id string) (*bucketResponse, error)
- func (s *Storage) ListBuckets(ctx context.Context) (*[]bucketResponse, error)
- func (s *Storage) UpdateBucket(ctx context.Context, id string, option bucketOption) (*bucketMessage, error)
- type User
- type UserCredentials
Constants ¶
const ( AuthEndpoint = "auth/v1" RestEndpoint = "rest/v1" StorageEndpoint = "storage/v1" )
Variables ¶
var ErrNotFound = errors.New("file not found")
Functions ¶
This section is empty.
Types ¶
type Auth ¶
type Auth struct {
// contains filtered or unexported fields
}
func (*Auth) DeleteUser ¶ added in v0.4.1
func (*Auth) ExchangeCode ¶
func (a *Auth) ExchangeCode(ctx context.Context, opts ExchangeCodeOpts) (*AuthenticatedDetails, error)
ExchangeCode takes an auth code and PCKE verifier and returns the current user if succeeded.
func (*Auth) GetUserFromEmail ¶ added in v0.4.2
func (*Auth) InviteUserByEmail ¶
InviteUserByEmail sends an invite link to the given email. Returns a user.
func (*Auth) RefreshUser ¶
func (a *Auth) RefreshUser(ctx context.Context, userToken string, refreshToken string) (*AuthenticatedDetails, error)
SignIn enters the user credentials and returns the current user if succeeded.
func (*Auth) ResetPasswordForEmail ¶
ResetPasswordForEmail sends a password recovery link to the given e-mail address.
func (*Auth) SendMagicLink ¶
SendMagicLink sends a link to a specific e-mail address for passwordless auth.
func (*Auth) SignIn ¶
func (a *Auth) SignIn(ctx context.Context, credentials UserCredentials) (*AuthenticatedDetails, error)
SignIn enters the user credentials and returns the current user if succeeded.
func (*Auth) SignInWithProvider ¶
func (a *Auth) SignInWithProvider(opts ProviderSignInOptions) (*ProviderSignInDetails, error)
SignInWithProvider returns a URL for signing in via OAuth
type AuthenticatedDetails ¶
type AuthenticatedDetails struct { AccessToken string `json:"access_token"` TokenType string `json:"token_type"` ExpiresIn int `json:"expires_in"` RefreshToken string `json:"refresh_token"` User User `json:"user"` ProviderToken string `json:"provider_token"` ProviderRefreshToken string `json:"provider_refresh_token"` }
type Client ¶
type ErrorResponse ¶
func (*ErrorResponse) Error ¶
func (err *ErrorResponse) Error() string
type ExchangeCodeOpts ¶
type FileErrorResponse ¶
type FileErrorResponse struct { Status string `json:"statusCode"` ShortError string `json:"error"` Message string `json:"message"` }
func (*FileErrorResponse) Error ¶
func (err *FileErrorResponse) Error() string
type FileObject ¶
type FileObject struct { Name string `json:"name"` BucketId string `json:"bucket_id"` Owner string `json:"owner"` Id string `json:"id"` UpdatedAt string `json:"updated_at"` CreatedAt string `json:"created_at"` LastAccessedAt string `json:"last_accessed_at"` Metadata interface{} `json:"metadata"` Buckets bucket `json:"buckets"` }
type FileResponse ¶
type FileSearchOptions ¶
type ListFileRequest ¶
type PKCEParams ¶
adapted from https://go-review.googlesource.com/c/oauth2/+/463979/9/pkce.go#64
type ProviderSignInDetails ¶
type ProviderSignInOptions ¶
type SignedUrlResponse ¶
type SignedUrlResponse struct {
SignedUrl string `json:"signedURL"`
}
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
func (*Storage) CreateBucket ¶
CreateBucket creates a new storage bucket @param: option: a bucketOption with the name and id of the bucket you want to create @returns: bucket: a response with the details of the bucket of the bucket created
func (*Storage) DeleteBucket ¶
DeleteBucket deletes a bucket by its id, a bucket can't be deleted except emptied @param id: the id of the bucket @returns bucketMessage: a successful response message or failed
func (*Storage) EmptyBucket ¶
EmptyBucket empties the object of a bucket by id @param id: the id of the bucket @returns bucketMessage: a successful response message or failed
func (*Storage) GetBucket ¶
GetBucket retrieves a bucket by its id @param: id: the id of the bucket @returns: bucketResponse: a response with the details of the bucket
func (*Storage) ListBuckets ¶
ListBucket retrieves all buckets ina supabase storage @returns: []bucketResponse: a response with the details of all the bucket
func (*Storage) UpdateBucket ¶
func (s *Storage) UpdateBucket(ctx context.Context, id string, option bucketOption) (*bucketMessage, error)
UpdateBucket updates a bucket by its id @param id: the id of the bucket @param option: the options to be updated @returns bucketMessage: a successful response message or failed
type User ¶
type User struct { ID string `json:"id"` Aud string `json:"aud"` Role string `json:"role"` Email string `json:"email"` InvitedAt time.Time `json:"invited_at"` ConfirmedAt time.Time `json:"confirmed_at"` ConfirmationSentAt time.Time `json:"confirmation_sent_at"` AppMetadata struct { // contains filtered or unexported fields } `json:"app_metadata"` UserMetadata map[string]interface{} `json:"user_metadata"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }