Documentation ¶
Index ¶
- Variables
- type Client
- func (sc Client) CheckCompatibilityWithLatest(subject, definition string) (*model.Compatibility, *model.Error)
- func (sc Client) CheckCompatibilityWithMajorVersion(subject string, majorVersion int, definition string) (*model.Compatibility, *model.Error)
- func (sc Client) CheckCompatibilityWithSemVer(subject string, semver model.SemVer, definition string) (*model.Compatibility, *model.Error)
- func (sc Client) CreateSubject(name, description string) (int64, *model.Error)
- func (cc Client) DeleteConfig(subject string) (int64, *model.Error)
- func (cc Client) DeleteProperty(subject, property string) (int64, *model.Error)
- func (sc Client) DeleteSubject(name string) (int64, *model.Error)
- func (cc Client) GetConfig(subject string) (*model.Config, *model.Error)
- func (sc Client) GetLatestSchema(subject string) (*model.Schema, *model.Error)
- func (cc Client) GetProperty(subject, property string) (string, *model.Error)
- func (sc Client) GetSchemaById(id int64) (*model.Schema, *model.Error)
- func (sc Client) GetSchemaByMajorVersion(subject string, majorVersion int) (*model.Schema, *model.Error)
- func (sc Client) GetSchemaBySemVer(subject string, semver model.SemVer) (*model.Schema, *model.Error)
- func (sc Client) GetSubject(name string) (*model.Subject, *model.Error)
- func (sc Client) ListSubjects() ([]string, *model.Error)
- func (sc Client) ListVersions(subject string) ([]model.SemVer, *model.Error)
- func (sc Client) LookupAllSchemas(subject, definition string) ([]model.Schema, *model.Error)
- func (sc Client) LookupSchema(subject, definition string) (*model.Schema, *model.Error)
- func (sc Client) RegisterSchema(subject, definition string) (*model.SchemaId, *model.Error)
- func (cc Client) SetConfig(subject string, config model.Config) (int64, *model.Error)
- func (cc Client) SetProperty(subject, name, value string) (int64, *model.Error)
- func (sc Client) UpdateDescription(name, description string) (int64, *model.Error)
Constants ¶
This section is empty.
Variables ¶
var (
DisableTransportSwap = false
)
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { *gorequest.SuperAgent // contains filtered or unexported fields }
func NewClient ¶
NewClient create and instantiate a new Client object which can interact with typebook server at the designated endpoint. endpoint should be in the form of `host:port`. Client instances should create for each goroutine to send multiple requests concurrently.
func (Client) CheckCompatibilityWithLatest ¶
func (sc Client) CheckCompatibilityWithLatest(subject, definition string) (*model.Compatibility, *model.Error)
CheckCompatibilityWithLatest issues POST /compatibility/subjects/(subject string)/versions/latest with a schema definition in its body to a typebook server. It will check if the posted schema is compatible with the latest one under the given subject. This method returns model.Compatibility on success otherwise non-nil model.Error is returned.
func (Client) CheckCompatibilityWithMajorVersion ¶
func (sc Client) CheckCompatibilityWithMajorVersion(subject string, majorVersion int, definition string) (*model.Compatibility, *model.Error)
CheckCompatibilityWithMajorVersion issues POST /compatibility/subjects/(subject string)/versions/v(majorVersion int) with a schema definition in its body to a typebook server. It will check if the posted schema is compatible with the latest one that has the designated major version under the given subject. This method returns model.Compatibility on success otherwise non-nil model.Error is returned.
func (Client) CheckCompatibilityWithSemVer ¶
func (sc Client) CheckCompatibilityWithSemVer(subject string, semver model.SemVer, definition string) (*model.Compatibility, *model.Error)
CheckCompatibilityWithSemVer issues POST /compatibility/subjects/(subject string)/versions/(semver string) with a schema definition in its body to a typebook server. It will check if the posted schema is compatible with the one that has the designated semver under the given subject. This method returns model.Compatibility on success otherwise non-nil model.Error is returned.
func (Client) CreateSubject ¶
CreateSubject issues a POST /subjects/(subject string) request with description in its body to a typebook server. It will create a new subject with given name and description. This method returns 0 for success otherwise returns non-nil model.Error.
func (Client) DeleteConfig ¶
DeleteConfig issues a DELETE /config/(subject string) request to a typebook server. It will delete a whole config belongs to a subject with the given name. This method returns the number of deleted rows in the backend database or returns non-nil model.Error on failure.
func (Client) DeleteProperty ¶
DeleteProperty issues a DELETE /config/(subject string)/properties/(property string) request to a typebook server. It will delete a specific property of config belongs to a subject with the given name. This method returns the number of deleted rows in the backend database so normally it is 1. Otherwise non-nil model.Error is returned.
func (Client) DeleteSubject ¶
DeleteSubject issues a DELETE /subjects/(subject string) to a typebook server. It will delete a subject which has the given name. This method returns the number of deleted rows in the backend database so normally it is 1 for success. Otherwise non-nil model.Error is returned
func (Client) GetConfig ¶
GetConfig issues a GET /config/(subject string) request to a typebook server. It will retrieve a whole config belongs to a subject with the given name. If it fails, non-nil model.Error is returned.
func (Client) GetLatestSchema ¶
GetLatestSchema issues a GET /subjects/(subject string)/versions/latest request to a typebook server. It will retrieve the latest schema under the given subject. This method returns model.Schema on success otherwise non-nil model.Error is returned.
func (Client) GetProperty ¶
GetProperty issues a GET /config/(subject string)/properties/(property string) request to a typebook server. It will retrieve a specific property of config belongs to a subject with the given name. If it fails, non-nil model.Error is returned.
func (Client) GetSchemaById ¶
GetSchemaById issue a GET /schemas/ids/(id int64) request to a typebook server. It will retrieve the schema that matches the given id. This method returns model.Schema on success, otherwise non-nil model.Error is returned.
func (Client) GetSchemaByMajorVersion ¶
func (sc Client) GetSchemaByMajorVersion(subject string, majorVersion int) (*model.Schema, *model.Error)
GetSchemaByMajorVersion issues a GET /subjects/(subject string)/versions/v(majorVersion int) request to a typebook server. It will retrieve a latest schema that has designated major version under the given subject. This method returns model.Schema on success otherwise non-nil model.Error is returned.
func (Client) GetSchemaBySemVer ¶
func (sc Client) GetSchemaBySemVer(subject string, semver model.SemVer) (*model.Schema, *model.Error)
GetSchemaBySemVer issues a GET /subjects/(subject string)/versions/(semver string) request to a typebook server. It will retrieve a schema that has designated semver under the given subject. This method returns model.Schema on success otherwise non-nil model.Error is returned.
func (Client) GetSubject ¶
GetSubject issues a GET /subjects/(subject string) request to a typebook server. It will retrieve a subject which has the given name. If it fails, non-nil model.Error is returned.
func (Client) ListSubjects ¶
ListSubjects issues a GET /subjects request to a typebook server. It will retrieve a list of names of existing subjects. If it fails, non-nil model.Error is returned.
func (Client) ListVersions ¶
ListVersions issues a GET /subjects/(subject string)/versions request to a typebook server. It retrieves all existing versions under the given subject. This method returns a list of model.SemVer on success, otherwise non-nil model.Error is returned.
func (Client) LookupAllSchemas ¶
LookupAllSchemas issues a POST /subjects/(subject string)/schema/lookupAll request with a schema definition to lookup in its body to a typebook server. It will lookup all schemas whose definition conforms to the given one within the given subject. If multiple schemas are found, all schemas are returned. This method returns non-nil model.Error on failure.
func (Client) LookupSchema ¶
LookupSchema issues a POST /subjects/(subject string)/schema/lookup request with a schema definition to lookup in its body to a typebook server. It will lookup a schema by its definition within the given subject. If multiple schemas are found, the latest one is chosen. This method returns model.Schema whose definition conforms to the given one if found otherwise it returns non-nil model.Error.
func (Client) RegisterSchema ¶
RegisterSchema issues a POST /subjects/(subject string)/versions request with a schema definition in its body to a typebook server. It will register a new schema under the given subject according to the given definition. This method returns model.SchemaId that represents id for the created schema on success, otherwise non-nil model.Error is returned.
func (Client) SetConfig ¶
SetConfig issue a PUT /config/(subject string) request with config json in its body to a typebook server. It will create or update a whole config of the subject with the given name. This method returns the number of updated rows in the backend database otherwise non-nil model.Error is returned on failure.
func (Client) SetProperty ¶
SetConfig issues a PUT /config/(subject string)/properties/(property string) request with its value in its body to a typebook server. It will create or update a specific property of config of a subject which has the given name. This method returns the number of updated rows so normally it is 1 for success, otherwise non-nil model.Error is returned.
func (Client) UpdateDescription ¶
UpdateDescription issues a PUT /subjects/(subject string) request with new description in its body to a typebook server. It will update a description of a subject which has the given name. This method returns the number of updated rows in the backend database so normally it is 1 for success. Otherwise non-nil model.Error is returned.