api_client

package
v0.1.68 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

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

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGetExamQuestionRequest

func NewGetExamQuestionRequest(server string, examId string, questionIndex int32) (*http.Request, error)

NewGetExamQuestionRequest generates requests for GetExamQuestion

func NewGetExamRequest

func NewGetExamRequest(server string, examId string) (*http.Request, error)

NewGetExamRequest generates requests for GetExam

func NewGetFindIncompleteExamsRequest added in v0.1.58

func NewGetFindIncompleteExamsRequest(server string) (*http.Request, error)

NewGetFindIncompleteExamsRequest generates requests for GetFindIncompleteExams

func NewGradeExamQuestionRequest

func NewGradeExamQuestionRequest(server string, examId string, questionIndex int32, body GradeExamQuestionJSONRequestBody) (*http.Request, error)

NewGradeExamQuestionRequest calls the generic GradeExamQuestion builder with application/json body

func NewGradeExamQuestionRequestWithBody

func NewGradeExamQuestionRequestWithBody(server string, examId string, questionIndex int32, contentType string, body io.Reader) (*http.Request, error)

NewGradeExamQuestionRequestWithBody generates requests for GradeExamQuestion with any type of body

Types

type Client

type Client struct {
	// The endpoint of the server conforming to this interface, with scheme,
	// https://api.deepmap.com for example. This can contain a path relative
	// to the server, such as https://api.deepmap.com/dev-test, and all the
	// paths in the swagger spec will be appended to the server.
	Server string

	// Doer for performing requests, typically a *http.Client with any
	// customized settings, such as certificate chains.
	Client HttpRequestDoer

	// A list of callbacks for modifying requests which are generated before sending over
	// the network.
	RequestEditors []RequestEditorFn
}

Client which conforms to the OpenAPI3 specification for this service.

func NewClient

func NewClient(server string, opts ...ClientOption) (*Client, error)

Creates a new Client, with reasonable defaults

func (*Client) GetExam

func (c *Client) GetExam(ctx context.Context, examId string, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetExamQuestion

func (c *Client) GetExamQuestion(ctx context.Context, examId string, questionIndex int32, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetFindIncompleteExams added in v0.1.58

func (c *Client) GetFindIncompleteExams(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GradeExamQuestion

func (c *Client) GradeExamQuestion(ctx context.Context, examId string, questionIndex int32, body GradeExamQuestionJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GradeExamQuestionWithBody

func (c *Client) GradeExamQuestionWithBody(ctx context.Context, examId string, questionIndex int32, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

type ClientInterface

type ClientInterface interface {
	// GetFindIncompleteExams request
	GetFindIncompleteExams(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetExam request
	GetExam(ctx context.Context, examId string, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetExamQuestion request
	GetExamQuestion(ctx context.Context, examId string, questionIndex int32, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GradeExamQuestionWithBody request with any body
	GradeExamQuestionWithBody(ctx context.Context, examId string, questionIndex int32, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	GradeExamQuestion(ctx context.Context, examId string, questionIndex int32, body GradeExamQuestionJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
}

The interface specification for the client above.

type ClientOption

type ClientOption func(*Client) error

ClientOption allows setting custom parameters during construction

func WithBaseURL

func WithBaseURL(baseURL string) ClientOption

WithBaseURL overrides the baseURL.

func WithHTTPClient

func WithHTTPClient(doer HttpRequestDoer) ClientOption

WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.

func WithRequestEditorFn

func WithRequestEditorFn(fn RequestEditorFn) ClientOption

WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.

type ClientWithResponses

type ClientWithResponses struct {
	ClientInterface
}

ClientWithResponses builds on ClientInterface to offer response payloads

func NewClientWithResponses

func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error)

NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling

func (*ClientWithResponses) GetExamQuestionWithResponse

func (c *ClientWithResponses) GetExamQuestionWithResponse(ctx context.Context, examId string, questionIndex int32, reqEditors ...RequestEditorFn) (*GetExamQuestionResponse, error)

GetExamQuestionWithResponse request returning *GetExamQuestionResponse

func (*ClientWithResponses) GetExamWithResponse

func (c *ClientWithResponses) GetExamWithResponse(ctx context.Context, examId string, reqEditors ...RequestEditorFn) (*GetExamResponse, error)

GetExamWithResponse request returning *GetExamResponse

func (*ClientWithResponses) GetFindIncompleteExamsWithResponse added in v0.1.58

func (c *ClientWithResponses) GetFindIncompleteExamsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetFindIncompleteExamsResponse, error)

GetFindIncompleteExamsWithResponse request returning *GetFindIncompleteExamsResponse

func (*ClientWithResponses) GradeExamQuestionWithBodyWithResponse

func (c *ClientWithResponses) GradeExamQuestionWithBodyWithResponse(ctx context.Context, examId string, questionIndex int32, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*GradeExamQuestionResponse, error)

GradeExamQuestionWithBodyWithResponse request with arbitrary body returning *GradeExamQuestionResponse

func (*ClientWithResponses) GradeExamQuestionWithResponse

func (c *ClientWithResponses) GradeExamQuestionWithResponse(ctx context.Context, examId string, questionIndex int32, body GradeExamQuestionJSONRequestBody, reqEditors ...RequestEditorFn) (*GradeExamQuestionResponse, error)

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// GetFindIncompleteExamsWithResponse request
	GetFindIncompleteExamsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetFindIncompleteExamsResponse, error)

	// GetExamWithResponse request
	GetExamWithResponse(ctx context.Context, examId string, reqEditors ...RequestEditorFn) (*GetExamResponse, error)

	// GetExamQuestionWithResponse request
	GetExamQuestionWithResponse(ctx context.Context, examId string, questionIndex int32, reqEditors ...RequestEditorFn) (*GetExamQuestionResponse, error)

	// GradeExamQuestionWithBodyWithResponse request with any body
	GradeExamQuestionWithBodyWithResponse(ctx context.Context, examId string, questionIndex int32, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*GradeExamQuestionResponse, error)

	GradeExamQuestionWithResponse(ctx context.Context, examId string, questionIndex int32, body GradeExamQuestionJSONRequestBody, reqEditors ...RequestEditorFn) (*GradeExamQuestionResponse, error)
}

ClientWithResponsesInterface is the interface specification for the client with responses above.

type Error

type Error struct {
	Code    *int32  `json:"code,omitempty"`
	Message *string `json:"message,omitempty"`
}

Error defines model for Error.

type Exam

type Exam struct {
	ExamId              string     `json:"examId"`
	Questions           []Question `json:"questions"`
	State               string     `json:"state"`
	TotalPointsEarned   *int32     `json:"totalPointsEarned,omitempty"`
	TotalPointsPossible int32      `json:"totalPointsPossible"`
}

Exam defines model for Exam.

type GetExamQuestionResponse

type GetExamQuestionResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *Question
	JSONDefault  *Error
}

func ParseGetExamQuestionResponse

func ParseGetExamQuestionResponse(rsp *http.Response) (*GetExamQuestionResponse, error)

ParseGetExamQuestionResponse parses an HTTP response from a GetExamQuestionWithResponse call

func (GetExamQuestionResponse) Status

func (r GetExamQuestionResponse) Status() string

Status returns HTTPResponse.Status

func (GetExamQuestionResponse) StatusCode

func (r GetExamQuestionResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetExamResponse

type GetExamResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *Exam
	JSONDefault  *Error
}

func ParseGetExamResponse

func ParseGetExamResponse(rsp *http.Response) (*GetExamResponse, error)

ParseGetExamResponse parses an HTTP response from a GetExamWithResponse call

func (GetExamResponse) Status

func (r GetExamResponse) Status() string

Status returns HTTPResponse.Status

func (GetExamResponse) StatusCode

func (r GetExamResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetFindIncompleteExamsResponse added in v0.1.58

type GetFindIncompleteExamsResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *[]Exam
	JSONDefault  *Error
}

func ParseGetFindIncompleteExamsResponse added in v0.1.58

func ParseGetFindIncompleteExamsResponse(rsp *http.Response) (*GetFindIncompleteExamsResponse, error)

ParseGetFindIncompleteExamsResponse parses an HTTP response from a GetFindIncompleteExamsWithResponse call

func (GetFindIncompleteExamsResponse) Status added in v0.1.58

Status returns HTTPResponse.Status

func (GetFindIncompleteExamsResponse) StatusCode added in v0.1.58

func (r GetFindIncompleteExamsResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GradeExamQuestionJSONRequestBody

type GradeExamQuestionJSONRequestBody = GradeQuestion

GradeExamQuestionJSONRequestBody defines body for GradeExamQuestion for application/json ContentType.

type GradeExamQuestionResponse

type GradeExamQuestionResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON201      *Exam
	JSONDefault  *Error
}

func ParseGradeExamQuestionResponse

func ParseGradeExamQuestionResponse(rsp *http.Response) (*GradeExamQuestionResponse, error)

ParseGradeExamQuestionResponse parses an HTTP response from a GradeExamQuestionWithResponse call

func (GradeExamQuestionResponse) Status

func (r GradeExamQuestionResponse) Status() string

Status returns HTTPResponse.Status

func (GradeExamQuestionResponse) StatusCode

func (r GradeExamQuestionResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GradeQuestion

type GradeQuestion struct {
	Feedback string `json:"feedback"`
	Points   int32  `json:"points"`
}

GradeQuestion defines model for GradeQuestion.

type HttpRequestDoer

type HttpRequestDoer interface {
	Do(req *http.Request) (*http.Response, error)
}

Doer performs HTTP requests.

The standard http.Client implements this interface.

type Question

type Question struct {
	ExamId         string  `json:"examId"`
	Feedback       *string `json:"feedback,omitempty"`
	Graded         bool    `json:"graded"`
	PointsEarned   *int32  `json:"pointsEarned,omitempty"`
	PointsPossible *int32  `json:"pointsPossible,omitempty"`
	ProvidedAnswer *string `json:"providedAnswer,omitempty"`
	QuestionId     string  `json:"questionId"`
	QuestionIndex  int32   `json:"questionIndex"`
	QuestionType   string  `json:"questionType"`
}

Question defines model for Question.

type RequestEditorFn

type RequestEditorFn func(ctx context.Context, req *http.Request) error

RequestEditorFn is the function signature for the RequestEditor callback function

Jump to

Keyboard shortcuts

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