carbon

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2022 License: Apache-2.0 Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_proto_carbon_proto protoreflect.FileDescriptor

Functions

func NewCarbonEndpoints

func NewCarbonEndpoints() []*api.Endpoint

func RegisterCarbonHandler

func RegisterCarbonHandler(s server.Server, hdlr CarbonHandler, opts ...server.HandlerOption) error

Types

type CarbonHandler

type CarbonHandler interface {
	Offset(context.Context, *OffsetRequest, *OffsetResponse) error
}

type CarbonService

type CarbonService interface {
	Offset(ctx context.Context, in *OffsetRequest, opts ...client.CallOption) (*OffsetResponse, error)
}

func NewCarbonService

func NewCarbonService(name string, c client.Client) CarbonService

type OffsetRequest

type OffsetRequest struct {
	// contains filtered or unexported fields
}

Purchase 1kg (0.001 tonnes) of carbon offsets in a single request

func (*OffsetRequest) Descriptor deprecated

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

Deprecated: Use OffsetRequest.ProtoReflect.Descriptor instead.

func (*OffsetRequest) ProtoMessage

func (*OffsetRequest) ProtoMessage()

func (*OffsetRequest) ProtoReflect

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

func (*OffsetRequest) Reset

func (x *OffsetRequest) Reset()

func (*OffsetRequest) String

func (x *OffsetRequest) String() string

type OffsetResponse

type OffsetResponse struct {

	// number of units purchased
	Units int32 `protobuf:"varint,1,opt,name=units,proto3" json:"units,omitempty"`
	// the metric used e.g KG or Tonnes
	Metric string `protobuf:"bytes,2,opt,name=metric,proto3" json:"metric,omitempty"`
	// number of tonnes
	Tonnes float64 `protobuf:"fixed64,3,opt,name=tonnes,proto3" json:"tonnes,omitempty"`
	// projects it was allocated to
	Projects []*Project `protobuf:"bytes,4,rep,name=projects,proto3" json:"projects,omitempty"`
	// contains filtered or unexported fields
}

func (*OffsetResponse) Descriptor deprecated

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

Deprecated: Use OffsetResponse.ProtoReflect.Descriptor instead.

func (*OffsetResponse) GetMetric

func (x *OffsetResponse) GetMetric() string

func (*OffsetResponse) GetProjects

func (x *OffsetResponse) GetProjects() []*Project

func (*OffsetResponse) GetTonnes

func (x *OffsetResponse) GetTonnes() float64

func (*OffsetResponse) GetUnits

func (x *OffsetResponse) GetUnits() int32

func (*OffsetResponse) ProtoMessage

func (*OffsetResponse) ProtoMessage()

func (*OffsetResponse) ProtoReflect

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

func (*OffsetResponse) Reset

func (x *OffsetResponse) Reset()

func (*OffsetResponse) String

func (x *OffsetResponse) String() string

type Project

type Project struct {

	// name of the project
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// percentage that went to this
	Percentage float64 `protobuf:"fixed64,2,opt,name=percentage,proto3" json:"percentage,omitempty"`
	// amount in tonnes
	Tonnes float64 `protobuf:"fixed64,3,opt,name=tonnes,proto3" json:"tonnes,omitempty"`
	// contains filtered or unexported fields
}

func (*Project) Descriptor deprecated

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

Deprecated: Use Project.ProtoReflect.Descriptor instead.

func (*Project) GetName

func (x *Project) GetName() string

func (*Project) GetPercentage

func (x *Project) GetPercentage() float64

func (*Project) GetTonnes

func (x *Project) GetTonnes() float64

func (*Project) ProtoMessage

func (*Project) ProtoMessage()

func (*Project) ProtoReflect

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

func (*Project) Reset

func (x *Project) Reset()

func (*Project) String

func (x *Project) String() string

Jump to

Keyboard shortcuts

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