api

package
v0.0.0-...-580e15c Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Contacts_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "Contacts",
	HandlerType: (*ContactsServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "ListContacts",
			Handler:    _Contacts_ListContacts_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "contacts.proto",
}

Contacts_ServiceDesc is the grpc.ServiceDesc for Contacts service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var File_contacts_proto protoreflect.FileDescriptor

Functions

func RegisterContactsServer

func RegisterContactsServer(s grpc.ServiceRegistrar, srv ContactsServer)

Types

type Contact

type Contact struct {
	Id          string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Forename    string `protobuf:"bytes,2,opt,name=forename,proto3" json:"forename,omitempty"`
	Surname     string `protobuf:"bytes,3,opt,name=surname,proto3" json:"surname,omitempty"`
	PhoneNumber string `protobuf:"bytes,4,opt,name=phone_number,json=phoneNumber,proto3" json:"phone_number,omitempty"`
	// contains filtered or unexported fields
}

func (*Contact) Descriptor deprecated

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

Deprecated: Use Contact.ProtoReflect.Descriptor instead.

func (*Contact) GetForename

func (x *Contact) GetForename() string

func (*Contact) GetId

func (x *Contact) GetId() string

func (*Contact) GetPhoneNumber

func (x *Contact) GetPhoneNumber() string

func (*Contact) GetSurname

func (x *Contact) GetSurname() string

func (*Contact) ProtoMessage

func (*Contact) ProtoMessage()

func (*Contact) ProtoReflect

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

func (*Contact) Reset

func (x *Contact) Reset()

func (*Contact) String

func (x *Contact) String() string

type ContactsClient

type ContactsClient interface {
	// Get a list of contacts.
	ListContacts(ctx context.Context, in *ListContactsRequest, opts ...grpc.CallOption) (*ListContactsResponse, error)
}

ContactsClient is the client API for Contacts service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewContactsClient

func NewContactsClient(cc grpc.ClientConnInterface) ContactsClient

type ContactsServer

type ContactsServer interface {
	// Get a list of contacts.
	ListContacts(context.Context, *ListContactsRequest) (*ListContactsResponse, error)
}

ContactsServer is the server API for Contacts service. All implementations should embed UnimplementedContactsServer for forward compatibility

type ListContactsRequest

type ListContactsRequest struct {

	// The query, this MUST NOT be set when using a page
	// token.
	Query *ListContactsRequest_Filters `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"`
	// How many results to return in one request, this
	// must be a minimum of 0 and a sane maximum, in this
	// case the server will return invalid arguement if
	// the page size is over 30 just to simulate it easier.
	PageSize int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
	// How many results to skip, this can be sent on the
	// first page request or when obtaining "next page".
	Skip int32 `protobuf:"varint,3,opt,name=skip,proto3" json:"skip,omitempty"`
	// The page token, if not set the first page of results
	// is returned.
	PageToken string `protobuf:"bytes,4,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"`
	// contains filtered or unexported fields
}

func (*ListContactsRequest) Descriptor deprecated

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

Deprecated: Use ListContactsRequest.ProtoReflect.Descriptor instead.

func (*ListContactsRequest) GetPageSize

func (x *ListContactsRequest) GetPageSize() int32

func (*ListContactsRequest) GetPageToken

func (x *ListContactsRequest) GetPageToken() string

func (*ListContactsRequest) GetQuery

func (*ListContactsRequest) GetSkip

func (x *ListContactsRequest) GetSkip() int32

func (*ListContactsRequest) ProtoMessage

func (*ListContactsRequest) ProtoMessage()

func (*ListContactsRequest) ProtoReflect

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

func (*ListContactsRequest) Reset

func (x *ListContactsRequest) Reset()

func (*ListContactsRequest) String

func (x *ListContactsRequest) String() string

type ListContactsRequest_Filters

type ListContactsRequest_Filters struct {

	// Filter on a partial forname.
	Forename string `protobuf:"bytes,1,opt,name=forename,proto3" json:"forename,omitempty"`
	// Filter on a partial phone number.
	PhoneNumber string `protobuf:"bytes,2,opt,name=phone_number,json=phoneNumber,proto3" json:"phone_number,omitempty"`
	// contains filtered or unexported fields
}

Filters message, we use a separate message to define the filters, this means we can use this message to encode the query for use on subsequent results.

func (*ListContactsRequest_Filters) Descriptor deprecated

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

Deprecated: Use ListContactsRequest_Filters.ProtoReflect.Descriptor instead.

func (*ListContactsRequest_Filters) GetForename

func (x *ListContactsRequest_Filters) GetForename() string

func (*ListContactsRequest_Filters) GetPhoneNumber

func (x *ListContactsRequest_Filters) GetPhoneNumber() string

func (*ListContactsRequest_Filters) ProtoMessage

func (*ListContactsRequest_Filters) ProtoMessage()

func (*ListContactsRequest_Filters) ProtoReflect

func (*ListContactsRequest_Filters) Reset

func (x *ListContactsRequest_Filters) Reset()

func (*ListContactsRequest_Filters) String

func (x *ListContactsRequest_Filters) String() string

type ListContactsResponse

type ListContactsResponse struct {

	// A list of contacts, ranging between 0 and
	// `page_size` in length.
	Contacts []*Contact `protobuf:"bytes,1,rep,name=contacts,proto3" json:"contacts,omitempty"`
	// The total results found in the query.
	Total int32 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"`
	// If set, means there is more results. Use this page token
	// in the next call to `ListContacts` to load more results.
	NextPageToken string `protobuf:"bytes,3,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"`
	// contains filtered or unexported fields
}

func (*ListContactsResponse) Descriptor deprecated

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

Deprecated: Use ListContactsResponse.ProtoReflect.Descriptor instead.

func (*ListContactsResponse) GetContacts

func (x *ListContactsResponse) GetContacts() []*Contact

func (*ListContactsResponse) GetNextPageToken

func (x *ListContactsResponse) GetNextPageToken() string

func (*ListContactsResponse) GetTotal

func (x *ListContactsResponse) GetTotal() int32

func (*ListContactsResponse) ProtoMessage

func (*ListContactsResponse) ProtoMessage()

func (*ListContactsResponse) ProtoReflect

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

func (*ListContactsResponse) Reset

func (x *ListContactsResponse) Reset()

func (*ListContactsResponse) String

func (x *ListContactsResponse) String() string

type UnimplementedContactsServer

type UnimplementedContactsServer struct {
}

UnimplementedContactsServer should be embedded to have forward compatible implementations.

func (UnimplementedContactsServer) ListContacts

type UnsafeContactsServer

type UnsafeContactsServer interface {
	// contains filtered or unexported methods
}

UnsafeContactsServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ContactsServer will result in compilation errors.

Jump to

Keyboard shortcuts

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