v1

package
v0.80.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package v1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Package credits/v1 contains the API of Credits services.

Index

Constants

View Source
const (

	// EventTypeCreditBundleCreated is the type of event fired after a credit bundle is created.
	// SubjectID contains the ID of the credit bundle.
	EventTypeCreditBundleCreated = "credit.creditbundle.created"
	// EventTypeCreditBundleCreated is the type of event fired after a credit bundle is updated.
	// SubjectID contains the ID of the credit bundle.
	EventTypeCreditBundleUpdated = "credit.creditbundle.updated"
	// EventTypeCreditBundleCreated is the type of event fired after a credit bundle is deleted.
	// SubjectID contains the ID of the credit bundle.
	EventTypeCreditBundleDeleted = "credit.creditbundle.deleted"
)
View Source
const (
	// APIID contains identifier of this API
	APIID = "credits/v1"
	// APIMajorVersion contains major version of this API
	APIMajorVersion = 1
	// APIMinorVersion contains minor version of this API
	APIMinorVersion = 0
	// APIPatchVersion contains patch version of this API
	APIPatchVersion = 0
)
View Source
const (
	// KindCreditBundle is a constant for the kind of CreditBundle resources.
	KindCreditBundle = "CreditBundle"
)
View Source
const (

	// PermissionCreditBundlesList is needed for listing credit bundles.
	PermissionCreditBundlesList = "credit.creditbundle.list"
)

Variables

View Source
var (
	ErrInvalidLengthCredits        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowCredits          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupCredits = fmt.Errorf("proto: unexpected end of group")
)

Functions

func CreditBundleURL

func CreditBundleURL(organizationURL, bundleID string) string

CreditBundleURL creates a resource URL for a credit bundle with the given ID.

func RegisterCreditsServiceHandler

func RegisterCreditsServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterCreditsServiceHandler registers the http handlers for service CreditsService to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterCreditsServiceHandlerClient

func RegisterCreditsServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client CreditsServiceClient) error

RegisterCreditsServiceHandlerClient registers the http handlers for service CreditsService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "CreditsServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "CreditsServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "CreditsServiceClient" to call the correct interceptors.

func RegisterCreditsServiceHandlerFromEndpoint

func RegisterCreditsServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterCreditsServiceHandlerFromEndpoint is same as RegisterCreditsServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterCreditsServiceHandlerServer

func RegisterCreditsServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server CreditsServiceServer) error

RegisterCreditsServiceHandlerServer registers the http handlers for service CreditsService to "mux". UnaryRPC :call CreditsServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.

func RegisterCreditsServiceServer

func RegisterCreditsServiceServer(s *grpc.Server, srv CreditsServiceServer)

Types

type CreditBundle

type CreditBundle struct {
	// ID of the credit bundle.
	// This is a read-only value.
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// URL of this credit bundle.
	// This is a read-only value.
	Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"`
	// The organization this credit bundle belongs to.
	// This is a read-only value.
	OrganizationId string `protobuf:"bytes,4,opt,name=organization_id,json=organizationId,proto3" json:"organization_id,omitempty"`
	// The number of credits purchased in this bundle.
	// This is a read-only value.
	CreditsPurchased float32 `protobuf:"fixed32,5,opt,name=credits_purchased,json=creditsPurchased,proto3" json:"credits_purchased,omitempty"`
	// The total price of these credits.
	// This is a read-only value.
	TotalPrice float32 `protobuf:"fixed32,6,opt,name=total_price,json=totalPrice,proto3" json:"total_price,omitempty"`
	// Currency used for total_price.
	// This is a read-only value.
	Currency string `protobuf:"bytes,7,opt,name=currency,proto3" json:"currency,omitempty"`
	// The number of credits remaining in this bundle.
	// This is a read-only value.
	CreditsRemaining float32 `protobuf:"fixed32,8,opt,name=credits_remaining,json=creditsRemaining,proto3" json:"credits_remaining,omitempty"`
	// The date at which this bundle was purchased.
	// This is a read-only value.
	PurchasedAt *types.Timestamp `protobuf:"bytes,9,opt,name=purchased_at,json=purchasedAt,proto3" json:"purchased_at,omitempty"`
	// The date from which this bundle is valid.
	// This is a read-only value.
	ValidFrom *types.Timestamp `protobuf:"bytes,10,opt,name=valid_from,json=validFrom,proto3" json:"valid_from,omitempty"`
	// The date until which this bundle is valid.
	// This is a read-only value.
	ValidUntil           *types.Timestamp `protobuf:"bytes,11,opt,name=valid_until,json=validUntil,proto3" json:"valid_until,omitempty"`
	XXX_NoUnkeyedLiteral struct{}         `json:"-"`
	XXX_unrecognized     []byte           `json:"-"`
	XXX_sizecache        int32            `json:"-"`
}

func (*CreditBundle) Descriptor

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

func (*CreditBundle) GetCreditsPurchased

func (m *CreditBundle) GetCreditsPurchased() float32

func (*CreditBundle) GetCreditsRemaining

func (m *CreditBundle) GetCreditsRemaining() float32

func (*CreditBundle) GetCurrency

func (m *CreditBundle) GetCurrency() string

func (*CreditBundle) GetId

func (m *CreditBundle) GetId() string

func (*CreditBundle) GetOrganizationId

func (m *CreditBundle) GetOrganizationId() string

func (*CreditBundle) GetPurchasedAt

func (m *CreditBundle) GetPurchasedAt() *types.Timestamp

func (*CreditBundle) GetTotalPrice

func (m *CreditBundle) GetTotalPrice() float32

func (*CreditBundle) GetUrl

func (m *CreditBundle) GetUrl() string

func (*CreditBundle) GetValidFrom

func (m *CreditBundle) GetValidFrom() *types.Timestamp

func (*CreditBundle) GetValidUntil

func (m *CreditBundle) GetValidUntil() *types.Timestamp

func (*CreditBundle) IsExpired

func (bundle *CreditBundle) IsExpired() bool

IsExpired returns true if a credit bundle is expired.

func (*CreditBundle) IsUsed

func (bundle *CreditBundle) IsUsed() bool

IsUsed returns true if a credit bundle has been used.

func (*CreditBundle) Marshal

func (m *CreditBundle) Marshal() (dAtA []byte, err error)

func (*CreditBundle) MarshalTo

func (m *CreditBundle) MarshalTo(dAtA []byte) (int, error)

func (*CreditBundle) MarshalToSizedBuffer

func (m *CreditBundle) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*CreditBundle) ProtoMessage

func (*CreditBundle) ProtoMessage()

func (*CreditBundle) Reset

func (m *CreditBundle) Reset()

func (*CreditBundle) Size

func (m *CreditBundle) Size() (n int)

func (*CreditBundle) String

func (m *CreditBundle) String() string

func (*CreditBundle) Unmarshal

func (m *CreditBundle) Unmarshal(dAtA []byte) error

func (*CreditBundle) XXX_DiscardUnknown

func (m *CreditBundle) XXX_DiscardUnknown()

func (*CreditBundle) XXX_Marshal

func (m *CreditBundle) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*CreditBundle) XXX_Merge

func (m *CreditBundle) XXX_Merge(src proto.Message)

func (*CreditBundle) XXX_Size

func (m *CreditBundle) XXX_Size() int

func (*CreditBundle) XXX_Unmarshal

func (m *CreditBundle) XXX_Unmarshal(b []byte) error

type CreditBundlesList

type CreditBundlesList struct {
	Items                []*CreditBundle `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"`
	XXX_NoUnkeyedLiteral struct{}        `json:"-"`
	XXX_unrecognized     []byte          `json:"-"`
	XXX_sizecache        int32           `json:"-"`
}

List of credit bundles

func (*CreditBundlesList) Descriptor

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

func (*CreditBundlesList) GetItems

func (m *CreditBundlesList) GetItems() []*CreditBundle

func (*CreditBundlesList) Marshal

func (m *CreditBundlesList) Marshal() (dAtA []byte, err error)

func (*CreditBundlesList) MarshalTo

func (m *CreditBundlesList) MarshalTo(dAtA []byte) (int, error)

func (*CreditBundlesList) MarshalToSizedBuffer

func (m *CreditBundlesList) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*CreditBundlesList) ProtoMessage

func (*CreditBundlesList) ProtoMessage()

func (*CreditBundlesList) Reset

func (m *CreditBundlesList) Reset()

func (*CreditBundlesList) Size

func (m *CreditBundlesList) Size() (n int)

func (*CreditBundlesList) String

func (m *CreditBundlesList) String() string

func (*CreditBundlesList) Unmarshal

func (m *CreditBundlesList) Unmarshal(dAtA []byte) error

func (*CreditBundlesList) XXX_DiscardUnknown

func (m *CreditBundlesList) XXX_DiscardUnknown()

func (*CreditBundlesList) XXX_Marshal

func (m *CreditBundlesList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*CreditBundlesList) XXX_Merge

func (m *CreditBundlesList) XXX_Merge(src proto.Message)

func (*CreditBundlesList) XXX_Size

func (m *CreditBundlesList) XXX_Size() int

func (*CreditBundlesList) XXX_Unmarshal

func (m *CreditBundlesList) XXX_Unmarshal(b []byte) error

type CreditsServiceClient

type CreditsServiceClient interface {
	// List credit bundles for an organization.
	// Required permissions:
	// - credit.creditbundle.list on the organization identified by the given organization ID
	ListCreditBundles(ctx context.Context, in *ListCreditBundlesRequest, opts ...grpc.CallOption) (*CreditBundlesList, error)
}

CreditsServiceClient is the client API for CreditsService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewCreditsServiceClient

func NewCreditsServiceClient(cc *grpc.ClientConn) CreditsServiceClient

type CreditsServiceServer

type CreditsServiceServer interface {
	// List credit bundles for an organization.
	// Required permissions:
	// - credit.creditbundle.list on the organization identified by the given organization ID
	ListCreditBundles(context.Context, *ListCreditBundlesRequest) (*CreditBundlesList, error)
}

CreditsServiceServer is the server API for CreditsService service.

type ListCreditBundlesRequest

type ListCreditBundlesRequest struct {
	// ID of the organization for which credit bundles are listed.
	// This is a required field.
	OrganizationId string `protobuf:"bytes,1,opt,name=organization_id,json=organizationId,proto3" json:"organization_id,omitempty"`
	// If set, exclude expired bundles.
	ExcludeExpired       bool     `protobuf:"varint,2,opt,name=exclude_expired,json=excludeExpired,proto3" json:"exclude_expired,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Request for listing credit bundles

func (*ListCreditBundlesRequest) Descriptor

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

func (*ListCreditBundlesRequest) GetExcludeExpired

func (m *ListCreditBundlesRequest) GetExcludeExpired() bool

func (*ListCreditBundlesRequest) GetOrganizationId

func (m *ListCreditBundlesRequest) GetOrganizationId() string

func (*ListCreditBundlesRequest) Marshal

func (m *ListCreditBundlesRequest) Marshal() (dAtA []byte, err error)

func (*ListCreditBundlesRequest) MarshalTo

func (m *ListCreditBundlesRequest) MarshalTo(dAtA []byte) (int, error)

func (*ListCreditBundlesRequest) MarshalToSizedBuffer

func (m *ListCreditBundlesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ListCreditBundlesRequest) ProtoMessage

func (*ListCreditBundlesRequest) ProtoMessage()

func (*ListCreditBundlesRequest) Reset

func (m *ListCreditBundlesRequest) Reset()

func (*ListCreditBundlesRequest) Size

func (m *ListCreditBundlesRequest) Size() (n int)

func (*ListCreditBundlesRequest) String

func (m *ListCreditBundlesRequest) String() string

func (*ListCreditBundlesRequest) Unmarshal

func (m *ListCreditBundlesRequest) Unmarshal(dAtA []byte) error

func (*ListCreditBundlesRequest) XXX_DiscardUnknown

func (m *ListCreditBundlesRequest) XXX_DiscardUnknown()

func (*ListCreditBundlesRequest) XXX_Marshal

func (m *ListCreditBundlesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ListCreditBundlesRequest) XXX_Merge

func (m *ListCreditBundlesRequest) XXX_Merge(src proto.Message)

func (*ListCreditBundlesRequest) XXX_Size

func (m *ListCreditBundlesRequest) XXX_Size() int

func (*ListCreditBundlesRequest) XXX_Unmarshal

func (m *ListCreditBundlesRequest) XXX_Unmarshal(b []byte) error

type UnimplementedCreditsServiceServer

type UnimplementedCreditsServiceServer struct {
}

UnimplementedCreditsServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedCreditsServiceServer) ListCreditBundles

Jump to

Keyboard shortcuts

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