openapi changes

This commit is contained in:
jay brown
2025-04-07 14:10:39 -07:00
parent 9b8101dea1
commit 73709878d9
7 changed files with 1685 additions and 60 deletions
+156 -60
View File
@@ -21,6 +21,7 @@ import (
)
const (
CognitoAuthScopes = "cognitoAuth.Scopes"
PlaceholderAuthScopes = "placeholderAuth.Scopes"
)
@@ -350,6 +351,15 @@ type TooManyRequests = ErrorMessage
// Unauthorized Description of error
type Unauthorized = ErrorMessage
// LoginCallbackParams defines parameters for LoginCallback.
type LoginCallbackParams struct {
// Code Authorization code from Cognito
Code string `form:"code" json:"code"`
// State State parameter for CSRF protection
State string `form:"state" json:"state"`
}
// CreateClientJSONRequestBody defines body for CreateClient for application/json ContentType.
type CreateClientJSONRequestBody = ClientCreate
@@ -403,6 +413,18 @@ type ServerInterface interface {
// Check export state.
// (GET /export/{id})
ExportState(ctx echo.Context, id ExportID) error
// Get the home page menu
// (GET /home)
GetHomePage(ctx echo.Context) error
// Login to the application
// (GET /login)
Login(ctx echo.Context) error
// OAuth2 callback endpoint
// (GET /login-callback)
LoginCallback(ctx echo.Context, params LoginCallbackParams) error
// Logout from the application
// (GET /logout)
Logout(ctx echo.Context) error
// List queries
// (GET /query)
ListQueries(ctx echo.Context) error
@@ -598,6 +620,64 @@ func (w *ServerInterfaceWrapper) ExportState(ctx echo.Context) error {
return err
}
// GetHomePage converts echo context to params.
func (w *ServerInterfaceWrapper) GetHomePage(ctx echo.Context) error {
var err error
ctx.Set(PlaceholderAuthScopes, []string{})
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.GetHomePage(ctx)
return err
}
// Login converts echo context to params.
func (w *ServerInterfaceWrapper) Login(ctx echo.Context) error {
var err error
ctx.Set(CognitoAuthScopes, []string{"openid", "email", "profile"})
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.Login(ctx)
return err
}
// LoginCallback converts echo context to params.
func (w *ServerInterfaceWrapper) LoginCallback(ctx echo.Context) error {
var err error
// Parameter object where we will unmarshal all parameters from the context
var params LoginCallbackParams
// ------------- Required query parameter "code" -------------
err = runtime.BindQueryParameter("form", true, true, "code", ctx.QueryParams(), &params.Code)
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter code: %s", err))
}
// ------------- Required query parameter "state" -------------
err = runtime.BindQueryParameter("form", true, true, "state", ctx.QueryParams(), &params.State)
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter state: %s", err))
}
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.LoginCallback(ctx, params)
return err
}
// Logout converts echo context to params.
func (w *ServerInterfaceWrapper) Logout(ctx echo.Context) error {
var err error
ctx.Set(PlaceholderAuthScopes, []string{})
// Invoke the callback with all the unmarshaled arguments
err = w.Handler.Logout(ctx)
return err
}
// ListQueries converts echo context to params.
func (w *ServerInterfaceWrapper) ListQueries(ctx echo.Context) error {
var err error
@@ -712,6 +792,10 @@ func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL
router.GET(baseURL+"/client/:id/status", wrapper.GetStatusByClientId)
router.GET(baseURL+"/document/:id", wrapper.GetDocument)
router.GET(baseURL+"/export/:id", wrapper.ExportState)
router.GET(baseURL+"/home", wrapper.GetHomePage)
router.GET(baseURL+"/login", wrapper.Login)
router.GET(baseURL+"/login-callback", wrapper.LoginCallback)
router.GET(baseURL+"/logout", wrapper.Logout)
router.GET(baseURL+"/query", wrapper.ListQueries)
router.POST(baseURL+"/query", wrapper.CreateQuery)
router.GET(baseURL+"/query/:id", wrapper.GetQuery)
@@ -723,66 +807,78 @@ func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL
// Base64 encoded, gzipped, json marshaled Swagger object
var swaggerSpec = []string{
"H4sIAAAAAAAC/+xcW3PbRrL+K1M4eTrhndT11KlaRnIc7tqyI8lb2bK0rCHQJCcLYKiZgWRGxf++NTfc",
"QYI0qeSBVX4QiLl093R/3dPd8Kvj0mBBQwgFdy5fnTlgD5j68xYL+EACIuSDB9x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IAx8",
"dZIjaJ4OYxpKARylFDVgyZD7nZ7LefQA+d6znoum86n2Tti3y0/2noKzE8dPByWMrKHIWT5L6ycnU+7d",
"kFca8nOjRLu6sVyjhmfJR5ZHVK7HqKUz65mL1ettvOnjMJxg/49aY/+I4yA0pv5V9tJD9h0UJMxe0DTW",
"Ywok6BJ8IDatLlC29I+SKP5m3jlwHCB48uc4ngFHxCAw/QNiXuMtZ1bySqiqstVWjG7ZTYrVl1GQZLuV",
"PzO3yhFuhs3/wc3vnebJ7W1z7P7Fwkbl6EElbelUlALOri5/kUoVElEyJlZJVi5cp641wnY7vcHWwt5t",
"i0w5I0R4KqeTlXq0rWyJVBZX63t7OWT9Wx1m/X9CnwKglB0d4mBBSaGy6wQUmohaIPlEZxoOZEaHaKI3",
"1lpx+nc/VDEJOFdGEwd1sVSPk8rkhAcpyCuiqexfZQoyHc2ZcppCvM56Qyvgu83u+aBCL6XC+21i4729",
"lrWW4xAWb5Ll7y+rK8M+IwIYwe7TM3u3bc8nZnYYx85jWJ7B+7Z7D2dl9+k6W5tTlOHhxUhvtTcg++pb",
"B1tzfX8zqcI+TqTy981ewvS9z8n2D3A6pVnc7yTfNyb5WitweEYKxS9g92p/WU3uzZxjT+Br7gvX2dp7",
"yX6PlLLUAAo8siLublXiTG9xbcfnzQH3BnTeveP1ajKvpt/aH7RIf5/MXDxL7wG+gN+rLf6d3vuG9N6N",
"kbUtzN3jVziEM4X5oH63QAGzvq2cxPpwtS6bKf6ITolkA1zs3T3yl7FrfKR0+3obnk1nH8KaC9MuabWM",
"PAnfKXC7ZtdI1a52MdUne3BXJS8YDRI/vYmo7lUmjluhPo3aD13lYmaMck9frZPILDtU6CqTbMWG4FmR",
"sEivqJYfa7qxTNN8T2X26aadZZzUtK/KofmmfWU7KtNTqvlNe9Anobkeikegm3aDC5ehs97yRYXnu+f/",
"CwAA///aY3I0l2cAAA==",
}
// GetSwagger returns the content of the embedded swagger specification file
+32
View File
@@ -0,0 +1,32 @@
package queryapi
import (
"net/http"
"github.com/labstack/echo/v4"
)
func (s *Controllers) Login(ctx echo.Context) error {
// Redirect to Cognito login page
// This is a placeholder implementation - you'll need to implement the actual Cognito redirect logic
loginURL := "https://doczy.auth.us-east-1.amazoncognito.com/oauth2/authorize"
return ctx.Redirect(http.StatusFound, loginURL)
}
func (s *Controllers) LoginCallback(ctx echo.Context, params LoginCallbackParams) error {
// Handle OAuth2 callback
// This is a placeholder implementation - you'll need to implement the actual token exchange logic
redirectURL := "https://doczy.com" // Replace with your actual redirect URL
return ctx.Redirect(http.StatusFound, redirectURL)
}
func (s *Controllers) Logout(ctx echo.Context) error {
// Handle logout
// This is a placeholder implementation - you'll need to implement the actual logout logic
logoutURL := "https://doczy.auth.us-east-1.amazoncognito.com/logout"
return ctx.Redirect(http.StatusFound, logoutURL)
}
func (s *Controllers) GetHomePage(ctx echo.Context) error {
return HomeHandler(ctx)
}
+202
View File
@@ -0,0 +1,202 @@
package queryapi
import (
"context"
"fmt"
"net/http"
"strings"
"github.com/labstack/echo/v4"
"github.com/lestrrat-go/jwx/v2/jwt"
)
// Constants for route paths
const (
LOGIN_CALLBACK_PATH = "/login-callback"
)
// endpointsList keeps track of registered endpoints
// This list should be kept in sync with actual route registrations
var endpointsList = []string{
// Auth Service Endpoints
"/login",
LOGIN_CALLBACK_PATH,
"/logout",
"/home",
// Client Service Endpoints
"/client",
"/client/:id",
"/client/:id/status",
"/client/:id/collector",
"/client/:id/documents",
"/client/:id/export",
// Query API Endpoints
"/query",
"/query/:id",
"/query/:id/test",
// Document Service Endpoints
"/document/:id",
// Export Service Endpoints
"/export/:id",
}
// homeHandler renders a simple HTML page with links to all endpoints
// and displays authentication status based on JWT token
func HomeHandler(c echo.Context) error {
var linksHTML string
baseURL := "http://localhost:8080"
// Create list items for each endpoint
for _, endpoint := range endpointsList {
// Skip endpoints with path parameters for direct linking
if strings.Contains(endpoint, ":") {
displayPath := strings.Replace(endpoint, ":id", "{id}", -1)
linksHTML += fmt.Sprintf("<li>%s (requires parameter)</li>\n", displayPath)
} else {
linksHTML += fmt.Sprintf("<li><a href=\"%s%s\">%s</a></li>\n", baseURL, endpoint, endpoint)
}
}
// Check if user is authenticated by looking for token in cookie
tokenCookie, err := c.Cookie("auth_token")
isAuthenticated := (err == nil && tokenCookie.Value != "")
// Variables for user info
username := ""
email := ""
var userGroups []string
// If authenticated, try to decode the JWT token to get user info
if isAuthenticated {
// Parse the JWT token without verification (just to extract info for display)
// In a production application, you would want to verify the token here as well
token, _ := jwt.Parse([]byte(tokenCookie.Value), jwt.WithVerify(false))
if token != nil {
claims, _ := token.AsMap(context.Background())
username, _ = claims["cognito:username"].(string)
email, _ = claims["email"].(string)
// Try to extract groups
if rawGroups, ok := claims["cognito:groups"]; ok {
if groups, ok := rawGroups.([]interface{}); ok {
userGroups = make([]string, len(groups))
for i, g := range groups {
userGroups[i] = fmt.Sprint(g)
}
}
}
}
}
// Create authentication status section
var authStatusHTML string
if isAuthenticated {
authStatusHTML = fmt.Sprintf(`
<div class="auth-status authenticated">
<h2>Authentication Status: Authenticated</h2>
<p><strong>Username:</strong> %s</p>
<p><strong>Email:</strong> %s</p>
<p><strong>Groups:</strong> %s</p>
<p><a href="/logout" class="logout-btn">Logout</a></p>
</div>
`, username, email, strings.Join(userGroups, ", "))
} else {
authStatusHTML = `
<div class="auth-status unauthenticated">
<h2>Authentication Status: Not Authenticated</h2>
<p>You are not currently logged in.</p>
<p><a href="/login" class="login-btn">Login</a></p>
</div>
`
}
// Create the complete HTML page
html := fmt.Sprintf(`
<!DOCTYPE html>
<html>
<head>
<title>Doczy Home</title>
<style>
body {
font-family: Arial, sans-serif;
line-height: 1.6;
margin: 20px;
max-width: 800px;
margin: 0 auto;
padding: 20px;
}
h1, h2 {
color: #333;
border-bottom: 1px solid #ddd;
padding-bottom: 10px;
}
ul {
margin-top: 20px;
}
li {
margin-bottom: 8px;
}
a {
color: #0066cc;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
.note {
background-color: #f8f9fa;
border-left: 4px solid #5bc0de;
padding: 10px 15px;
margin-top: 20px;
font-size: 0.9em;
}
.auth-status {
margin: 20px 0;
padding: 15px;
border-radius: 5px;
}
.authenticated {
background-color: #dff0d8;
border: 1px solid #d6e9c6;
}
.unauthenticated {
background-color: #f2dede;
border: 1px solid #ebccd1;
}
.login-btn, .logout-btn {
display: inline-block;
padding: 8px 16px;
background-color: #0066cc;
color: white;
border-radius: 4px;
text-decoration: none;
margin-top: 10px;
}
.logout-btn {
background-color: #d9534f;
}
</style>
</head>
<body>
<h1>Doczy Home</h1>
%s
<h2>Available Endpoints</h2>
<ul>
%s
</ul>
<div class="note">
<p><strong>Note:</strong> This is a debugging page. Some endpoints require authentication or specific permissions.</p>
</div>
</body>
</html>
`, authStatusHTML, linksHTML)
return c.HTML(http.StatusOK, html)
}
+293
View File
@@ -622,6 +622,79 @@ func (_c *MockClientInterface_GetDocument_Call) RunAndReturn(run func(context.Co
return _c
}
// GetHomePage provides a mock function with given fields: ctx, reqEditors
func (_m *MockClientInterface) GetHomePage(ctx context.Context, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) {
_va := make([]interface{}, len(reqEditors))
for _i := range reqEditors {
_va[_i] = reqEditors[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for GetHomePage")
}
var r0 *http.Response
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, ...queryapi.RequestEditorFn) (*http.Response, error)); ok {
return rf(ctx, reqEditors...)
}
if rf, ok := ret.Get(0).(func(context.Context, ...queryapi.RequestEditorFn) *http.Response); ok {
r0 = rf(ctx, reqEditors...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*http.Response)
}
}
if rf, ok := ret.Get(1).(func(context.Context, ...queryapi.RequestEditorFn) error); ok {
r1 = rf(ctx, reqEditors...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockClientInterface_GetHomePage_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetHomePage'
type MockClientInterface_GetHomePage_Call struct {
*mock.Call
}
// GetHomePage is a helper method to define mock.On call
// - ctx context.Context
// - reqEditors ...queryapi.RequestEditorFn
func (_e *MockClientInterface_Expecter) GetHomePage(ctx interface{}, reqEditors ...interface{}) *MockClientInterface_GetHomePage_Call {
return &MockClientInterface_GetHomePage_Call{Call: _e.mock.On("GetHomePage",
append([]interface{}{ctx}, reqEditors...)...)}
}
func (_c *MockClientInterface_GetHomePage_Call) Run(run func(ctx context.Context, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_GetHomePage_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]queryapi.RequestEditorFn, len(args)-1)
for i, a := range args[1:] {
if a != nil {
variadicArgs[i] = a.(queryapi.RequestEditorFn)
}
}
run(args[0].(context.Context), variadicArgs...)
})
return _c
}
func (_c *MockClientInterface_GetHomePage_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_GetHomePage_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockClientInterface_GetHomePage_Call) RunAndReturn(run func(context.Context, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_GetHomePage_Call {
_c.Call.Return(run)
return _c
}
// GetQuery provides a mock function with given fields: ctx, id, reqEditors
func (_m *MockClientInterface) GetQuery(ctx context.Context, id uuid.UUID, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) {
_va := make([]interface{}, len(reqEditors))
@@ -917,6 +990,226 @@ func (_c *MockClientInterface_ListQueries_Call) RunAndReturn(run func(context.Co
return _c
}
// Login provides a mock function with given fields: ctx, reqEditors
func (_m *MockClientInterface) Login(ctx context.Context, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) {
_va := make([]interface{}, len(reqEditors))
for _i := range reqEditors {
_va[_i] = reqEditors[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for Login")
}
var r0 *http.Response
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, ...queryapi.RequestEditorFn) (*http.Response, error)); ok {
return rf(ctx, reqEditors...)
}
if rf, ok := ret.Get(0).(func(context.Context, ...queryapi.RequestEditorFn) *http.Response); ok {
r0 = rf(ctx, reqEditors...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*http.Response)
}
}
if rf, ok := ret.Get(1).(func(context.Context, ...queryapi.RequestEditorFn) error); ok {
r1 = rf(ctx, reqEditors...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockClientInterface_Login_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Login'
type MockClientInterface_Login_Call struct {
*mock.Call
}
// Login is a helper method to define mock.On call
// - ctx context.Context
// - reqEditors ...queryapi.RequestEditorFn
func (_e *MockClientInterface_Expecter) Login(ctx interface{}, reqEditors ...interface{}) *MockClientInterface_Login_Call {
return &MockClientInterface_Login_Call{Call: _e.mock.On("Login",
append([]interface{}{ctx}, reqEditors...)...)}
}
func (_c *MockClientInterface_Login_Call) Run(run func(ctx context.Context, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_Login_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]queryapi.RequestEditorFn, len(args)-1)
for i, a := range args[1:] {
if a != nil {
variadicArgs[i] = a.(queryapi.RequestEditorFn)
}
}
run(args[0].(context.Context), variadicArgs...)
})
return _c
}
func (_c *MockClientInterface_Login_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_Login_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockClientInterface_Login_Call) RunAndReturn(run func(context.Context, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_Login_Call {
_c.Call.Return(run)
return _c
}
// LoginCallback provides a mock function with given fields: ctx, params, reqEditors
func (_m *MockClientInterface) LoginCallback(ctx context.Context, params *queryapi.LoginCallbackParams, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) {
_va := make([]interface{}, len(reqEditors))
for _i := range reqEditors {
_va[_i] = reqEditors[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, params)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for LoginCallback")
}
var r0 *http.Response
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *queryapi.LoginCallbackParams, ...queryapi.RequestEditorFn) (*http.Response, error)); ok {
return rf(ctx, params, reqEditors...)
}
if rf, ok := ret.Get(0).(func(context.Context, *queryapi.LoginCallbackParams, ...queryapi.RequestEditorFn) *http.Response); ok {
r0 = rf(ctx, params, reqEditors...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*http.Response)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *queryapi.LoginCallbackParams, ...queryapi.RequestEditorFn) error); ok {
r1 = rf(ctx, params, reqEditors...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockClientInterface_LoginCallback_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LoginCallback'
type MockClientInterface_LoginCallback_Call struct {
*mock.Call
}
// LoginCallback is a helper method to define mock.On call
// - ctx context.Context
// - params *queryapi.LoginCallbackParams
// - reqEditors ...queryapi.RequestEditorFn
func (_e *MockClientInterface_Expecter) LoginCallback(ctx interface{}, params interface{}, reqEditors ...interface{}) *MockClientInterface_LoginCallback_Call {
return &MockClientInterface_LoginCallback_Call{Call: _e.mock.On("LoginCallback",
append([]interface{}{ctx, params}, reqEditors...)...)}
}
func (_c *MockClientInterface_LoginCallback_Call) Run(run func(ctx context.Context, params *queryapi.LoginCallbackParams, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_LoginCallback_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]queryapi.RequestEditorFn, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(queryapi.RequestEditorFn)
}
}
run(args[0].(context.Context), args[1].(*queryapi.LoginCallbackParams), variadicArgs...)
})
return _c
}
func (_c *MockClientInterface_LoginCallback_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_LoginCallback_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockClientInterface_LoginCallback_Call) RunAndReturn(run func(context.Context, *queryapi.LoginCallbackParams, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_LoginCallback_Call {
_c.Call.Return(run)
return _c
}
// Logout provides a mock function with given fields: ctx, reqEditors
func (_m *MockClientInterface) Logout(ctx context.Context, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) {
_va := make([]interface{}, len(reqEditors))
for _i := range reqEditors {
_va[_i] = reqEditors[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for Logout")
}
var r0 *http.Response
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, ...queryapi.RequestEditorFn) (*http.Response, error)); ok {
return rf(ctx, reqEditors...)
}
if rf, ok := ret.Get(0).(func(context.Context, ...queryapi.RequestEditorFn) *http.Response); ok {
r0 = rf(ctx, reqEditors...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*http.Response)
}
}
if rf, ok := ret.Get(1).(func(context.Context, ...queryapi.RequestEditorFn) error); ok {
r1 = rf(ctx, reqEditors...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockClientInterface_Logout_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Logout'
type MockClientInterface_Logout_Call struct {
*mock.Call
}
// Logout is a helper method to define mock.On call
// - ctx context.Context
// - reqEditors ...queryapi.RequestEditorFn
func (_e *MockClientInterface_Expecter) Logout(ctx interface{}, reqEditors ...interface{}) *MockClientInterface_Logout_Call {
return &MockClientInterface_Logout_Call{Call: _e.mock.On("Logout",
append([]interface{}{ctx}, reqEditors...)...)}
}
func (_c *MockClientInterface_Logout_Call) Run(run func(ctx context.Context, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_Logout_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]queryapi.RequestEditorFn, len(args)-1)
for i, a := range args[1:] {
if a != nil {
variadicArgs[i] = a.(queryapi.RequestEditorFn)
}
}
run(args[0].(context.Context), variadicArgs...)
})
return _c
}
func (_c *MockClientInterface_Logout_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_Logout_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockClientInterface_Logout_Call) RunAndReturn(run func(context.Context, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_Logout_Call {
_c.Call.Return(run)
return _c
}
// SetCollectorByClientId provides a mock function with given fields: ctx, id, body, reqEditors
func (_m *MockClientInterface) SetCollectorByClientId(ctx context.Context, id string, body queryapi.CollectorSet, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) {
_va := make([]interface{}, len(reqEditors))
@@ -620,6 +620,79 @@ func (_c *MockClientWithResponsesInterface_GetDocumentWithResponse_Call) RunAndR
return _c
}
// GetHomePageWithResponse provides a mock function with given fields: ctx, reqEditors
func (_m *MockClientWithResponsesInterface) GetHomePageWithResponse(ctx context.Context, reqEditors ...queryapi.RequestEditorFn) (*queryapi.GetHomePageResponse, error) {
_va := make([]interface{}, len(reqEditors))
for _i := range reqEditors {
_va[_i] = reqEditors[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for GetHomePageWithResponse")
}
var r0 *queryapi.GetHomePageResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, ...queryapi.RequestEditorFn) (*queryapi.GetHomePageResponse, error)); ok {
return rf(ctx, reqEditors...)
}
if rf, ok := ret.Get(0).(func(context.Context, ...queryapi.RequestEditorFn) *queryapi.GetHomePageResponse); ok {
r0 = rf(ctx, reqEditors...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*queryapi.GetHomePageResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, ...queryapi.RequestEditorFn) error); ok {
r1 = rf(ctx, reqEditors...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockClientWithResponsesInterface_GetHomePageWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetHomePageWithResponse'
type MockClientWithResponsesInterface_GetHomePageWithResponse_Call struct {
*mock.Call
}
// GetHomePageWithResponse is a helper method to define mock.On call
// - ctx context.Context
// - reqEditors ...queryapi.RequestEditorFn
func (_e *MockClientWithResponsesInterface_Expecter) GetHomePageWithResponse(ctx interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_GetHomePageWithResponse_Call {
return &MockClientWithResponsesInterface_GetHomePageWithResponse_Call{Call: _e.mock.On("GetHomePageWithResponse",
append([]interface{}{ctx}, reqEditors...)...)}
}
func (_c *MockClientWithResponsesInterface_GetHomePageWithResponse_Call) Run(run func(ctx context.Context, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_GetHomePageWithResponse_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]queryapi.RequestEditorFn, len(args)-1)
for i, a := range args[1:] {
if a != nil {
variadicArgs[i] = a.(queryapi.RequestEditorFn)
}
}
run(args[0].(context.Context), variadicArgs...)
})
return _c
}
func (_c *MockClientWithResponsesInterface_GetHomePageWithResponse_Call) Return(_a0 *queryapi.GetHomePageResponse, _a1 error) *MockClientWithResponsesInterface_GetHomePageWithResponse_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockClientWithResponsesInterface_GetHomePageWithResponse_Call) RunAndReturn(run func(context.Context, ...queryapi.RequestEditorFn) (*queryapi.GetHomePageResponse, error)) *MockClientWithResponsesInterface_GetHomePageWithResponse_Call {
_c.Call.Return(run)
return _c
}
// GetQueryWithResponse provides a mock function with given fields: ctx, id, reqEditors
func (_m *MockClientWithResponsesInterface) GetQueryWithResponse(ctx context.Context, id uuid.UUID, reqEditors ...queryapi.RequestEditorFn) (*queryapi.GetQueryResponse, error) {
_va := make([]interface{}, len(reqEditors))
@@ -915,6 +988,226 @@ func (_c *MockClientWithResponsesInterface_ListQueriesWithResponse_Call) RunAndR
return _c
}
// LoginCallbackWithResponse provides a mock function with given fields: ctx, params, reqEditors
func (_m *MockClientWithResponsesInterface) LoginCallbackWithResponse(ctx context.Context, params *queryapi.LoginCallbackParams, reqEditors ...queryapi.RequestEditorFn) (*queryapi.LoginCallbackResponse, error) {
_va := make([]interface{}, len(reqEditors))
for _i := range reqEditors {
_va[_i] = reqEditors[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, params)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for LoginCallbackWithResponse")
}
var r0 *queryapi.LoginCallbackResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *queryapi.LoginCallbackParams, ...queryapi.RequestEditorFn) (*queryapi.LoginCallbackResponse, error)); ok {
return rf(ctx, params, reqEditors...)
}
if rf, ok := ret.Get(0).(func(context.Context, *queryapi.LoginCallbackParams, ...queryapi.RequestEditorFn) *queryapi.LoginCallbackResponse); ok {
r0 = rf(ctx, params, reqEditors...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*queryapi.LoginCallbackResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *queryapi.LoginCallbackParams, ...queryapi.RequestEditorFn) error); ok {
r1 = rf(ctx, params, reqEditors...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockClientWithResponsesInterface_LoginCallbackWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LoginCallbackWithResponse'
type MockClientWithResponsesInterface_LoginCallbackWithResponse_Call struct {
*mock.Call
}
// LoginCallbackWithResponse is a helper method to define mock.On call
// - ctx context.Context
// - params *queryapi.LoginCallbackParams
// - reqEditors ...queryapi.RequestEditorFn
func (_e *MockClientWithResponsesInterface_Expecter) LoginCallbackWithResponse(ctx interface{}, params interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_LoginCallbackWithResponse_Call {
return &MockClientWithResponsesInterface_LoginCallbackWithResponse_Call{Call: _e.mock.On("LoginCallbackWithResponse",
append([]interface{}{ctx, params}, reqEditors...)...)}
}
func (_c *MockClientWithResponsesInterface_LoginCallbackWithResponse_Call) Run(run func(ctx context.Context, params *queryapi.LoginCallbackParams, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_LoginCallbackWithResponse_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]queryapi.RequestEditorFn, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(queryapi.RequestEditorFn)
}
}
run(args[0].(context.Context), args[1].(*queryapi.LoginCallbackParams), variadicArgs...)
})
return _c
}
func (_c *MockClientWithResponsesInterface_LoginCallbackWithResponse_Call) Return(_a0 *queryapi.LoginCallbackResponse, _a1 error) *MockClientWithResponsesInterface_LoginCallbackWithResponse_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockClientWithResponsesInterface_LoginCallbackWithResponse_Call) RunAndReturn(run func(context.Context, *queryapi.LoginCallbackParams, ...queryapi.RequestEditorFn) (*queryapi.LoginCallbackResponse, error)) *MockClientWithResponsesInterface_LoginCallbackWithResponse_Call {
_c.Call.Return(run)
return _c
}
// LoginWithResponse provides a mock function with given fields: ctx, reqEditors
func (_m *MockClientWithResponsesInterface) LoginWithResponse(ctx context.Context, reqEditors ...queryapi.RequestEditorFn) (*queryapi.LoginResponse, error) {
_va := make([]interface{}, len(reqEditors))
for _i := range reqEditors {
_va[_i] = reqEditors[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for LoginWithResponse")
}
var r0 *queryapi.LoginResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, ...queryapi.RequestEditorFn) (*queryapi.LoginResponse, error)); ok {
return rf(ctx, reqEditors...)
}
if rf, ok := ret.Get(0).(func(context.Context, ...queryapi.RequestEditorFn) *queryapi.LoginResponse); ok {
r0 = rf(ctx, reqEditors...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*queryapi.LoginResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, ...queryapi.RequestEditorFn) error); ok {
r1 = rf(ctx, reqEditors...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockClientWithResponsesInterface_LoginWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LoginWithResponse'
type MockClientWithResponsesInterface_LoginWithResponse_Call struct {
*mock.Call
}
// LoginWithResponse is a helper method to define mock.On call
// - ctx context.Context
// - reqEditors ...queryapi.RequestEditorFn
func (_e *MockClientWithResponsesInterface_Expecter) LoginWithResponse(ctx interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_LoginWithResponse_Call {
return &MockClientWithResponsesInterface_LoginWithResponse_Call{Call: _e.mock.On("LoginWithResponse",
append([]interface{}{ctx}, reqEditors...)...)}
}
func (_c *MockClientWithResponsesInterface_LoginWithResponse_Call) Run(run func(ctx context.Context, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_LoginWithResponse_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]queryapi.RequestEditorFn, len(args)-1)
for i, a := range args[1:] {
if a != nil {
variadicArgs[i] = a.(queryapi.RequestEditorFn)
}
}
run(args[0].(context.Context), variadicArgs...)
})
return _c
}
func (_c *MockClientWithResponsesInterface_LoginWithResponse_Call) Return(_a0 *queryapi.LoginResponse, _a1 error) *MockClientWithResponsesInterface_LoginWithResponse_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockClientWithResponsesInterface_LoginWithResponse_Call) RunAndReturn(run func(context.Context, ...queryapi.RequestEditorFn) (*queryapi.LoginResponse, error)) *MockClientWithResponsesInterface_LoginWithResponse_Call {
_c.Call.Return(run)
return _c
}
// LogoutWithResponse provides a mock function with given fields: ctx, reqEditors
func (_m *MockClientWithResponsesInterface) LogoutWithResponse(ctx context.Context, reqEditors ...queryapi.RequestEditorFn) (*queryapi.LogoutResponse, error) {
_va := make([]interface{}, len(reqEditors))
for _i := range reqEditors {
_va[_i] = reqEditors[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for LogoutWithResponse")
}
var r0 *queryapi.LogoutResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, ...queryapi.RequestEditorFn) (*queryapi.LogoutResponse, error)); ok {
return rf(ctx, reqEditors...)
}
if rf, ok := ret.Get(0).(func(context.Context, ...queryapi.RequestEditorFn) *queryapi.LogoutResponse); ok {
r0 = rf(ctx, reqEditors...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*queryapi.LogoutResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, ...queryapi.RequestEditorFn) error); ok {
r1 = rf(ctx, reqEditors...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockClientWithResponsesInterface_LogoutWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LogoutWithResponse'
type MockClientWithResponsesInterface_LogoutWithResponse_Call struct {
*mock.Call
}
// LogoutWithResponse is a helper method to define mock.On call
// - ctx context.Context
// - reqEditors ...queryapi.RequestEditorFn
func (_e *MockClientWithResponsesInterface_Expecter) LogoutWithResponse(ctx interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_LogoutWithResponse_Call {
return &MockClientWithResponsesInterface_LogoutWithResponse_Call{Call: _e.mock.On("LogoutWithResponse",
append([]interface{}{ctx}, reqEditors...)...)}
}
func (_c *MockClientWithResponsesInterface_LogoutWithResponse_Call) Run(run func(ctx context.Context, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_LogoutWithResponse_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]queryapi.RequestEditorFn, len(args)-1)
for i, a := range args[1:] {
if a != nil {
variadicArgs[i] = a.(queryapi.RequestEditorFn)
}
}
run(args[0].(context.Context), variadicArgs...)
})
return _c
}
func (_c *MockClientWithResponsesInterface_LogoutWithResponse_Call) Return(_a0 *queryapi.LogoutResponse, _a1 error) *MockClientWithResponsesInterface_LogoutWithResponse_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockClientWithResponsesInterface_LogoutWithResponse_Call) RunAndReturn(run func(context.Context, ...queryapi.RequestEditorFn) (*queryapi.LogoutResponse, error)) *MockClientWithResponsesInterface_LogoutWithResponse_Call {
_c.Call.Return(run)
return _c
}
// SetCollectorByClientIdWithBodyWithResponse provides a mock function with given fields: ctx, id, contentType, body, reqEditors
func (_m *MockClientWithResponsesInterface) SetCollectorByClientIdWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn) (*queryapi.SetCollectorByClientIdResponse, error) {
_va := make([]interface{}, len(reqEditors))
+544
View File
@@ -19,6 +19,7 @@ import (
)
const (
CognitoAuthScopes = "cognitoAuth.Scopes"
PlaceholderAuthScopes = "placeholderAuth.Scopes"
)
@@ -348,6 +349,15 @@ type TooManyRequests = ErrorMessage
// Unauthorized Description of error
type Unauthorized = ErrorMessage
// LoginCallbackParams defines parameters for LoginCallback.
type LoginCallbackParams struct {
// Code Authorization code from Cognito
Code string `form:"code" json:"code"`
// State State parameter for CSRF protection
State string `form:"state" json:"state"`
}
// CreateClientJSONRequestBody defines body for CreateClient for application/json ContentType.
type CreateClientJSONRequestBody = ClientCreate
@@ -480,6 +490,18 @@ type ClientInterface interface {
// ExportState request
ExportState(ctx context.Context, id ExportID, reqEditors ...RequestEditorFn) (*http.Response, error)
// GetHomePage request
GetHomePage(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
// Login request
Login(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
// LoginCallback request
LoginCallback(ctx context.Context, params *LoginCallbackParams, reqEditors ...RequestEditorFn) (*http.Response, error)
// Logout request
Logout(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
// ListQueries request
ListQueries(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
@@ -670,6 +692,54 @@ func (c *Client) ExportState(ctx context.Context, id ExportID, reqEditors ...Req
return c.Client.Do(req)
}
func (c *Client) GetHomePage(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewGetHomePageRequest(c.Server)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) Login(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewLoginRequest(c.Server)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) LoginCallback(ctx context.Context, params *LoginCallbackParams, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewLoginCallbackRequest(c.Server, params)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) Logout(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewLogoutRequest(c.Server)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) ListQueries(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewListQueriesRequest(c.Server)
if err != nil {
@@ -1151,6 +1221,144 @@ func NewExportStateRequest(server string, id ExportID) (*http.Request, error) {
return req, nil
}
// NewGetHomePageRequest generates requests for GetHomePage
func NewGetHomePageRequest(server string) (*http.Request, error) {
var err error
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/home")
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest("GET", queryURL.String(), nil)
if err != nil {
return nil, err
}
return req, nil
}
// NewLoginRequest generates requests for Login
func NewLoginRequest(server string) (*http.Request, error) {
var err error
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/login")
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest("GET", queryURL.String(), nil)
if err != nil {
return nil, err
}
return req, nil
}
// NewLoginCallbackRequest generates requests for LoginCallback
func NewLoginCallbackRequest(server string, params *LoginCallbackParams) (*http.Request, error) {
var err error
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/login-callback")
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
if params != nil {
queryValues := queryURL.Query()
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "code", runtime.ParamLocationQuery, params.Code); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "state", runtime.ParamLocationQuery, params.State); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
queryURL.RawQuery = queryValues.Encode()
}
req, err := http.NewRequest("GET", queryURL.String(), nil)
if err != nil {
return nil, err
}
return req, nil
}
// NewLogoutRequest generates requests for Logout
func NewLogoutRequest(server string) (*http.Request, error) {
var err error
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/logout")
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest("GET", queryURL.String(), nil)
if err != nil {
return nil, err
}
return req, nil
}
// NewListQueriesRequest generates requests for ListQueries
func NewListQueriesRequest(server string) (*http.Request, error) {
var err error
@@ -1427,6 +1635,18 @@ type ClientWithResponsesInterface interface {
// ExportStateWithResponse request
ExportStateWithResponse(ctx context.Context, id ExportID, reqEditors ...RequestEditorFn) (*ExportStateResponse, error)
// GetHomePageWithResponse request
GetHomePageWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetHomePageResponse, error)
// LoginWithResponse request
LoginWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*LoginResponse, error)
// LoginCallbackWithResponse request
LoginCallbackWithResponse(ctx context.Context, params *LoginCallbackParams, reqEditors ...RequestEditorFn) (*LoginCallbackResponse, error)
// LogoutWithResponse request
LogoutWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*LogoutResponse, error)
// ListQueriesWithResponse request
ListQueriesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListQueriesResponse, error)
@@ -1707,6 +1927,106 @@ func (r ExportStateResponse) StatusCode() int {
return 0
}
type GetHomePageResponse struct {
Body []byte
HTTPResponse *http.Response
JSON400 *InvalidRequest
JSON401 *Unauthorized
JSON429 *TooManyRequests
JSON500 *InternalError
}
// Status returns HTTPResponse.Status
func (r GetHomePageResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r GetHomePageResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
type LoginResponse struct {
Body []byte
HTTPResponse *http.Response
JSON400 *InvalidRequest
JSON401 *Unauthorized
JSON429 *TooManyRequests
JSON500 *InternalError
}
// Status returns HTTPResponse.Status
func (r LoginResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r LoginResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
type LoginCallbackResponse struct {
Body []byte
HTTPResponse *http.Response
JSON400 *InvalidRequest
JSON401 *Unauthorized
JSON429 *TooManyRequests
JSON500 *InternalError
}
// Status returns HTTPResponse.Status
func (r LoginCallbackResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r LoginCallbackResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
type LogoutResponse struct {
Body []byte
HTTPResponse *http.Response
JSON400 *InvalidRequest
JSON401 *Unauthorized
JSON429 *TooManyRequests
JSON500 *InternalError
}
// Status returns HTTPResponse.Status
func (r LogoutResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r LogoutResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
type ListQueriesResponse struct {
Body []byte
HTTPResponse *http.Response
@@ -1958,6 +2278,42 @@ func (c *ClientWithResponses) ExportStateWithResponse(ctx context.Context, id Ex
return ParseExportStateResponse(rsp)
}
// GetHomePageWithResponse request returning *GetHomePageResponse
func (c *ClientWithResponses) GetHomePageWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetHomePageResponse, error) {
rsp, err := c.GetHomePage(ctx, reqEditors...)
if err != nil {
return nil, err
}
return ParseGetHomePageResponse(rsp)
}
// LoginWithResponse request returning *LoginResponse
func (c *ClientWithResponses) LoginWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*LoginResponse, error) {
rsp, err := c.Login(ctx, reqEditors...)
if err != nil {
return nil, err
}
return ParseLoginResponse(rsp)
}
// LoginCallbackWithResponse request returning *LoginCallbackResponse
func (c *ClientWithResponses) LoginCallbackWithResponse(ctx context.Context, params *LoginCallbackParams, reqEditors ...RequestEditorFn) (*LoginCallbackResponse, error) {
rsp, err := c.LoginCallback(ctx, params, reqEditors...)
if err != nil {
return nil, err
}
return ParseLoginCallbackResponse(rsp)
}
// LogoutWithResponse request returning *LogoutResponse
func (c *ClientWithResponses) LogoutWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*LogoutResponse, error) {
rsp, err := c.Logout(ctx, reqEditors...)
if err != nil {
return nil, err
}
return ParseLogoutResponse(rsp)
}
// ListQueriesWithResponse request returning *ListQueriesResponse
func (c *ClientWithResponses) ListQueriesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListQueriesResponse, error) {
rsp, err := c.ListQueries(ctx, reqEditors...)
@@ -2553,6 +2909,194 @@ func ParseExportStateResponse(rsp *http.Response) (*ExportStateResponse, error)
return response, nil
}
// ParseGetHomePageResponse parses an HTTP response from a GetHomePageWithResponse call
func ParseGetHomePageResponse(rsp *http.Response) (*GetHomePageResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &GetHomePageResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
var dest InvalidRequest
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON400 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401:
var dest Unauthorized
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON401 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 429:
var dest TooManyRequests
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON429 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500:
var dest InternalError
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON500 = &dest
}
return response, nil
}
// ParseLoginResponse parses an HTTP response from a LoginWithResponse call
func ParseLoginResponse(rsp *http.Response) (*LoginResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &LoginResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
var dest InvalidRequest
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON400 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401:
var dest Unauthorized
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON401 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 429:
var dest TooManyRequests
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON429 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500:
var dest InternalError
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON500 = &dest
}
return response, nil
}
// ParseLoginCallbackResponse parses an HTTP response from a LoginCallbackWithResponse call
func ParseLoginCallbackResponse(rsp *http.Response) (*LoginCallbackResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &LoginCallbackResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
var dest InvalidRequest
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON400 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401:
var dest Unauthorized
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON401 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 429:
var dest TooManyRequests
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON429 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500:
var dest InternalError
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON500 = &dest
}
return response, nil
}
// ParseLogoutResponse parses an HTTP response from a LogoutWithResponse call
func ParseLogoutResponse(rsp *http.Response) (*LogoutResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &LogoutResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
var dest InvalidRequest
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON400 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401:
var dest Unauthorized
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON401 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 429:
var dest TooManyRequests
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON429 = &dest
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500:
var dest InternalError
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON500 = &dest
}
return response, nil
}
// ParseListQueriesResponse parses an HTTP response from a ListQueriesWithResponse call
func ParseListQueriesResponse(rsp *http.Response) (*ListQueriesResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
+165
View File
@@ -25,6 +25,8 @@ tags:
description: Operations related to queries
- name: ExportService
description: Operations related to exports
- name: AuthService
description: Operations related to authentication
paths:
/client:
@@ -494,6 +496,151 @@ paths:
"500":
$ref: "#/components/responses/InternalError"
/login:
get:
operationId: login
tags:
- AuthService
summary: Login to the application
description: >-
Initiates the login flow by redirecting to Cognito IDP login page.
security:
- {}
- cognitoAuth: [openid, email, profile]
responses:
"302":
description: Redirect to Cognito login page
headers:
Location:
schema:
type: string
format: uri
maxLength: 2048
pattern: "^https://.*"
description: URL to the Cognito login page
RateLimit:
$ref: "#/components/headers/RateLimit"
"400":
$ref: "#/components/responses/InvalidRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"429":
$ref: "#/components/responses/TooManyRequests"
"500":
$ref: "#/components/responses/InternalError"
/login-callback:
get:
operationId: loginCallback
tags:
- AuthService
summary: OAuth2 callback endpoint
description: >-
Handles the OAuth2 callback during the login process. Receives the
authorization code from Cognito IDP and exchanges it for tokens.
security:
- {}
parameters:
- name: code
in: query
description: Authorization code from Cognito
required: true
schema:
type: string
maxLength: 2048
pattern: "^[A-Za-z0-9\\-_]+$"
- name: state
in: query
description: State parameter for CSRF protection
required: true
schema:
type: string
maxLength: 1024
pattern: "^[A-Za-z0-9\\-_]+$"
responses:
"302":
description: Redirect to application after successful login
headers:
Location:
schema:
type: string
format: uri
maxLength: 2048
pattern: "^https?://.*"
description: URL to redirect after successful login
"400":
$ref: "#/components/responses/InvalidRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"429":
$ref: "#/components/responses/TooManyRequests"
"500":
$ref: "#/components/responses/InternalError"
/logout:
get:
operationId: logout
tags:
- AuthService
summary: Logout from the application
description: >-
Logs the user out by invalidating the session and redirecting to
Cognito logout endpoint.
security:
- placeholderAuth: []
responses:
"302":
description: Redirect to Cognito logout page or application home page
headers:
Location:
schema:
type: string
format: uri
maxLength: 2048
pattern: "^https?://.*"
description: URL to redirect after logout
"400":
$ref: "#/components/responses/InvalidRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"429":
$ref: "#/components/responses/TooManyRequests"
"500":
$ref: "#/components/responses/InternalError"
/home:
get:
operationId: getHomePage
tags:
- AuthService
summary: Get the home page menu
description: >-
Returns the HTML menu page for authenticated users.
security:
- placeholderAuth: []
responses:
"200":
description: Home page HTML
headers:
RateLimit:
$ref: "#/components/headers/RateLimit"
content:
text/html:
schema:
type: string
description: HTML content for the home page menu
maxLength: 1048576 # 1MB limit
pattern: "^.*$" # Any string content
format: html # Indicate format is HTML
"400":
$ref: "#/components/responses/InvalidRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"429":
$ref: "#/components/responses/TooManyRequests"
"500":
$ref: "#/components/responses/InternalError"
components:
parameters:
ClientID:
@@ -544,6 +691,21 @@ components:
in: header
name: X-API-Key
description: "Placeholder security scheme for future implementation"
cognitoAuth:
type: oauth2
description: >-
Authentication using Amazon Cognito IDP. Implements RFC8725 JWT best
practices for security.
flows:
authorizationCode:
authorizationUrl: >-
https://doczy.auth.us-east-1.amazoncognito.com/oauth2/authorize
tokenUrl: >-
https://doczy.auth.us-east-1.amazoncognito.com/oauth2/token
scopes:
openid: Get OIDC token
email: Access to user's email
profile: Access to user's profile
responses:
InvalidRequest:
@@ -595,6 +757,9 @@ components:
$ref: "#/components/schemas/ErrorMessage"
schemas:
# Query API schemas
ClientID:
type: string
description: The client external id