2124 lines
69 KiB
Go
2124 lines
69 KiB
Go
|
|
// 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
|
|||
|
|
|
|||
|
|
import (
|
|||
|
|
"bytes"
|
|||
|
|
"compress/gzip"
|
|||
|
|
"context"
|
|||
|
|
"encoding/base64"
|
|||
|
|
"encoding/json"
|
|||
|
|
"fmt"
|
|||
|
|
"io"
|
|||
|
|
"net/http"
|
|||
|
|
"net/url"
|
|||
|
|
"path"
|
|||
|
|
"strings"
|
|||
|
|
"time"
|
|||
|
|
|
|||
|
|
"github.com/getkin/kin-openapi/openapi3"
|
|||
|
|
"github.com/gin-gonic/gin"
|
|||
|
|
"github.com/oapi-codegen/runtime"
|
|||
|
|
strictgin "github.com/oapi-codegen/runtime/strictmiddleware/gin"
|
|||
|
|
openapi_types "github.com/oapi-codegen/runtime/types"
|
|||
|
|
)
|
|||
|
|
|
|||
|
|
// Defines values for QuestionType.
|
|||
|
|
const (
|
|||
|
|
Boolean QuestionType = "boolean"
|
|||
|
|
Date QuestionType = "date"
|
|||
|
|
Number QuestionType = "number"
|
|||
|
|
Select QuestionType = "select"
|
|||
|
|
Text QuestionType = "text"
|
|||
|
|
)
|
|||
|
|
|
|||
|
|
// Defines values for SignatureType.
|
|||
|
|
const (
|
|||
|
|
Drawn SignatureType = "drawn"
|
|||
|
|
Image SignatureType = "image"
|
|||
|
|
)
|
|||
|
|
|
|||
|
|
// Defines values for UserIdType.
|
|||
|
|
const (
|
|||
|
|
Email UserIdType = "email"
|
|||
|
|
Guid UserIdType = "guid"
|
|||
|
|
Phone UserIdType = "phone"
|
|||
|
|
Username UserIdType = "username"
|
|||
|
|
)
|
|||
|
|
|
|||
|
|
// AccessCode defines model for AccessCode.
|
|||
|
|
type AccessCode struct {
|
|||
|
|
Code string `json:"code"`
|
|||
|
|
CreatedAt time.Time `json:"createdAt"`
|
|||
|
|
FormId openapi_types.UUID `json:"formId"`
|
|||
|
|
Id openapi_types.UUID `json:"id"`
|
|||
|
|
Used bool `json:"used"`
|
|||
|
|
UsedAt *time.Time `json:"usedAt,omitempty"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Answer defines model for Answer.
|
|||
|
|
type Answer struct {
|
|||
|
|
QuestionId openapi_types.UUID `json:"questionId"`
|
|||
|
|
|
|||
|
|
// Value Answer value. String, number, boolean or list of strings depending on the question type.
|
|||
|
|
Value interface{} `json:"value"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// AnswerRecord defines model for AnswerRecord.
|
|||
|
|
type AnswerRecord struct {
|
|||
|
|
QuestionId openapi_types.UUID `json:"questionId"`
|
|||
|
|
QuestionKey string `json:"questionKey"`
|
|||
|
|
|
|||
|
|
// Value The captured value
|
|||
|
|
Value interface{} `json:"value"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// ClientTracking Client supplied tracking details. IP and user agent are captured server-side.
|
|||
|
|
type ClientTracking struct {
|
|||
|
|
Locale *string `json:"locale,omitempty"`
|
|||
|
|
Place *string `json:"place,omitempty"`
|
|||
|
|
Referer *string `json:"referer,omitempty"`
|
|||
|
|
Timezone *string `json:"timezone,omitempty"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// CreateAccessCodesRequest defines model for CreateAccessCodesRequest.
|
|||
|
|
type CreateAccessCodesRequest struct {
|
|||
|
|
Count int `json:"count"`
|
|||
|
|
Prefix *string `json:"prefix,omitempty"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// CreateFormRequest defines model for CreateFormRequest.
|
|||
|
|
type CreateFormRequest struct {
|
|||
|
|
CompanyName *string `json:"companyName,omitempty"`
|
|||
|
|
ContactEmail *string `json:"contactEmail,omitempty"`
|
|||
|
|
ContactPhone *string `json:"contactPhone,omitempty"`
|
|||
|
|
ContactUrl *string `json:"contactUrl,omitempty"`
|
|||
|
|
Description *string `json:"description,omitempty"`
|
|||
|
|
ExternalReferenceLabel *string `json:"externalReferenceLabel,omitempty"`
|
|||
|
|
ExternalReferenceRequired *bool `json:"externalReferenceRequired,omitempty"`
|
|||
|
|
Introduction *string `json:"introduction,omitempty"`
|
|||
|
|
LogoUrl *string `json:"logoUrl,omitempty"`
|
|||
|
|
PdfUrl *string `json:"pdfUrl,omitempty"`
|
|||
|
|
Questions []QuestionInput `json:"questions"`
|
|||
|
|
RequiresAccessCode *bool `json:"requiresAccessCode,omitempty"`
|
|||
|
|
SignatureRequired *bool `json:"signatureRequired,omitempty"`
|
|||
|
|
Title string `json:"title"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Error defines model for Error.
|
|||
|
|
type Error struct {
|
|||
|
|
Code *string `json:"code,omitempty"`
|
|||
|
|
Error string `json:"error"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Form defines model for Form.
|
|||
|
|
type Form struct {
|
|||
|
|
CompanyName *string `json:"companyName,omitempty"`
|
|||
|
|
ContactEmail *string `json:"contactEmail,omitempty"`
|
|||
|
|
ContactPhone *string `json:"contactPhone,omitempty"`
|
|||
|
|
ContactUrl *string `json:"contactUrl,omitempty"`
|
|||
|
|
CreatedAt time.Time `json:"createdAt"`
|
|||
|
|
Description *string `json:"description,omitempty"`
|
|||
|
|
|
|||
|
|
// ExternalReferenceLabel Label shown for the external reference, for example Invoice number
|
|||
|
|
ExternalReferenceLabel *string `json:"externalReferenceLabel,omitempty"`
|
|||
|
|
|
|||
|
|
// ExternalReferenceRequired Whether a reference identifier is required before the form can be submitted
|
|||
|
|
ExternalReferenceRequired *bool `json:"externalReferenceRequired,omitempty"`
|
|||
|
|
FormGroupId openapi_types.UUID `json:"formGroupId"`
|
|||
|
|
Id openapi_types.UUID `json:"id"`
|
|||
|
|
|
|||
|
|
// Introduction Introduction section explaining purpose, background and support details
|
|||
|
|
Introduction *string `json:"introduction,omitempty"`
|
|||
|
|
IsActive bool `json:"isActive"`
|
|||
|
|
LogoUrl *string `json:"logoUrl,omitempty"`
|
|||
|
|
|
|||
|
|
// PdfUrl Optional absolute URL of a prebuilt PDF form linked to this definition
|
|||
|
|
PdfUrl *string `json:"pdfUrl,omitempty"`
|
|||
|
|
Questions []Question `json:"questions"`
|
|||
|
|
RequiresAccessCode bool `json:"requiresAccessCode"`
|
|||
|
|
|
|||
|
|
// SignatureRequired Whether a digital signature is captured at the end of the form
|
|||
|
|
SignatureRequired *bool `json:"signatureRequired,omitempty"`
|
|||
|
|
Title string `json:"title"`
|
|||
|
|
UpdatedAt time.Time `json:"updatedAt"`
|
|||
|
|
Version int `json:"version"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// FormSummary defines model for FormSummary.
|
|||
|
|
type FormSummary struct {
|
|||
|
|
CreatedAt time.Time `json:"createdAt"`
|
|||
|
|
Description *string `json:"description,omitempty"`
|
|||
|
|
|
|||
|
|
// ExternalReferenceLabel Label shown for the external reference, for example Invoice number
|
|||
|
|
ExternalReferenceLabel *string `json:"externalReferenceLabel,omitempty"`
|
|||
|
|
|
|||
|
|
// ExternalReferenceRequired Whether a reference identifier is required before the form can be submitted
|
|||
|
|
ExternalReferenceRequired *bool `json:"externalReferenceRequired,omitempty"`
|
|||
|
|
|
|||
|
|
// FormGroupId Groups all versions of the same logical form
|
|||
|
|
FormGroupId openapi_types.UUID `json:"formGroupId"`
|
|||
|
|
Id openapi_types.UUID `json:"id"`
|
|||
|
|
IsActive bool `json:"isActive"`
|
|||
|
|
LogoUrl *string `json:"logoUrl,omitempty"`
|
|||
|
|
|
|||
|
|
// PdfUrl Optional absolute URL of a prebuilt PDF form linked to this definition
|
|||
|
|
PdfUrl *string `json:"pdfUrl,omitempty"`
|
|||
|
|
QuestionCount int `json:"questionCount"`
|
|||
|
|
Title string `json:"title"`
|
|||
|
|
UpdatedAt time.Time `json:"updatedAt"`
|
|||
|
|
Version int `json:"version"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Health defines model for Health.
|
|||
|
|
type Health struct {
|
|||
|
|
Status string `json:"status"`
|
|||
|
|
UptimeSeconds *int64 `json:"uptimeSeconds,omitempty"`
|
|||
|
|
Version string `json:"version"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Question defines model for Question.
|
|||
|
|
type Question struct {
|
|||
|
|
Description *string `json:"description,omitempty"`
|
|||
|
|
Id openapi_types.UUID `json:"id"`
|
|||
|
|
|
|||
|
|
// Key Stable machine key for this question within the form
|
|||
|
|
Key string `json:"key"`
|
|||
|
|
|
|||
|
|
// Label The question text (may be multiline, no formatting directives)
|
|||
|
|
Label string `json:"label"`
|
|||
|
|
|
|||
|
|
// MaxValue Maximum allowed value for `number` questions
|
|||
|
|
MaxValue *float32 `json:"maxValue,omitempty"`
|
|||
|
|
|
|||
|
|
// MinValue Minimum allowed value for `number` questions
|
|||
|
|
MinValue *float32 `json:"minValue,omitempty"`
|
|||
|
|
|
|||
|
|
// Multiline Whether a `text` answer may span multiple lines
|
|||
|
|
Multiline *bool `json:"multiline,omitempty"`
|
|||
|
|
|
|||
|
|
// Options Present for `select` questions
|
|||
|
|
Options *[]QuestionOption `json:"options,omitempty"`
|
|||
|
|
Placeholder *string `json:"placeholder,omitempty"`
|
|||
|
|
Position int `json:"position"`
|
|||
|
|
Required bool `json:"required"`
|
|||
|
|
|
|||
|
|
// Type * `boolean` – true/false
|
|||
|
|
// * `number` – numeric answer
|
|||
|
|
// * `select` – one option from a configured list
|
|||
|
|
// * `text` – free-form text (single or multiline)
|
|||
|
|
// * `date` - calendar date in `YYYY-MM-DD` form
|
|||
|
|
Type QuestionType `json:"type"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// QuestionInput defines model for QuestionInput.
|
|||
|
|
type QuestionInput struct {
|
|||
|
|
Description *string `json:"description,omitempty"`
|
|||
|
|
Key string `json:"key"`
|
|||
|
|
Label string `json:"label"`
|
|||
|
|
MaxValue *float32 `json:"maxValue,omitempty"`
|
|||
|
|
MinValue *float32 `json:"minValue,omitempty"`
|
|||
|
|
Multiline *bool `json:"multiline,omitempty"`
|
|||
|
|
Options *[]QuestionOption `json:"options,omitempty"`
|
|||
|
|
Placeholder *string `json:"placeholder,omitempty"`
|
|||
|
|
Required bool `json:"required"`
|
|||
|
|
|
|||
|
|
// Type * `boolean` – true/false
|
|||
|
|
// * `number` – numeric answer
|
|||
|
|
// * `select` – one option from a configured list
|
|||
|
|
// * `text` – free-form text (single or multiline)
|
|||
|
|
// * `date` - calendar date in `YYYY-MM-DD` form
|
|||
|
|
Type QuestionType `json:"type"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// QuestionOption defines model for QuestionOption.
|
|||
|
|
type QuestionOption struct {
|
|||
|
|
Label string `json:"label"`
|
|||
|
|
Value string `json:"value"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// QuestionType * `boolean` – true/false
|
|||
|
|
// * `number` – numeric answer
|
|||
|
|
// * `select` – one option from a configured list
|
|||
|
|
// * `text` – free-form text (single or multiline)
|
|||
|
|
// * `date` - calendar date in `YYYY-MM-DD` form
|
|||
|
|
type QuestionType string
|
|||
|
|
|
|||
|
|
// Signature defines model for Signature.
|
|||
|
|
type Signature struct {
|
|||
|
|
DataUrl string `json:"dataUrl"`
|
|||
|
|
Name string `json:"name"`
|
|||
|
|
SignedAt time.Time `json:"signedAt"`
|
|||
|
|
Title *string `json:"title,omitempty"`
|
|||
|
|
|
|||
|
|
// Type * `drawn` - signature drawn in the browser
|
|||
|
|
// * `image` - uploaded image containing a signature
|
|||
|
|
Type SignatureType `json:"type"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// SignatureInput defines model for SignatureInput.
|
|||
|
|
type SignatureInput struct {
|
|||
|
|
// DataUrl PNG or JPEG image data URL (maximum decoded size 2 MB)
|
|||
|
|
DataUrl string `json:"dataUrl"`
|
|||
|
|
|
|||
|
|
// Name Name of the person signing
|
|||
|
|
Name string `json:"name"`
|
|||
|
|
|
|||
|
|
// Title Optional title of the person signing
|
|||
|
|
Title *string `json:"title,omitempty"`
|
|||
|
|
|
|||
|
|
// Type * `drawn` - signature drawn in the browser
|
|||
|
|
// * `image` - uploaded image containing a signature
|
|||
|
|
Type SignatureType `json:"type"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// SignatureType * `drawn` - signature drawn in the browser
|
|||
|
|
// * `image` - uploaded image containing a signature
|
|||
|
|
type SignatureType string
|
|||
|
|
|
|||
|
|
// Submission defines model for Submission.
|
|||
|
|
type Submission struct {
|
|||
|
|
Answers []AnswerRecord `json:"answers"`
|
|||
|
|
ExternalReference *string `json:"externalReference,omitempty"`
|
|||
|
|
FormId openapi_types.UUID `json:"formId"`
|
|||
|
|
FormVersion int `json:"formVersion"`
|
|||
|
|
Id openapi_types.UUID `json:"id"`
|
|||
|
|
|
|||
|
|
// OfflinePdfName Present when the respondent uploaded a completed offline PDF
|
|||
|
|
OfflinePdfName *string `json:"offlinePdfName,omitempty"`
|
|||
|
|
Signature *Signature `json:"signature,omitempty"`
|
|||
|
|
SubmittedAt time.Time `json:"submittedAt"`
|
|||
|
|
Tracking *Tracking `json:"tracking,omitempty"`
|
|||
|
|
UserId string `json:"userId"`
|
|||
|
|
UserIdType UserIdType `json:"userIdType"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// SubmissionSummary defines model for SubmissionSummary.
|
|||
|
|
type SubmissionSummary struct {
|
|||
|
|
ExternalReference *string `json:"externalReference,omitempty"`
|
|||
|
|
FormId openapi_types.UUID `json:"formId"`
|
|||
|
|
FormVersion int `json:"formVersion"`
|
|||
|
|
Id openapi_types.UUID `json:"id"`
|
|||
|
|
SubmittedAt time.Time `json:"submittedAt"`
|
|||
|
|
UserId string `json:"userId"`
|
|||
|
|
UserIdType UserIdType `json:"userIdType"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// SubmitFormRequest defines model for SubmitFormRequest.
|
|||
|
|
type SubmitFormRequest struct {
|
|||
|
|
// AccessCode Required when the form has `requiresAccessCode = true`
|
|||
|
|
AccessCode *string `json:"accessCode,omitempty"`
|
|||
|
|
Answers []Answer `json:"answers"`
|
|||
|
|
|
|||
|
|
// ExternalReference External reference identifier used to link this response to a record in
|
|||
|
|
// another system, for example an invoice, account or policy number.
|
|||
|
|
ExternalReference *string `json:"externalReference,omitempty"`
|
|||
|
|
|
|||
|
|
// OfflinePdf Base64 data URL of a PDF completed offline (for example
|
|||
|
|
// `data:application/pdf;base64,...`). Maximum decoded size is 10 MB.
|
|||
|
|
OfflinePdf *string `json:"offlinePdf,omitempty"`
|
|||
|
|
|
|||
|
|
// OfflinePdfName Original filename of the uploaded offline PDF
|
|||
|
|
OfflinePdfName *string `json:"offlinePdfName,omitempty"`
|
|||
|
|
Signature *SignatureInput `json:"signature,omitempty"`
|
|||
|
|
|
|||
|
|
// Tracking Client supplied tracking details. IP and user agent are captured server-side.
|
|||
|
|
Tracking *ClientTracking `json:"tracking,omitempty"`
|
|||
|
|
|
|||
|
|
// UserId Respondent identifier captured at the start (email, username, phone or GUID)
|
|||
|
|
UserId string `json:"userId"`
|
|||
|
|
UserIdType UserIdType `json:"userIdType"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Tracking defines model for Tracking.
|
|||
|
|
type Tracking struct {
|
|||
|
|
IpAddress *string `json:"ipAddress,omitempty"`
|
|||
|
|
Locale *string `json:"locale,omitempty"`
|
|||
|
|
Place *string `json:"place,omitempty"`
|
|||
|
|
Referer *string `json:"referer,omitempty"`
|
|||
|
|
Timezone *string `json:"timezone,omitempty"`
|
|||
|
|
UserAgent *string `json:"userAgent,omitempty"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// UpdateFormRequest defines model for UpdateFormRequest.
|
|||
|
|
type UpdateFormRequest struct {
|
|||
|
|
CompanyName *string `json:"companyName,omitempty"`
|
|||
|
|
ContactEmail *string `json:"contactEmail,omitempty"`
|
|||
|
|
ContactPhone *string `json:"contactPhone,omitempty"`
|
|||
|
|
ContactUrl *string `json:"contactUrl,omitempty"`
|
|||
|
|
Description *string `json:"description,omitempty"`
|
|||
|
|
ExternalReferenceLabel *string `json:"externalReferenceLabel,omitempty"`
|
|||
|
|
ExternalReferenceRequired *bool `json:"externalReferenceRequired,omitempty"`
|
|||
|
|
Introduction *string `json:"introduction,omitempty"`
|
|||
|
|
LogoUrl *string `json:"logoUrl,omitempty"`
|
|||
|
|
PdfUrl *string `json:"pdfUrl,omitempty"`
|
|||
|
|
Questions []QuestionInput `json:"questions"`
|
|||
|
|
RequiresAccessCode *bool `json:"requiresAccessCode,omitempty"`
|
|||
|
|
SignatureRequired *bool `json:"signatureRequired,omitempty"`
|
|||
|
|
Title string `json:"title"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// UserIdType defines model for UserIdType.
|
|||
|
|
type UserIdType string
|
|||
|
|
|
|||
|
|
// FormId defines model for FormId.
|
|||
|
|
type FormId = openapi_types.UUID
|
|||
|
|
|
|||
|
|
// ListFormsParams defines parameters for ListForms.
|
|||
|
|
type ListFormsParams struct {
|
|||
|
|
IncludeInactive *bool `form:"includeInactive,omitempty" json:"includeInactive,omitempty"`
|
|||
|
|
ActiveOnly *bool `form:"activeOnly,omitempty" json:"activeOnly,omitempty"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// CreateFormJSONRequestBody defines body for CreateForm for application/json ContentType.
|
|||
|
|
type CreateFormJSONRequestBody = CreateFormRequest
|
|||
|
|
|
|||
|
|
// UpdateFormJSONRequestBody defines body for UpdateForm for application/json ContentType.
|
|||
|
|
type UpdateFormJSONRequestBody = UpdateFormRequest
|
|||
|
|
|
|||
|
|
// CreateAccessCodesJSONRequestBody defines body for CreateAccessCodes for application/json ContentType.
|
|||
|
|
type CreateAccessCodesJSONRequestBody = CreateAccessCodesRequest
|
|||
|
|
|
|||
|
|
// SubmitFormJSONRequestBody defines body for SubmitForm for application/json ContentType.
|
|||
|
|
type SubmitFormJSONRequestBody = SubmitFormRequest
|
|||
|
|
|
|||
|
|
// ServerInterface represents all server handlers.
|
|||
|
|
type ServerInterface interface {
|
|||
|
|
// List forms
|
|||
|
|
// (GET /forms)
|
|||
|
|
ListForms(c *gin.Context, params ListFormsParams)
|
|||
|
|
// Create a form
|
|||
|
|
// (POST /forms)
|
|||
|
|
CreateForm(c *gin.Context)
|
|||
|
|
// Delete a form definition
|
|||
|
|
// (DELETE /forms/{formId})
|
|||
|
|
DeleteForm(c *gin.Context, formId FormId)
|
|||
|
|
// Get a form by id
|
|||
|
|
// (GET /forms/{formId})
|
|||
|
|
GetForm(c *gin.Context, formId FormId)
|
|||
|
|
// Update a form definition
|
|||
|
|
// (PUT /forms/{formId})
|
|||
|
|
UpdateForm(c *gin.Context, formId FormId)
|
|||
|
|
// List access codes for a form
|
|||
|
|
// (GET /forms/{formId}/access-codes)
|
|||
|
|
ListAccessCodes(c *gin.Context, formId FormId)
|
|||
|
|
// Create one or more access codes for a form
|
|||
|
|
// (POST /forms/{formId}/access-codes)
|
|||
|
|
CreateAccessCodes(c *gin.Context, formId FormId)
|
|||
|
|
// Activate a form
|
|||
|
|
// (POST /forms/{formId}/activate)
|
|||
|
|
ActivateForm(c *gin.Context, formId FormId)
|
|||
|
|
// Inactivate a form
|
|||
|
|
// (POST /forms/{formId}/inactivate)
|
|||
|
|
InactivateForm(c *gin.Context, formId FormId)
|
|||
|
|
// Download a PDF rendering of the form definition
|
|||
|
|
// (GET /forms/{formId}/pdf)
|
|||
|
|
GetFormPdf(c *gin.Context, formId FormId)
|
|||
|
|
// List submissions for a form (management)
|
|||
|
|
// (GET /forms/{formId}/submissions)
|
|||
|
|
ListFormSubmissions(c *gin.Context, formId FormId)
|
|||
|
|
// Submit an answer set for a form
|
|||
|
|
// (POST /forms/{formId}/submissions)
|
|||
|
|
SubmitForm(c *gin.Context, formId FormId)
|
|||
|
|
// Create a new version of a form
|
|||
|
|
// (POST /forms/{formId}/versions)
|
|||
|
|
CreateFormVersion(c *gin.Context, formId FormId)
|
|||
|
|
// Service health
|
|||
|
|
// (GET /health)
|
|||
|
|
GetHealth(c *gin.Context)
|
|||
|
|
// Get a submission by id (management)
|
|||
|
|
// (GET /submissions/{submissionId})
|
|||
|
|
GetSubmission(c *gin.Context, submissionId openapi_types.UUID)
|
|||
|
|
// Download the offline PDF uploaded with a submission
|
|||
|
|
// (GET /submissions/{submissionId}/offline-pdf)
|
|||
|
|
GetSubmissionOfflinePdf(c *gin.Context, submissionId openapi_types.UUID)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// ServerInterfaceWrapper converts contexts to parameters.
|
|||
|
|
type ServerInterfaceWrapper struct {
|
|||
|
|
Handler ServerInterface
|
|||
|
|
HandlerMiddlewares []MiddlewareFunc
|
|||
|
|
ErrorHandler func(*gin.Context, error, int)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type MiddlewareFunc func(c *gin.Context)
|
|||
|
|
|
|||
|
|
// ListForms operation middleware
|
|||
|
|
func (siw *ServerInterfaceWrapper) ListForms(c *gin.Context) {
|
|||
|
|
|
|||
|
|
var err error
|
|||
|
|
|
|||
|
|
// Parameter object where we will unmarshal all parameters from the context
|
|||
|
|
var params ListFormsParams
|
|||
|
|
|
|||
|
|
// ------------- Optional query parameter "includeInactive" -------------
|
|||
|
|
|
|||
|
|
err = runtime.BindQueryParameter("form", true, false, "includeInactive", c.Request.URL.Query(), ¶ms.IncludeInactive)
|
|||
|
|
if err != nil {
|
|||
|
|
siw.ErrorHandler(c, fmt.Errorf("Invalid format for parameter includeInactive: %w", err), http.StatusBadRequest)
|
|||
|
|
return
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// ------------- Optional query parameter "activeOnly" -------------
|
|||
|
|
|
|||
|
|
err = runtime.BindQueryParameter("form", true, false, "activeOnly", c.Request.URL.Query(), ¶ms.ActiveOnly)
|
|||
|
|
if err != nil {
|
|||
|
|
siw.ErrorHandler(c, fmt.Errorf("Invalid format for parameter activeOnly: %w", err), http.StatusBadRequest)
|
|||
|
|
return
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|||
|
|
middleware(c)
|
|||
|
|
if c.IsAborted() {
|
|||
|
|
return
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
siw.Handler.ListForms(c, params)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// CreateForm operation middleware
|
|||
|
|
func (siw *ServerInterfaceWrapper) CreateForm(c *gin.Context) {
|
|||
|
|
|
|||
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|||
|
|
middleware(c)
|
|||
|
|
if c.IsAborted() {
|
|||
|
|
return
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
siw.Handler.CreateForm(c)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// DeleteForm operation middleware
|
|||
|
|
func (siw *ServerInterfaceWrapper) DeleteForm(c *gin.Context) {
|
|||
|
|
|
|||
|
|
var err error
|
|||
|
|
|
|||
|
|
// ------------- Path parameter "formId" -------------
|
|||
|
|
var formId FormId
|
|||
|
|
|
|||
|
|
err = runtime.BindStyledParameterWithOptions("simple", "formId", c.Param("formId"), &formId, runtime.BindStyledParameterOptions{Explode: false, Required: true})
|
|||
|
|
if err != nil {
|
|||
|
|
siw.ErrorHandler(c, fmt.Errorf("Invalid format for parameter formId: %w", err), http.StatusBadRequest)
|
|||
|
|
return
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|||
|
|
middleware(c)
|
|||
|
|
if c.IsAborted() {
|
|||
|
|
return
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
siw.Handler.DeleteForm(c, formId)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// GetForm operation middleware
|
|||
|
|
func (siw *ServerInterfaceWrapper) GetForm(c *gin.Context) {
|
|||
|
|
|
|||
|
|
var err error
|
|||
|
|
|
|||
|
|
// ------------- Path parameter "formId" -------------
|
|||
|
|
var formId FormId
|
|||
|
|
|
|||
|
|
err = runtime.BindStyledParameterWithOptions("simple", "formId", c.Param("formId"), &formId, runtime.BindStyledParameterOptions{Explode: false, Required: true})
|
|||
|
|
if err != nil {
|
|||
|
|
siw.ErrorHandler(c, fmt.Errorf("Invalid format for parameter formId: %w", err), http.StatusBadRequest)
|
|||
|
|
return
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|||
|
|
middleware(c)
|
|||
|
|
if c.IsAborted() {
|
|||
|
|
return
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
siw.Handler.GetForm(c, formId)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// UpdateForm operation middleware
|
|||
|
|
func (siw *ServerInterfaceWrapper) UpdateForm(c *gin.Context) {
|
|||
|
|
|
|||
|
|
var err error
|
|||
|
|
|
|||
|
|
// ------------- Path parameter "formId" -------------
|
|||
|
|
var formId FormId
|
|||
|
|
|
|||
|
|
err = runtime.BindStyledParameterWithOptions("simple", "formId", c.Param("formId"), &formId, runtime.BindStyledParameterOptions{Explode: false, Required: true})
|
|||
|
|
if err != nil {
|
|||
|
|
siw.ErrorHandler(c, fmt.Errorf("Invalid format for parameter formId: %w", err), http.StatusBadRequest)
|
|||
|
|
return
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|||
|
|
middleware(c)
|
|||
|
|
if c.IsAborted() {
|
|||
|
|
return
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
siw.Handler.UpdateForm(c, formId)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// ListAccessCodes operation middleware
|
|||
|
|
func (siw *ServerInterfaceWrapper) ListAccessCodes(c *gin.Context) {
|
|||
|
|
|
|||
|
|
var err error
|
|||
|
|
|
|||
|
|
// ------------- Path parameter "formId" -------------
|
|||
|
|
var formId FormId
|
|||
|
|
|
|||
|
|
err = runtime.BindStyledParameterWithOptions("simple", "formId", c.Param("formId"), &formId, runtime.BindStyledParameterOptions{Explode: false, Required: true})
|
|||
|
|
if err != nil {
|
|||
|
|
siw.ErrorHandler(c, fmt.Errorf("Invalid format for parameter formId: %w", err), http.StatusBadRequest)
|
|||
|
|
return
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|||
|
|
middleware(c)
|
|||
|
|
if c.IsAborted() {
|
|||
|
|
return
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
siw.Handler.ListAccessCodes(c, formId)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// CreateAccessCodes operation middleware
|
|||
|
|
func (siw *ServerInterfaceWrapper) CreateAccessCodes(c *gin.Context) {
|
|||
|
|
|
|||
|
|
var err error
|
|||
|
|
|
|||
|
|
// ------------- Path parameter "formId" -------------
|
|||
|
|
var formId FormId
|
|||
|
|
|
|||
|
|
err = runtime.BindStyledParameterWithOptions("simple", "formId", c.Param("formId"), &formId, runtime.BindStyledParameterOptions{Explode: false, Required: true})
|
|||
|
|
if err != nil {
|
|||
|
|
siw.ErrorHandler(c, fmt.Errorf("Invalid format for parameter formId: %w", err), http.StatusBadRequest)
|
|||
|
|
return
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|||
|
|
middleware(c)
|
|||
|
|
if c.IsAborted() {
|
|||
|
|
return
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
siw.Handler.CreateAccessCodes(c, formId)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// ActivateForm operation middleware
|
|||
|
|
func (siw *ServerInterfaceWrapper) ActivateForm(c *gin.Context) {
|
|||
|
|
|
|||
|
|
var err error
|
|||
|
|
|
|||
|
|
// ------------- Path parameter "formId" -------------
|
|||
|
|
var formId FormId
|
|||
|
|
|
|||
|
|
err = runtime.BindStyledParameterWithOptions("simple", "formId", c.Param("formId"), &formId, runtime.BindStyledParameterOptions{Explode: false, Required: true})
|
|||
|
|
if err != nil {
|
|||
|
|
siw.ErrorHandler(c, fmt.Errorf("Invalid format for parameter formId: %w", err), http.StatusBadRequest)
|
|||
|
|
return
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|||
|
|
middleware(c)
|
|||
|
|
if c.IsAborted() {
|
|||
|
|
return
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
siw.Handler.ActivateForm(c, formId)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// InactivateForm operation middleware
|
|||
|
|
func (siw *ServerInterfaceWrapper) InactivateForm(c *gin.Context) {
|
|||
|
|
|
|||
|
|
var err error
|
|||
|
|
|
|||
|
|
// ------------- Path parameter "formId" -------------
|
|||
|
|
var formId FormId
|
|||
|
|
|
|||
|
|
err = runtime.BindStyledParameterWithOptions("simple", "formId", c.Param("formId"), &formId, runtime.BindStyledParameterOptions{Explode: false, Required: true})
|
|||
|
|
if err != nil {
|
|||
|
|
siw.ErrorHandler(c, fmt.Errorf("Invalid format for parameter formId: %w", err), http.StatusBadRequest)
|
|||
|
|
return
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|||
|
|
middleware(c)
|
|||
|
|
if c.IsAborted() {
|
|||
|
|
return
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
siw.Handler.InactivateForm(c, formId)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// GetFormPdf operation middleware
|
|||
|
|
func (siw *ServerInterfaceWrapper) GetFormPdf(c *gin.Context) {
|
|||
|
|
|
|||
|
|
var err error
|
|||
|
|
|
|||
|
|
// ------------- Path parameter "formId" -------------
|
|||
|
|
var formId FormId
|
|||
|
|
|
|||
|
|
err = runtime.BindStyledParameterWithOptions("simple", "formId", c.Param("formId"), &formId, runtime.BindStyledParameterOptions{Explode: false, Required: true})
|
|||
|
|
if err != nil {
|
|||
|
|
siw.ErrorHandler(c, fmt.Errorf("Invalid format for parameter formId: %w", err), http.StatusBadRequest)
|
|||
|
|
return
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|||
|
|
middleware(c)
|
|||
|
|
if c.IsAborted() {
|
|||
|
|
return
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
siw.Handler.GetFormPdf(c, formId)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// ListFormSubmissions operation middleware
|
|||
|
|
func (siw *ServerInterfaceWrapper) ListFormSubmissions(c *gin.Context) {
|
|||
|
|
|
|||
|
|
var err error
|
|||
|
|
|
|||
|
|
// ------------- Path parameter "formId" -------------
|
|||
|
|
var formId FormId
|
|||
|
|
|
|||
|
|
err = runtime.BindStyledParameterWithOptions("simple", "formId", c.Param("formId"), &formId, runtime.BindStyledParameterOptions{Explode: false, Required: true})
|
|||
|
|
if err != nil {
|
|||
|
|
siw.ErrorHandler(c, fmt.Errorf("Invalid format for parameter formId: %w", err), http.StatusBadRequest)
|
|||
|
|
return
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|||
|
|
middleware(c)
|
|||
|
|
if c.IsAborted() {
|
|||
|
|
return
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
siw.Handler.ListFormSubmissions(c, formId)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// SubmitForm operation middleware
|
|||
|
|
func (siw *ServerInterfaceWrapper) SubmitForm(c *gin.Context) {
|
|||
|
|
|
|||
|
|
var err error
|
|||
|
|
|
|||
|
|
// ------------- Path parameter "formId" -------------
|
|||
|
|
var formId FormId
|
|||
|
|
|
|||
|
|
err = runtime.BindStyledParameterWithOptions("simple", "formId", c.Param("formId"), &formId, runtime.BindStyledParameterOptions{Explode: false, Required: true})
|
|||
|
|
if err != nil {
|
|||
|
|
siw.ErrorHandler(c, fmt.Errorf("Invalid format for parameter formId: %w", err), http.StatusBadRequest)
|
|||
|
|
return
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|||
|
|
middleware(c)
|
|||
|
|
if c.IsAborted() {
|
|||
|
|
return
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
siw.Handler.SubmitForm(c, formId)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// CreateFormVersion operation middleware
|
|||
|
|
func (siw *ServerInterfaceWrapper) CreateFormVersion(c *gin.Context) {
|
|||
|
|
|
|||
|
|
var err error
|
|||
|
|
|
|||
|
|
// ------------- Path parameter "formId" -------------
|
|||
|
|
var formId FormId
|
|||
|
|
|
|||
|
|
err = runtime.BindStyledParameterWithOptions("simple", "formId", c.Param("formId"), &formId, runtime.BindStyledParameterOptions{Explode: false, Required: true})
|
|||
|
|
if err != nil {
|
|||
|
|
siw.ErrorHandler(c, fmt.Errorf("Invalid format for parameter formId: %w", err), http.StatusBadRequest)
|
|||
|
|
return
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|||
|
|
middleware(c)
|
|||
|
|
if c.IsAborted() {
|
|||
|
|
return
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
siw.Handler.CreateFormVersion(c, formId)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// GetHealth operation middleware
|
|||
|
|
func (siw *ServerInterfaceWrapper) GetHealth(c *gin.Context) {
|
|||
|
|
|
|||
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|||
|
|
middleware(c)
|
|||
|
|
if c.IsAborted() {
|
|||
|
|
return
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
siw.Handler.GetHealth(c)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// GetSubmission operation middleware
|
|||
|
|
func (siw *ServerInterfaceWrapper) GetSubmission(c *gin.Context) {
|
|||
|
|
|
|||
|
|
var err error
|
|||
|
|
|
|||
|
|
// ------------- Path parameter "submissionId" -------------
|
|||
|
|
var submissionId openapi_types.UUID
|
|||
|
|
|
|||
|
|
err = runtime.BindStyledParameterWithOptions("simple", "submissionId", c.Param("submissionId"), &submissionId, runtime.BindStyledParameterOptions{Explode: false, Required: true})
|
|||
|
|
if err != nil {
|
|||
|
|
siw.ErrorHandler(c, fmt.Errorf("Invalid format for parameter submissionId: %w", err), http.StatusBadRequest)
|
|||
|
|
return
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|||
|
|
middleware(c)
|
|||
|
|
if c.IsAborted() {
|
|||
|
|
return
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
siw.Handler.GetSubmission(c, submissionId)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// GetSubmissionOfflinePdf operation middleware
|
|||
|
|
func (siw *ServerInterfaceWrapper) GetSubmissionOfflinePdf(c *gin.Context) {
|
|||
|
|
|
|||
|
|
var err error
|
|||
|
|
|
|||
|
|
// ------------- Path parameter "submissionId" -------------
|
|||
|
|
var submissionId openapi_types.UUID
|
|||
|
|
|
|||
|
|
err = runtime.BindStyledParameterWithOptions("simple", "submissionId", c.Param("submissionId"), &submissionId, runtime.BindStyledParameterOptions{Explode: false, Required: true})
|
|||
|
|
if err != nil {
|
|||
|
|
siw.ErrorHandler(c, fmt.Errorf("Invalid format for parameter submissionId: %w", err), http.StatusBadRequest)
|
|||
|
|
return
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
for _, middleware := range siw.HandlerMiddlewares {
|
|||
|
|
middleware(c)
|
|||
|
|
if c.IsAborted() {
|
|||
|
|
return
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
siw.Handler.GetSubmissionOfflinePdf(c, submissionId)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// GinServerOptions provides options for the Gin server.
|
|||
|
|
type GinServerOptions struct {
|
|||
|
|
BaseURL string
|
|||
|
|
Middlewares []MiddlewareFunc
|
|||
|
|
ErrorHandler func(*gin.Context, error, int)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// RegisterHandlers creates http.Handler with routing matching OpenAPI spec.
|
|||
|
|
func RegisterHandlers(router gin.IRouter, si ServerInterface) {
|
|||
|
|
RegisterHandlersWithOptions(router, si, GinServerOptions{})
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// RegisterHandlersWithOptions creates http.Handler with additional options
|
|||
|
|
func RegisterHandlersWithOptions(router gin.IRouter, si ServerInterface, options GinServerOptions) {
|
|||
|
|
errorHandler := options.ErrorHandler
|
|||
|
|
if errorHandler == nil {
|
|||
|
|
errorHandler = func(c *gin.Context, err error, statusCode int) {
|
|||
|
|
c.JSON(statusCode, gin.H{"msg": err.Error()})
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
wrapper := ServerInterfaceWrapper{
|
|||
|
|
Handler: si,
|
|||
|
|
HandlerMiddlewares: options.Middlewares,
|
|||
|
|
ErrorHandler: errorHandler,
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
router.GET(options.BaseURL+"/forms", wrapper.ListForms)
|
|||
|
|
router.POST(options.BaseURL+"/forms", wrapper.CreateForm)
|
|||
|
|
router.DELETE(options.BaseURL+"/forms/:formId", wrapper.DeleteForm)
|
|||
|
|
router.GET(options.BaseURL+"/forms/:formId", wrapper.GetForm)
|
|||
|
|
router.PUT(options.BaseURL+"/forms/:formId", wrapper.UpdateForm)
|
|||
|
|
router.GET(options.BaseURL+"/forms/:formId/access-codes", wrapper.ListAccessCodes)
|
|||
|
|
router.POST(options.BaseURL+"/forms/:formId/access-codes", wrapper.CreateAccessCodes)
|
|||
|
|
router.POST(options.BaseURL+"/forms/:formId/activate", wrapper.ActivateForm)
|
|||
|
|
router.POST(options.BaseURL+"/forms/:formId/inactivate", wrapper.InactivateForm)
|
|||
|
|
router.GET(options.BaseURL+"/forms/:formId/pdf", wrapper.GetFormPdf)
|
|||
|
|
router.GET(options.BaseURL+"/forms/:formId/submissions", wrapper.ListFormSubmissions)
|
|||
|
|
router.POST(options.BaseURL+"/forms/:formId/submissions", wrapper.SubmitForm)
|
|||
|
|
router.POST(options.BaseURL+"/forms/:formId/versions", wrapper.CreateFormVersion)
|
|||
|
|
router.GET(options.BaseURL+"/health", wrapper.GetHealth)
|
|||
|
|
router.GET(options.BaseURL+"/submissions/:submissionId", wrapper.GetSubmission)
|
|||
|
|
router.GET(options.BaseURL+"/submissions/:submissionId/offline-pdf", wrapper.GetSubmissionOfflinePdf)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type ErrorJSONResponse Error
|
|||
|
|
|
|||
|
|
type ListFormsRequestObject struct {
|
|||
|
|
Params ListFormsParams
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type ListFormsResponseObject interface {
|
|||
|
|
VisitListFormsResponse(w http.ResponseWriter) error
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type ListForms200JSONResponse []FormSummary
|
|||
|
|
|
|||
|
|
func (response ListForms200JSONResponse) VisitListFormsResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/json")
|
|||
|
|
w.WriteHeader(200)
|
|||
|
|
|
|||
|
|
return json.NewEncoder(w).Encode(response)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type ListForms500JSONResponse struct{ ErrorJSONResponse }
|
|||
|
|
|
|||
|
|
func (response ListForms500JSONResponse) VisitListFormsResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/json")
|
|||
|
|
w.WriteHeader(500)
|
|||
|
|
|
|||
|
|
return json.NewEncoder(w).Encode(response)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type CreateFormRequestObject struct {
|
|||
|
|
Body *CreateFormJSONRequestBody
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type CreateFormResponseObject interface {
|
|||
|
|
VisitCreateFormResponse(w http.ResponseWriter) error
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type CreateForm201JSONResponse Form
|
|||
|
|
|
|||
|
|
func (response CreateForm201JSONResponse) VisitCreateFormResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/json")
|
|||
|
|
w.WriteHeader(201)
|
|||
|
|
|
|||
|
|
return json.NewEncoder(w).Encode(response)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type CreateForm400JSONResponse struct{ ErrorJSONResponse }
|
|||
|
|
|
|||
|
|
func (response CreateForm400JSONResponse) VisitCreateFormResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/json")
|
|||
|
|
w.WriteHeader(400)
|
|||
|
|
|
|||
|
|
return json.NewEncoder(w).Encode(response)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type CreateForm500JSONResponse Error
|
|||
|
|
|
|||
|
|
func (response CreateForm500JSONResponse) VisitCreateFormResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/json")
|
|||
|
|
w.WriteHeader(500)
|
|||
|
|
|
|||
|
|
return json.NewEncoder(w).Encode(response)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type DeleteFormRequestObject struct {
|
|||
|
|
FormId FormId `json:"formId"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type DeleteFormResponseObject interface {
|
|||
|
|
VisitDeleteFormResponse(w http.ResponseWriter) error
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type DeleteForm204Response struct {
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
func (response DeleteForm204Response) VisitDeleteFormResponse(w http.ResponseWriter) error {
|
|||
|
|
w.WriteHeader(204)
|
|||
|
|
return nil
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type DeleteForm404JSONResponse struct{ ErrorJSONResponse }
|
|||
|
|
|
|||
|
|
func (response DeleteForm404JSONResponse) VisitDeleteFormResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/json")
|
|||
|
|
w.WriteHeader(404)
|
|||
|
|
|
|||
|
|
return json.NewEncoder(w).Encode(response)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type DeleteForm500JSONResponse Error
|
|||
|
|
|
|||
|
|
func (response DeleteForm500JSONResponse) VisitDeleteFormResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/json")
|
|||
|
|
w.WriteHeader(500)
|
|||
|
|
|
|||
|
|
return json.NewEncoder(w).Encode(response)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type GetFormRequestObject struct {
|
|||
|
|
FormId FormId `json:"formId"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type GetFormResponseObject interface {
|
|||
|
|
VisitGetFormResponse(w http.ResponseWriter) error
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type GetForm200JSONResponse Form
|
|||
|
|
|
|||
|
|
func (response GetForm200JSONResponse) VisitGetFormResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/json")
|
|||
|
|
w.WriteHeader(200)
|
|||
|
|
|
|||
|
|
return json.NewEncoder(w).Encode(response)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type GetForm404JSONResponse struct{ ErrorJSONResponse }
|
|||
|
|
|
|||
|
|
func (response GetForm404JSONResponse) VisitGetFormResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/json")
|
|||
|
|
w.WriteHeader(404)
|
|||
|
|
|
|||
|
|
return json.NewEncoder(w).Encode(response)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type GetForm500JSONResponse Error
|
|||
|
|
|
|||
|
|
func (response GetForm500JSONResponse) VisitGetFormResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/json")
|
|||
|
|
w.WriteHeader(500)
|
|||
|
|
|
|||
|
|
return json.NewEncoder(w).Encode(response)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type UpdateFormRequestObject struct {
|
|||
|
|
FormId FormId `json:"formId"`
|
|||
|
|
Body *UpdateFormJSONRequestBody
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type UpdateFormResponseObject interface {
|
|||
|
|
VisitUpdateFormResponse(w http.ResponseWriter) error
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type UpdateForm200JSONResponse Form
|
|||
|
|
|
|||
|
|
func (response UpdateForm200JSONResponse) VisitUpdateFormResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/json")
|
|||
|
|
w.WriteHeader(200)
|
|||
|
|
|
|||
|
|
return json.NewEncoder(w).Encode(response)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type UpdateForm400JSONResponse struct{ ErrorJSONResponse }
|
|||
|
|
|
|||
|
|
func (response UpdateForm400JSONResponse) VisitUpdateFormResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/json")
|
|||
|
|
w.WriteHeader(400)
|
|||
|
|
|
|||
|
|
return json.NewEncoder(w).Encode(response)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type UpdateForm404JSONResponse Error
|
|||
|
|
|
|||
|
|
func (response UpdateForm404JSONResponse) VisitUpdateFormResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/json")
|
|||
|
|
w.WriteHeader(404)
|
|||
|
|
|
|||
|
|
return json.NewEncoder(w).Encode(response)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type UpdateForm500JSONResponse Error
|
|||
|
|
|
|||
|
|
func (response UpdateForm500JSONResponse) VisitUpdateFormResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/json")
|
|||
|
|
w.WriteHeader(500)
|
|||
|
|
|
|||
|
|
return json.NewEncoder(w).Encode(response)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type ListAccessCodesRequestObject struct {
|
|||
|
|
FormId FormId `json:"formId"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type ListAccessCodesResponseObject interface {
|
|||
|
|
VisitListAccessCodesResponse(w http.ResponseWriter) error
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type ListAccessCodes200JSONResponse []AccessCode
|
|||
|
|
|
|||
|
|
func (response ListAccessCodes200JSONResponse) VisitListAccessCodesResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/json")
|
|||
|
|
w.WriteHeader(200)
|
|||
|
|
|
|||
|
|
return json.NewEncoder(w).Encode(response)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type ListAccessCodes404JSONResponse struct{ ErrorJSONResponse }
|
|||
|
|
|
|||
|
|
func (response ListAccessCodes404JSONResponse) VisitListAccessCodesResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/json")
|
|||
|
|
w.WriteHeader(404)
|
|||
|
|
|
|||
|
|
return json.NewEncoder(w).Encode(response)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type ListAccessCodes500JSONResponse Error
|
|||
|
|
|
|||
|
|
func (response ListAccessCodes500JSONResponse) VisitListAccessCodesResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/json")
|
|||
|
|
w.WriteHeader(500)
|
|||
|
|
|
|||
|
|
return json.NewEncoder(w).Encode(response)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type CreateAccessCodesRequestObject struct {
|
|||
|
|
FormId FormId `json:"formId"`
|
|||
|
|
Body *CreateAccessCodesJSONRequestBody
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type CreateAccessCodesResponseObject interface {
|
|||
|
|
VisitCreateAccessCodesResponse(w http.ResponseWriter) error
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type CreateAccessCodes201JSONResponse []AccessCode
|
|||
|
|
|
|||
|
|
func (response CreateAccessCodes201JSONResponse) VisitCreateAccessCodesResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/json")
|
|||
|
|
w.WriteHeader(201)
|
|||
|
|
|
|||
|
|
return json.NewEncoder(w).Encode(response)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type CreateAccessCodes400JSONResponse struct{ ErrorJSONResponse }
|
|||
|
|
|
|||
|
|
func (response CreateAccessCodes400JSONResponse) VisitCreateAccessCodesResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/json")
|
|||
|
|
w.WriteHeader(400)
|
|||
|
|
|
|||
|
|
return json.NewEncoder(w).Encode(response)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type CreateAccessCodes404JSONResponse Error
|
|||
|
|
|
|||
|
|
func (response CreateAccessCodes404JSONResponse) VisitCreateAccessCodesResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/json")
|
|||
|
|
w.WriteHeader(404)
|
|||
|
|
|
|||
|
|
return json.NewEncoder(w).Encode(response)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type CreateAccessCodes500JSONResponse Error
|
|||
|
|
|
|||
|
|
func (response CreateAccessCodes500JSONResponse) VisitCreateAccessCodesResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/json")
|
|||
|
|
w.WriteHeader(500)
|
|||
|
|
|
|||
|
|
return json.NewEncoder(w).Encode(response)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type ActivateFormRequestObject struct {
|
|||
|
|
FormId FormId `json:"formId"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type ActivateFormResponseObject interface {
|
|||
|
|
VisitActivateFormResponse(w http.ResponseWriter) error
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type ActivateForm200JSONResponse Form
|
|||
|
|
|
|||
|
|
func (response ActivateForm200JSONResponse) VisitActivateFormResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/json")
|
|||
|
|
w.WriteHeader(200)
|
|||
|
|
|
|||
|
|
return json.NewEncoder(w).Encode(response)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type ActivateForm404JSONResponse struct{ ErrorJSONResponse }
|
|||
|
|
|
|||
|
|
func (response ActivateForm404JSONResponse) VisitActivateFormResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/json")
|
|||
|
|
w.WriteHeader(404)
|
|||
|
|
|
|||
|
|
return json.NewEncoder(w).Encode(response)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type ActivateForm500JSONResponse Error
|
|||
|
|
|
|||
|
|
func (response ActivateForm500JSONResponse) VisitActivateFormResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/json")
|
|||
|
|
w.WriteHeader(500)
|
|||
|
|
|
|||
|
|
return json.NewEncoder(w).Encode(response)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type InactivateFormRequestObject struct {
|
|||
|
|
FormId FormId `json:"formId"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type InactivateFormResponseObject interface {
|
|||
|
|
VisitInactivateFormResponse(w http.ResponseWriter) error
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type InactivateForm200JSONResponse Form
|
|||
|
|
|
|||
|
|
func (response InactivateForm200JSONResponse) VisitInactivateFormResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/json")
|
|||
|
|
w.WriteHeader(200)
|
|||
|
|
|
|||
|
|
return json.NewEncoder(w).Encode(response)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type InactivateForm404JSONResponse struct{ ErrorJSONResponse }
|
|||
|
|
|
|||
|
|
func (response InactivateForm404JSONResponse) VisitInactivateFormResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/json")
|
|||
|
|
w.WriteHeader(404)
|
|||
|
|
|
|||
|
|
return json.NewEncoder(w).Encode(response)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type InactivateForm500JSONResponse Error
|
|||
|
|
|
|||
|
|
func (response InactivateForm500JSONResponse) VisitInactivateFormResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/json")
|
|||
|
|
w.WriteHeader(500)
|
|||
|
|
|
|||
|
|
return json.NewEncoder(w).Encode(response)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type GetFormPdfRequestObject struct {
|
|||
|
|
FormId FormId `json:"formId"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type GetFormPdfResponseObject interface {
|
|||
|
|
VisitGetFormPdfResponse(w http.ResponseWriter) error
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type GetFormPdf200ApplicationpdfResponse struct {
|
|||
|
|
Body io.Reader
|
|||
|
|
ContentLength int64
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
func (response GetFormPdf200ApplicationpdfResponse) VisitGetFormPdfResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/pdf")
|
|||
|
|
if response.ContentLength != 0 {
|
|||
|
|
w.Header().Set("Content-Length", fmt.Sprint(response.ContentLength))
|
|||
|
|
}
|
|||
|
|
w.WriteHeader(200)
|
|||
|
|
|
|||
|
|
if closer, ok := response.Body.(io.ReadCloser); ok {
|
|||
|
|
defer closer.Close()
|
|||
|
|
}
|
|||
|
|
_, err := io.Copy(w, response.Body)
|
|||
|
|
return err
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type GetFormPdf404JSONResponse struct{ ErrorJSONResponse }
|
|||
|
|
|
|||
|
|
func (response GetFormPdf404JSONResponse) VisitGetFormPdfResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/json")
|
|||
|
|
w.WriteHeader(404)
|
|||
|
|
|
|||
|
|
return json.NewEncoder(w).Encode(response)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type GetFormPdf500JSONResponse Error
|
|||
|
|
|
|||
|
|
func (response GetFormPdf500JSONResponse) VisitGetFormPdfResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/json")
|
|||
|
|
w.WriteHeader(500)
|
|||
|
|
|
|||
|
|
return json.NewEncoder(w).Encode(response)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type ListFormSubmissionsRequestObject struct {
|
|||
|
|
FormId FormId `json:"formId"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type ListFormSubmissionsResponseObject interface {
|
|||
|
|
VisitListFormSubmissionsResponse(w http.ResponseWriter) error
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type ListFormSubmissions200JSONResponse []SubmissionSummary
|
|||
|
|
|
|||
|
|
func (response ListFormSubmissions200JSONResponse) VisitListFormSubmissionsResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/json")
|
|||
|
|
w.WriteHeader(200)
|
|||
|
|
|
|||
|
|
return json.NewEncoder(w).Encode(response)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type ListFormSubmissions404JSONResponse struct{ ErrorJSONResponse }
|
|||
|
|
|
|||
|
|
func (response ListFormSubmissions404JSONResponse) VisitListFormSubmissionsResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/json")
|
|||
|
|
w.WriteHeader(404)
|
|||
|
|
|
|||
|
|
return json.NewEncoder(w).Encode(response)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type ListFormSubmissions500JSONResponse Error
|
|||
|
|
|
|||
|
|
func (response ListFormSubmissions500JSONResponse) VisitListFormSubmissionsResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/json")
|
|||
|
|
w.WriteHeader(500)
|
|||
|
|
|
|||
|
|
return json.NewEncoder(w).Encode(response)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type SubmitFormRequestObject struct {
|
|||
|
|
FormId FormId `json:"formId"`
|
|||
|
|
Body *SubmitFormJSONRequestBody
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type SubmitFormResponseObject interface {
|
|||
|
|
VisitSubmitFormResponse(w http.ResponseWriter) error
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type SubmitForm201JSONResponse Submission
|
|||
|
|
|
|||
|
|
func (response SubmitForm201JSONResponse) VisitSubmitFormResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/json")
|
|||
|
|
w.WriteHeader(201)
|
|||
|
|
|
|||
|
|
return json.NewEncoder(w).Encode(response)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type SubmitForm400JSONResponse struct{ ErrorJSONResponse }
|
|||
|
|
|
|||
|
|
func (response SubmitForm400JSONResponse) VisitSubmitFormResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/json")
|
|||
|
|
w.WriteHeader(400)
|
|||
|
|
|
|||
|
|
return json.NewEncoder(w).Encode(response)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type SubmitForm404JSONResponse Error
|
|||
|
|
|
|||
|
|
func (response SubmitForm404JSONResponse) VisitSubmitFormResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/json")
|
|||
|
|
w.WriteHeader(404)
|
|||
|
|
|
|||
|
|
return json.NewEncoder(w).Encode(response)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type SubmitForm409JSONResponse Error
|
|||
|
|
|
|||
|
|
func (response SubmitForm409JSONResponse) VisitSubmitFormResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/json")
|
|||
|
|
w.WriteHeader(409)
|
|||
|
|
|
|||
|
|
return json.NewEncoder(w).Encode(response)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type SubmitForm410JSONResponse Error
|
|||
|
|
|
|||
|
|
func (response SubmitForm410JSONResponse) VisitSubmitFormResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/json")
|
|||
|
|
w.WriteHeader(410)
|
|||
|
|
|
|||
|
|
return json.NewEncoder(w).Encode(response)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type SubmitForm500JSONResponse Error
|
|||
|
|
|
|||
|
|
func (response SubmitForm500JSONResponse) VisitSubmitFormResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/json")
|
|||
|
|
w.WriteHeader(500)
|
|||
|
|
|
|||
|
|
return json.NewEncoder(w).Encode(response)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type CreateFormVersionRequestObject struct {
|
|||
|
|
FormId FormId `json:"formId"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type CreateFormVersionResponseObject interface {
|
|||
|
|
VisitCreateFormVersionResponse(w http.ResponseWriter) error
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type CreateFormVersion201JSONResponse Form
|
|||
|
|
|
|||
|
|
func (response CreateFormVersion201JSONResponse) VisitCreateFormVersionResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/json")
|
|||
|
|
w.WriteHeader(201)
|
|||
|
|
|
|||
|
|
return json.NewEncoder(w).Encode(response)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type CreateFormVersion404JSONResponse struct{ ErrorJSONResponse }
|
|||
|
|
|
|||
|
|
func (response CreateFormVersion404JSONResponse) VisitCreateFormVersionResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/json")
|
|||
|
|
w.WriteHeader(404)
|
|||
|
|
|
|||
|
|
return json.NewEncoder(w).Encode(response)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type CreateFormVersion500JSONResponse Error
|
|||
|
|
|
|||
|
|
func (response CreateFormVersion500JSONResponse) VisitCreateFormVersionResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/json")
|
|||
|
|
w.WriteHeader(500)
|
|||
|
|
|
|||
|
|
return json.NewEncoder(w).Encode(response)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type GetHealthRequestObject struct {
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type GetHealthResponseObject interface {
|
|||
|
|
VisitGetHealthResponse(w http.ResponseWriter) error
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type GetHealth200JSONResponse Health
|
|||
|
|
|
|||
|
|
func (response GetHealth200JSONResponse) VisitGetHealthResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/json")
|
|||
|
|
w.WriteHeader(200)
|
|||
|
|
|
|||
|
|
return json.NewEncoder(w).Encode(response)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type GetSubmissionRequestObject struct {
|
|||
|
|
SubmissionId openapi_types.UUID `json:"submissionId"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type GetSubmissionResponseObject interface {
|
|||
|
|
VisitGetSubmissionResponse(w http.ResponseWriter) error
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type GetSubmission200JSONResponse Submission
|
|||
|
|
|
|||
|
|
func (response GetSubmission200JSONResponse) VisitGetSubmissionResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/json")
|
|||
|
|
w.WriteHeader(200)
|
|||
|
|
|
|||
|
|
return json.NewEncoder(w).Encode(response)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type GetSubmission404JSONResponse struct{ ErrorJSONResponse }
|
|||
|
|
|
|||
|
|
func (response GetSubmission404JSONResponse) VisitGetSubmissionResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/json")
|
|||
|
|
w.WriteHeader(404)
|
|||
|
|
|
|||
|
|
return json.NewEncoder(w).Encode(response)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type GetSubmission500JSONResponse Error
|
|||
|
|
|
|||
|
|
func (response GetSubmission500JSONResponse) VisitGetSubmissionResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/json")
|
|||
|
|
w.WriteHeader(500)
|
|||
|
|
|
|||
|
|
return json.NewEncoder(w).Encode(response)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type GetSubmissionOfflinePdfRequestObject struct {
|
|||
|
|
SubmissionId openapi_types.UUID `json:"submissionId"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type GetSubmissionOfflinePdfResponseObject interface {
|
|||
|
|
VisitGetSubmissionOfflinePdfResponse(w http.ResponseWriter) error
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type GetSubmissionOfflinePdf200ApplicationpdfResponse struct {
|
|||
|
|
Body io.Reader
|
|||
|
|
ContentLength int64
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
func (response GetSubmissionOfflinePdf200ApplicationpdfResponse) VisitGetSubmissionOfflinePdfResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/pdf")
|
|||
|
|
if response.ContentLength != 0 {
|
|||
|
|
w.Header().Set("Content-Length", fmt.Sprint(response.ContentLength))
|
|||
|
|
}
|
|||
|
|
w.WriteHeader(200)
|
|||
|
|
|
|||
|
|
if closer, ok := response.Body.(io.ReadCloser); ok {
|
|||
|
|
defer closer.Close()
|
|||
|
|
}
|
|||
|
|
_, err := io.Copy(w, response.Body)
|
|||
|
|
return err
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type GetSubmissionOfflinePdf404JSONResponse struct{ ErrorJSONResponse }
|
|||
|
|
|
|||
|
|
func (response GetSubmissionOfflinePdf404JSONResponse) VisitGetSubmissionOfflinePdfResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/json")
|
|||
|
|
w.WriteHeader(404)
|
|||
|
|
|
|||
|
|
return json.NewEncoder(w).Encode(response)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type GetSubmissionOfflinePdf500JSONResponse Error
|
|||
|
|
|
|||
|
|
func (response GetSubmissionOfflinePdf500JSONResponse) VisitGetSubmissionOfflinePdfResponse(w http.ResponseWriter) error {
|
|||
|
|
w.Header().Set("Content-Type", "application/json")
|
|||
|
|
w.WriteHeader(500)
|
|||
|
|
|
|||
|
|
return json.NewEncoder(w).Encode(response)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// StrictServerInterface represents all server handlers.
|
|||
|
|
type StrictServerInterface interface {
|
|||
|
|
// List forms
|
|||
|
|
// (GET /forms)
|
|||
|
|
ListForms(ctx context.Context, request ListFormsRequestObject) (ListFormsResponseObject, error)
|
|||
|
|
// Create a form
|
|||
|
|
// (POST /forms)
|
|||
|
|
CreateForm(ctx context.Context, request CreateFormRequestObject) (CreateFormResponseObject, error)
|
|||
|
|
// Delete a form definition
|
|||
|
|
// (DELETE /forms/{formId})
|
|||
|
|
DeleteForm(ctx context.Context, request DeleteFormRequestObject) (DeleteFormResponseObject, error)
|
|||
|
|
// Get a form by id
|
|||
|
|
// (GET /forms/{formId})
|
|||
|
|
GetForm(ctx context.Context, request GetFormRequestObject) (GetFormResponseObject, error)
|
|||
|
|
// Update a form definition
|
|||
|
|
// (PUT /forms/{formId})
|
|||
|
|
UpdateForm(ctx context.Context, request UpdateFormRequestObject) (UpdateFormResponseObject, error)
|
|||
|
|
// List access codes for a form
|
|||
|
|
// (GET /forms/{formId}/access-codes)
|
|||
|
|
ListAccessCodes(ctx context.Context, request ListAccessCodesRequestObject) (ListAccessCodesResponseObject, error)
|
|||
|
|
// Create one or more access codes for a form
|
|||
|
|
// (POST /forms/{formId}/access-codes)
|
|||
|
|
CreateAccessCodes(ctx context.Context, request CreateAccessCodesRequestObject) (CreateAccessCodesResponseObject, error)
|
|||
|
|
// Activate a form
|
|||
|
|
// (POST /forms/{formId}/activate)
|
|||
|
|
ActivateForm(ctx context.Context, request ActivateFormRequestObject) (ActivateFormResponseObject, error)
|
|||
|
|
// Inactivate a form
|
|||
|
|
// (POST /forms/{formId}/inactivate)
|
|||
|
|
InactivateForm(ctx context.Context, request InactivateFormRequestObject) (InactivateFormResponseObject, error)
|
|||
|
|
// Download a PDF rendering of the form definition
|
|||
|
|
// (GET /forms/{formId}/pdf)
|
|||
|
|
GetFormPdf(ctx context.Context, request GetFormPdfRequestObject) (GetFormPdfResponseObject, error)
|
|||
|
|
// List submissions for a form (management)
|
|||
|
|
// (GET /forms/{formId}/submissions)
|
|||
|
|
ListFormSubmissions(ctx context.Context, request ListFormSubmissionsRequestObject) (ListFormSubmissionsResponseObject, error)
|
|||
|
|
// Submit an answer set for a form
|
|||
|
|
// (POST /forms/{formId}/submissions)
|
|||
|
|
SubmitForm(ctx context.Context, request SubmitFormRequestObject) (SubmitFormResponseObject, error)
|
|||
|
|
// Create a new version of a form
|
|||
|
|
// (POST /forms/{formId}/versions)
|
|||
|
|
CreateFormVersion(ctx context.Context, request CreateFormVersionRequestObject) (CreateFormVersionResponseObject, error)
|
|||
|
|
// Service health
|
|||
|
|
// (GET /health)
|
|||
|
|
GetHealth(ctx context.Context, request GetHealthRequestObject) (GetHealthResponseObject, error)
|
|||
|
|
// Get a submission by id (management)
|
|||
|
|
// (GET /submissions/{submissionId})
|
|||
|
|
GetSubmission(ctx context.Context, request GetSubmissionRequestObject) (GetSubmissionResponseObject, error)
|
|||
|
|
// Download the offline PDF uploaded with a submission
|
|||
|
|
// (GET /submissions/{submissionId}/offline-pdf)
|
|||
|
|
GetSubmissionOfflinePdf(ctx context.Context, request GetSubmissionOfflinePdfRequestObject) (GetSubmissionOfflinePdfResponseObject, error)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type StrictHandlerFunc = strictgin.StrictGinHandlerFunc
|
|||
|
|
type StrictMiddlewareFunc = strictgin.StrictGinMiddlewareFunc
|
|||
|
|
|
|||
|
|
func NewStrictHandler(ssi StrictServerInterface, middlewares []StrictMiddlewareFunc) ServerInterface {
|
|||
|
|
return &strictHandler{ssi: ssi, middlewares: middlewares}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
type strictHandler struct {
|
|||
|
|
ssi StrictServerInterface
|
|||
|
|
middlewares []StrictMiddlewareFunc
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// ListForms operation middleware
|
|||
|
|
func (sh *strictHandler) ListForms(ctx *gin.Context, params ListFormsParams) {
|
|||
|
|
var request ListFormsRequestObject
|
|||
|
|
|
|||
|
|
request.Params = params
|
|||
|
|
|
|||
|
|
handler := func(ctx *gin.Context, request interface{}) (interface{}, error) {
|
|||
|
|
return sh.ssi.ListForms(ctx, request.(ListFormsRequestObject))
|
|||
|
|
}
|
|||
|
|
for _, middleware := range sh.middlewares {
|
|||
|
|
handler = middleware(handler, "ListForms")
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
response, err := handler(ctx, request)
|
|||
|
|
|
|||
|
|
if err != nil {
|
|||
|
|
ctx.Error(err)
|
|||
|
|
ctx.Status(http.StatusInternalServerError)
|
|||
|
|
} else if validResponse, ok := response.(ListFormsResponseObject); ok {
|
|||
|
|
if err := validResponse.VisitListFormsResponse(ctx.Writer); err != nil {
|
|||
|
|
ctx.Error(err)
|
|||
|
|
}
|
|||
|
|
} else if response != nil {
|
|||
|
|
ctx.Error(fmt.Errorf("unexpected response type: %T", response))
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// CreateForm operation middleware
|
|||
|
|
func (sh *strictHandler) CreateForm(ctx *gin.Context) {
|
|||
|
|
var request CreateFormRequestObject
|
|||
|
|
|
|||
|
|
var body CreateFormJSONRequestBody
|
|||
|
|
if err := ctx.ShouldBindJSON(&body); err != nil {
|
|||
|
|
ctx.Status(http.StatusBadRequest)
|
|||
|
|
ctx.Error(err)
|
|||
|
|
return
|
|||
|
|
}
|
|||
|
|
request.Body = &body
|
|||
|
|
|
|||
|
|
handler := func(ctx *gin.Context, request interface{}) (interface{}, error) {
|
|||
|
|
return sh.ssi.CreateForm(ctx, request.(CreateFormRequestObject))
|
|||
|
|
}
|
|||
|
|
for _, middleware := range sh.middlewares {
|
|||
|
|
handler = middleware(handler, "CreateForm")
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
response, err := handler(ctx, request)
|
|||
|
|
|
|||
|
|
if err != nil {
|
|||
|
|
ctx.Error(err)
|
|||
|
|
ctx.Status(http.StatusInternalServerError)
|
|||
|
|
} else if validResponse, ok := response.(CreateFormResponseObject); ok {
|
|||
|
|
if err := validResponse.VisitCreateFormResponse(ctx.Writer); err != nil {
|
|||
|
|
ctx.Error(err)
|
|||
|
|
}
|
|||
|
|
} else if response != nil {
|
|||
|
|
ctx.Error(fmt.Errorf("unexpected response type: %T", response))
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// DeleteForm operation middleware
|
|||
|
|
func (sh *strictHandler) DeleteForm(ctx *gin.Context, formId FormId) {
|
|||
|
|
var request DeleteFormRequestObject
|
|||
|
|
|
|||
|
|
request.FormId = formId
|
|||
|
|
|
|||
|
|
handler := func(ctx *gin.Context, request interface{}) (interface{}, error) {
|
|||
|
|
return sh.ssi.DeleteForm(ctx, request.(DeleteFormRequestObject))
|
|||
|
|
}
|
|||
|
|
for _, middleware := range sh.middlewares {
|
|||
|
|
handler = middleware(handler, "DeleteForm")
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
response, err := handler(ctx, request)
|
|||
|
|
|
|||
|
|
if err != nil {
|
|||
|
|
ctx.Error(err)
|
|||
|
|
ctx.Status(http.StatusInternalServerError)
|
|||
|
|
} else if validResponse, ok := response.(DeleteFormResponseObject); ok {
|
|||
|
|
if err := validResponse.VisitDeleteFormResponse(ctx.Writer); err != nil {
|
|||
|
|
ctx.Error(err)
|
|||
|
|
}
|
|||
|
|
} else if response != nil {
|
|||
|
|
ctx.Error(fmt.Errorf("unexpected response type: %T", response))
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// GetForm operation middleware
|
|||
|
|
func (sh *strictHandler) GetForm(ctx *gin.Context, formId FormId) {
|
|||
|
|
var request GetFormRequestObject
|
|||
|
|
|
|||
|
|
request.FormId = formId
|
|||
|
|
|
|||
|
|
handler := func(ctx *gin.Context, request interface{}) (interface{}, error) {
|
|||
|
|
return sh.ssi.GetForm(ctx, request.(GetFormRequestObject))
|
|||
|
|
}
|
|||
|
|
for _, middleware := range sh.middlewares {
|
|||
|
|
handler = middleware(handler, "GetForm")
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
response, err := handler(ctx, request)
|
|||
|
|
|
|||
|
|
if err != nil {
|
|||
|
|
ctx.Error(err)
|
|||
|
|
ctx.Status(http.StatusInternalServerError)
|
|||
|
|
} else if validResponse, ok := response.(GetFormResponseObject); ok {
|
|||
|
|
if err := validResponse.VisitGetFormResponse(ctx.Writer); err != nil {
|
|||
|
|
ctx.Error(err)
|
|||
|
|
}
|
|||
|
|
} else if response != nil {
|
|||
|
|
ctx.Error(fmt.Errorf("unexpected response type: %T", response))
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// UpdateForm operation middleware
|
|||
|
|
func (sh *strictHandler) UpdateForm(ctx *gin.Context, formId FormId) {
|
|||
|
|
var request UpdateFormRequestObject
|
|||
|
|
|
|||
|
|
request.FormId = formId
|
|||
|
|
|
|||
|
|
var body UpdateFormJSONRequestBody
|
|||
|
|
if err := ctx.ShouldBindJSON(&body); err != nil {
|
|||
|
|
ctx.Status(http.StatusBadRequest)
|
|||
|
|
ctx.Error(err)
|
|||
|
|
return
|
|||
|
|
}
|
|||
|
|
request.Body = &body
|
|||
|
|
|
|||
|
|
handler := func(ctx *gin.Context, request interface{}) (interface{}, error) {
|
|||
|
|
return sh.ssi.UpdateForm(ctx, request.(UpdateFormRequestObject))
|
|||
|
|
}
|
|||
|
|
for _, middleware := range sh.middlewares {
|
|||
|
|
handler = middleware(handler, "UpdateForm")
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
response, err := handler(ctx, request)
|
|||
|
|
|
|||
|
|
if err != nil {
|
|||
|
|
ctx.Error(err)
|
|||
|
|
ctx.Status(http.StatusInternalServerError)
|
|||
|
|
} else if validResponse, ok := response.(UpdateFormResponseObject); ok {
|
|||
|
|
if err := validResponse.VisitUpdateFormResponse(ctx.Writer); err != nil {
|
|||
|
|
ctx.Error(err)
|
|||
|
|
}
|
|||
|
|
} else if response != nil {
|
|||
|
|
ctx.Error(fmt.Errorf("unexpected response type: %T", response))
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// ListAccessCodes operation middleware
|
|||
|
|
func (sh *strictHandler) ListAccessCodes(ctx *gin.Context, formId FormId) {
|
|||
|
|
var request ListAccessCodesRequestObject
|
|||
|
|
|
|||
|
|
request.FormId = formId
|
|||
|
|
|
|||
|
|
handler := func(ctx *gin.Context, request interface{}) (interface{}, error) {
|
|||
|
|
return sh.ssi.ListAccessCodes(ctx, request.(ListAccessCodesRequestObject))
|
|||
|
|
}
|
|||
|
|
for _, middleware := range sh.middlewares {
|
|||
|
|
handler = middleware(handler, "ListAccessCodes")
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
response, err := handler(ctx, request)
|
|||
|
|
|
|||
|
|
if err != nil {
|
|||
|
|
ctx.Error(err)
|
|||
|
|
ctx.Status(http.StatusInternalServerError)
|
|||
|
|
} else if validResponse, ok := response.(ListAccessCodesResponseObject); ok {
|
|||
|
|
if err := validResponse.VisitListAccessCodesResponse(ctx.Writer); err != nil {
|
|||
|
|
ctx.Error(err)
|
|||
|
|
}
|
|||
|
|
} else if response != nil {
|
|||
|
|
ctx.Error(fmt.Errorf("unexpected response type: %T", response))
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// CreateAccessCodes operation middleware
|
|||
|
|
func (sh *strictHandler) CreateAccessCodes(ctx *gin.Context, formId FormId) {
|
|||
|
|
var request CreateAccessCodesRequestObject
|
|||
|
|
|
|||
|
|
request.FormId = formId
|
|||
|
|
|
|||
|
|
var body CreateAccessCodesJSONRequestBody
|
|||
|
|
if err := ctx.ShouldBindJSON(&body); err != nil {
|
|||
|
|
ctx.Status(http.StatusBadRequest)
|
|||
|
|
ctx.Error(err)
|
|||
|
|
return
|
|||
|
|
}
|
|||
|
|
request.Body = &body
|
|||
|
|
|
|||
|
|
handler := func(ctx *gin.Context, request interface{}) (interface{}, error) {
|
|||
|
|
return sh.ssi.CreateAccessCodes(ctx, request.(CreateAccessCodesRequestObject))
|
|||
|
|
}
|
|||
|
|
for _, middleware := range sh.middlewares {
|
|||
|
|
handler = middleware(handler, "CreateAccessCodes")
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
response, err := handler(ctx, request)
|
|||
|
|
|
|||
|
|
if err != nil {
|
|||
|
|
ctx.Error(err)
|
|||
|
|
ctx.Status(http.StatusInternalServerError)
|
|||
|
|
} else if validResponse, ok := response.(CreateAccessCodesResponseObject); ok {
|
|||
|
|
if err := validResponse.VisitCreateAccessCodesResponse(ctx.Writer); err != nil {
|
|||
|
|
ctx.Error(err)
|
|||
|
|
}
|
|||
|
|
} else if response != nil {
|
|||
|
|
ctx.Error(fmt.Errorf("unexpected response type: %T", response))
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// ActivateForm operation middleware
|
|||
|
|
func (sh *strictHandler) ActivateForm(ctx *gin.Context, formId FormId) {
|
|||
|
|
var request ActivateFormRequestObject
|
|||
|
|
|
|||
|
|
request.FormId = formId
|
|||
|
|
|
|||
|
|
handler := func(ctx *gin.Context, request interface{}) (interface{}, error) {
|
|||
|
|
return sh.ssi.ActivateForm(ctx, request.(ActivateFormRequestObject))
|
|||
|
|
}
|
|||
|
|
for _, middleware := range sh.middlewares {
|
|||
|
|
handler = middleware(handler, "ActivateForm")
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
response, err := handler(ctx, request)
|
|||
|
|
|
|||
|
|
if err != nil {
|
|||
|
|
ctx.Error(err)
|
|||
|
|
ctx.Status(http.StatusInternalServerError)
|
|||
|
|
} else if validResponse, ok := response.(ActivateFormResponseObject); ok {
|
|||
|
|
if err := validResponse.VisitActivateFormResponse(ctx.Writer); err != nil {
|
|||
|
|
ctx.Error(err)
|
|||
|
|
}
|
|||
|
|
} else if response != nil {
|
|||
|
|
ctx.Error(fmt.Errorf("unexpected response type: %T", response))
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// InactivateForm operation middleware
|
|||
|
|
func (sh *strictHandler) InactivateForm(ctx *gin.Context, formId FormId) {
|
|||
|
|
var request InactivateFormRequestObject
|
|||
|
|
|
|||
|
|
request.FormId = formId
|
|||
|
|
|
|||
|
|
handler := func(ctx *gin.Context, request interface{}) (interface{}, error) {
|
|||
|
|
return sh.ssi.InactivateForm(ctx, request.(InactivateFormRequestObject))
|
|||
|
|
}
|
|||
|
|
for _, middleware := range sh.middlewares {
|
|||
|
|
handler = middleware(handler, "InactivateForm")
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
response, err := handler(ctx, request)
|
|||
|
|
|
|||
|
|
if err != nil {
|
|||
|
|
ctx.Error(err)
|
|||
|
|
ctx.Status(http.StatusInternalServerError)
|
|||
|
|
} else if validResponse, ok := response.(InactivateFormResponseObject); ok {
|
|||
|
|
if err := validResponse.VisitInactivateFormResponse(ctx.Writer); err != nil {
|
|||
|
|
ctx.Error(err)
|
|||
|
|
}
|
|||
|
|
} else if response != nil {
|
|||
|
|
ctx.Error(fmt.Errorf("unexpected response type: %T", response))
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// GetFormPdf operation middleware
|
|||
|
|
func (sh *strictHandler) GetFormPdf(ctx *gin.Context, formId FormId) {
|
|||
|
|
var request GetFormPdfRequestObject
|
|||
|
|
|
|||
|
|
request.FormId = formId
|
|||
|
|
|
|||
|
|
handler := func(ctx *gin.Context, request interface{}) (interface{}, error) {
|
|||
|
|
return sh.ssi.GetFormPdf(ctx, request.(GetFormPdfRequestObject))
|
|||
|
|
}
|
|||
|
|
for _, middleware := range sh.middlewares {
|
|||
|
|
handler = middleware(handler, "GetFormPdf")
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
response, err := handler(ctx, request)
|
|||
|
|
|
|||
|
|
if err != nil {
|
|||
|
|
ctx.Error(err)
|
|||
|
|
ctx.Status(http.StatusInternalServerError)
|
|||
|
|
} else if validResponse, ok := response.(GetFormPdfResponseObject); ok {
|
|||
|
|
if err := validResponse.VisitGetFormPdfResponse(ctx.Writer); err != nil {
|
|||
|
|
ctx.Error(err)
|
|||
|
|
}
|
|||
|
|
} else if response != nil {
|
|||
|
|
ctx.Error(fmt.Errorf("unexpected response type: %T", response))
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// ListFormSubmissions operation middleware
|
|||
|
|
func (sh *strictHandler) ListFormSubmissions(ctx *gin.Context, formId FormId) {
|
|||
|
|
var request ListFormSubmissionsRequestObject
|
|||
|
|
|
|||
|
|
request.FormId = formId
|
|||
|
|
|
|||
|
|
handler := func(ctx *gin.Context, request interface{}) (interface{}, error) {
|
|||
|
|
return sh.ssi.ListFormSubmissions(ctx, request.(ListFormSubmissionsRequestObject))
|
|||
|
|
}
|
|||
|
|
for _, middleware := range sh.middlewares {
|
|||
|
|
handler = middleware(handler, "ListFormSubmissions")
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
response, err := handler(ctx, request)
|
|||
|
|
|
|||
|
|
if err != nil {
|
|||
|
|
ctx.Error(err)
|
|||
|
|
ctx.Status(http.StatusInternalServerError)
|
|||
|
|
} else if validResponse, ok := response.(ListFormSubmissionsResponseObject); ok {
|
|||
|
|
if err := validResponse.VisitListFormSubmissionsResponse(ctx.Writer); err != nil {
|
|||
|
|
ctx.Error(err)
|
|||
|
|
}
|
|||
|
|
} else if response != nil {
|
|||
|
|
ctx.Error(fmt.Errorf("unexpected response type: %T", response))
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// SubmitForm operation middleware
|
|||
|
|
func (sh *strictHandler) SubmitForm(ctx *gin.Context, formId FormId) {
|
|||
|
|
var request SubmitFormRequestObject
|
|||
|
|
|
|||
|
|
request.FormId = formId
|
|||
|
|
|
|||
|
|
var body SubmitFormJSONRequestBody
|
|||
|
|
if err := ctx.ShouldBindJSON(&body); err != nil {
|
|||
|
|
ctx.Status(http.StatusBadRequest)
|
|||
|
|
ctx.Error(err)
|
|||
|
|
return
|
|||
|
|
}
|
|||
|
|
request.Body = &body
|
|||
|
|
|
|||
|
|
handler := func(ctx *gin.Context, request interface{}) (interface{}, error) {
|
|||
|
|
return sh.ssi.SubmitForm(ctx, request.(SubmitFormRequestObject))
|
|||
|
|
}
|
|||
|
|
for _, middleware := range sh.middlewares {
|
|||
|
|
handler = middleware(handler, "SubmitForm")
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
response, err := handler(ctx, request)
|
|||
|
|
|
|||
|
|
if err != nil {
|
|||
|
|
ctx.Error(err)
|
|||
|
|
ctx.Status(http.StatusInternalServerError)
|
|||
|
|
} else if validResponse, ok := response.(SubmitFormResponseObject); ok {
|
|||
|
|
if err := validResponse.VisitSubmitFormResponse(ctx.Writer); err != nil {
|
|||
|
|
ctx.Error(err)
|
|||
|
|
}
|
|||
|
|
} else if response != nil {
|
|||
|
|
ctx.Error(fmt.Errorf("unexpected response type: %T", response))
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// CreateFormVersion operation middleware
|
|||
|
|
func (sh *strictHandler) CreateFormVersion(ctx *gin.Context, formId FormId) {
|
|||
|
|
var request CreateFormVersionRequestObject
|
|||
|
|
|
|||
|
|
request.FormId = formId
|
|||
|
|
|
|||
|
|
handler := func(ctx *gin.Context, request interface{}) (interface{}, error) {
|
|||
|
|
return sh.ssi.CreateFormVersion(ctx, request.(CreateFormVersionRequestObject))
|
|||
|
|
}
|
|||
|
|
for _, middleware := range sh.middlewares {
|
|||
|
|
handler = middleware(handler, "CreateFormVersion")
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
response, err := handler(ctx, request)
|
|||
|
|
|
|||
|
|
if err != nil {
|
|||
|
|
ctx.Error(err)
|
|||
|
|
ctx.Status(http.StatusInternalServerError)
|
|||
|
|
} else if validResponse, ok := response.(CreateFormVersionResponseObject); ok {
|
|||
|
|
if err := validResponse.VisitCreateFormVersionResponse(ctx.Writer); err != nil {
|
|||
|
|
ctx.Error(err)
|
|||
|
|
}
|
|||
|
|
} else if response != nil {
|
|||
|
|
ctx.Error(fmt.Errorf("unexpected response type: %T", response))
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// GetHealth operation middleware
|
|||
|
|
func (sh *strictHandler) GetHealth(ctx *gin.Context) {
|
|||
|
|
var request GetHealthRequestObject
|
|||
|
|
|
|||
|
|
handler := func(ctx *gin.Context, request interface{}) (interface{}, error) {
|
|||
|
|
return sh.ssi.GetHealth(ctx, request.(GetHealthRequestObject))
|
|||
|
|
}
|
|||
|
|
for _, middleware := range sh.middlewares {
|
|||
|
|
handler = middleware(handler, "GetHealth")
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
response, err := handler(ctx, request)
|
|||
|
|
|
|||
|
|
if err != nil {
|
|||
|
|
ctx.Error(err)
|
|||
|
|
ctx.Status(http.StatusInternalServerError)
|
|||
|
|
} else if validResponse, ok := response.(GetHealthResponseObject); ok {
|
|||
|
|
if err := validResponse.VisitGetHealthResponse(ctx.Writer); err != nil {
|
|||
|
|
ctx.Error(err)
|
|||
|
|
}
|
|||
|
|
} else if response != nil {
|
|||
|
|
ctx.Error(fmt.Errorf("unexpected response type: %T", response))
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// GetSubmission operation middleware
|
|||
|
|
func (sh *strictHandler) GetSubmission(ctx *gin.Context, submissionId openapi_types.UUID) {
|
|||
|
|
var request GetSubmissionRequestObject
|
|||
|
|
|
|||
|
|
request.SubmissionId = submissionId
|
|||
|
|
|
|||
|
|
handler := func(ctx *gin.Context, request interface{}) (interface{}, error) {
|
|||
|
|
return sh.ssi.GetSubmission(ctx, request.(GetSubmissionRequestObject))
|
|||
|
|
}
|
|||
|
|
for _, middleware := range sh.middlewares {
|
|||
|
|
handler = middleware(handler, "GetSubmission")
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
response, err := handler(ctx, request)
|
|||
|
|
|
|||
|
|
if err != nil {
|
|||
|
|
ctx.Error(err)
|
|||
|
|
ctx.Status(http.StatusInternalServerError)
|
|||
|
|
} else if validResponse, ok := response.(GetSubmissionResponseObject); ok {
|
|||
|
|
if err := validResponse.VisitGetSubmissionResponse(ctx.Writer); err != nil {
|
|||
|
|
ctx.Error(err)
|
|||
|
|
}
|
|||
|
|
} else if response != nil {
|
|||
|
|
ctx.Error(fmt.Errorf("unexpected response type: %T", response))
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// GetSubmissionOfflinePdf operation middleware
|
|||
|
|
func (sh *strictHandler) GetSubmissionOfflinePdf(ctx *gin.Context, submissionId openapi_types.UUID) {
|
|||
|
|
var request GetSubmissionOfflinePdfRequestObject
|
|||
|
|
|
|||
|
|
request.SubmissionId = submissionId
|
|||
|
|
|
|||
|
|
handler := func(ctx *gin.Context, request interface{}) (interface{}, error) {
|
|||
|
|
return sh.ssi.GetSubmissionOfflinePdf(ctx, request.(GetSubmissionOfflinePdfRequestObject))
|
|||
|
|
}
|
|||
|
|
for _, middleware := range sh.middlewares {
|
|||
|
|
handler = middleware(handler, "GetSubmissionOfflinePdf")
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
response, err := handler(ctx, request)
|
|||
|
|
|
|||
|
|
if err != nil {
|
|||
|
|
ctx.Error(err)
|
|||
|
|
ctx.Status(http.StatusInternalServerError)
|
|||
|
|
} else if validResponse, ok := response.(GetSubmissionOfflinePdfResponseObject); ok {
|
|||
|
|
if err := validResponse.VisitGetSubmissionOfflinePdfResponse(ctx.Writer); err != nil {
|
|||
|
|
ctx.Error(err)
|
|||
|
|
}
|
|||
|
|
} else if response != nil {
|
|||
|
|
ctx.Error(fmt.Errorf("unexpected response type: %T", response))
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Base64 encoded, gzipped, json marshaled Swagger object
|
|||
|
|
var swaggerSpec = []string{
|
|||
|
|
|
|||
|
|
"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",
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// GetSwagger returns the content of the embedded swagger specification file
|
|||
|
|
// or error if failed to decode
|
|||
|
|
func decodeSpec() ([]byte, error) {
|
|||
|
|
zipped, err := base64.StdEncoding.DecodeString(strings.Join(swaggerSpec, ""))
|
|||
|
|
if err != nil {
|
|||
|
|
return nil, fmt.Errorf("error base64 decoding spec: %w", err)
|
|||
|
|
}
|
|||
|
|
zr, err := gzip.NewReader(bytes.NewReader(zipped))
|
|||
|
|
if err != nil {
|
|||
|
|
return nil, fmt.Errorf("error decompressing spec: %w", err)
|
|||
|
|
}
|
|||
|
|
var buf bytes.Buffer
|
|||
|
|
_, err = buf.ReadFrom(zr)
|
|||
|
|
if err != nil {
|
|||
|
|
return nil, fmt.Errorf("error decompressing spec: %w", err)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return buf.Bytes(), nil
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
var rawSpec = decodeSpecCached()
|
|||
|
|
|
|||
|
|
// a naive cached of a decoded swagger spec
|
|||
|
|
func decodeSpecCached() func() ([]byte, error) {
|
|||
|
|
data, err := decodeSpec()
|
|||
|
|
return func() ([]byte, error) {
|
|||
|
|
return data, err
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Constructs a synthetic filesystem for resolving external references when loading openapi specifications.
|
|||
|
|
func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) {
|
|||
|
|
res := make(map[string]func() ([]byte, error))
|
|||
|
|
if len(pathToFile) > 0 {
|
|||
|
|
res[pathToFile] = rawSpec
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return res
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// GetSwagger returns the Swagger specification corresponding to the generated code
|
|||
|
|
// in this file. The external references of Swagger specification are resolved.
|
|||
|
|
// The logic of resolving external references is tightly connected to "import-mapping" feature.
|
|||
|
|
// Externally referenced files must be embedded in the corresponding golang packages.
|
|||
|
|
// Urls can be supported but this task was out of the scope.
|
|||
|
|
func GetSwagger() (swagger *openapi3.T, err error) {
|
|||
|
|
resolvePath := PathToRawSpec("")
|
|||
|
|
|
|||
|
|
loader := openapi3.NewLoader()
|
|||
|
|
loader.IsExternalRefsAllowed = true
|
|||
|
|
loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) {
|
|||
|
|
pathToFile := url.String()
|
|||
|
|
pathToFile = path.Clean(pathToFile)
|
|||
|
|
getSpec, ok := resolvePath[pathToFile]
|
|||
|
|
if !ok {
|
|||
|
|
err1 := fmt.Errorf("path not found: %s", pathToFile)
|
|||
|
|
return nil, err1
|
|||
|
|
}
|
|||
|
|
return getSpec()
|
|||
|
|
}
|
|||
|
|
var specData []byte
|
|||
|
|
specData, err = rawSpec()
|
|||
|
|
if err != nil {
|
|||
|
|
return
|
|||
|
|
}
|
|||
|
|
swagger, err = loader.LoadFromData(specData)
|
|||
|
|
if err != nil {
|
|||
|
|
return
|
|||
|
|
}
|
|||
|
|
return
|
|||
|
|
}
|