Documentation
¶
Index ¶
- Constants
- func IsInvalidResponse[T any](response BaseResponse[T]) bool
- type BaseResource
- type BaseResponse
- type Client
- func (c *Client) GetOrganizations(ctx context.Context) ([]Organization, error)
- func (c *Client) GetSessionDetails(ctx context.Context) (SessionDetails, error)
- func (c *Client) GetUserRolePermissions(ctx context.Context, roleId string) (map[string]bool, error)
- func (c *Client) GetUserRoleProfile(ctx context.Context, roleId string) (UserRoleProfile, error)
- func (c *Client) GetUserRoleProfiles(ctx context.Context, getUserRoleProfilesVars PaginationParams) ([]UserRoleProfile, int, error)
- func (c *Client) GetUsers(ctx context.Context, getUsersVars PaginationParams) ([]User, int, error)
- func (c *Client) Login(ctx context.Context, organizationId string) error
- type Credentials
- type Filter
- type LoginData
- type LoginResponse
- type Organization
- type OrganizationsResponse
- type PaginationParams
- type RequestOption
- type SearchParams
- type SessionDetails
- type SessionDetailsResponse
- type Sort
- type User
- type UserParams
- type UserRolePermissionsResponse
- type UserRoleProfile
- type UserRoleProfileResponse
- type UserRoleProfilesResponse
- type UsersResponse
Constants ¶
const ApiSessionBaseURL = BaseURL + "/GetSessionInfo.json"
const BaseURL = "https://api.bill.com/api/v2"
const LoginBaseURL = BaseURL + "/Login.json"
usual format: <API_Base_URL>/Crud/<Operation>/<Entity>.json (Read more at https://developer.bill.com/docs/api-request-format)
const OrganizationsBaseURL = BaseURL + "/ListOrgs.json"
const SandboxBaseURL = "https://api-sandbox.bill.com/api/v2"
const UserRolePermissionsBaseURL = BaseURL + "/GetProfilePermissions.json"
const UserRoleProfileBaseURL = BaseURL + "/Crud/Read/Profile.json"
const UserRoleProfilesBaseURL = BaseURL + "/List/Profile.json"
const UsersBaseURL = BaseURL + "/List/User.json"
Variables ¶
This section is empty.
Functions ¶
func IsInvalidResponse ¶
func IsInvalidResponse[T any](response BaseResponse[T]) bool
Types ¶
type BaseResource ¶
type BaseResource struct {
Id string `json:"id"`
}
type BaseResponse ¶
type Client ¶
type Client struct {
Credentials
// contains filtered or unexported fields
}
func (*Client) GetOrganizations ¶
func (c *Client) GetOrganizations(ctx context.Context) ([]Organization, error)
GetOrganization returns detail information about the organization. This operation does not require Login to be called first.
func (*Client) GetSessionDetails ¶
func (c *Client) GetSessionDetails(ctx context.Context) (SessionDetails, error)
GetSessionDetails returns details regarding session of currently signed in user and organization.
func (*Client) GetUserRolePermissions ¶
func (c *Client) GetUserRolePermissions(ctx context.Context, roleId string) (map[string]bool, error)
GetUserRolePermissions returns map of permissions under the provided user role.
func (*Client) GetUserRoleProfile ¶
GetUserRoleProfile returns detail information about the user role under provided id.
func (*Client) GetUserRoleProfiles ¶
func (c *Client) GetUserRoleProfiles(ctx context.Context, getUserRoleProfilesVars PaginationParams) ([]UserRoleProfile, int, error)
GetUserRoleProfiles returns all user roles available in the organization.
type Credentials ¶
type Credentials struct {
Username string
Password string
OrganizationId string
DeveloperKey string
SessionId string
}
func (Credentials) Apply ¶
func (credentials Credentials) Apply(body *url.Values)
Method Apply for Credentials struct adds credentials to the request body.
type LoginResponse ¶
type LoginResponse = BaseResponse[LoginData]
type Organization ¶
type OrganizationsResponse ¶
type OrganizationsResponse = BaseResponse[[]Organization]
type PaginationParams ¶
func (PaginationParams) Apply ¶
func (pagination PaginationParams) Apply(body *url.Values)
Method Apply for PaginationParams struct adds pagination parameters to the request body.
type RequestOption ¶
type SearchParams ¶
type SearchParams struct {
Id string `json:"id"`
Filters []Filter `json:"filters"`
Sort []Sort `json:"sort"`
Nested bool `json:"nested"`
ShowAudit bool `json:"showAudit"`
}
func (SearchParams) Apply ¶
func (searchParams SearchParams) Apply(body *url.Values)
Method Apply for SearchParams struct adds search parameters (like id of the resource) to the request body. In case of Bill.com API, it uses the data field to pass the search parameters as well as the pagination parameters So this function handles both cases.
type SessionDetails ¶
type SessionDetailsResponse ¶
type SessionDetailsResponse = BaseResponse[SessionDetails]
type UserParams ¶
type UserParams struct {
PaginationParams
SearchParams
}
type UserRolePermissionsResponse ¶
type UserRolePermissionsResponse = BaseResponse[map[string]bool]
type UserRoleProfile ¶
type UserRoleProfile struct {
BaseResource
Name string `json:"name"`
Type string `json:"type"`
Description string `json:"description"`
}
type UserRoleProfileResponse ¶
type UserRoleProfileResponse = BaseResponse[UserRoleProfile]
type UserRoleProfilesResponse ¶
type UserRoleProfilesResponse = BaseResponse[[]UserRoleProfile]
type UsersResponse ¶
type UsersResponse = BaseResponse[[]User]