Documentation
¶
Overview ¶
Package sdk provides primitives to interact with the openapi HTTP API.
Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.8.0 DO NOT EDIT.
Index ¶
- func NewGetEligibilityRuleRequest(server string, school string, action Action) (*http.Request, error)
- func NewSetEligibilityRuleRequest(server string, school string, action Action, params *SetEligibilityRuleParams, ...) (*http.Request, error)
- func NewSetEligibilityRuleRequestWithBody(server string, school string, action Action, params *SetEligibilityRuleParams, ...) (*http.Request, error)
- type Action
- type Change
- type ChangeConditions
- type Client
- func (c *Client) GetEligibilityRule(ctx context.Context, school string, action Action, ...) (*http.Response, error)
- func (c *Client) SetEligibilityRule(ctx context.Context, school string, action Action, ...) (*http.Response, error)
- func (c *Client) SetEligibilityRuleWithBody(ctx context.Context, school string, action Action, ...) (*http.Response, error)
- type ClientInterface
- type ClientOption
- type ClientWithResponses
- func (c *ClientWithResponses) GetEligibilityRuleWithResponse(ctx context.Context, school string, action Action, ...) (*GetEligibilityRuleResponse, error)
- func (c *ClientWithResponses) SetEligibilityRuleWithBodyWithResponse(ctx context.Context, school string, action Action, ...) (*SetEligibilityRuleResponse, error)
- func (c *ClientWithResponses) SetEligibilityRuleWithResponse(ctx context.Context, school string, action Action, ...) (*SetEligibilityRuleResponse, error)
- type ClientWithResponsesInterface
- type Error
- type GetEligibilityRuleResponse
- func (r GetEligibilityRuleResponse) ContentType() string
- func (r GetEligibilityRuleResponse) GetBody() []byte
- func (r GetEligibilityRuleResponse) GetJSON200() *Rule
- func (r GetEligibilityRuleResponse) GetJSON400() *Error
- func (r GetEligibilityRuleResponse) GetJSON401() *Error
- func (r GetEligibilityRuleResponse) GetJSON403() *Error
- func (r GetEligibilityRuleResponse) GetJSON409() *Error
- func (r GetEligibilityRuleResponse) GetJSON503() *Error
- func (r GetEligibilityRuleResponse) Status() string
- func (r GetEligibilityRuleResponse) StatusCode() int
- type HttpRequestDoer
- type RequestEditorFn
- type Rule
- type RuleConditions
- type SetEligibilityRuleJSONRequestBody
- type SetEligibilityRuleParams
- type SetEligibilityRuleResponse
- func (r SetEligibilityRuleResponse) ContentType() string
- func (r SetEligibilityRuleResponse) GetBody() []byte
- func (r SetEligibilityRuleResponse) GetJSON200() *Rule
- func (r SetEligibilityRuleResponse) GetJSON400() *Error
- func (r SetEligibilityRuleResponse) GetJSON401() *Error
- func (r SetEligibilityRuleResponse) GetJSON403() *Error
- func (r SetEligibilityRuleResponse) GetJSON409() *Error
- func (r SetEligibilityRuleResponse) GetJSON503() *Error
- func (r SetEligibilityRuleResponse) Status() string
- func (r SetEligibilityRuleResponse) StatusCode() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewGetEligibilityRuleRequest ¶
func NewGetEligibilityRuleRequest(server string, school string, action Action) (*http.Request, error)
NewGetEligibilityRuleRequest constructs an http.Request for the GetEligibilityRule method
func NewSetEligibilityRuleRequest ¶
func NewSetEligibilityRuleRequest(server string, school string, action Action, params *SetEligibilityRuleParams, body SetEligibilityRuleJSONRequestBody) (*http.Request, error)
NewSetEligibilityRuleRequest calls the generic SetEligibilityRule builder with application/json body
func NewSetEligibilityRuleRequestWithBody ¶
func NewSetEligibilityRuleRequestWithBody(server string, school string, action Action, params *SetEligibilityRuleParams, contentType string, body io.Reader) (*http.Request, error)
NewSetEligibilityRuleRequestWithBody constructs an http.Request for the SetEligibilityRule method, with any body, and a specified content type
Types ¶
type Action ¶
type Action string
Action 动作目录。resources.purchase 与 membership.purchase 默认要求 campus_eligibility;登录由调用方已验证身份保证。各动作独立支持全站规则与授权范围覆盖。
const ( Bookmark Action = "bookmark" ContentEnter Action = "content.enter" MembershipPurchase Action = "membership.purchase" PublishCourse Action = "publish_course" PublishMentor Action = "publish_mentor" ReadFull Action = "read_full" Reply Action = "reply" ReplyTeacher Action = "reply_teacher" Report Action = "report" ResourcesDiscover Action = "resources.discover" ResourcesDownloadPublic Action = "resources.download.public" ResourcesDownloadRestricted Action = "resources.download.restricted" ResourcesPurchase Action = "resources.purchase" ResourcesUpload Action = "resources.upload" Vote Action = "vote" )
Defines values for Action.
type Change ¶
type Change struct {
Conditions []ChangeConditions `json:"conditions"`
ExpectedVersion string `json:"expected_version"`
}
Change defines model for Change.
type ChangeConditions ¶
type ChangeConditions string
ChangeConditions defines model for Change.Conditions.
const ( ChangeConditionsCampusEligibility ChangeConditions = "campus_eligibility" ChangeConditionsContentAccess ChangeConditions = "content_access" ChangeConditionsCourseEnrollment ChangeConditions = "course_enrollment" ChangeConditionsIdentityVerified ChangeConditions = "identity_verified" ChangeConditionsPhoneBound ChangeConditions = "phone_bound" )
Defines values for ChangeConditions.
func (ChangeConditions) Valid ¶
func (e ChangeConditions) Valid() bool
Valid indicates whether the value is a known member of the ChangeConditions enum.
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) GetEligibilityRule ¶
func (c *Client) GetEligibilityRule(ctx context.Context, school string, action Action, reqEditors ...RequestEditorFn) (*http.Response, error)
GetEligibilityRule performs a GET /api/v1/platform/eligibility/{school}/{action} (the `GetEligibilityRule` operationId) request.
func (*Client) SetEligibilityRule ¶
func (c *Client) SetEligibilityRule(ctx context.Context, school string, action Action, params *SetEligibilityRuleParams, body SetEligibilityRuleJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
SetEligibilityRule performs a PUT /api/v1/platform/eligibility/{school}/{action} (the `SetEligibilityRule` operationId) request. Takes a body of the `application/json` content type.
func (*Client) SetEligibilityRuleWithBody ¶
func (c *Client) SetEligibilityRuleWithBody(ctx context.Context, school string, action Action, params *SetEligibilityRuleParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
SetEligibilityRuleWithBody performs a PUT /api/v1/platform/eligibility/{school}/{action} (the `SetEligibilityRule` operationId) request, with any type of body and a specified content type.
type ClientInterface ¶
type ClientInterface interface {
// GetEligibilityRule performs a GET /api/v1/platform/eligibility/{school}/{action} (the `GetEligibilityRule` operationId) request.
GetEligibilityRule(ctx context.Context, school string, action Action, reqEditors ...RequestEditorFn) (*http.Response, error)
// SetEligibilityRuleWithBody performs a PUT /api/v1/platform/eligibility/{school}/{action} (the `SetEligibilityRule` operationId) request,
// with any type of body and a specified content type.
SetEligibilityRuleWithBody(ctx context.Context, school string, action Action, params *SetEligibilityRuleParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
// SetEligibilityRule performs a PUT /api/v1/platform/eligibility/{school}/{action} (the `SetEligibilityRule` operationId) request.
// Takes a body of the `application/json` content type.
SetEligibilityRule(ctx context.Context, school string, action Action, params *SetEligibilityRuleParams, body SetEligibilityRuleJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
}
The interface specification for the client above.
type ClientOption ¶
ClientOption allows setting custom parameters during construction
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) GetEligibilityRuleWithResponse ¶
func (c *ClientWithResponses) GetEligibilityRuleWithResponse(ctx context.Context, school string, action Action, reqEditors ...RequestEditorFn) (*GetEligibilityRuleResponse, error)
GetEligibilityRuleWithResponse performs a GET /api/v1/platform/eligibility/{school}/{action} (the `GetEligibilityRule` operationId) request.
Returns a wrapper object for the known response body format(s).
func (*ClientWithResponses) SetEligibilityRuleWithBodyWithResponse ¶
func (c *ClientWithResponses) SetEligibilityRuleWithBodyWithResponse(ctx context.Context, school string, action Action, params *SetEligibilityRuleParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SetEligibilityRuleResponse, error)
SetEligibilityRuleWithBodyWithResponse performs a PUT /api/v1/platform/eligibility/{school}/{action} (the `SetEligibilityRule` operationId) request, with any type of body and a specified content type.
Returns a wrapper object for the known response body format(s).
func (*ClientWithResponses) SetEligibilityRuleWithResponse ¶
func (c *ClientWithResponses) SetEligibilityRuleWithResponse(ctx context.Context, school string, action Action, params *SetEligibilityRuleParams, body SetEligibilityRuleJSONRequestBody, reqEditors ...RequestEditorFn) (*SetEligibilityRuleResponse, error)
SetEligibilityRuleWithResponse performs a PUT /api/v1/platform/eligibility/{school}/{action} (the `SetEligibilityRule` operationId) request. Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).
type ClientWithResponsesInterface ¶
type ClientWithResponsesInterface interface {
// GetEligibilityRuleWithResponse performs a GET /api/v1/platform/eligibility/{school}/{action} (the `GetEligibilityRule` operationId) request.
//
// Returns a wrapper object for the known response body format(s).
GetEligibilityRuleWithResponse(ctx context.Context, school string, action Action, reqEditors ...RequestEditorFn) (*GetEligibilityRuleResponse, error)
// SetEligibilityRuleWithBodyWithResponse performs a PUT /api/v1/platform/eligibility/{school}/{action} (the `SetEligibilityRule` operationId) request,
// with any type of body and a specified content type.
//
// Returns a wrapper object for the known response body format(s).
SetEligibilityRuleWithBodyWithResponse(ctx context.Context, school string, action Action, params *SetEligibilityRuleParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SetEligibilityRuleResponse, error)
// SetEligibilityRuleWithResponse performs a PUT /api/v1/platform/eligibility/{school}/{action} (the `SetEligibilityRule` operationId) request.
// Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).
SetEligibilityRuleWithResponse(ctx context.Context, school string, action Action, params *SetEligibilityRuleParams, body SetEligibilityRuleJSONRequestBody, reqEditors ...RequestEditorFn) (*SetEligibilityRuleResponse, error)
}
ClientWithResponsesInterface is the interface specification for the client with responses above.
type GetEligibilityRuleResponse ¶
type GetEligibilityRuleResponse struct {
Body []byte
HTTPResponse *http.Response
// JSON200 the response for an HTTP 200 `application/json` response
JSON200 *Rule
// JSON400 the response for an HTTP 400 `application/json` response
JSON400 *Error
// JSON401 the response for an HTTP 401 `application/json` response
JSON401 *Error
// JSON403 the response for an HTTP 403 `application/json` response
JSON403 *Error
// JSON409 the response for an HTTP 409 `application/json` response
JSON409 *Error
// JSON503 the response for an HTTP 503 `application/json` response
JSON503 *Error
}
func ParseGetEligibilityRuleResponse ¶
func ParseGetEligibilityRuleResponse(rsp *http.Response) (*GetEligibilityRuleResponse, error)
ParseGetEligibilityRuleResponse parses an HTTP response from a GetEligibilityRuleWithResponse call
func (GetEligibilityRuleResponse) ContentType ¶
func (r GetEligibilityRuleResponse) ContentType() string
ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (GetEligibilityRuleResponse) GetBody ¶
func (r GetEligibilityRuleResponse) GetBody() []byte
GetBody returns the raw response body bytes
func (GetEligibilityRuleResponse) GetJSON200 ¶
func (r GetEligibilityRuleResponse) GetJSON200() *Rule
GetJSON200 returns the response for an HTTP 200 `application/json` response
func (GetEligibilityRuleResponse) GetJSON400 ¶
func (r GetEligibilityRuleResponse) GetJSON400() *Error
GetJSON400 returns the response for an HTTP 400 `application/json` response
func (GetEligibilityRuleResponse) GetJSON401 ¶
func (r GetEligibilityRuleResponse) GetJSON401() *Error
GetJSON401 returns the response for an HTTP 401 `application/json` response
func (GetEligibilityRuleResponse) GetJSON403 ¶
func (r GetEligibilityRuleResponse) GetJSON403() *Error
GetJSON403 returns the response for an HTTP 403 `application/json` response
func (GetEligibilityRuleResponse) GetJSON409 ¶
func (r GetEligibilityRuleResponse) GetJSON409() *Error
GetJSON409 returns the response for an HTTP 409 `application/json` response
func (GetEligibilityRuleResponse) GetJSON503 ¶
func (r GetEligibilityRuleResponse) GetJSON503() *Error
GetJSON503 returns the response for an HTTP 503 `application/json` response
func (GetEligibilityRuleResponse) Status ¶
func (r GetEligibilityRuleResponse) Status() string
Status returns HTTPResponse.Status
func (GetEligibilityRuleResponse) StatusCode ¶
func (r GetEligibilityRuleResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type HttpRequestDoer ¶
Doer performs HTTP requests.
The standard http.Client implements this interface.
type RequestEditorFn ¶
RequestEditorFn is the function signature for the RequestEditor callback function
type Rule ¶
type Rule struct {
Conditions []RuleConditions `json:"conditions"`
Version string `json:"version"`
}
Rule defines model for Rule.
type RuleConditions ¶
type RuleConditions string
RuleConditions defines model for Rule.Conditions.
const ( RuleConditionsCampusEligibility RuleConditions = "campus_eligibility" RuleConditionsContentAccess RuleConditions = "content_access" RuleConditionsCourseEnrollment RuleConditions = "course_enrollment" RuleConditionsIdentityVerified RuleConditions = "identity_verified" RuleConditionsPhoneBound RuleConditions = "phone_bound" )
Defines values for RuleConditions.
func (RuleConditions) Valid ¶
func (e RuleConditions) Valid() bool
Valid indicates whether the value is a known member of the RuleConditions enum.
type SetEligibilityRuleJSONRequestBody ¶
type SetEligibilityRuleJSONRequestBody = Change
SetEligibilityRuleJSONRequestBody defines body for SetEligibilityRule for application/json ContentType.
type SetEligibilityRuleParams ¶
type SetEligibilityRuleParams struct {
IdempotencyKey string `json:"Idempotency-Key"`
}
SetEligibilityRuleParams defines parameters for SetEligibilityRule.
type SetEligibilityRuleResponse ¶
type SetEligibilityRuleResponse struct {
Body []byte
HTTPResponse *http.Response
// JSON200 the response for an HTTP 200 `application/json` response
JSON200 *Rule
// JSON400 the response for an HTTP 400 `application/json` response
JSON400 *Error
// JSON401 the response for an HTTP 401 `application/json` response
JSON401 *Error
// JSON403 the response for an HTTP 403 `application/json` response
JSON403 *Error
// JSON409 the response for an HTTP 409 `application/json` response
JSON409 *Error
// JSON503 the response for an HTTP 503 `application/json` response
JSON503 *Error
}
func ParseSetEligibilityRuleResponse ¶
func ParseSetEligibilityRuleResponse(rsp *http.Response) (*SetEligibilityRuleResponse, error)
ParseSetEligibilityRuleResponse parses an HTTP response from a SetEligibilityRuleWithResponse call
func (SetEligibilityRuleResponse) ContentType ¶
func (r SetEligibilityRuleResponse) ContentType() string
ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (SetEligibilityRuleResponse) GetBody ¶
func (r SetEligibilityRuleResponse) GetBody() []byte
GetBody returns the raw response body bytes
func (SetEligibilityRuleResponse) GetJSON200 ¶
func (r SetEligibilityRuleResponse) GetJSON200() *Rule
GetJSON200 returns the response for an HTTP 200 `application/json` response
func (SetEligibilityRuleResponse) GetJSON400 ¶
func (r SetEligibilityRuleResponse) GetJSON400() *Error
GetJSON400 returns the response for an HTTP 400 `application/json` response
func (SetEligibilityRuleResponse) GetJSON401 ¶
func (r SetEligibilityRuleResponse) GetJSON401() *Error
GetJSON401 returns the response for an HTTP 401 `application/json` response
func (SetEligibilityRuleResponse) GetJSON403 ¶
func (r SetEligibilityRuleResponse) GetJSON403() *Error
GetJSON403 returns the response for an HTTP 403 `application/json` response
func (SetEligibilityRuleResponse) GetJSON409 ¶
func (r SetEligibilityRuleResponse) GetJSON409() *Error
GetJSON409 returns the response for an HTTP 409 `application/json` response
func (SetEligibilityRuleResponse) GetJSON503 ¶
func (r SetEligibilityRuleResponse) GetJSON503() *Error
GetJSON503 returns the response for an HTTP 503 `application/json` response
func (SetEligibilityRuleResponse) Status ¶
func (r SetEligibilityRuleResponse) Status() string
Status returns HTTPResponse.Status
func (SetEligibilityRuleResponse) StatusCode ¶
func (r SetEligibilityRuleResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode