jsonrpc2

package module
v0.0.0-...-05c8c24 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2020 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Code_name = map[int32]string{
		0:      "OK",
		-32700: "PARSE_ERROR",
		-32600: "INVALID_REQUEST",
		-32601: "METHOD_NOT_FOUND",
		-32602: "INVALID_PARAMS",
		-32603: "INTERNAL_ERROR",
		-32002: "SERVER_NOT_INITIALIZED",
		-32001: "UNKNOWN_ERROR_CODE",
		-32800: "REQUEST_CANCELLED",
		-32801: "CONTENT_MODIFIED",
	}
	Code_value = map[string]int32{
		"OK":                     0,
		"PARSE_ERROR":            -32700,
		"INVALID_REQUEST":        -32600,
		"METHOD_NOT_FOUND":       -32601,
		"INVALID_PARAMS":         -32602,
		"INTERNAL_ERROR":         -32603,
		"SERVER_NOT_INITIALIZED": -32002,
		"UNKNOWN_ERROR_CODE":     -32001,
		"REQUEST_CANCELLED":      -32800,
		"CONTENT_MODIFIED":       -32801,
	}
)

Enum value maps for Code.

View Source
var File_lsp_jsonrpc2_jsonrpc2_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type Code

type Code int32

Code is the error code in case a request fails.

const (
	// Conventional default for enums. Do not use this.
	Code_OK Code = 0
	// Invalid JSON was received by the server. An error occurred on the server while parsing the JSON
	// text.
	Code_PARSE_ERROR Code = -32700
	// The JSON sent is not a valid Request object.
	Code_INVALID_REQUEST Code = -32600
	// The method does not exist / is not available.
	Code_METHOD_NOT_FOUND Code = -32601
	// Invalid method parameter(s).
	Code_INVALID_PARAMS Code = -32602
	// Internal JSON-RPC error.
	Code_INTERNAL_ERROR Code = -32603
	// Server not initialized.
	Code_SERVER_NOT_INITIALIZED Code = -32002
	// Unknown error.
	Code_UNKNOWN_ERROR_CODE Code = -32001
	// Cancelled request.
	Code_REQUEST_CANCELLED Code = -32800
	// Modified content.
	Code_CONTENT_MODIFIED Code = -32801
)

func (Code) Descriptor

func (Code) Descriptor() protoreflect.EnumDescriptor

func (Code) Enum

func (x Code) Enum() *Code

func (Code) EnumDescriptor deprecated

func (Code) EnumDescriptor() ([]byte, []int)

Deprecated: Use Code.Descriptor instead.

func (Code) Number

func (x Code) Number() protoreflect.EnumNumber

func (Code) String

func (x Code) String() string

func (Code) Type

func (Code) Type() protoreflect.EnumType

type Error

type Error struct {

	// A number indicating the error type that occurred.
	//
	// Which may an enum value of [Code][#code].
	Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	// A string providing a short description of the error.
	Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	// A primitive or structured value that contains additional
	// information about the error. Can be omitted.
	Data string `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`
	// contains filtered or unexported fields
}

Error represents a JSON-RPC error.

func (*Error) Descriptor deprecated

func (*Error) Descriptor() ([]byte, []int)

Deprecated: Use Error.ProtoReflect.Descriptor instead.

func (*Error) GetCode

func (x *Error) GetCode() int32

func (*Error) GetData

func (x *Error) GetData() string

func (*Error) GetMessage

func (x *Error) GetMessage() string

func (*Error) ProtoMessage

func (*Error) ProtoMessage()

func (*Error) ProtoReflect

func (x *Error) ProtoReflect() protoreflect.Message

func (*Error) Reset

func (x *Error) Reset()

func (*Error) String

func (x *Error) String() string

type Notification

type Notification struct {

	// The jsonrpc version.
	//
	// The language server protocol always uses “2.0” as the jsonrpc version.
	Jsonrpc string `protobuf:"bytes,1,opt,name=jsonrpc,proto3" json:"jsonrpc,omitempty"`
	// The method to be invoked.
	Method string `protobuf:"bytes,2,opt,name=method,proto3" json:"method,omitempty"`
	// The method's params.
	Params *any.Any `protobuf:"bytes,3,opt,name=params,proto3" json:"params,omitempty"`
	// contains filtered or unexported fields
}

Notification is a processed notification message must not send a response back. They work like events.

func (*Notification) Descriptor deprecated

func (*Notification) Descriptor() ([]byte, []int)

Deprecated: Use Notification.ProtoReflect.Descriptor instead.

func (*Notification) GetJsonrpc

func (x *Notification) GetJsonrpc() string

func (*Notification) GetMethod

func (x *Notification) GetMethod() string

func (*Notification) GetParams

func (x *Notification) GetParams() *any.Any

func (*Notification) ProtoMessage

func (*Notification) ProtoMessage()

func (*Notification) ProtoReflect

func (x *Notification) ProtoReflect() protoreflect.Message

func (*Notification) Reset

func (x *Notification) Reset()

func (*Notification) String

func (x *Notification) String() string

type Request

type Request struct {

	// The jsonrpc version.
	//
	// The language server protocol always uses “2.0” as the jsonrpc version.
	Jsonrpc string `protobuf:"bytes,1,opt,name=jsonrpc,proto3" json:"jsonrpc,omitempty"`
	// The request id.
	//
	// proto3 `number` JSON mapping is (u)int32
	Id int32 `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"`
	// The method to be invoked.
	Method string `protobuf:"bytes,3,opt,name=method,proto3" json:"method,omitempty"`
	// The method's params.
	Params *any.Any `protobuf:"bytes,4,opt,name=params,proto3" json:"params,omitempty"`
	// contains filtered or unexported fields
}

Request to describe a request between the client and the server. Every processed request must send a response back to the sender of the request.

func (*Request) Descriptor deprecated

func (*Request) Descriptor() ([]byte, []int)

Deprecated: Use Request.ProtoReflect.Descriptor instead.

func (*Request) GetId

func (x *Request) GetId() int32

func (*Request) GetJsonrpc

func (x *Request) GetJsonrpc() string

func (*Request) GetMethod

func (x *Request) GetMethod() string

func (*Request) GetParams

func (x *Request) GetParams() *any.Any

func (*Request) ProtoMessage

func (*Request) ProtoMessage()

func (*Request) ProtoReflect

func (x *Request) ProtoReflect() protoreflect.Message

func (*Request) Reset

func (x *Request) Reset()

func (*Request) String

func (x *Request) String() string

type Response

type Response struct {

	// The jsonrpc version.
	//
	// The language server protocol always uses “2.0” as the jsonrpc version.
	Jsonrpc string `protobuf:"bytes,1,opt,name=jsonrpc,proto3" json:"jsonrpc,omitempty"`
	// The request id.
	//
	// proto3 `number` JSON mapping is (u)int32
	Id int32 `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"`
	// The result of a request. This member is require on success.
	// This member MUST NOT exist if there was an error invoking the method.
	Result *any.Any `protobuf:"bytes,3,opt,name=result,proto3" json:"result,omitempty"`
	// The error object in case a request fails.
	Error *Error `protobuf:"bytes,4,opt,name=error,proto3" json:"error,omitempty"`
	// contains filtered or unexported fields
}

Response sent as a result of a request. If a request doesn’t provide a result value the receiver of a request still needs to return a response message to conform to the JSON RPC specification. The result property of the ResponseMessage should be set to null in this case to signal a successful request.

func (*Response) Descriptor deprecated

func (*Response) Descriptor() ([]byte, []int)

Deprecated: Use Response.ProtoReflect.Descriptor instead.

func (*Response) GetError

func (x *Response) GetError() *Error

func (*Response) GetId

func (x *Response) GetId() int32

func (*Response) GetJsonrpc

func (x *Response) GetJsonrpc() string

func (*Response) GetResult

func (x *Response) GetResult() *any.Any

func (*Response) ProtoMessage

func (*Response) ProtoMessage()

func (*Response) ProtoReflect

func (x *Response) ProtoReflect() protoreflect.Message

func (*Response) Reset

func (x *Response) Reset()

func (*Response) String

func (x *Response) String() string

Jump to

Keyboard shortcuts

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