api

package
v0.0.0-...-97ce471 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const API_AUTH = "/oauth2/token"
View Source
const API_USER = API_V1 + "/user"
View Source
const API_USER_ME = API_USER + "/me"
View Source
const API_V1 = "/api/v1.0"
View Source
const DOMAIN = ".pamdas.org"

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthResponse

type AuthResponse struct {
	AccessToken      string `json:"access_token"`
	ExpiresIn        int    `json:"expires_in"`
	TokenType        string `json:"token_type"`
	Scope            string `json:"scope"`
	RefreshToken     string `json:"refresh_token"`
	ErrorDescription string `json:"error_description"`
}

func Authenticate

func Authenticate(sitename, username, password string) (*AuthResponse, error)

type UserResponse

type UserResponse struct {
	Data struct {
		Username    string `json:"username"`
		Email       string `json:"email"`
		FirstName   string `json:"first_name"`
		LastName    string `json:"last_name"`
		Role        string `json:"role"`
		IsStaff     bool   `json:"is_staff"`
		IsSuperUser bool   `json:"is_superuser"`
		DateJoined  string `json:"date_joined"`
		ID          string `json:"id"`
		IsActive    bool   `json:"is_active"`
		LastLogin   string `json:"last_login"`
		Pin         string `json:"pin"`
		Subject     struct {
			ID string `json:"id"`
		} `json:"subject"`
	} `json:"data"`
	ErrorDescription string `json:"error_description"`
}

func User

func User() (*UserResponse, error)

Jump to

Keyboard shortcuts

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