openapi

package
v0.0.0-...-be3f9aa Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

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

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

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

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

Index

Constants

View Source
const (
	KeyScopes    = "key.Scopes"
	SecretScopes = "secret.Scopes"
)

Variables

View Source
var (
	NewStorePropertyRes = NewGetPropertyRes
)

Functions

func FromPhones

func FromPhones(in ...Phone) []entity.Phone

func Handler

func Handler(si ServerInterface) http.Handler

Handler creates http.Handler with routing matching OpenAPI spec.

func HandlerFromMux

func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler

HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.

func HandlerFromMuxWithBaseURL

func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler

func HandlerWithOptions

func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler

HandlerWithOptions creates http.Handler with additional options

Types

type AddPropertyJSONRequestBody

type AddPropertyJSONRequestBody = StorePropertyReq

AddPropertyJSONRequestBody defines body for AddProperty for application/json ContentType.

type AddTenantJSONRequestBody

type AddTenantJSONRequestBody = StoreTenantReq

AddTenantJSONRequestBody defines body for AddTenant for application/json ContentType.

type Address

type Address struct {
	City   string `json:"city"`
	State  string `json:"state"`
	Street string `json:"street"`
	Zip    string `json:"zip"`
}

Address defines model for Address.

func (*Address) ToProperty

func (x *Address) ToProperty() entity.Property

type ChiServerOptions

type ChiServerOptions struct {
	BaseURL          string
	BaseRouter       chi.Router
	Middlewares      []MiddlewareFunc
	ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}

type Date

type Date = types.Date

func ToDate

func ToDate(in schedule.Date) Date

type Error

type Error struct {
	Code    int32  `json:"code"`
	Message string `json:"message"`
	Type    string `json:"type"`
}

Error defines model for Error.

func (Error) Error

func (x Error) Error() string

type ErrorResponse

type ErrorResponse struct {
	Error Error `json:"error"`
}

ErrorResponse defines model for ErrorResponse.

type GetLeaseRes

type GetLeaseRes struct {
	Lease Lease `json:"lease"`
}

GetLeaseRes defines model for GetLeaseRes.

type GetPropertyRes

type GetPropertyRes struct {
	Property Property `json:"property"`
}

GetPropertyRes defines model for GetPropertyRes.

func NewGetPropertyRes

func NewGetPropertyRes(in entity.Property) GetPropertyRes

type GetTenantRes

type GetTenantRes struct {
	Tenant Tenant `json:"tenant"`
}

GetTenantRes defines model for GetTenantRes.

func NewGetTenantRes

func NewGetTenantRes(in entity.Tenant) GetTenantRes

type InvalidParamFormatError

type InvalidParamFormatError struct {
	ParamName string
	Err       error
}

func (*InvalidParamFormatError) Error

func (e *InvalidParamFormatError) Error() string

func (*InvalidParamFormatError) Unwrap

func (e *InvalidParamFormatError) Unwrap() error

type Lease

type Lease struct {
	// Currency will default to USD when empty
	Currency     string             `json:"currency"`
	Deposit      int                `json:"deposit"`
	EndDate      openapi_types.Date `json:"endDate"`
	Id           string             `json:"id"`
	PropertyID   string             `json:"propertyID"`
	RentAmount   *int               `json:"rentAmount,omitempty"`
	RentInterval LeaseRentInterval  `json:"rentInterval"`
	StartDate    openapi_types.Date `json:"startDate"`
	TenantIDs    *[]string          `json:"tenantIDs,omitempty"`
}

Lease defines model for Lease.

type LeaseList

type LeaseList struct {
	Leases []Lease `json:"leases"`
}

LeaseList defines model for LeaseList.

type LeasePropertyJSONRequestBody

type LeasePropertyJSONRequestBody = LeasePropertyReq

LeasePropertyJSONRequestBody defines body for LeaseProperty for application/json ContentType.

type LeasePropertyReq

type LeasePropertyReq struct {
	Lease MinLease `json:"lease"`
}

LeasePropertyReq defines model for LeasePropertyReq.

type LeaseRentInterval

type LeaseRentInterval string

LeaseRentInterval defines model for Lease.RentInterval.

const (
	LeaseRentIntervalDaily   LeaseRentInterval = "daily"
	LeaseRentIntervalMonthly LeaseRentInterval = "monthly"
	LeaseRentIntervalWeekly  LeaseRentInterval = "weekly"
)

Defines values for LeaseRentInterval.

type ListPropertiesParams

type ListPropertiesParams struct {
	// Search This will search the address for any substring.
	Search *string `form:"search,omitempty" json:"search,omitempty"`
}

ListPropertiesParams defines parameters for ListProperties.

func (*ListPropertiesParams) ToFilter

type ListPropertiesRes

type ListPropertiesRes struct {
	Filter     *PropertyFilter `json:"filter,omitempty"`
	Properties []Property      `json:"properties"`
}

ListPropertiesRes defines model for ListPropertiesRes.

func NewListPropertiesRes

func NewListPropertiesRes(in ...entity.Property) ListPropertiesRes

func (*ListPropertiesRes) ToProperties

func (x *ListPropertiesRes) ToProperties() []entity.Property

type MiddlewareFunc

type MiddlewareFunc func(http.Handler) http.Handler

type MinLease

type MinLease struct {
	// Currency will default to USD when empty
	Currency     string               `json:"currency"`
	Deposit      int                  `json:"deposit"`
	EndDate      openapi_types.Date   `json:"endDate"`
	PropertyID   string               `json:"propertyID"`
	RentAmount   *int                 `json:"rentAmount,omitempty"`
	RentInterval MinLeaseRentInterval `json:"rentInterval"`
	StartDate    openapi_types.Date   `json:"startDate"`
	TenantIDs    *[]string            `json:"tenantIDs,omitempty"`
}

MinLease defines model for MinLease.

type MinLeaseRentInterval

type MinLeaseRentInterval string

MinLeaseRentInterval defines model for MinLease.RentInterval.

const (
	MinLeaseRentIntervalDaily   MinLeaseRentInterval = "daily"
	MinLeaseRentIntervalMonthly MinLeaseRentInterval = "monthly"
	MinLeaseRentIntervalWeekly  MinLeaseRentInterval = "weekly"
)

Defines values for MinLeaseRentInterval.

type MinTenant

type MinTenant struct {
	DlNum    string             `json:"dlNum"`
	DlState  string             `json:"dlState"`
	Dob      openapi_types.Date `json:"dob"`
	FullName string             `json:"fullName"`
	Phones   []Phone            `json:"phones"`
}

MinTenant defines model for MinTenant.

func (*MinTenant) ToTenant

func (x *MinTenant) ToTenant() entity.Tenant

type Phone

type Phone struct {
	Desc   string `json:"desc"`
	Number string `json:"number"`
}

Phone defines model for Phone.

func ToPhones

func ToPhones(in ...entity.Phone) []Phone

type Property

type Property struct {
	City   string `json:"city"`
	Id     string `json:"id"`
	State  string `json:"state"`
	Street string `json:"street"`
	Zip    string `json:"zip"`
}

Property defines model for Property.

func ToProperty

func ToProperty(e entity.Property) *Property

func (*Property) GetID

func (x *Property) GetID() string

func (*Property) ToProperty

func (x *Property) ToProperty() entity.Property

type PropertyFilter

type PropertyFilter struct {
	Search *string `json:"search,omitempty"`
}

PropertyFilter defines model for PropertyFilter.

type RequiredHeaderError

type RequiredHeaderError struct {
	ParamName string
	Err       error
}

func (*RequiredHeaderError) Error

func (e *RequiredHeaderError) Error() string

func (*RequiredHeaderError) Unwrap

func (e *RequiredHeaderError) Unwrap() error

type RequiredParamError

type RequiredParamError struct {
	ParamName string
}

func (*RequiredParamError) Error

func (e *RequiredParamError) Error() string

type ServerInterface

type ServerInterface interface {
	// List leases
	// (GET /lease)
	ListLeases(w http.ResponseWriter, r *http.Request)
	// Lease property
	// (POST /lease)
	LeaseProperty(w http.ResponseWriter, r *http.Request)
	// Get Lease
	// (GET /lease/{leaseID})
	GetLease(w http.ResponseWriter, r *http.Request, leaseID string)
	// List properties
	// (GET /property)
	ListProperties(w http.ResponseWriter, r *http.Request, params ListPropertiesParams)
	// Add Property
	// (POST /property)
	AddProperty(w http.ResponseWriter, r *http.Request)
	// Deletes a property
	// (DELETE /property/{propertyID})
	DeleteProperty(w http.ResponseWriter, r *http.Request, propertyID string)
	// Find property by ID
	// (GET /property/{propertyID})
	GetPropertyById(w http.ResponseWriter, r *http.Request, propertyID string)
	// Store Property
	// (PUT /property/{propertyID})
	StoreProperty(w http.ResponseWriter, r *http.Request, propertyID string)
	// List Tenants
	// (GET /tenant)
	ListTenants(w http.ResponseWriter, r *http.Request)
	// Add Tenant
	// (POST /tenant)
	AddTenant(w http.ResponseWriter, r *http.Request)
	// Get Tenant
	// (GET /tenant/{tenantID})
	GetTenant(w http.ResponseWriter, r *http.Request, tenantID string)
	// Store Tenant
	// (PUT /tenant/{tenantID})
	StoreTenant(w http.ResponseWriter, r *http.Request, tenantID string)
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler            ServerInterface
	HandlerMiddlewares []MiddlewareFunc
	ErrorHandlerFunc   func(w http.ResponseWriter, r *http.Request, err error)
}

ServerInterfaceWrapper converts contexts to parameters.

func (*ServerInterfaceWrapper) AddProperty

func (siw *ServerInterfaceWrapper) AddProperty(w http.ResponseWriter, r *http.Request)

AddProperty operation middleware

func (*ServerInterfaceWrapper) AddTenant

func (siw *ServerInterfaceWrapper) AddTenant(w http.ResponseWriter, r *http.Request)

AddTenant operation middleware

func (*ServerInterfaceWrapper) DeleteProperty

func (siw *ServerInterfaceWrapper) DeleteProperty(w http.ResponseWriter, r *http.Request)

DeleteProperty operation middleware

func (*ServerInterfaceWrapper) GetLease

func (siw *ServerInterfaceWrapper) GetLease(w http.ResponseWriter, r *http.Request)

GetLease operation middleware

func (*ServerInterfaceWrapper) GetPropertyById

func (siw *ServerInterfaceWrapper) GetPropertyById(w http.ResponseWriter, r *http.Request)

GetPropertyById operation middleware

func (*ServerInterfaceWrapper) GetTenant

func (siw *ServerInterfaceWrapper) GetTenant(w http.ResponseWriter, r *http.Request)

GetTenant operation middleware

func (*ServerInterfaceWrapper) LeaseProperty

func (siw *ServerInterfaceWrapper) LeaseProperty(w http.ResponseWriter, r *http.Request)

LeaseProperty operation middleware

func (*ServerInterfaceWrapper) ListLeases

func (siw *ServerInterfaceWrapper) ListLeases(w http.ResponseWriter, r *http.Request)

ListLeases operation middleware

func (*ServerInterfaceWrapper) ListProperties

func (siw *ServerInterfaceWrapper) ListProperties(w http.ResponseWriter, r *http.Request)

ListProperties operation middleware

func (*ServerInterfaceWrapper) ListTenants

func (siw *ServerInterfaceWrapper) ListTenants(w http.ResponseWriter, r *http.Request)

ListTenants operation middleware

func (*ServerInterfaceWrapper) StoreProperty

func (siw *ServerInterfaceWrapper) StoreProperty(w http.ResponseWriter, r *http.Request)

StoreProperty operation middleware

func (*ServerInterfaceWrapper) StoreTenant

func (siw *ServerInterfaceWrapper) StoreTenant(w http.ResponseWriter, r *http.Request)

StoreTenant operation middleware

type StorePropertyJSONRequestBody

type StorePropertyJSONRequestBody = StorePropertyReq

StorePropertyJSONRequestBody defines body for StoreProperty for application/json ContentType.

type StorePropertyReq

type StorePropertyReq struct {
	Property Address `json:"property"`
}

StorePropertyReq defines model for StorePropertyReq.

func NewStorePropertyReq

func NewStorePropertyReq(p entity.Property) *StorePropertyReq

func (*StorePropertyReq) ToProperty

func (x *StorePropertyReq) ToProperty() entity.Property

type StorePropertyRes

type StorePropertyRes = GetPropertyRes

type StoreTenantJSONRequestBody

type StoreTenantJSONRequestBody = StoreTenantReq

StoreTenantJSONRequestBody defines body for StoreTenant for application/json ContentType.

type StoreTenantReq

type StoreTenantReq struct {
	Tenant MinTenant `json:"tenant"`
}

StoreTenantReq defines model for StoreTenantReq.

func NewStoreTenantReq

func NewStoreTenantReq(in entity.Tenant) *StoreTenantReq

func (*StoreTenantReq) JSON

func (x *StoreTenantReq) JSON() []byte

type StoreTenantRes

type StoreTenantRes = GetTenantRes

type Tenant

type Tenant struct {
	DlNum    string             `json:"dlNum"`
	DlState  string             `json:"dlState"`
	Dob      openapi_types.Date `json:"dob"`
	FullName string             `json:"fullName"`
	Id       string             `json:"id"`
	Phones   []Phone            `json:"phones"`
}

Tenant defines model for Tenant.

func ToTenant

func ToTenant(in entity.Tenant) *Tenant

func (*Tenant) GetID

func (x *Tenant) GetID() string

func (*Tenant) JSON

func (x *Tenant) JSON() []byte

func (*Tenant) ToTenant

func (x *Tenant) ToTenant() *entity.Tenant

type TenantList

type TenantList struct {
	Tenants []Tenant `json:"tenants"`
}

TenantList defines model for TenantList.

func ToTenantList

func ToTenantList(in ...entity.Tenant) TenantList

func (TenantList) ToTenantMap

func (x TenantList) ToTenantMap() map[entity.ID]entity.Tenant

func (TenantList) ToTenants

func (x TenantList) ToTenants() []entity.Tenant

type TooManyValuesForParamError

type TooManyValuesForParamError struct {
	ParamName string
	Count     int
}

func (*TooManyValuesForParamError) Error

type UnescapedCookieParamError

type UnescapedCookieParamError struct {
	ParamName string
	Err       error
}

func (*UnescapedCookieParamError) Error

func (e *UnescapedCookieParamError) Error() string

func (*UnescapedCookieParamError) Unwrap

func (e *UnescapedCookieParamError) Unwrap() error

type Unimplemented

type Unimplemented struct{}

func (Unimplemented) AddProperty

func (_ Unimplemented) AddProperty(w http.ResponseWriter, r *http.Request)

Add Property (POST /property)

func (Unimplemented) AddTenant

func (_ Unimplemented) AddTenant(w http.ResponseWriter, r *http.Request)

Add Tenant (POST /tenant)

func (Unimplemented) DeleteProperty

func (_ Unimplemented) DeleteProperty(w http.ResponseWriter, r *http.Request, propertyID string)

Deletes a property (DELETE /property/{propertyID})

func (Unimplemented) GetLease

func (_ Unimplemented) GetLease(w http.ResponseWriter, r *http.Request, leaseID string)

Get Lease (GET /lease/{leaseID})

func (Unimplemented) GetPropertyById

func (_ Unimplemented) GetPropertyById(w http.ResponseWriter, r *http.Request, propertyID string)

Find property by ID (GET /property/{propertyID})

func (Unimplemented) GetTenant

func (_ Unimplemented) GetTenant(w http.ResponseWriter, r *http.Request, tenantID string)

Get Tenant (GET /tenant/{tenantID})

func (Unimplemented) LeaseProperty

func (_ Unimplemented) LeaseProperty(w http.ResponseWriter, r *http.Request)

Lease property (POST /lease)

func (Unimplemented) ListLeases

func (_ Unimplemented) ListLeases(w http.ResponseWriter, r *http.Request)

List leases (GET /lease)

func (Unimplemented) ListProperties

func (_ Unimplemented) ListProperties(w http.ResponseWriter, r *http.Request, params ListPropertiesParams)

List properties (GET /property)

func (Unimplemented) ListTenants

func (_ Unimplemented) ListTenants(w http.ResponseWriter, r *http.Request)

List Tenants (GET /tenant)

func (Unimplemented) StoreProperty

func (_ Unimplemented) StoreProperty(w http.ResponseWriter, r *http.Request, propertyID string)

Store Property (PUT /property/{propertyID})

func (Unimplemented) StoreTenant

func (_ Unimplemented) StoreTenant(w http.ResponseWriter, r *http.Request, tenantID string)

Store Tenant (PUT /tenant/{tenantID})

type UnmarshalingParamError

type UnmarshalingParamError struct {
	ParamName string
	Err       error
}

func (*UnmarshalingParamError) Error

func (e *UnmarshalingParamError) Error() string

func (*UnmarshalingParamError) Unwrap

func (e *UnmarshalingParamError) Unwrap() error

Jump to

Keyboard shortcuts

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