sdk

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

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

func NewGetSchoolEligibilityRequest(server string, school string) (*http.Request, error)

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 动作资格条件包括内容准入、校园资格、手机号和独立实名。各动作支持全站规则与学校覆盖。

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.

func (Action) Valid

func (e Action) Valid() bool

Valid indicates whether the value is a known member of the Action enum.

type Change

type Change struct {
	// Conditions 动作资格条件包括内容准入、校园资格、手机号和独立实名。各动作支持全站规则与学校覆盖。
	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"
	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

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

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

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) 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"
	ConditionIdentityVerified  Condition = "identity_verified"
	ConditionPhoneBound        Condition = "phone_bound"
)

Defines values for Condition.

func (Condition) Valid added in v0.2.1

func (e Condition) Valid() bool

Valid indicates whether the value is a known member of the Condition enum.

type EligibilityEvaluation added in v0.2.1

type EligibilityEvaluation struct {
	// Action 动作资格条件包括内容准入、校园资格、手机号和独立实名。各动作支持全站规则与学校覆盖。
	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"`
	UnavailableConditions []Condition `json:"unavailable_conditions"`
}

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.

const (
	Conflict         ErrorCode = "conflict"
	Forbidden        ErrorCode = "forbidden"
	InvalidRequest   ErrorCode = "invalid_request"
	InvalidRule      ErrorCode = "invalid_rule"
	MethodNotAllowed ErrorCode = "method_not_allowed"
	Unauthenticated  ErrorCode = "unauthenticated"
	Unavailable      ErrorCode = "unavailable"
)

Defines values for ErrorCode.

func (ErrorCode) Valid added in v0.2.1

func (e ErrorCode) Valid() bool

Valid indicates whether the value is a known member of the ErrorCode enum.

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

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

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

Status returns HTTPResponse.Status

func (GetSchoolEligibilityResponse) StatusCode added in v0.2.1

func (r GetSchoolEligibilityResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type HttpRequestDoer

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

Doer performs HTTP requests.

The standard http.Client implements this interface.

type RequestEditorFn

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

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

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 动作资格条件包括内容准入、校园资格、手机号和独立实名。各动作支持全站规则与学校覆盖。
	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"
	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"
	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

Status returns HTTPResponse.Status

func (SetEligibilityRuleResponse) StatusCode

func (r SetEligibilityRuleResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

Directories

Path Synopsis
Package adminsdk provides primitives to interact with the openapi HTTP API.
Package adminsdk provides primitives to interact with the openapi HTTP API.

Jump to

Keyboard shortcuts

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