Documentation
¶
Index ¶
- Constants
- type AccessRole
- type AssignUserToTeamRequest
- type AssignUserToTeamResponse
- type Client
- func (c *Client) AssignUserToTeam(ctx context.Context, teamUID string, userUID string) (*AssignUserToTeamResponse, annotations.Annotations, error)
- func (c *Client) CreateUser(ctx context.Context, user UserPayload) (*CreateUserResponse, annotations.Annotations, error)
- func (c *Client) GetTeamUsers(ctx context.Context, teamID string) ([]*ZuperUser, string, annotations.Annotations, error)
- func (c *Client) GetTeams(ctx context.Context, opts PageOptions) ([]*Team, string, annotations.Annotations, error)
- func (c *Client) GetUserByID(ctx context.Context, userUID string) (*ZuperUser, annotations.Annotations, error)
- func (c *Client) GetUsers(ctx context.Context, opts PageOptions) ([]*ZuperUser, string, annotations.Annotations, error)
- func (c *Client) IsUserInTeam(ctx context.Context, teamUID string, userUID string) (bool, error)
- func (c *Client) UnassignUserFromTeam(ctx context.Context, teamUID string, userUID string) (*AssignUserToTeamResponse, annotations.Annotations, error)
- func (c *Client) UpdateUserAccessRole(ctx context.Context, userUID string, accessRoleUID string) (*UpdateUserRoleResponse, annotations.Annotations, error)
- func (c *Client) UpdateUserField(ctx context.Context, userUID string, field string, value interface{}) (*UpdateUserRoleResponse, annotations.Annotations, error)
- func (c *Client) UpdateUserRole(ctx context.Context, userUID string, roleID int) (*UpdateUserRoleResponse, annotations.Annotations, error)
- type CreateUserRequest
- type CreateUserResponse
- type CreatedBy
- type ErrorResponse
- type PageOptions
- type Role
- type Team
- type TeamDetailsResponse
- type TeamDetailsWithUsersResponse
- type TeamsResponse
- type UnassignUserFromTeamRequest
- type UpdateUserAccessRoleRequest
- type UpdateUserRoleRequest
- type UpdateUserRoleResponse
- type UserDetailsResponse
- type UserPayload
- type UsersResponse
- type WorkHour
- type ZuperError
- type ZuperUser
Constants ¶
const DefaultPageSize = 50
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessRole ¶
type AssignUserToTeamRequest ¶
type AssignUserToTeamRequest struct {
TeamUID string `json:"team_uid"`
UserUID string `json:"user_uid"`
}
AssignUserToTeam models.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the Zuper API client for Baton.
func NewClient ¶
func NewClient(ctx context.Context, apiUrl string, apiKey string, httpClient *uhttp.BaseHttpClient) *Client
NewClient creates a new Client instance with the provided HTTP client.
func (*Client) AssignUserToTeam ¶
func (c *Client) AssignUserToTeam(ctx context.Context, teamUID string, userUID string) (*AssignUserToTeamResponse, annotations.Annotations, error)
AssignUserToTeam assigns a user to a team in Zuper using the teamUID and userUID.
func (*Client) CreateUser ¶
func (c *Client) CreateUser(ctx context.Context, user UserPayload) (*CreateUserResponse, annotations.Annotations, error)
CreateUser sends a request to create a new user with the provided user payload and default work hours.
func (*Client) GetTeamUsers ¶
func (c *Client) GetTeamUsers(ctx context.Context, teamID string) ([]*ZuperUser, string, annotations.Annotations, error)
GetTeamUsers fetches the users of a team from the Zuper API.
func (*Client) GetTeams ¶
func (c *Client) GetTeams(ctx context.Context, opts PageOptions) ([]*Team, string, annotations.Annotations, error)
GetTeams fetches a paginated list of teams from the Zuper API.
func (*Client) GetUserByID ¶
func (c *Client) GetUserByID(ctx context.Context, userUID string) (*ZuperUser, annotations.Annotations, error)
GetUserByID fetches the details of a user by their user_uid from the Zuper API.
func (*Client) GetUsers ¶
func (c *Client) GetUsers(ctx context.Context, opts PageOptions) ([]*ZuperUser, string, annotations.Annotations, error)
GetUsers fetches a paginated list of users from the Zuper API.
func (*Client) IsUserInTeam ¶
IsUserInTeam checks if a user is already a member of a team.
func (*Client) UnassignUserFromTeam ¶
func (c *Client) UnassignUserFromTeam(ctx context.Context, teamUID string, userUID string) (*AssignUserToTeamResponse, annotations.Annotations, error)
UnassignUserFromTeam removes a user from a team in Zuper using the teamUID and userUID.
func (*Client) UpdateUserAccessRole ¶
func (c *Client) UpdateUserAccessRole(ctx context.Context, userUID string, accessRoleUID string) (*UpdateUserRoleResponse, annotations.Annotations, error)
UpdateUserAccessRole updates the access role of a user using UpdateUserField.
func (*Client) UpdateUserField ¶
func (c *Client) UpdateUserField(ctx context.Context, userUID string, field string, value interface{}) (*UpdateUserRoleResponse, annotations.Annotations, error)
UpdateUserField updates a specific field of a user in Zuper.
func (*Client) UpdateUserRole ¶
func (c *Client) UpdateUserRole(ctx context.Context, userUID string, roleID int) (*UpdateUserRoleResponse, annotations.Annotations, error)
UpdateUserRole updates the role of a user using UpdateUserField.
type CreateUserRequest ¶
type CreateUserRequest struct {
WorkHours []WorkHour `json:"work_hours"`
User UserPayload `json:"user"`
}
type CreateUserResponse ¶
type CreatedBy ¶
type CreatedBy struct {
UserUID string `json:"user_uid"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
Email string `json:"email"`
ExternalLoginID string `json:"external_login_id"`
HomePhoneNumber string `json:"home_phone_number"`
Designation string `json:"designation"`
EmpCode string `json:"emp_code"`
Prefix string `json:"prefix"`
WorkPhoneNumber string `json:"work_phone_number"`
MobilePhoneNumber string `json:"mobile_phone_number"`
ProfilePicture string `json:"profile_picture"`
HourlyLaborCharge string `json:"hourly_labor_charge"`
IsActive bool `json:"is_active"`
IsDeleted bool `json:"is_deleted"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
CreateUser models.
type ErrorResponse ¶
type ErrorResponse interface {
Message() string
}
type PageOptions ¶
type Role ¶
type Role struct {
RoleUID string `json:"role_uid"`
RoleName string `json:"role_name"`
RoleKey string `json:"role_key"`
}
Role & Access Models.
type Team ¶
type Team struct {
TeamUID string `json:"team_uid"`
TeamName string `json:"team_name"`
TeamColor string `json:"team_color"`
TeamDescription string `json:"team_description"`
TeamTimezone string `json:"team_timezone"`
UserCount int `json:"user_count"`
IsActive bool `json:"is_active"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
CreatedBy CreatedBy `json:"created_by"`
}
Teams Models.
type TeamDetailsResponse ¶
type TeamsResponse ¶
type UnassignUserFromTeamRequest ¶
type UnassignUserFromTeamRequest struct {
TeamUID string `json:"team_uid"`
UserUID string `json:"user_uid"`
}
UnassignUserFromTeam models.
type UpdateUserAccessRoleRequest ¶
type UpdateUserAccessRoleRequest struct {
User struct {
AccessRole string `json:"access_role"`
} `json:"user"`
}
UpdateUserAccessRoleRequest models.
type UpdateUserRoleRequest ¶
type UpdateUserRoleRequest struct {
User struct {
RoleID int `json:"role_id"`
} `json:"user"`
}
type UpdateUserRoleResponse ¶
type UpdateUserRoleResponse struct {
Type string `json:"type"`
Message string `json:"message"`
Title string `json:"title,omitempty"`
}
UpdateUserRole models.
type UserDetailsResponse ¶
type UserPayload ¶
type UsersResponse ¶
type WorkHour ¶
type WorkHour struct {
Day string `json:"day"`
StartTime string `json:"start_time"`
EndTime string `json:"end_time"`
WorkMins int `json:"work_mins"`
TrackLocation bool `json:"track_location"`
IsEnabled string `json:"is_enabled"`
}
Create Users.
type ZuperError ¶
type ZuperError struct {
MessageError string `json:"message"`
Title string `json:"title"`
Type string `json:"type"`
}
Error Models.
func (*ZuperError) Message ¶
func (e *ZuperError) Message() string
Error implements the uhttp.ErrorResponse interface.
type ZuperUser ¶
type ZuperUser struct {
UserUID string `json:"user_uid"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
Email string `json:"email"`
Designation string `json:"designation"`
EmpCode string `json:"emp_code"`
IsActive bool `json:"is_active"`
IsDeleted bool `json:"is_deleted"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
Role *Role `json:"role"`
AccessRole *AccessRole `json:"access_role"`
}
Users Models.