Documentation
¶
Overview ¶
Package apistore is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- func RegisterAPIStoreHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterAPIStoreHandlerClient(ctx context.Context, mux *runtime.ServeMux, client APIStoreClient) error
- func RegisterAPIStoreHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterAPIStoreServer(s *grpc.Server, srv APIStoreServer)
- type API
- func (*API) Descriptor() ([]byte, []int)
- func (m *API) GetAPIID() string
- func (m *API) GetMethods() []*Method
- func (m *API) GetName() string
- func (m *API) GetSchemas() []*Ref
- func (m *API) GetServers() []*Server
- func (m *API) GetTitle() string
- func (m *API) GetVersion() string
- func (*API) ProtoMessage()
- func (m *API) Reset()
- func (m *API) String() string
- func (m *API) XXX_DiscardUnknown()
- func (m *API) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *API) XXX_Merge(src proto.Message)
- func (m *API) XXX_Size() int
- func (m *API) XXX_Unmarshal(b []byte) error
- type APIStoreClient
- type APIStoreServer
- type CreateAPIRes
- func (*CreateAPIRes) Descriptor() ([]byte, []int)
- func (m *CreateAPIRes) GetAPI() *API
- func (m *CreateAPIRes) GetCode() string
- func (m *CreateAPIRes) GetMsg() string
- func (*CreateAPIRes) ProtoMessage()
- func (m *CreateAPIRes) Reset()
- func (m *CreateAPIRes) String() string
- func (m *CreateAPIRes) XXX_DiscardUnknown()
- func (m *CreateAPIRes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *CreateAPIRes) XXX_Merge(src proto.Message)
- func (m *CreateAPIRes) XXX_Size() int
- func (m *CreateAPIRes) XXX_Unmarshal(b []byte) error
- type Data
- func (*Data) Descriptor() ([]byte, []int)
- func (m *Data) GetParams() string
- func (m *Data) GetReturn() string
- func (*Data) ProtoMessage()
- func (m *Data) Reset()
- func (m *Data) String() string
- func (m *Data) XXX_DiscardUnknown()
- func (m *Data) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Data) XXX_Merge(src proto.Message)
- func (m *Data) XXX_Size() int
- func (m *Data) XXX_Unmarshal(b []byte) error
- type Method
- func (*Method) Descriptor() ([]byte, []int)
- func (m *Method) GetData() *Data
- func (m *Method) GetDescription() string
- func (m *Method) GetMethodID() string
- func (m *Method) GetName() string
- func (m *Method) GetRefNames() []string
- func (*Method) ProtoMessage()
- func (m *Method) Reset()
- func (m *Method) String() string
- func (m *Method) XXX_DiscardUnknown()
- func (m *Method) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Method) XXX_Merge(src proto.Message)
- func (m *Method) XXX_Size() int
- func (m *Method) XXX_Unmarshal(b []byte) error
- type OpenAPI
- func (*OpenAPI) Descriptor() ([]byte, []int)
- func (m *OpenAPI) GetContent() string
- func (*OpenAPI) ProtoMessage()
- func (m *OpenAPI) Reset()
- func (m *OpenAPI) String() string
- func (m *OpenAPI) XXX_DiscardUnknown()
- func (m *OpenAPI) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *OpenAPI) XXX_Merge(src proto.Message)
- func (m *OpenAPI) XXX_Size() int
- func (m *OpenAPI) XXX_Unmarshal(b []byte) error
- type Ref
- func (*Ref) Descriptor() ([]byte, []int)
- func (m *Ref) GetName() string
- func (m *Ref) GetSchema() string
- func (*Ref) ProtoMessage()
- func (m *Ref) Reset()
- func (m *Ref) String() string
- func (m *Ref) XXX_DiscardUnknown()
- func (m *Ref) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Ref) XXX_Merge(src proto.Message)
- func (m *Ref) XXX_Size() int
- func (m *Ref) XXX_Unmarshal(b []byte) error
- type Server
- func (*Server) Descriptor() ([]byte, []int)
- func (m *Server) GetDescription() map[string]string
- func (m *Server) GetUrl() string
- func (*Server) ProtoMessage()
- func (m *Server) Reset()
- func (m *Server) String() string
- func (m *Server) XXX_DiscardUnknown()
- func (m *Server) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Server) XXX_Merge(src proto.Message)
- func (m *Server) XXX_Size() int
- func (m *Server) XXX_Unmarshal(b []byte) error
- type UnimplementedAPIStoreServer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterAPIStoreHandler ¶
func RegisterAPIStoreHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterAPIStoreHandler registers the http handlers for service APIStore to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterAPIStoreHandlerClient ¶
func RegisterAPIStoreHandlerClient(ctx context.Context, mux *runtime.ServeMux, client APIStoreClient) error
RegisterAPIStoreHandlerClient registers the http handlers for service APIStore to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "APIStoreClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "APIStoreClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "APIStoreClient" to call the correct interceptors.
func RegisterAPIStoreHandlerFromEndpoint ¶
func RegisterAPIStoreHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterAPIStoreHandlerFromEndpoint is same as RegisterAPIStoreHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterAPIStoreServer ¶
func RegisterAPIStoreServer(s *grpc.Server, srv APIStoreServer)
Types ¶
type API ¶
type API struct { APIID string `protobuf:"bytes,1,opt,name=APIID,proto3" json:"APIID,omitempty"` Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` Methods []*Method `protobuf:"bytes,4,rep,name=methods,proto3" json:"methods,omitempty"` Schemas []*Ref `protobuf:"bytes,5,rep,name=schemas,proto3" json:"schemas,omitempty"` Servers []*Server `protobuf:"bytes,6,rep,name=servers,proto3" json:"servers,omitempty"` Title string `protobuf:"bytes,7,opt,name=title,proto3" json:"title,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*API) Descriptor ¶
func (*API) GetMethods ¶
func (*API) GetSchemas ¶
func (*API) GetServers ¶
func (*API) GetVersion ¶
func (*API) ProtoMessage ¶
func (*API) ProtoMessage()
func (*API) XXX_DiscardUnknown ¶
func (m *API) XXX_DiscardUnknown()
func (*API) XXX_Unmarshal ¶
type APIStoreClient ¶
type APIStoreClient interface { // 导入API CreateAPI(ctx context.Context, in *OpenAPI, opts ...grpc.CallOption) (*CreateAPIRes, error) }
APIStoreClient is the client API for APIStore service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewAPIStoreClient ¶
func NewAPIStoreClient(cc *grpc.ClientConn) APIStoreClient
type APIStoreServer ¶
type APIStoreServer interface { // 导入API CreateAPI(context.Context, *OpenAPI) (*CreateAPIRes, error) }
APIStoreServer is the server API for APIStore service.
type CreateAPIRes ¶
type CreateAPIRes struct { Code string `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"` Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` API *API `protobuf:"bytes,3,opt,name=API,proto3" json:"API,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*CreateAPIRes) Descriptor ¶
func (*CreateAPIRes) Descriptor() ([]byte, []int)
func (*CreateAPIRes) GetAPI ¶
func (m *CreateAPIRes) GetAPI() *API
func (*CreateAPIRes) GetCode ¶
func (m *CreateAPIRes) GetCode() string
func (*CreateAPIRes) GetMsg ¶
func (m *CreateAPIRes) GetMsg() string
func (*CreateAPIRes) ProtoMessage ¶
func (*CreateAPIRes) ProtoMessage()
func (*CreateAPIRes) Reset ¶
func (m *CreateAPIRes) Reset()
func (*CreateAPIRes) String ¶
func (m *CreateAPIRes) String() string
func (*CreateAPIRes) XXX_DiscardUnknown ¶
func (m *CreateAPIRes) XXX_DiscardUnknown()
func (*CreateAPIRes) XXX_Marshal ¶
func (m *CreateAPIRes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*CreateAPIRes) XXX_Merge ¶
func (m *CreateAPIRes) XXX_Merge(src proto.Message)
func (*CreateAPIRes) XXX_Size ¶
func (m *CreateAPIRes) XXX_Size() int
func (*CreateAPIRes) XXX_Unmarshal ¶
func (m *CreateAPIRes) XXX_Unmarshal(b []byte) error
type Data ¶
type Data struct { Params string `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` Return string `protobuf:"bytes,2,opt,name=return,proto3" json:"return,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*Data) Descriptor ¶
func (*Data) ProtoMessage ¶
func (*Data) ProtoMessage()
func (*Data) XXX_DiscardUnknown ¶
func (m *Data) XXX_DiscardUnknown()
func (*Data) XXX_Unmarshal ¶
type Method ¶
type Method struct { MethodID string `protobuf:"bytes,1,opt,name=methodID,proto3" json:"methodID,omitempty"` Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` Data *Data `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"` RefNames []string `protobuf:"bytes,5,rep,name=refNames,proto3" json:"refNames,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*Method) Descriptor ¶
func (*Method) GetDescription ¶
func (*Method) GetMethodID ¶
func (*Method) GetRefNames ¶
func (*Method) ProtoMessage ¶
func (*Method) ProtoMessage()
func (*Method) XXX_DiscardUnknown ¶
func (m *Method) XXX_DiscardUnknown()
func (*Method) XXX_Marshal ¶
func (*Method) XXX_Unmarshal ¶
type OpenAPI ¶
type OpenAPI struct { Content string `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*OpenAPI) Descriptor ¶
func (*OpenAPI) GetContent ¶
func (*OpenAPI) ProtoMessage ¶
func (*OpenAPI) ProtoMessage()
func (*OpenAPI) XXX_DiscardUnknown ¶
func (m *OpenAPI) XXX_DiscardUnknown()
func (*OpenAPI) XXX_Marshal ¶
func (*OpenAPI) XXX_Unmarshal ¶
type Ref ¶
type Ref struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Schema string `protobuf:"bytes,2,opt,name=schema,proto3" json:"schema,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*Ref) Descriptor ¶
func (*Ref) ProtoMessage ¶
func (*Ref) ProtoMessage()
func (*Ref) XXX_DiscardUnknown ¶
func (m *Ref) XXX_DiscardUnknown()
func (*Ref) XXX_Unmarshal ¶
type Server ¶
type Server struct { Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` Description map[string]string `` /* 163-byte string literal not displayed */ XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*Server) Descriptor ¶
func (*Server) GetDescription ¶
func (*Server) ProtoMessage ¶
func (*Server) ProtoMessage()
func (*Server) XXX_DiscardUnknown ¶
func (m *Server) XXX_DiscardUnknown()
func (*Server) XXX_Marshal ¶
func (*Server) XXX_Unmarshal ¶
type UnimplementedAPIStoreServer ¶
type UnimplementedAPIStoreServer struct { }
UnimplementedAPIStoreServer can be embedded to have forward compatible implementations.
func (*UnimplementedAPIStoreServer) CreateAPI ¶
func (*UnimplementedAPIStoreServer) CreateAPI(ctx context.Context, req *OpenAPI) (*CreateAPIRes, error)