rest

package
v0.0.0-...-a5db094 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const BearerSchema = "Bearer "

Variables

This section is empty.

Functions

func AcceptInvitation

func AcceptInvitation(service services.ApplicationService) gin.HandlerFunc

AcceptInvitation godoc

@Summary		Accept invitaion.
@Description	Accept inviation to a project.
@Tags			ProjectRouter
@Accept			json
@Produce		json
@Failure		400	{object}	response.ErrInvalidRequest
@Failure		401	{object}	response.ErrUnauthorized
@Failure		500	{object}	response.ErrServerError
@Success		200	{object}	response.Response{}
@Router			/accept_invitation [post]

AcceptInvitation is used to accept an invitation

func CheckInitialLogin

func CheckInitialLogin(applicationService services.ApplicationService, userID string) (bool, error)

func CreateApiToken

func CreateApiToken(service services.ApplicationService) gin.HandlerFunc

CreateApiToken godoc

@Description	Creates a new api token for the user.
@Tags			UserRouter
@Accept			json
@Produce		json
@Failure		400	{object}	response.ErrInvalidRequest
@Failure		400	{object}	response.ErrUserNotFound
@Failure		500	{object}	response.ErrServerError
@Success		200	{object}	response.NewApiToken{}
@Router			/create_token [post]

CreateApiToken creates a new api token for the user

func CreateProject

func CreateProject(service services.ApplicationService) gin.HandlerFunc

CreateProject godoc

@Summary		Create project.
@Description	Create a new project.
@Tags			ProjectRouter
@Accept			json
@Produce		json
@Failure		500	{object}	response.ErrServerError
@Success		200	{object}	response.Response{}
@Router			/create_project [post]

func CreateUser

func CreateUser(service services.ApplicationService) gin.HandlerFunc

CreateUser godoc

@Description	Create new user.
@Tags			UserRouter
@Accept			json
@Produce		json
@Failure		400	{object}	response.ErrInvalidRequest
@Failure		401	{object}	response.ErrUnauthorized
@Failure		400	{object}	response.ErrInvalidEmail
@Failure		401	{object}	response.ErrStrictPasswordPolicyViolation
@Failure		401	{object}	response.ErrStrictUsernamePolicyViolation
@Failure		401	{object}	response.ErrUserExists
@Failure		500	{object}	response.ErrServerError
@Success		200	{object}	response.UserResponse{}
@Router			/create_user [post]

func DeclineInvitation

func DeclineInvitation(service services.ApplicationService) gin.HandlerFunc

DeclineInvitation godoc

@Summary		Decline invitation.
@Description	Deecline invitation to a project.
@Tags			ProjectRouter
@Accept			json
@Produce		json
@Failure		400	{object}	response.ErrInvalidRequest
@Failure		401	{object}	response.ErrUnauthorized
@Failure		500	{object}	response.ErrServerError
@Success		200	{object}	response.Response{}
@Router			/decline_invitation [post]

DeclineInvitation is used to decline an invitation

func DeleteApiToken

func DeleteApiToken(service services.ApplicationService) gin.HandlerFunc

DeleteApiToken godoc

@Description	Delete api token for the user.
@Tags			UserRouter
@Accept			json
@Produce		json
@Failure		400	{object}	response.ErrInvalidRequest
@Failure		500	{object}	response.ErrServerError
@Success		200	{object}	response.MessageResponse{}
@Router			/remove_token [post]

DeleteApiToken deletes the api token for the user

func DeleteProject

func DeleteProject(service services.ApplicationService) gin.HandlerFunc

DeleteProject godoc

@Description	Delete a project.
@Tags			ProjectRouter
@Accept			json
@Produce		json
@Failure		400	{object}	response.ErrProjectNotFound
@Failure		500	{object}	response.ErrServerError
@Success		200	{object}	response.Response{}
@Router			/delete_project/{project_id} [post]

DeleteProject is used to delete a project.

func DexCallback

func DexCallback(userService services.ApplicationService) gin.HandlerFunc

DexCallback godoc

@Description	DexRouter creates all the required routes for OAuth purposes. .
@Tags			DexRouter
@Accept			json
@Produce		json
@Failure		500	{object}	response.ErrServerError
@Success		200	{object}	response.Response{}
@Router			/dex/callback [get]

DexCallback is the handler that creates/logs in the user from Dex and provides JWT to frontend via a redirect

func DexLogin

func DexLogin() gin.HandlerFunc

DexLogin godoc

@Description	DexRouter creates all the required routes for OAuth purposes. .
@Tags			DexRouter
@Accept			json
@Produce		json
@Failure		500	{object}	response.ErrServerError
@Success		200	{object}	response.Response{}
@Router			/dex/login [get]

DexLogin handles and redirects to DexServer to proceed with OAuth

func FetchUsers

func FetchUsers(service services.ApplicationService) gin.HandlerFunc

FetchUsers godoc

@Description	Fetch users.
@Tags			UserRouter
@Accept			json
@Produce		json
@Failure		401	{object}	response.ErrUnauthorized
@Failure		500	{object}	response.ErrServerError
@Success		200	{object}	response.UserResponse{}
@Router			/users [get]

func GetActiveProjectMembers

func GetActiveProjectMembers(service services.ApplicationService) gin.HandlerFunc

GetActiveProjectMembers godoc

@Summary		Get active project members.
@Description	Return list of active project members.
@Tags			ProjectRouter
@Param			state	path	string	true	"State"
@Accept			json
@Produce		json
@Failure		500	{object}	response.ErrServerError
@Success		200	{object}	response.Response{}
@Router			/get_project_members/:project_id/:state [get]

func GetActiveProjectOwners

func GetActiveProjectOwners(service services.ApplicationService) gin.HandlerFunc

GetActiveProjectOwners godoc

@Summary		Get active project Owners.
@Description	Return list of active project owners.
@Tags			ProjectRouter
@Param			state	path	string	true	"State"
@Accept			json
@Produce		json
@Failure		500	{object}	response.ErrServerError
@Success		200	{object}	response.Response{}
@Router			/get_project_owners/:project_id/:state [get]

func GetApiTokens

func GetApiTokens(service services.ApplicationService) gin.HandlerFunc

GetApiTokens godoc

@Description	Returns all the api tokens for the user.
@Tags			UserRouter
@Accept			json
@Produce		json
@Failure		500	{object}	response.ErrServerError
@Success		200	{object}	response.ApiTokenResponse{}
@Router			/token/:uid [post]

GetApiTokens returns all the api tokens for the user

func GetCapabilities

func GetCapabilities() gin.HandlerFunc

GetCapabilities godoc

@Summary		Get capabilities of Auth Server.
@Description	Returns capabilities that can be leveraged by frontend services to toggle certain features.
@Tags			CapabilitiesRouter
@Accept			json
@Produce		json
@Failure		500	{object}	response.ErrServerError
@Success		200	{object}	response.CapabilitiesResponse{}
@Router			/capabilities [get]

func GetOwnerProjects

func GetOwnerProjects(service services.ApplicationService) gin.HandlerFunc

GetOwnerProjects godoc

@Summary		Get projects owner.
@Description	Return owner of projects.
@Tags			ProjectRouter
@Accept			json
@Produce		json
@Failure		400	{object}	response.ErrInvalidRequest
@Failure		401	{object}	response.ErrUnauthorized
@Failure		500	{object}	response.ErrServerError
@Success		200	{object}	response.Response{}
@Router			/get_owner_projects [get]

GetOwnerProjects returns an array of projects in which user is an owner

func GetProject

func GetProject(service services.ApplicationService) gin.HandlerFunc

GetProject queries the project with a given projectID from the database

func GetProjectRole

func GetProjectRole(service services.ApplicationService) gin.HandlerFunc

GetProjectRole godoc

@Summary		Get project Role.
@Description	Return role of a project.
@Tags			ProjectRouter
@Param			project_id	path	int	true	"Project ID"
@Accept			json
@Produce		json
@Failure		400	{object}	response.ErrProjectNotFound
@Failure		500	{object}	response.ErrServerError
@Success		200	{object}	response.Response{}
@Router			/get_project_role/:project_id [get]

GetProjectRole returns the role of a user in the project

func GetProjectStats

func GetProjectStats(service services.ApplicationService) gin.HandlerFunc

GetProjectStats godoc

@Summary		Get stats of a project.
@Description	Return stats of a project.
@Tags			ProjectRouter
@Accept			json
@Produce		json
@Failure		500	{object}	response.ErrServerError
@Success		200	{object}	response.Response{}
@Router			/get_projects_stats [get]

GetProjectStats is used to retrive stats related to projects in the DB

func GetProjectsByUserID

func GetProjectsByUserID(service services.ApplicationService) gin.HandlerFunc

GetProjectsByUserID godoc

@Summary		Get stats of a project.
@Description	Return stats of a project.
@Tags			ProjectRouter
@Accept			json
@Produce		json
@Failure		500	{object}	response.ErrServerError
@Success		200	{object}	response.Response{}
@Router			/list_projects [get]

GetProjectsByUserID queries the project with a given userID from the database and returns it in the appropriate format

func GetUser

func GetUser(service services.ApplicationService) gin.HandlerFunc

GetUser godoc

@Description	Get user.
@Tags			UserRouter
@Accept			json
@Produce		json
@Failure		400	{object}	response.ErrUserNotFound
@Success		200	{object}	response.UserResponse{}
@Router			/get_user/:uid [get]

GetUser returns the user that matches the uid passed in parameter

func GetUserWithProject

func GetUserWithProject(service services.ApplicationService) gin.HandlerFunc

GetUserWithProject returns user and project details based on username

func InviteUsers

func InviteUsers(service services.ApplicationService) gin.HandlerFunc

InviteUsers godoc

@Description	Invite users.
@Tags			UserRouter
@Accept			json
@Produce		json
@Failure		400	{object}	response.ErrInvalidRequest
@Failure		500	{object}	response.ErrServerError
@Success		200	{object}	response.UserResponse{}
@Router			/invite_users/:project_id [get]

func LeaveProject

func LeaveProject(service services.ApplicationService) gin.HandlerFunc

LeaveProject godoc

@Summary		Leave project.
@Description	Leave project.
@Tags			ProjectRouter
@Accept			json
@Produce		json
@Failure		400	{object}	response.ErrInvalidRequest
@Failure		401	{object}	response.ErrUnauthorized
@Failure		500	{object}	response.ErrServerError
@Success		200	{object}	response.Response{}
@Router			/leave_project [post]

LeaveProject is used to leave a project

func ListInvitations

func ListInvitations(service services.ApplicationService) gin.HandlerFunc

ListInvitations godoc

@Summary		List invitations.
@Description	Return list of invitations.
@Tags			ProjectRouter
@Param			invitation_state	path	string	true	"Invitation State"
@Accept			json
@Produce		json
@Failure		500	{object}	response.ErrServerError
@Success		200	{object}	response.Response{}
@Router			/list_invitations_with_filters/:invitation_state [get]

ListInvitations returns the Invitation status

func LoginUser

func LoginUser(service services.ApplicationService) gin.HandlerFunc

LoginUser godoc

@Description	User Login.
@Tags			UserRouter
@Accept			json
@Produce		json
@Failure		400	{object}	response.ErrInvalidRequest
@Failure		400	{object}	response.ErrUserNotFound
@Failure		400	{object}	response.ErrUserDeactivated
@Failure		401	{object}	response.ErrInvalidCredentials
@Failure		500	{object}	response.ErrServerError
@Success		200	{object}	response.LoginResponse{}
@Router			/login [post]

func LogoutUser

func LogoutUser(service services.ApplicationService) gin.HandlerFunc

LogoutUser godoc

@Description	Revokes the token passed in the Authorization header.
@Tags			UserRouter
@Accept			json
@Produce		json
@Failure		401	{object}	response.ErrUnauthorized
@Failure		500	{object}	response.ErrServerError
@Success		200	{object}	response.MessageResponse{}
@Router			/logout [post]

LogoutUser revokes the token passed in the Authorization header

func Readiness

func Readiness(service services.ApplicationService) gin.HandlerFunc

Readiness godoc

@Description	Return list of tags.
@Tags			MiscRouter
@Accept			json
@Produce		json
@Failure		500	{object}	response.ErrServerError
@Success		200	{object}	response.Response{}
@Router			/readiness [get]

func RemoveInvitation

func RemoveInvitation(service services.ApplicationService) gin.HandlerFunc

RemoveInvitation godoc

@Summary		Remove invitation.
@Description	Remove invitation of a project.
@Tags			ProjectRouter
@Accept			json
@Produce		json
@Failure		400	{object}	response.ErrInvalidRequest
@Failure		401	{object}	response.ErrUnauthorized
@Failure		500	{object}	response.ErrServerError
@Success		200	{obejct}	response.Response{}
@Router			/remove_invitation [post]

RemoveInvitation removes member or cancels invitation

func ResetPassword

func ResetPassword(service services.ApplicationService) gin.HandlerFunc

ResetPassword godoc

@Description	Reset user password.
@Tags			UserRouter
@Accept			json
@Produce		json
@Failure		401	{object}	response.ErrUnauthorized
@Failure		400	{object}	response.ErrInvalidRequest
@Failure		401	{object}	response.ErrStrictPasswordPolicyViolation
@Failure		500	{object}	response.ErrServerError
@Success		200	{object}	response.MessageResponse{}
@Router			/reset/password [post]

func SendInvitation

func SendInvitation(service services.ApplicationService) gin.HandlerFunc

SendInvitation godoc

@Summary		Send invitation.
@Description	Send invitation to a project.
@Tags			ProjectRouter
@Accept			json
@Produce		json
@Failure		400	{object}	response.ErrInvalidRequest
@Failure		401	{object}	response.ErrUnauthorized
@Failure		400	{object}	response.ErrInvalidRole
@Failure		400	{object}	response.ErrUserNotFound
@Failure		500	{object}	response.ErrServerError
@Success		200	{object}	response.Response{}
@Router			/send_invitation [post]

SendInvitation sends an invitation to a new user and returns an error if the member is already part of the project

func Status

Status godoc

@Description	Status will request users list and return, if successful, an http code 200.
@Tags			MiscRouter
@Accept			json
@Produce		json
@Failure		500	{object}	response.ErrServerError
@Success		200	{object}	response.Response{}
@Router			/status [get]

Status will request users list and return, if successful, an http code 200

func UpdateMemberRole

func UpdateMemberRole(service services.ApplicationService) gin.HandlerFunc

UpdateMemberRole godoc

@Summary		Update member role.
@Description	Return updated member role.
@Tags			ProjectRouter
@Accept			json
@Produce		json
@Failure		400	{object}	response.ErrInvalidRequest
@Failure		401	{object}	response.ErrUnauthorized
@Failure		500	{object}	response.ErrServerError
@Success		200	{object}	response.Response{}
@Router			/update_member_role [post]

UpdateMemberRole is used to update a member role in the project

func UpdatePassword

func UpdatePassword(service services.ApplicationService) gin.HandlerFunc

UpdatePassword godoc

@Description	Update user password.
@Tags			UserRouter
@Accept			json
@Produce		json
@Failure		400	{object}	response.ErrInvalidRequest
@Failure		401	{object}	response.ErrStrictPasswordPolicyViolation
@Failure		400	{object}	response.ErrOldPassword
@Failure		401	{object}	response.ErrInvalidCredentials
@Success		200	{object}	response.MessageResponse{}
@Router			/update/password [post]

func UpdateProjectName

func UpdateProjectName(service services.ApplicationService) gin.HandlerFunc

UpdateProjectName godoc

@Summary		Update project name.
@Description	Return updated project name.
@Tags			ProjectRouter
@Accept			json
@Produce		json
@Failure		400	{object}	response.ErrInvalidRequest
@Failure		401	{object}	response.ErrUnauthorized
@Failure		500	{object}	response.ErrServerError
@Success		200	{object}	response.Response{}
@Router			/update_project_name [post]

UpdateProjectName is used to update a project's name

func UpdateUser

func UpdateUser(service services.ApplicationService) gin.HandlerFunc

UpdateUser godoc

@Description	Update users details.
@Tags			UserRouter
@Accept			json
@Produce		json
@Failure		400	{object}	response.ErrInvalidRequest
@Failure		401	{object}	response.ErrStrictPasswordPolicyViolation
@Failure		401	{object}	response.ErrStrictUsernamePolicyViolation
@Failure		500	{object}	response.ErrServerError
@Success		200	{object}	response.MessageResponse{}
@Router			/update/details [post]

func UpdateUserState

func UpdateUserState(service services.ApplicationService) gin.HandlerFunc

UpdateUserState godoc

@Description	Updates the user state.
@Tags			UserRouter
@Accept			json
@Produce		json
@Failure		401	{object}	response.ErrUnauthorized
@Failure		400	{object}	response.ErrInvalidRequest
@Success		200	{object}	response.MessageResponse{}
@Router			/update/state [post]

Types

type ReadinessAPIStatus

type ReadinessAPIStatus struct {
	DataBase    string `json:"database"`
	Collections string `json:"collections"`
}

Jump to

Keyboard shortcuts

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