api

package
v0.0.0-...-7cfe8d5 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package api provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.4.1 DO NOT EDIT.

Package api provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.4.1 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterHandlers

func RegisterHandlers(router gin.IRouter, si ServerInterface)

RegisterHandlers creates http.Handler with routing matching OpenAPI spec.

func RegisterHandlersWithOptions

func RegisterHandlersWithOptions(router gin.IRouter, si ServerInterface, options GinServerOptions)

RegisterHandlersWithOptions creates http.Handler with additional options

Types

type AvailabilityResult

type AvailabilityResult struct {
	AllAvailableSlots []TimeSlot          `json:"all_available_slots"`
	PartialSlots      []PartialSlotDetail `json:"partial_slots"`
}

func FindBestTimeSlots

func FindBestTimeSlots(matrix [][]int, dividedSlots []TimeSlot, users []int) AvailabilityResult

type CreateEventJSONRequestBody

type CreateEventJSONRequestBody = CreateEventRequest

CreateEventJSONRequestBody defines body for CreateEvent for application/json ContentType.

type CreateEventRequest

type CreateEventRequest struct {
	Duration         int         `json:"duration"`
	EndTime          []time.Time `json:"end_time"`
	EventDescription string      `json:"event_description"`
	EventName        string      `json:"event_name"`
	OrganizerId      int         `json:"organizer_id"`
	StartTime        []time.Time `json:"start_time"`
}

CreateEventRequest defines model for CreateEventRequest.

type CreateEventResponse

type CreateEventResponse struct {
	CreatedAt        *time.Time `json:"created_at,omitempty"`
	EventDescription string     `json:"event_description"`
	EventId          *int       `json:"event_id,omitempty"`
	EventName        string     `json:"event_name"`
	OrganizerId      int        `json:"organizer_id"`
}

CreateEventResponse defines model for CreateEventResponse.

type CreateTimeSlotUserJSONRequestBody

type CreateTimeSlotUserJSONRequestBody = CreateTimeSlotUserRequest

CreateTimeSlotUserJSONRequestBody defines body for CreateTimeSlotUser for application/json ContentType.

type CreateTimeSlotUserRequest

type CreateTimeSlotUserRequest struct {
	EndTime   []time.Time `json:"end_time"`
	StartTime []time.Time `json:"start_time"`
	UserId    int         `json:"user_id"`
}

CreateTimeSlotUserRequest defines model for CreateTimeSlotUserRequest.

type DeleteTimeSlotEventParams

type DeleteTimeSlotEventParams struct {
	Id      int `form:"id" json:"id"`
	EventId int `form:"event_id" json:"event_id"`
}

DeleteTimeSlotEventParams defines parameters for DeleteTimeSlotEvent.

type DeleteTimeSlotUserParams

type DeleteTimeSlotUserParams struct {
	Id     int `form:"id" json:"id"`
	UserId int `form:"user_id" json:"user_id"`
}

DeleteTimeSlotUserParams defines parameters for DeleteTimeSlotUser.

type Event

type Event = []struct {
	CreatedAt        *time.Time   `json:"created_at,omitempty"`
	Duration         *int         `json:"duration,omitempty"`
	EndTime          *[]time.Time `json:"end_time,omitempty"`
	EventDescription *string      `json:"event_description,omitempty"`
	EventId          *int         `json:"event_id,omitempty"`
	EventName        *string      `json:"event_name,omitempty"`
	OrganizerId      *int         `json:"organizer_id,omitempty"`
	StartTime        *[]time.Time `json:"start_time,omitempty"`
	UpdatedAt        *time.Time   `json:"updated_at,omitempty"`
}

Event defines model for Event.

type GinServerOptions

type GinServerOptions struct {
	BaseURL      string
	Middlewares  []MiddlewareFunc
	ErrorHandler func(*gin.Context, error, int)
}

GinServerOptions provides options for the Gin server.

type MiddlewareFunc

type MiddlewareFunc func(c *gin.Context)

type PartialSlotDetail

type PartialSlotDetail struct {
	Slot             TimeSlot `json:"slot"`
	UnavailableUsers []int    `json:"unavailable_users"`
}

type PostUsersJSONBody

type PostUsersJSONBody struct {
	Name *string `json:"name,omitempty"`
}

PostUsersJSONBody defines parameters for PostUsers.

type PostUsersJSONRequestBody

type PostUsersJSONRequestBody PostUsersJSONBody

PostUsersJSONRequestBody defines body for PostUsers for application/json ContentType.

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(store db.Store) *Server

func (Server) CreateEvent

func (server Server) CreateEvent(ctx *gin.Context)

(POST /events/)

func (Server) CreateTimeSlotUser

func (server Server) CreateTimeSlotUser(ctx *gin.Context)

(POST /time-slots/user)

func (Server) DeleteEvent

func (server Server) DeleteEvent(ctx *gin.Context, eventId int)

(DELETE /events/{event_id})

func (Server) DeleteTimeSlotEvent

func (server Server) DeleteTimeSlotEvent(ctx *gin.Context, params DeleteTimeSlotEventParams)

(DELETE /time-slots/event)

func (Server) DeleteTimeSlotUser

func (server Server) DeleteTimeSlotUser(ctx *gin.Context, params DeleteTimeSlotUserParams)

(DELETE /time-slots/user)

func (Server) GetEventByID

func (server Server) GetEventByID(ctx *gin.Context, eventId int)

(GET /events/{event_id})

func (Server) GetMatchingTimeSlotsForEvent

func (server Server) GetMatchingTimeSlotsForEvent(ctx *gin.Context, eventId int)

(GET /matching-slots/event/{event_id})

func (Server) GetTimeSlotsByEvent

func (server Server) GetTimeSlotsByEvent(ctx *gin.Context, eventId int)

(GET /time-slots/event)

func (Server) GetTimeSlotsByUser

func (server Server) GetTimeSlotsByUser(ctx *gin.Context, userId int)

(GET /time-slots/user)

func (Server) GetUsers

func (server Server) GetUsers(ctx *gin.Context)

(GET /users/)

func (Server) GetUsersId

func (server Server) GetUsersId(ctx *gin.Context, id int)

(GET /users/{id})

func (Server) ListEvents

func (server Server) ListEvents(ctx *gin.Context)

(GET /events/list)

func (Server) ListEventsByOrganizer

func (server Server) ListEventsByOrganizer(ctx *gin.Context, organizerId int)

(GET /events/organiser/{organiser_id}/)

func (Server) PostUsers

func (server Server) PostUsers(ctx *gin.Context)

(POST /users/)

func (Server) UpdateEvent

func (server Server) UpdateEvent(ctx *gin.Context, eventId int)

(PUT /events/{event_id})

func (Server) UpdateTimeSlotEvent

func (server Server) UpdateTimeSlotEvent(ctx *gin.Context)

(PUT /time-slots/event)

func (Server) UpdateTimeSlotUser

func (server Server) UpdateTimeSlotUser(ctx *gin.Context)

(PUT /time-slots/user)

type ServerInterface

type ServerInterface interface {
	// Create a new event
	// (POST /events)
	CreateEvent(c *gin.Context)
	// List all events
	// (GET /events/list)
	ListEvents(c *gin.Context)
	// List events by organizer
	// (GET /events/organizer/{organizer_id})
	ListEventsByOrganizer(c *gin.Context, organizerId int)
	// Delete an event
	// (DELETE /events/{event_id})
	DeleteEvent(c *gin.Context, eventId int)
	// Get an event by ID
	// (GET /events/{event_id})
	GetEventByID(c *gin.Context, eventId int)
	// Update an event's name, description and duration
	// (PUT /events/{event_id})
	UpdateEvent(c *gin.Context, eventId int)
	// Get matching time slots for event
	// (GET /matching-slots/event/{event_id})
	GetMatchingTimeSlotsForEvent(c *gin.Context, eventId int)
	// Delete an event time slot
	// (DELETE /time-slots/event)
	DeleteTimeSlotEvent(c *gin.Context, params DeleteTimeSlotEventParams)
	// Update an event time slot
	// (PUT /time-slots/event)
	UpdateTimeSlotEvent(c *gin.Context)
	// Get time slots by event
	// (GET /time-slots/event/{event_id})
	GetTimeSlotsByEvent(c *gin.Context, eventId int)
	// Delete a user time slot
	// (DELETE /time-slots/user)
	DeleteTimeSlotUser(c *gin.Context, params DeleteTimeSlotUserParams)
	// Create time slots for a user
	// (POST /time-slots/user)
	CreateTimeSlotUser(c *gin.Context)
	// Update a user time slot
	// (PUT /time-slots/user)
	UpdateTimeSlotUser(c *gin.Context)
	// Get time slots by user
	// (GET /time-slots/user/{user_id})
	GetTimeSlotsByUser(c *gin.Context, userId int)
	// List all users
	// (GET /users)
	GetUsers(c *gin.Context)
	// Create a new user
	// (POST /users)
	PostUsers(c *gin.Context)
	// Get a user by ID
	// (GET /users/{id})
	GetUsersId(c *gin.Context, id int)
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler            ServerInterface
	HandlerMiddlewares []MiddlewareFunc
	ErrorHandler       func(*gin.Context, error, int)
}

ServerInterfaceWrapper converts contexts to parameters.

func (*ServerInterfaceWrapper) CreateEvent

func (siw *ServerInterfaceWrapper) CreateEvent(c *gin.Context)

CreateEvent operation middleware

func (*ServerInterfaceWrapper) CreateTimeSlotUser

func (siw *ServerInterfaceWrapper) CreateTimeSlotUser(c *gin.Context)

CreateTimeSlotUser operation middleware

func (*ServerInterfaceWrapper) DeleteEvent

func (siw *ServerInterfaceWrapper) DeleteEvent(c *gin.Context)

DeleteEvent operation middleware

func (*ServerInterfaceWrapper) DeleteTimeSlotEvent

func (siw *ServerInterfaceWrapper) DeleteTimeSlotEvent(c *gin.Context)

DeleteTimeSlotEvent operation middleware

func (*ServerInterfaceWrapper) DeleteTimeSlotUser

func (siw *ServerInterfaceWrapper) DeleteTimeSlotUser(c *gin.Context)

DeleteTimeSlotUser operation middleware

func (*ServerInterfaceWrapper) GetEventByID

func (siw *ServerInterfaceWrapper) GetEventByID(c *gin.Context)

GetEventByID operation middleware

func (*ServerInterfaceWrapper) GetMatchingTimeSlotsForEvent

func (siw *ServerInterfaceWrapper) GetMatchingTimeSlotsForEvent(c *gin.Context)

GetMatchingTimeSlotsForEvent operation middleware

func (*ServerInterfaceWrapper) GetTimeSlotsByEvent

func (siw *ServerInterfaceWrapper) GetTimeSlotsByEvent(c *gin.Context)

GetTimeSlotsByEvent operation middleware

func (*ServerInterfaceWrapper) GetTimeSlotsByUser

func (siw *ServerInterfaceWrapper) GetTimeSlotsByUser(c *gin.Context)

GetTimeSlotsByUser operation middleware

func (*ServerInterfaceWrapper) GetUsers

func (siw *ServerInterfaceWrapper) GetUsers(c *gin.Context)

GetUsers operation middleware

func (*ServerInterfaceWrapper) GetUsersId

func (siw *ServerInterfaceWrapper) GetUsersId(c *gin.Context)

GetUsersId operation middleware

func (*ServerInterfaceWrapper) ListEvents

func (siw *ServerInterfaceWrapper) ListEvents(c *gin.Context)

ListEvents operation middleware

func (*ServerInterfaceWrapper) ListEventsByOrganizer

func (siw *ServerInterfaceWrapper) ListEventsByOrganizer(c *gin.Context)

ListEventsByOrganizer operation middleware

func (*ServerInterfaceWrapper) PostUsers

func (siw *ServerInterfaceWrapper) PostUsers(c *gin.Context)

PostUsers operation middleware

func (*ServerInterfaceWrapper) UpdateEvent

func (siw *ServerInterfaceWrapper) UpdateEvent(c *gin.Context)

UpdateEvent operation middleware

func (*ServerInterfaceWrapper) UpdateTimeSlotEvent

func (siw *ServerInterfaceWrapper) UpdateTimeSlotEvent(c *gin.Context)

UpdateTimeSlotEvent operation middleware

func (*ServerInterfaceWrapper) UpdateTimeSlotUser

func (siw *ServerInterfaceWrapper) UpdateTimeSlotUser(c *gin.Context)

UpdateTimeSlotUser operation middleware

type TimeSlot

type TimeSlot struct {
	Start time.Time
	End   time.Time
}

type TimeSlotUserResponse

type TimeSlotUserResponse struct {
	EndTime   *time.Time `json:"end_time,omitempty"`
	Id        *int       `json:"id,omitempty"`
	StartTime *time.Time `json:"start_time,omitempty"`
	UserId    *int       `json:"user_id,omitempty"`
}

TimeSlotUserResponse defines model for TimeSlotUserResponse.

type TimeSlotsEventResponse

type TimeSlotsEventResponse struct {
	EndTime   *time.Time `json:"end_time,omitempty"`
	EventId   *int       `json:"event_id,omitempty"`
	Id        *int       `json:"id,omitempty"`
	StartTime *time.Time `json:"start_time,omitempty"`
}

TimeSlotsEventResponse defines model for TimeSlotsEventResponse.

type TimeSlotsUser

type TimeSlotsUser struct {
	EndTime   time.Time `json:"end_time"`
	Id        int       `json:"id"`
	StartTime time.Time `json:"start_time"`
	UserId    int       `json:"user_id"`
}

TimeSlotsUser defines model for TimeSlotsUser.

type UpdateEventJSONRequestBody

type UpdateEventJSONRequestBody = UpdateEventResponse

UpdateEventJSONRequestBody defines body for UpdateEvent for application/json ContentType.

type UpdateEventResponse

type UpdateEventResponse struct {
	Duration         int    `json:"duration"`
	EventDescription string `json:"event_description"`
	EventName        string `json:"event_name"`
}

UpdateEventResponse defines model for UpdateEventResponse.

type UpdateTimeSlotEventJSONRequestBody

type UpdateTimeSlotEventJSONRequestBody = UpdateTimeSlotsEventRequest

UpdateTimeSlotEventJSONRequestBody defines body for UpdateTimeSlotEvent for application/json ContentType.

type UpdateTimeSlotUserJSONRequestBody

type UpdateTimeSlotUserJSONRequestBody = TimeSlotsUser

UpdateTimeSlotUserJSONRequestBody defines body for UpdateTimeSlotUser for application/json ContentType.

type UpdateTimeSlotsEventRequest

type UpdateTimeSlotsEventRequest struct {
	EndTime   time.Time `json:"end_time"`
	EventId   int       `json:"event_id"`
	Id        int       `json:"id"`
	StartTime time.Time `json:"start_time"`
}

UpdateTimeSlotsEventRequest defines model for UpdateTimeSlotsEventRequest.

type User

type User struct {
	CreatedAt time.Time `json:"created_at"`
	Name      string    `json:"name"`
	UserId    int       `json:"user_id"`
}

User defines model for User.

Jump to

Keyboard shortcuts

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