Documentation
¶
Index ¶
- func GetClientPrincipalData[Q any](ir *models.InvokeRequest[Q]) (string, string, error)
- func SwaggerBaseHandler(w http.ResponseWriter, r *http.Request)
- func SwaggerFileHandler(w http.ResponseWriter, r *http.Request)
- type Handler
- func (h *Handler) DeleteUserPrefs(w http.ResponseWriter, r *http.Request)
- func (h *Handler) GetCosmosClient() *azcosmos.Client
- func (h *Handler) GetGewoscoutDbClient() *azcosmos.DatabaseClient
- func (h *Handler) GetListingById(w http.ResponseWriter, r *http.Request)
- func (h *Handler) GetListings(w http.ResponseWriter, r *http.Request)
- func (h *Handler) GetListingsByCityContainerClient() *azcosmos.ContainerClient
- func (h *Handler) GetNotificationSettingsByCityContainerClient() *azcosmos.ContainerClient
- func (h *Handler) GetTelemetryClient() appinsights.TelemetryClient
- func (h *Handler) GetUserDataByUserIdContainerClient() *azcosmos.ContainerClient
- func (h *Handler) GetUserPrefs(w http.ResponseWriter, r *http.Request)
- func (h *Handler) HandleHealth(w http.ResponseWriter, r *http.Request)
- func (h *Handler) HandleNewListingResult(w http.ResponseWriter, r *http.Request)
- func (h *Handler) HandleNotification(w http.ResponseWriter, r *http.Request)
- func (h *Handler) HandleScraperResult(w http.ResponseWriter, r *http.Request)
- func (h *Handler) UpdateUserPrefs(w http.ResponseWriter, r *http.Request)
- type MockResponseWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetClientPrincipalData ¶
Checks that the user is marked as authenticated by the runtime and that the headers that are required are present. These headers include the client id and an email address of the user.
func SwaggerBaseHandler ¶
func SwaggerBaseHandler(w http.ResponseWriter, r *http.Request)
func SwaggerFileHandler ¶
func SwaggerFileHandler(w http.ResponseWriter, r *http.Request)
Types ¶
type Handler ¶
type Handler struct { ScraperResultSchema *gojsonschema.Schema // contains filtered or unexported fields }
func NewHandler ¶
func NewHandler() *Handler
func (*Handler) DeleteUserPrefs ¶
func (h *Handler) DeleteUserPrefs(w http.ResponseWriter, r *http.Request)
DeleteUserPrefs Handler function for /deleteUserPrefs, which deletes a user's notification preferences for a given city. @Summary Delete a user's notification preferences for a given city @Description Delete notification preferences of the user for the given city @Tags userPreferences @Param city path string true "The city the preferences relate to" @Success 200 {object} models.InvokeResponse "Successfully deleted notification settings" @Failure 404 {object} models.Error "Notification settings could not be deleted" @Failure 400 {object} models.Error "Bad request" @Router /users/preferences/{city} [put]
func (*Handler) GetCosmosClient ¶
func (*Handler) GetGewoscoutDbClient ¶
func (h *Handler) GetGewoscoutDbClient() *azcosmos.DatabaseClient
func (*Handler) GetListingById ¶
func (h *Handler) GetListingById(w http.ResponseWriter, r *http.Request)
GetListingById Handler function for /listingById, which returns a listing by its id and city. Neither the city nor the id are guaranteed to exist at this point. @Summary Get a listing by its id @Description Get a listing by its id @Tags listings @Accept json @Produce json @Param city path string true "The city for which to get the listing" @Param id path string true "The id of the listing" @Success 200 {object} models.Listing "Successfully found listing" @Failure 404 {object} models.Error "Listing not found" @Failure 400 {object} models.Error "Bad request" @Router /cities/{city}/listings/{id} [get]
func (*Handler) GetListings ¶
func (h *Handler) GetListings(w http.ResponseWriter, r *http.Request)
GetListings Handler function for /listings, which returns any listings within the partition defined by the city path param, which is guaranteed to exist at this point. @Summary Get listings for a city @Description Get listings for a city @Tags listings @Accept json @Produce json @Param city path string true "The city for which to get listings" @Param continuationToken query string false "The continuation token for pagination" @Param title query string false "Listing title to search for" @Param housingCooperative query string false "Name of the 'Genossenschaft'" @Param projectId query string false "Project ID for which to return listings" @Param postalCode query string false "Postal code(s) within which to look for listings" @Param roomCount query integer false "Exact room count to search for" @Param minRoomCount query integer false "Minimum number of rooms" @Param maxRoomCount query integer false "Maximum number of rooms" @Param minSqm query integer false "Minimum number of square meters" @Param maxSqm query integer false "Maximum number of square meters" @Param availableFrom query string false "Date from which the listing has to be available (latest date)" @Param minYearBuilt query integer false "Oldest allowed construction year" @Param maxYearBuilt query integer false "Most recent allowed construction year" @Param minHwgEnergyClass query string false "Worst acceptable HWG energy class" Enums(A++, A+, A, B, C, D, E, F) @Param minFgeeEnergyClass query string false "Worst acceptable fgEE energy class" Enums(A++, A+, A, B, C, D, E, F) @Param listingType query string false "Type of listing" Enums(rent, sale, both) @Param minRentPricePerMonth query integer false "Minimum rent per month" @Param maxRentPricePerMonth query integer false "Maximum rent per month" @Param minCooperativeShare query integer false "Minimum cooperative share" @Param maxCooperativeShare query integer false "Maximum cooperative share" @Param minSalePrice query integer false "Minimum sale price" @Param maxSalePrice query integer false "Maximum sale price" @Param sortBy query string false "Field to sort by" @Param sortType query string false "Whether to search ascending or descending" Enums(ASC, DESC) @Success 200 {object} models.GetListingsResponse @Failure 400 {object} models.Error @Failure 500 {object} models.Error @Router /cities/{city}/listings [get]
func (*Handler) GetListingsByCityContainerClient ¶
func (h *Handler) GetListingsByCityContainerClient() *azcosmos.ContainerClient
func (*Handler) GetNotificationSettingsByCityContainerClient ¶
func (h *Handler) GetNotificationSettingsByCityContainerClient() *azcosmos.ContainerClient
func (*Handler) GetTelemetryClient ¶
func (h *Handler) GetTelemetryClient() appinsights.TelemetryClient
func (*Handler) GetUserDataByUserIdContainerClient ¶
func (h *Handler) GetUserDataByUserIdContainerClient() *azcosmos.ContainerClient
func (*Handler) GetUserPrefs ¶
func (h *Handler) GetUserPrefs(w http.ResponseWriter, r *http.Request)
GetUserPrefs Handler function for /userPrefs, which gets a user's notification preferences. @Summary Get a user's notification preferences @Description Get notification preferences of the user with the given id @Tags userPreferences @Produce json @Success 200 {object} models.NotificationSettings @Failure 404 {object} models.Error "Notification settings could not be found" @Failure 400 {object} models.Error "Bad request" @Router /users/preferences [get]
func (*Handler) HandleHealth ¶
func (h *Handler) HandleHealth(w http.ResponseWriter, r *http.Request)
HandleHealth Handler function for /health, which returns a simple alive response @Summary Health check @Description Health check @Tags health @Accept json @Produce json @Success 200 {object} models.HealthResponse "Alive" @Router /health [get]
func (*Handler) HandleNewListingResult ¶
func (h *Handler) HandleNewListingResult(w http.ResponseWriter, r *http.Request)
func (*Handler) HandleNotification ¶
func (h *Handler) HandleNotification(w http.ResponseWriter, r *http.Request)
func (*Handler) HandleScraperResult ¶
func (h *Handler) HandleScraperResult(w http.ResponseWriter, r *http.Request)
func (*Handler) UpdateUserPrefs ¶
func (h *Handler) UpdateUserPrefs(w http.ResponseWriter, r *http.Request)
UpdateUserPrefs Handler function for /updateUserPrefs, which sets a user's notification preferences by either creating or updating them in the DB. Neither the city nor the id are guaranteed to exist at this point. @Summary Set (or update) a user's notification preferences @Description Update notification preferences of the user with the given id @Tags userPreferences @Accept json @Produce json @Param city path string true "The city the preferences relate to" @Param preferences body models.NotificationSettings true "The user's new preferences" @Success 200 {object} models.NotificationSettings "Successfully updates notification settings" @Failure 404 {object} models.Error "Notification settings could not be updated" @Failure 400 {object} models.Error "Bad request" @Router /users/preferences/{city} [put]
type MockResponseWriter ¶
MockResponseWriter captures the HTTP response data
func NewMockResponseWriter ¶
func NewMockResponseWriter() *MockResponseWriter
NewMockResponseWriter creates and initializes a new MockResponseWriter
func (*MockResponseWriter) Header ¶
func (m *MockResponseWriter) Header() http.Header
Header returns the header map that will be sent by WriteHeader
func (*MockResponseWriter) Write ¶
func (m *MockResponseWriter) Write(data []byte) (int, error)
Write writes the data to the buffer and satisfies the http.ResponseWriter interface
func (*MockResponseWriter) WriteHeader ¶
func (m *MockResponseWriter) WriteHeader(statusCode int)
WriteHeader stores the status code