api

package module
v0.0.0-...-59c490d Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2024 License: MIT Imports: 8 Imported by: 0

README

api-go

status-badge

A Golang implementation of the Licensing API as defined by the proto repository.

package main

import (
	"google.golang.org/grpc"

	"code.pitz.tech/licensing/api-go"
)

func main() {
	clientConn, err := grpc.Dial("host:port") // grpc.Dial("host:port", dialopts...)
	if err != nil {
		panic(err)
    }
	
	client, err := api.NewClient(api.ClientConfig{
		ClientConn: clientConn,
	})
	if err != nil {
		panic(err)
    }
	
	client.Contributors()
	client.Licenses()
	client.Packages()
	client.Products()
	client.Tokens()
	client.Users()
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client encapsulates all operations that can be performed against the service.

func NewClient

func NewClient(opts ...ClientOption) (*Client, error)

NewClient constructs an API client using the provided configuration or list of options.

func (*Client) Contributors

func (*Client) Licenses

func (c *Client) Licenses() licensesv1.LicenseServiceClient

func (*Client) Packages

func (c *Client) Packages() packagesv1.PackageServiceClient

func (*Client) Products

func (c *Client) Products() productsv1.ProductServiceClient

func (*Client) Tokens

func (c *Client) Tokens() tokensv1.TokenServiceClient

func (*Client) Users

func (c *Client) Users() usersv1.UserServiceClient

type ClientConfig

type ClientConfig struct {
	ClientConn *grpc.ClientConn
}

ClientConfig defines the bare requirements needed to establish a connection to the target server instance.

func (ClientConfig) Apply

func (c ClientConfig) Apply(dst *ClientConfig)

Apply merges this configuration with the destination configuration. This mechanism uses a last-write-wins approach.

type ClientOption

type ClientOption interface {
	// Apply configures the provided ClientConfig when called.
	Apply(*ClientConfig)
}

ClientOption defines a base abstraction for configuring the client.

type ClientOptionFunc

type ClientOptionFunc func(*ClientConfig)

ClientOptionFunc provides a functional abstraction for configuring the client.

func (ClientOptionFunc) Apply

func (fn ClientOptionFunc) Apply(config *ClientConfig)

Directories

Path Synopsis
contributors
v1
Package contributorsv1 is a reverse proxy.
Package contributorsv1 is a reverse proxy.
licenses
v1
Package licensesv1 is a reverse proxy.
Package licensesv1 is a reverse proxy.
packages
v1
Package packagesv1 is a reverse proxy.
Package packagesv1 is a reverse proxy.
products
v1
Package productsv1 is a reverse proxy.
Package productsv1 is a reverse proxy.
tokens
v1
Package tokensv1 is a reverse proxy.
Package tokensv1 is a reverse proxy.
users
v1
Package usersv1 is a reverse proxy.
Package usersv1 is a reverse proxy.

Jump to

Keyboard shortcuts

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