rpcservice

package
v1.19.4 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Port is the port number to listen to on localhost
	Port int

	// Info, error, etc. logger. Unrelated to API request logs.
	Log *log.Logger

	// UserCfg is the Stripe CLI config of the user
	UserCfg *config.Config
}

Config provides the configuration for the RPC service.

type ConfigOutput

type ConfigOutput struct {
	// Host is the IP address of the gRPC server
	Host string `json:"host"`

	// Port is port number of the gRPC server
	Port int `json:"port"`
}

ConfigOutput is the config that clients will need to connect to the gRPC server. This is printed out for clients to parse.

type IProxy

type IProxy interface {
	Run(context.Context) error
}

IProxy enables mocking a proxy object in tests

type ITailer

type ITailer interface {
	Run(context.Context) error
}

ITailer enables mocking a tailer object in tests

type RPCService

type RPCService struct {

	// TelemetryClient to use for sending telemetry events
	TelemetryClient stripe.TelemetryClient
	// contains filtered or unexported fields
}

RPCService implements the gRPC interface and starts the gRPC server.

func New

func New(
	cfg *Config,
	telemetryClient stripe.TelemetryClient,
) *RPCService

New creates a new RPC service

func (*RPCService) EventsResend

EventsResend resends an event given an event ID

func (*RPCService) Fixture added in v1.7.5

func (srv *RPCService) Fixture(ctx context.Context, req *rpc.FixtureRequest) (*rpc.FixtureResponse, error)

Fixture returns the default fixture of given event in string format

func (*RPCService) Listen

func (srv *RPCService) Listen(req *rpc.ListenRequest, stream rpc.StripeCLI_ListenServer) error

Listen returns a stream of webhook events and forwards them to a local endpoint

func (*RPCService) Login

func (srv *RPCService) Login(ctx context.Context, req *rpc.LoginRequest) (*rpc.LoginResponse, error)

Login returns a URL and pairing code to complete the login for the Stripe CLI

func (*RPCService) LoginStatus

func (srv *RPCService) LoginStatus(ctx context.Context, req *rpc.LoginStatusRequest) (*rpc.LoginStatusResponse, error)

LoginStatus returns when login is successful, or returns an error if failure or timeout.

func (*RPCService) LogsTail

func (srv *RPCService) LogsTail(req *rpc.LogsTailRequest, stream rpc.StripeCLI_LogsTailServer) error

LogsTail returns a stream of API logs

func (*RPCService) Run

func (srv *RPCService) Run(ctx context.Context)

Run starts a gRPC server on localhost

func (*RPCService) SampleConfigs

SampleConfigs returns a list of available configs for a given Stripe sample.

func (*RPCService) SampleCreate

SampleCreate creates a sample at a given path with the selected integration, client language, and server language.

func (*RPCService) SamplesList

func (srv *RPCService) SamplesList(ctx context.Context, req *rpc.SamplesListRequest) (*rpc.SamplesListResponse, error)

SamplesList returns a list of available Stripe samples

func (*RPCService) Trigger

func (srv *RPCService) Trigger(ctx context.Context, req *rpc.TriggerRequest) (*rpc.TriggerResponse, error)

Trigger triggers a Stripe event.

func (*RPCService) TriggersList

TriggersList returns a list of available events for `Trigger`.

func (*RPCService) Version

func (srv *RPCService) Version(ctx context.Context, req *rpc.VersionRequest) (*rpc.VersionResponse, error)

Version returns the version of the Stripe CLI

func (*RPCService) WebhookEndpointCreate added in v1.7.12

WebhookEndpointCreate create a new webhook endpoint

func (*RPCService) WebhookEndpointsList added in v1.7.9

WebhookEndpointsList returns a list of webhook endpoints.

type WrappedServerStream added in v1.7.4

type WrappedServerStream struct {
	grpc.ServerStream
	// contains filtered or unexported fields
}

WrappedServerStream wraps a ServerSteam so that we can pass values through context. https://pkg.go.dev/github.com/grpc-ecosystem/go-grpc-middleware#hdr-Writing_Your_Own

func (WrappedServerStream) Context added in v1.7.4

func (w WrappedServerStream) Context() context.Context

Context returns the context for this stream.

Jump to

Keyboard shortcuts

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