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 NewCheckEligibilityActionsRequest(server string, params *CheckEligibilityActionsParams) (*http.Request, error)
- func NewGetEligibilityRuleRequest(server string, school string, action Action) (*http.Request, error)
- func NewGetSchoolEligibilityRequest(server string, school string) (*http.Request, error)
- func NewResetEligibilityRuleRequest(server string, school string, action Action, ...) (*http.Request, error)
- func NewResetEligibilityRuleRequestWithBody(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 CheckEligibilityActionsParams
- type CheckEligibilityActionsResponse
- func (r CheckEligibilityActionsResponse) ContentType() string
- func (r CheckEligibilityActionsResponse) GetBody() []byte
- func (r CheckEligibilityActionsResponse) GetJSON200() *EligibilityEvaluationBatch
- func (r CheckEligibilityActionsResponse) GetJSON400() *Error
- func (r CheckEligibilityActionsResponse) GetJSON401() *Error
- func (r CheckEligibilityActionsResponse) GetJSON403() *Error
- func (r CheckEligibilityActionsResponse) GetJSON503() *Error
- func (r CheckEligibilityActionsResponse) Status() string
- func (r CheckEligibilityActionsResponse) StatusCode() int
- type Client
- func (c *Client) CheckEligibilityActions(ctx context.Context, params *CheckEligibilityActionsParams, ...) (*http.Response, error)
- func (c *Client) GetEligibilityRule(ctx context.Context, school string, action Action, ...) (*http.Response, error)
- func (c *Client) GetSchoolEligibility(ctx context.Context, school string, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) ResetEligibilityRule(ctx context.Context, school string, action Action, ...) (*http.Response, error)
- func (c *Client) ResetEligibilityRuleWithBody(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) CheckEligibilityActionsWithResponse(ctx context.Context, params *CheckEligibilityActionsParams, ...) (*CheckEligibilityActionsResponse, error)
- func (c *ClientWithResponses) GetEligibilityRuleWithResponse(ctx context.Context, school string, action Action, ...) (*GetEligibilityRuleResponse, error)
- func (c *ClientWithResponses) GetSchoolEligibilityWithResponse(ctx context.Context, school string, reqEditors ...RequestEditorFn) (*GetSchoolEligibilityResponse, error)
- func (c *ClientWithResponses) ResetEligibilityRuleWithBodyWithResponse(ctx context.Context, school string, action Action, ...) (*ResetEligibilityRuleResponse, error)
- func (c *ClientWithResponses) ResetEligibilityRuleWithResponse(ctx context.Context, school string, action Action, ...) (*ResetEligibilityRuleResponse, 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 Condition
- type EligibilityEvaluation
- type EligibilityEvaluationBatch
- type Error
- type ErrorCode
- 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 GetSchoolEligibilityResponse
- func (r GetSchoolEligibilityResponse) ContentType() string
- func (r GetSchoolEligibilityResponse) GetBody() []byte
- func (r GetSchoolEligibilityResponse) GetJSON200() *SchoolConfiguration
- func (r GetSchoolEligibilityResponse) GetJSON400() *Error
- func (r GetSchoolEligibilityResponse) GetJSON401() *Error
- func (r GetSchoolEligibilityResponse) GetJSON403() *Error
- func (r GetSchoolEligibilityResponse) GetJSON503() *Error
- func (r GetSchoolEligibilityResponse) Status() string
- func (r GetSchoolEligibilityResponse) StatusCode() int
- type HttpRequestDoer
- type RequestEditorFn
- type Reset
- type ResetEligibilityRuleJSONRequestBody
- type ResetEligibilityRuleParams
- type ResetEligibilityRuleResponse
- func (r ResetEligibilityRuleResponse) ContentType() string
- func (r ResetEligibilityRuleResponse) GetBody() []byte
- func (r ResetEligibilityRuleResponse) GetJSON200() *Rule
- func (r ResetEligibilityRuleResponse) GetJSON400() *Error
- func (r ResetEligibilityRuleResponse) GetJSON401() *Error
- func (r ResetEligibilityRuleResponse) GetJSON403() *Error
- func (r ResetEligibilityRuleResponse) GetJSON409() *Error
- func (r ResetEligibilityRuleResponse) GetJSON503() *Error
- func (r ResetEligibilityRuleResponse) Status() string
- func (r ResetEligibilityRuleResponse) StatusCode() int
- type Rule
- type RuleConditions
- type RuleSource
- type RuleSupportedConditions
- type SchoolConfiguration
- 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 NewCheckEligibilityActionsRequest ¶ added in v0.2.1
func NewCheckEligibilityActionsRequest(server string, params *CheckEligibilityActionsParams) (*http.Request, error)
NewCheckEligibilityActionsRequest constructs an http.Request for the CheckEligibilityActions method
func NewGetEligibilityRuleRequest ¶
func NewGetEligibilityRuleRequest(server string, school string, action Action) (*http.Request, error)
NewGetEligibilityRuleRequest constructs an http.Request for the GetEligibilityRule method
func NewGetSchoolEligibilityRequest ¶ added in v0.2.1
NewGetSchoolEligibilityRequest constructs an http.Request for the GetSchoolEligibility method
func NewResetEligibilityRuleRequest ¶ added in v0.2.1
func NewResetEligibilityRuleRequest(server string, school string, action Action, params *ResetEligibilityRuleParams, body ResetEligibilityRuleJSONRequestBody) (*http.Request, error)
NewResetEligibilityRuleRequest calls the generic ResetEligibilityRule builder with application/json body
func NewResetEligibilityRuleRequestWithBody ¶ added in v0.2.1
func NewResetEligibilityRuleRequestWithBody(server string, school string, action Action, params *ResetEligibilityRuleParams, contentType string, body io.Reader) (*http.Request, error)
NewResetEligibilityRuleRequestWithBody constructs an http.Request for the ResetEligibilityRule method, with any body, and a specified content type
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;登录由调用方已验证身份保证。仅 publish_course 支持 course_enrollment,其余 14 个动作支持 content_access、campus_eligibility、phone_bound、identity_verified。各动作独立支持全站规则与授权范围覆盖。
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 目标动作生效条件集合,必须属于该动作支持的条件白名单(仅 publish_course 允许包含 course_enrollment),越界条件返回 400 invalid_rule。
Conditions []ChangeConditions `json:"conditions"`
ExpectedVersion string `json:"expected_version"`
// Reason 配置变更原因,写入平台审计记录。
Reason *string `json:"reason,omitempty"`
}
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 CheckEligibilityActionsParams ¶ added in v0.2.1
type CheckEligibilityActionsParams struct {
School string `form:"school" json:"school"`
Actions []Action `form:"actions" json:"actions"`
}
CheckEligibilityActionsParams defines parameters for CheckEligibilityActions.
type CheckEligibilityActionsResponse ¶ added in v0.2.1
type CheckEligibilityActionsResponse struct {
Body []byte
HTTPResponse *http.Response
// JSON200 the response for an HTTP 200 `application/json` response
JSON200 *EligibilityEvaluationBatch
// 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
// JSON503 the response for an HTTP 503 `application/json` response
JSON503 *Error
}
func ParseCheckEligibilityActionsResponse ¶ added in v0.2.1
func ParseCheckEligibilityActionsResponse(rsp *http.Response) (*CheckEligibilityActionsResponse, error)
ParseCheckEligibilityActionsResponse parses an HTTP response from a CheckEligibilityActionsWithResponse call
func (CheckEligibilityActionsResponse) ContentType ¶ added in v0.2.1
func (r CheckEligibilityActionsResponse) ContentType() string
ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (CheckEligibilityActionsResponse) GetBody ¶ added in v0.2.1
func (r CheckEligibilityActionsResponse) GetBody() []byte
GetBody returns the raw response body bytes
func (CheckEligibilityActionsResponse) GetJSON200 ¶ added in v0.2.1
func (r CheckEligibilityActionsResponse) GetJSON200() *EligibilityEvaluationBatch
GetJSON200 returns the response for an HTTP 200 `application/json` response
func (CheckEligibilityActionsResponse) GetJSON400 ¶ added in v0.2.1
func (r CheckEligibilityActionsResponse) GetJSON400() *Error
GetJSON400 returns the response for an HTTP 400 `application/json` response
func (CheckEligibilityActionsResponse) GetJSON401 ¶ added in v0.2.1
func (r CheckEligibilityActionsResponse) GetJSON401() *Error
GetJSON401 returns the response for an HTTP 401 `application/json` response
func (CheckEligibilityActionsResponse) GetJSON403 ¶ added in v0.2.1
func (r CheckEligibilityActionsResponse) GetJSON403() *Error
GetJSON403 returns the response for an HTTP 403 `application/json` response
func (CheckEligibilityActionsResponse) GetJSON503 ¶ added in v0.2.1
func (r CheckEligibilityActionsResponse) GetJSON503() *Error
GetJSON503 returns the response for an HTTP 503 `application/json` response
func (CheckEligibilityActionsResponse) Status ¶ added in v0.2.1
func (r CheckEligibilityActionsResponse) Status() string
Status returns HTTPResponse.Status
func (CheckEligibilityActionsResponse) StatusCode ¶ added in v0.2.1
func (r CheckEligibilityActionsResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
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) CheckEligibilityActions ¶ added in v0.2.1
func (c *Client) CheckEligibilityActions(ctx context.Context, params *CheckEligibilityActionsParams, reqEditors ...RequestEditorFn) (*http.Response, error)
CheckEligibilityActions performs a GET /api/v1/platform/eligibility-check (the `CheckEligibilityActions` operationId) request.
面向已登录师生前端与移动端的批量动作资格预检接口。一次返回当前账号在指定学校与动作集合上的满足状态、缺失条件与暂不可用条件。.
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) GetSchoolEligibility ¶ added in v0.2.1
func (c *Client) GetSchoolEligibility(ctx context.Context, school string, reqEditors ...RequestEditorFn) (*http.Response, error)
GetSchoolEligibility performs a GET /api/v1/platform/eligibility/{school} (the `GetSchoolEligibility` operationId) request.
读取指定学校或全站(*)全部 15 个动作的生效规则矩阵、规则来源、全站基准条件与当前范围修订号。.
func (*Client) ResetEligibilityRule ¶ added in v0.2.1
func (c *Client) ResetEligibilityRule(ctx context.Context, school string, action Action, params *ResetEligibilityRuleParams, body ResetEligibilityRuleJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
ResetEligibilityRule performs a DELETE /api/v1/platform/eligibility/{school}/{action} (the `ResetEligibilityRule` operationId) request. Takes a body of the `application/json` content type.
删除指定学校的显式覆盖规则并恢复继承全站规则;禁止对全站 * 执行删除。不存在学校覆盖时返回 409。.
func (*Client) ResetEligibilityRuleWithBody ¶ added in v0.2.1
func (c *Client) ResetEligibilityRuleWithBody(ctx context.Context, school string, action Action, params *ResetEligibilityRuleParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
ResetEligibilityRuleWithBody performs a DELETE /api/v1/platform/eligibility/{school}/{action} (the `ResetEligibilityRule` operationId) request, with any type of body and a specified content type.
删除指定学校的显式覆盖规则并恢复继承全站规则;禁止对全站 * 执行删除。不存在学校覆盖时返回 409。.
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 {
// CheckEligibilityActions performs a GET /api/v1/platform/eligibility-check (the `CheckEligibilityActions` operationId) request.
//
// 面向已登录师生前端与移动端的批量动作资格预检接口。一次返回当前账号在指定学校与动作集合上的满足状态、缺失条件与暂不可用条件。.
CheckEligibilityActions(ctx context.Context, params *CheckEligibilityActionsParams, reqEditors ...RequestEditorFn) (*http.Response, error)
// GetSchoolEligibility performs a GET /api/v1/platform/eligibility/{school} (the `GetSchoolEligibility` operationId) request.
//
// 读取指定学校或全站(*)全部 15 个动作的生效规则矩阵、规则来源、全站基准条件与当前范围修订号。.
GetSchoolEligibility(ctx context.Context, school string, reqEditors ...RequestEditorFn) (*http.Response, error)
// ResetEligibilityRuleWithBody performs a DELETE /api/v1/platform/eligibility/{school}/{action} (the `ResetEligibilityRule` operationId) request,
// with any type of body and a specified content type.
//
// 删除指定学校的显式覆盖规则并恢复继承全站规则;禁止对全站 * 执行删除。不存在学校覆盖时返回 409。.
ResetEligibilityRuleWithBody(ctx context.Context, school string, action Action, params *ResetEligibilityRuleParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
// ResetEligibilityRule performs a DELETE /api/v1/platform/eligibility/{school}/{action} (the `ResetEligibilityRule` operationId) request.
// Takes a body of the `application/json` content type.
//
// 删除指定学校的显式覆盖规则并恢复继承全站规则;禁止对全站 * 执行删除。不存在学校覆盖时返回 409。.
ResetEligibilityRule(ctx context.Context, school string, action Action, params *ResetEligibilityRuleParams, body ResetEligibilityRuleJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// 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) CheckEligibilityActionsWithResponse ¶ added in v0.2.1
func (c *ClientWithResponses) CheckEligibilityActionsWithResponse(ctx context.Context, params *CheckEligibilityActionsParams, reqEditors ...RequestEditorFn) (*CheckEligibilityActionsResponse, error)
CheckEligibilityActionsWithResponse performs a GET /api/v1/platform/eligibility-check (the `CheckEligibilityActions` operationId) request.
面向已登录师生前端与移动端的批量动作资格预检接口。一次返回当前账号在指定学校与动作集合上的满足状态、缺失条件与暂不可用条件。.
Returns a wrapper object for the known response body format(s).
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) GetSchoolEligibilityWithResponse ¶ added in v0.2.1
func (c *ClientWithResponses) GetSchoolEligibilityWithResponse(ctx context.Context, school string, reqEditors ...RequestEditorFn) (*GetSchoolEligibilityResponse, error)
GetSchoolEligibilityWithResponse performs a GET /api/v1/platform/eligibility/{school} (the `GetSchoolEligibility` operationId) request.
读取指定学校或全站(*)全部 15 个动作的生效规则矩阵、规则来源、全站基准条件与当前范围修订号。.
Returns a wrapper object for the known response body format(s).
func (*ClientWithResponses) ResetEligibilityRuleWithBodyWithResponse ¶ added in v0.2.1
func (c *ClientWithResponses) ResetEligibilityRuleWithBodyWithResponse(ctx context.Context, school string, action Action, params *ResetEligibilityRuleParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ResetEligibilityRuleResponse, error)
ResetEligibilityRuleWithBodyWithResponse performs a DELETE /api/v1/platform/eligibility/{school}/{action} (the `ResetEligibilityRule` operationId) request, with any type of body and a specified content type.
删除指定学校的显式覆盖规则并恢复继承全站规则;禁止对全站 * 执行删除。不存在学校覆盖时返回 409。.
Returns a wrapper object for the known response body format(s).
func (*ClientWithResponses) ResetEligibilityRuleWithResponse ¶ added in v0.2.1
func (c *ClientWithResponses) ResetEligibilityRuleWithResponse(ctx context.Context, school string, action Action, params *ResetEligibilityRuleParams, body ResetEligibilityRuleJSONRequestBody, reqEditors ...RequestEditorFn) (*ResetEligibilityRuleResponse, error)
ResetEligibilityRuleWithResponse performs a DELETE /api/v1/platform/eligibility/{school}/{action} (the `ResetEligibilityRule` operationId) request. Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).
删除指定学校的显式覆盖规则并恢复继承全站规则;禁止对全站 * 执行删除。不存在学校覆盖时返回 409。.
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 {
// CheckEligibilityActionsWithResponse performs a GET /api/v1/platform/eligibility-check (the `CheckEligibilityActions` operationId) request.
//
// 面向已登录师生前端与移动端的批量动作资格预检接口。一次返回当前账号在指定学校与动作集合上的满足状态、缺失条件与暂不可用条件。.
//
// Returns a wrapper object for the known response body format(s).
CheckEligibilityActionsWithResponse(ctx context.Context, params *CheckEligibilityActionsParams, reqEditors ...RequestEditorFn) (*CheckEligibilityActionsResponse, error)
// GetSchoolEligibilityWithResponse performs a GET /api/v1/platform/eligibility/{school} (the `GetSchoolEligibility` operationId) request.
//
// 读取指定学校或全站(*)全部 15 个动作的生效规则矩阵、规则来源、全站基准条件与当前范围修订号。.
//
// Returns a wrapper object for the known response body format(s).
GetSchoolEligibilityWithResponse(ctx context.Context, school string, reqEditors ...RequestEditorFn) (*GetSchoolEligibilityResponse, error)
// ResetEligibilityRuleWithBodyWithResponse performs a DELETE /api/v1/platform/eligibility/{school}/{action} (the `ResetEligibilityRule` operationId) request,
// with any type of body and a specified content type.
//
// 删除指定学校的显式覆盖规则并恢复继承全站规则;禁止对全站 * 执行删除。不存在学校覆盖时返回 409。.
//
// Returns a wrapper object for the known response body format(s).
ResetEligibilityRuleWithBodyWithResponse(ctx context.Context, school string, action Action, params *ResetEligibilityRuleParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ResetEligibilityRuleResponse, error)
// ResetEligibilityRuleWithResponse performs a DELETE /api/v1/platform/eligibility/{school}/{action} (the `ResetEligibilityRule` operationId) request.
// Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).
//
// 删除指定学校的显式覆盖规则并恢复继承全站规则;禁止对全站 * 执行删除。不存在学校覆盖时返回 409。.
ResetEligibilityRuleWithResponse(ctx context.Context, school string, action Action, params *ResetEligibilityRuleParams, body ResetEligibilityRuleJSONRequestBody, reqEditors ...RequestEditorFn) (*ResetEligibilityRuleResponse, 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).
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 Condition ¶ added in v0.2.1
type Condition string
Condition defines model for Condition.
const ( ConditionCampusEligibility Condition = "campus_eligibility" ConditionContentAccess Condition = "content_access" ConditionCourseEnrollment Condition = "course_enrollment" ConditionIdentityVerified Condition = "identity_verified" ConditionPhoneBound Condition = "phone_bound" )
Defines values for Condition.
type EligibilityEvaluation ¶ added in v0.2.1
type EligibilityEvaluation struct {
// Action 动作目录。resources.purchase 与 membership.purchase 默认要求 campus_eligibility;登录由调用方已验证身份保证。仅 publish_course 支持 course_enrollment,其余 14 个动作支持 content_access、campus_eligibility、phone_bound、identity_verified。各动作独立支持全站规则与授权范围覆盖。
Action Action `json:"action"`
Allowed bool `json:"allowed"`
MissingConditions []Condition `json:"missing_conditions"`
RuleVersion string `json:"rule_version"`
SatisfiedConditions []Condition `json:"satisfied_conditions"`
School string `json:"school"`
}
EligibilityEvaluation defines model for EligibilityEvaluation.
type EligibilityEvaluationBatch ¶ added in v0.2.1
type EligibilityEvaluationBatch struct {
Items []EligibilityEvaluation `json:"items"`
School string `json:"school"`
}
EligibilityEvaluationBatch defines model for EligibilityEvaluationBatch.
type Error ¶
type Error struct {
Code ErrorCode `json:"code"`
Evaluation *EligibilityEvaluation `json:"evaluation,omitempty"`
// RequestId 请求追踪标识,与响应头 X-Request-ID 一致。
RequestId *string `json:"request_id,omitempty"`
}
Error defines model for Error.
type ErrorCode ¶ added in v0.2.1
type ErrorCode string
ErrorCode defines model for Error.Code.
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 GetSchoolEligibilityResponse ¶ added in v0.2.1
type GetSchoolEligibilityResponse struct {
Body []byte
HTTPResponse *http.Response
// JSON200 the response for an HTTP 200 `application/json` response
JSON200 *SchoolConfiguration
// 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
// JSON503 the response for an HTTP 503 `application/json` response
JSON503 *Error
}
func ParseGetSchoolEligibilityResponse ¶ added in v0.2.1
func ParseGetSchoolEligibilityResponse(rsp *http.Response) (*GetSchoolEligibilityResponse, error)
ParseGetSchoolEligibilityResponse parses an HTTP response from a GetSchoolEligibilityWithResponse call
func (GetSchoolEligibilityResponse) ContentType ¶ added in v0.2.1
func (r GetSchoolEligibilityResponse) ContentType() string
ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (GetSchoolEligibilityResponse) GetBody ¶ added in v0.2.1
func (r GetSchoolEligibilityResponse) GetBody() []byte
GetBody returns the raw response body bytes
func (GetSchoolEligibilityResponse) GetJSON200 ¶ added in v0.2.1
func (r GetSchoolEligibilityResponse) GetJSON200() *SchoolConfiguration
GetJSON200 returns the response for an HTTP 200 `application/json` response
func (GetSchoolEligibilityResponse) GetJSON400 ¶ added in v0.2.1
func (r GetSchoolEligibilityResponse) GetJSON400() *Error
GetJSON400 returns the response for an HTTP 400 `application/json` response
func (GetSchoolEligibilityResponse) GetJSON401 ¶ added in v0.2.1
func (r GetSchoolEligibilityResponse) GetJSON401() *Error
GetJSON401 returns the response for an HTTP 401 `application/json` response
func (GetSchoolEligibilityResponse) GetJSON403 ¶ added in v0.2.1
func (r GetSchoolEligibilityResponse) GetJSON403() *Error
GetJSON403 returns the response for an HTTP 403 `application/json` response
func (GetSchoolEligibilityResponse) GetJSON503 ¶ added in v0.2.1
func (r GetSchoolEligibilityResponse) GetJSON503() *Error
GetJSON503 returns the response for an HTTP 503 `application/json` response
func (GetSchoolEligibilityResponse) Status ¶ added in v0.2.1
func (r GetSchoolEligibilityResponse) Status() string
Status returns HTTPResponse.Status
func (GetSchoolEligibilityResponse) StatusCode ¶ added in v0.2.1
func (r GetSchoolEligibilityResponse) 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 Reset ¶ added in v0.2.1
type Reset struct {
ExpectedVersion string `json:"expected_version"`
Reason string `json:"reason"`
}
Reset defines model for Reset.
type ResetEligibilityRuleJSONRequestBody ¶ added in v0.2.1
type ResetEligibilityRuleJSONRequestBody = Reset
ResetEligibilityRuleJSONRequestBody defines body for ResetEligibilityRule for application/json ContentType.
type ResetEligibilityRuleParams ¶ added in v0.2.1
type ResetEligibilityRuleParams struct {
IdempotencyKey string `json:"Idempotency-Key"`
}
ResetEligibilityRuleParams defines parameters for ResetEligibilityRule.
type ResetEligibilityRuleResponse ¶ added in v0.2.1
type ResetEligibilityRuleResponse 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 ParseResetEligibilityRuleResponse ¶ added in v0.2.1
func ParseResetEligibilityRuleResponse(rsp *http.Response) (*ResetEligibilityRuleResponse, error)
ParseResetEligibilityRuleResponse parses an HTTP response from a ResetEligibilityRuleWithResponse call
func (ResetEligibilityRuleResponse) ContentType ¶ added in v0.2.1
func (r ResetEligibilityRuleResponse) ContentType() string
ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (ResetEligibilityRuleResponse) GetBody ¶ added in v0.2.1
func (r ResetEligibilityRuleResponse) GetBody() []byte
GetBody returns the raw response body bytes
func (ResetEligibilityRuleResponse) GetJSON200 ¶ added in v0.2.1
func (r ResetEligibilityRuleResponse) GetJSON200() *Rule
GetJSON200 returns the response for an HTTP 200 `application/json` response
func (ResetEligibilityRuleResponse) GetJSON400 ¶ added in v0.2.1
func (r ResetEligibilityRuleResponse) GetJSON400() *Error
GetJSON400 returns the response for an HTTP 400 `application/json` response
func (ResetEligibilityRuleResponse) GetJSON401 ¶ added in v0.2.1
func (r ResetEligibilityRuleResponse) GetJSON401() *Error
GetJSON401 returns the response for an HTTP 401 `application/json` response
func (ResetEligibilityRuleResponse) GetJSON403 ¶ added in v0.2.1
func (r ResetEligibilityRuleResponse) GetJSON403() *Error
GetJSON403 returns the response for an HTTP 403 `application/json` response
func (ResetEligibilityRuleResponse) GetJSON409 ¶ added in v0.2.1
func (r ResetEligibilityRuleResponse) GetJSON409() *Error
GetJSON409 returns the response for an HTTP 409 `application/json` response
func (ResetEligibilityRuleResponse) GetJSON503 ¶ added in v0.2.1
func (r ResetEligibilityRuleResponse) GetJSON503() *Error
GetJSON503 returns the response for an HTTP 503 `application/json` response
func (ResetEligibilityRuleResponse) Status ¶ added in v0.2.1
func (r ResetEligibilityRuleResponse) Status() string
Status returns HTTPResponse.Status
func (ResetEligibilityRuleResponse) StatusCode ¶ added in v0.2.1
func (r ResetEligibilityRuleResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type Rule ¶
type Rule struct {
Conditions []RuleConditions `json:"conditions"`
GlobalConditions *[]Condition `json:"global_conditions,omitempty"`
Source *RuleSource `json:"source,omitempty"`
// SupportedConditions 当前动作允许配置的条件白名单。仅 publish_course 支持 course_enrollment,其余动作支持 content_access、campus_eligibility、phone_bound、identity_verified。
SupportedConditions *[]RuleSupportedConditions `json:"supported_conditions,omitempty"`
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 RuleSource ¶ added in v0.2.1
type RuleSource string
RuleSource defines model for RuleSource.
const ( Global RuleSource = "global" InitialDefault RuleSource = "initial_default" SchoolOverride RuleSource = "school_override" )
Defines values for RuleSource.
func (RuleSource) Valid ¶ added in v0.2.1
func (e RuleSource) Valid() bool
Valid indicates whether the value is a known member of the RuleSource enum.
type RuleSupportedConditions ¶ added in v0.2.1
type RuleSupportedConditions string
RuleSupportedConditions defines model for Rule.SupportedConditions.
const ( RuleSupportedConditionsCampusEligibility RuleSupportedConditions = "campus_eligibility" RuleSupportedConditionsContentAccess RuleSupportedConditions = "content_access" RuleSupportedConditionsCourseEnrollment RuleSupportedConditions = "course_enrollment" RuleSupportedConditionsIdentityVerified RuleSupportedConditions = "identity_verified" RuleSupportedConditionsPhoneBound RuleSupportedConditions = "phone_bound" )
Defines values for RuleSupportedConditions.
func (RuleSupportedConditions) Valid ¶ added in v0.2.1
func (e RuleSupportedConditions) Valid() bool
Valid indicates whether the value is a known member of the RuleSupportedConditions enum.
type SchoolConfiguration ¶ added in v0.2.1
type SchoolConfiguration struct {
Rules map[string]Rule `json:"rules"`
School string `json:"school"`
Version string `json:"version"`
}
SchoolConfiguration defines model for SchoolConfiguration.
type SetEligibilityRuleJSONRequestBody ¶
type SetEligibilityRuleJSONRequestBody = Change
SetEligibilityRuleJSONRequestBody defines body for SetEligibilityRule for application/json ContentType.
type SetEligibilityRuleParams ¶
type SetEligibilityRuleParams struct {
// IdempotencyKey 1—128 个非空白可打印 ASCII 字符。
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