scheduling

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2024 License: CC0-1.0 Imports: 29 Imported by: 0

Documentation

Overview

Package scheduling provides the scheduling module for Mimi.

This module allows authorized users to CC Nise in their emails to schedule meetings and events. When Nise is CCed in an email, she will parse the email and extract the date, time, and location of the event. Nise will then create a Google Calendar event and send an invitation.

Index

Constants

View Source
const SchedulingPathPrefix = "/twirp/within.website.x.mimi.scheduling.Scheduling/"

SchedulingPathPrefix is a convenience constant that may identify URL paths. Should be used with caution, it only matches routes generated by Twirp Go clients, with the default "/twirp" prefix and default CamelCase service and method names. More info: https://twitchtv.github.io/twirp/docs/routing.html

View Source
const (
	Scheduling_ParseEmail_FullMethodName = "/within.website.x.mimi.scheduling.Scheduling/ParseEmail"
)

Variables

View Source
var File_scheduling_proto protoreflect.FileDescriptor
View Source
var Scheduling_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "within.website.x.mimi.scheduling.Scheduling",
	HandlerType: (*SchedulingServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "ParseEmail",
			Handler:    _Scheduling_ParseEmail_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "scheduling.proto",
}

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

Functions

func RegisterSchedulingServer

func RegisterSchedulingServer(s grpc.ServiceRegistrar, srv SchedulingServer)

func WriteError

func WriteError(resp http.ResponseWriter, err error)

WriteError writes an HTTP response with a valid Twirp error format (code, msg, meta). Useful outside of the Twirp server (e.g. http middleware), but does not trigger hooks. If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)

Types

type ConversationMember

type ConversationMember struct {
	Role  string `protobuf:"bytes,1,opt,name=role,proto3" json:"role,omitempty"`
	Name  string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"`
	// contains filtered or unexported fields
}

func (*ConversationMember) Descriptor deprecated

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

Deprecated: Use ConversationMember.ProtoReflect.Descriptor instead.

func (*ConversationMember) GetEmail

func (x *ConversationMember) GetEmail() string

func (*ConversationMember) GetName

func (x *ConversationMember) GetName() string

func (*ConversationMember) GetRole

func (x *ConversationMember) GetRole() string

func (*ConversationMember) ProtoMessage

func (*ConversationMember) ProtoMessage()

func (*ConversationMember) ProtoReflect

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

func (*ConversationMember) Reset

func (x *ConversationMember) Reset()

func (*ConversationMember) String

func (x *ConversationMember) String() string

func (*ConversationMember) Valid

func (cm *ConversationMember) Valid() error

type HTTPClient

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

HTTPClient is the interface used by generated clients to send HTTP requests. It is fulfilled by *(net/http).Client, which is sufficient for most users. Users can provide their own implementation for special retry policies.

HTTPClient implementations should not follow redirects. Redirects are automatically disabled if *(net/http).Client is passed to client constructors. See the withoutRedirects function in this file for more details.

type Module

type Module struct {
	UnimplementedSchedulingServer
	// contains filtered or unexported fields
}

func New

func New() *Module

func (*Module) ParseEmail

func (m *Module) ParseEmail(ctx context.Context, req *ParseReq) (*ParseResp, error)

type ParseReq

type ParseReq struct {
	Month               string                `protobuf:"bytes,1,opt,name=month,proto3" json:"month,omitempty"`
	ConversationMembers []*ConversationMember `protobuf:"bytes,2,rep,name=conversation_members,json=conversationMembers,proto3" json:"conversation_members,omitempty"`
	Message             string                `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"`
	Date                string                `protobuf:"bytes,4,opt,name=date,proto3" json:"date,omitempty"`
	// contains filtered or unexported fields
}

func (*ParseReq) Descriptor deprecated

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

Deprecated: Use ParseReq.ProtoReflect.Descriptor instead.

func (*ParseReq) GetConversationMembers

func (x *ParseReq) GetConversationMembers() []*ConversationMember

func (*ParseReq) GetDate

func (x *ParseReq) GetDate() string

func (*ParseReq) GetMessage

func (x *ParseReq) GetMessage() string

func (*ParseReq) GetMonth

func (x *ParseReq) GetMonth() string

func (*ParseReq) ProtoMessage

func (*ParseReq) ProtoMessage()

func (*ParseReq) ProtoReflect

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

func (*ParseReq) Reset

func (x *ParseReq) Reset()

func (*ParseReq) String

func (x *ParseReq) String() string

func (*ParseReq) Valid

func (pr *ParseReq) Valid() error

type ParseResp

type ParseResp struct {
	StartTime string                `protobuf:"bytes,1,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"`
	Duration  string                `protobuf:"bytes,2,opt,name=duration,proto3" json:"duration,omitempty"`
	Summary   string                `protobuf:"bytes,3,opt,name=summary,proto3" json:"summary,omitempty"`
	Attendees []*ConversationMember `protobuf:"bytes,4,rep,name=attendees,proto3" json:"attendees,omitempty"`
	Location  string                `protobuf:"bytes,5,opt,name=location,proto3" json:"location,omitempty"`
	// contains filtered or unexported fields
}

func (*ParseResp) Descriptor deprecated

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

Deprecated: Use ParseResp.ProtoReflect.Descriptor instead.

func (*ParseResp) GetAttendees

func (x *ParseResp) GetAttendees() []*ConversationMember

func (*ParseResp) GetDuration

func (x *ParseResp) GetDuration() string

func (*ParseResp) GetLocation

func (x *ParseResp) GetLocation() string

func (*ParseResp) GetStartTime

func (x *ParseResp) GetStartTime() string

func (*ParseResp) GetSummary

func (x *ParseResp) GetSummary() string

func (*ParseResp) ProtoMessage

func (*ParseResp) ProtoMessage()

func (*ParseResp) ProtoReflect

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

func (*ParseResp) Reset

func (x *ParseResp) Reset()

func (*ParseResp) String

func (x *ParseResp) String() string

type Scheduling

type Scheduling interface {
	ParseEmail(context.Context, *ParseReq) (*ParseResp, error)
}

func NewSchedulingJSONClient

func NewSchedulingJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Scheduling

NewSchedulingJSONClient creates a JSON client that implements the Scheduling interface. It communicates using JSON and can be configured with a custom HTTPClient.

func NewSchedulingProtobufClient

func NewSchedulingProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Scheduling

NewSchedulingProtobufClient creates a Protobuf client that implements the Scheduling interface. It communicates using Protobuf and can be configured with a custom HTTPClient.

type SchedulingClient

type SchedulingClient interface {
	ParseEmail(ctx context.Context, in *ParseReq, opts ...grpc.CallOption) (*ParseResp, error)
}

SchedulingClient is the client API for Scheduling 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 NewSchedulingClient

func NewSchedulingClient(cc grpc.ClientConnInterface) SchedulingClient

type SchedulingServer

type SchedulingServer interface {
	ParseEmail(context.Context, *ParseReq) (*ParseResp, error)
	// contains filtered or unexported methods
}

SchedulingServer is the server API for Scheduling service. All implementations must embed UnimplementedSchedulingServer for forward compatibility

type TwirpServer

type TwirpServer interface {
	http.Handler

	// ServiceDescriptor returns gzipped bytes describing the .proto file that
	// this service was generated from. Once unzipped, the bytes can be
	// unmarshalled as a
	// google.golang.org/protobuf/types/descriptorpb.FileDescriptorProto.
	//
	// The returned integer is the index of this particular service within that
	// FileDescriptorProto's 'Service' slice of ServiceDescriptorProtos. This is a
	// low-level field, expected to be used for reflection.
	ServiceDescriptor() ([]byte, int)

	// ProtocGenTwirpVersion is the semantic version string of the version of
	// twirp used to generate this file.
	ProtocGenTwirpVersion() string

	// PathPrefix returns the HTTP URL path prefix for all methods handled by this
	// service. This can be used with an HTTP mux to route Twirp requests.
	// The path prefix is in the form: "/<prefix>/<package>.<Service>/"
	// that is, everything in a Twirp route except for the <Method> at the end.
	PathPrefix() string
}

TwirpServer is the interface generated server structs will support: they're HTTP handlers with additional methods for accessing metadata about the service. Those accessors are a low-level API for building reflection tools. Most people can think of TwirpServers as just http.Handlers.

func NewSchedulingServer

func NewSchedulingServer(svc Scheduling, opts ...interface{}) TwirpServer

NewSchedulingServer builds a TwirpServer that can be used as an http.Handler to handle HTTP requests that are routed to the right method in the provided svc implementation. The opts are twirp.ServerOption modifiers, for example twirp.WithServerHooks(hooks).

type UnimplementedSchedulingServer

type UnimplementedSchedulingServer struct {
}

UnimplementedSchedulingServer must be embedded to have forward compatible implementations.

func (UnimplementedSchedulingServer) ParseEmail

type UnsafeSchedulingServer

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

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

Jump to

Keyboard shortcuts

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