client

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ScopesReadOnly = []string{
		"core.business_entity.read",
		"core.common.read",
		"core.user_group.read",
		"core.user.read",
		"email login",
		"openid",
		"profile",
	}
	ScopesReadWrite = append(
		ScopesReadOnly,
		"core.user_group.write",
		"core.user.write",
	)
)

Functions

func AllUsersQuery

func AllUsersQuery(pg string) string

func GetUserGroups

func GetUserGroups(userId int) string

func GetUserRoles

func GetUserRoles(userId int) string

func GroupMembersQuery

func GroupMembersQuery(groupID string) string

func GroupsQuery

func GroupsQuery(pg string) string

func LicenseGrantQuery

func LicenseGrantQuery(licenseName string, pg string) string

func RoleGrantQuery

func RoleGrantQuery(roleID string, pg string) string

func RolesQuery

func RolesQuery(pg string) string

func WithBearerToken

func WithBearerToken(token string) uhttp.RequestOption

WithBearerToken - TODO(marcos): move this function to `baton-sdk`.

Types

type Client

type Client struct {
	ReadOnlyTokenSource oauth2.TokenSource
	// contains filtered or unexported fields
}

func New

func New(
	ctx context.Context,
	instanceUrl string,
	clientId string,
	clientSecret string,
) (*Client, error)

func (*Client) Initialize

func (c *Client) Initialize(ctx context.Context) error

func (*Client) Query

func (c *Client) Query(
	ctx context.Context,
	rawQuery string,
	target interface{},
) (
	*http.Response,
	*v2.RateLimitDescription,
	error,
)

type Group

type Group struct {
	ID          int     `json:"id"`
	Name        string  `json:"name"`
	Description *string `json:"description,omitempty"`
}

type GroupMembersQueryResponse

type GroupMembersQueryResponse struct {
	UserGroups []struct {
		Id    int    `json:"id"`
		Name  string `json:"name"`
		Users []struct {
			Id int `json:"id"`
		} `json:"users"`
	} `json:"userGroups"`
}

type GroupsQueryResponse

type GroupsQueryResponse struct {
	UserGroups []*Group `json:"userGroups"`
}

type License

type License struct {
	Name        string
	ID          string
	Description string
}

type LicenseGrantsQueryResponse

type LicenseGrantsQueryResponse struct {
	Users []struct {
		Id int `json:"id"`
	} `json:"users"`
}

type Query

type Query struct {
	Query     string            `json:"query"`
	Variables map[string]string `json:"variables,omitempty"`
}

type ResourceId

type ResourceId struct {
	Id int `json:"id"`
}

type Role

type Role struct {
	Name        string  `json:"name"`
	ID          int     `json:"id"`
	Description *string `json:"description,omitempty"`
}

type RoleGrantsQueryResponse

type RoleGrantsQueryResponse struct {
	Users []struct {
		Id int `json:"id"`
	} `json:"users"`
}

type RolesQueryResponse

type RolesQueryResponse struct {
	Roles []*Role `json:"roles"`
}

type User

type User struct {
	ID       int    `json:"id"`
	Email    string `json:"email"`
	Fullname string `json:"fullname"`
	Active   bool   `json:"active"`
}

type UserGroups

type UserGroups struct {
	Id    int     `json:"id"`
	Group []Group `json:"userGroups"`
}

type UserGroupsApiResponse

type UserGroupsApiResponse struct {
	Id    int     `json:"id"`
	Group []Group `json:"user-groups"`
}

type UserGroupsResponse

type UserGroupsResponse struct {
	Users []UserGroups `json:"users"`
}

type UserLicenseResponse

type UserLicenseResponse struct {
	Id              int  `json:"id"`
	RiskAssessUser  bool `json:"risk-assess-user"`
	AicUser         bool `json:"aic-user"`
	PurchasingUser  bool `json:"purchasing-user"`
	ExpenseUser     bool `json:"expense-user"`
	SourcingUser    bool `json:"sourcing-user"`
	InventoryUser   bool `json:"inventory-user"`
	ContractsUser   bool `json:"contracts-user"`
	AnalyticsUser   bool `json:"analytics-user"`
	SpendGuardUser  bool `json:"spend-guard-user"`
	CcwUser         bool `json:"ccw-user"`
	SupplyChainUser bool `json:"supply-chain-user"`
	TravelUser      bool `json:"travel-user"`
	TreasuryUser    bool `json:"treasury-user"`
}

type UserRoles

type UserRoles struct {
	Id    int    `json:"id"`
	Roles []Role `json:"roles"`
}

type UserRolesPutResponse

type UserRolesPutResponse struct {
	ResourceId
	Roles []Role `json:"roles"`
}

type UserRolesResponse

type UserRolesResponse struct {
	Users []UserRoles `json:"users"`
}

type UsersQueryResponse

type UsersQueryResponse struct {
	Users []*User `json:"users"`
}

Jump to

Keyboard shortcuts

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