client

package module
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: May 12, 2026 License: MIT Imports: 22 Imported by: 0

README

syfon client (Go SDK)

Go Reference Go Report Card Go Version CI Client Coverage dependabot Latest Release PRs Welcome GitHub Stars

This module provides a reusable Go client for Syfon APIs.

  • Module: github.com/calypr/syfon/client
  • Pattern: Vault-style grouped services (Client.Data(), Client.Index(), Client.Buckets(), etc.)
  • Current surface:
    • Health: /healthz
    • Data: /data/upload, /data/upload/{file_id}, /data/upload/bulk, /data/download/{file_id}, multipart endpoints
    • Index: /index, /index/{id}, bulk endpoints
    • Buckets: /data/buckets, /data/buckets/{bucket}, /data/buckets/{bucket}/scopes
    • Core: /index/v1/sha256/validity
    • Metrics: /index/v1/metrics/*

Usage

package main

import (
  "context"
  "log"

  syclient "github.com/calypr/syfon/client"
)

func main() {
  c := syclient.New(
    "http://127.0.0.1:8080",
    syclient.WithBasicAuth("user", "pass"),
  )

  err := c.Buckets().Put(context.Background(), syclient.PutBucketRequest{
    Bucket:       "cbds",
    Provider:     "s3",
    Region:       "us-east-1",
    AccessKey:    "...",
    SecretKey:    "...",
    Organization: "syfon",
    ProjectID:    "e2e",
  })
  if err != nil {
    log.Fatal(err)
  }

  if err := c.Health().Ping(context.Background()); err != nil {
    log.Fatal(err)
  }
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Download

func Download(ctx context.Context, api *Client, bk transfer.ReadBackend, guids []string, opts DownloadOptions) error

Download handles single- and multi-file downloads and manifest expansion.

func New

func New(baseURL string, opts ...Option) (syfonclient.SyfonClient, error)

func Upload

func Upload(ctx context.Context, bk transfer.MultipartBackend, sourcePath string, opts UploadOptions) error

Upload handles local file uploads, manifest-driven uploads, and retrying failed uploads.

Types

type BasicAuth

type BasicAuth struct {
	Username string
	Password string
}

type Client

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

Client implements syfonclient.SyfonClient

func NewClient

func NewClient(cfg *Config) (*Client, error)

func (*Client) Address

func (c *Client) Address() string

func (*Client) BucketAPI

func (c *Client) BucketAPI() *bucketapi.ClientWithResponses

func (*Client) Buckets

func (c *Client) Buckets() *syfonclient.BucketsService

func (*Client) DRS

func (c *Client) DRS() *syfonclient.DRSService

func (*Client) DRSAPI

func (c *Client) DRSAPI() *drs.ClientWithResponses

func (*Client) Data

func (c *Client) Data() *syfonclient.DataService

func (*Client) HTTPClient

func (c *Client) HTTPClient() *http.Client

func (*Client) Health

func (c *Client) Health() *syfonclient.HealthService

func (*Client) Index

func (c *Client) Index() *syfonclient.IndexService

func (*Client) InternalAPI

func (c *Client) InternalAPI() *internalapi.ClientWithResponses

func (*Client) LFS

func (c *Client) LFS() *syfonclient.LFSService

func (*Client) LFSAPI

func (c *Client) LFSAPI() *lfsapi.ClientWithResponses

Schema-specific generated clients

func (*Client) Logger

func (c *Client) Logger() *logs.Gen3Logger

func (*Client) Metrics

func (c *Client) Metrics() *syfonclient.MetricsService

func (*Client) MetricsAPI

func (c *Client) MetricsAPI() *metricsapi.ClientWithResponses

func (*Client) Requestor

func (c *Client) Requestor() request.Requester

type Config

type Config struct {
	Address    string
	HTTPClient *http.Client
	UserAgent  string
	BasicAuth  *BasicAuth
	Token      string
}

func DefaultConfig

func DefaultConfig() *Config

type DownloadOptions

type DownloadOptions struct {
	DownloadPath   string
	FilenameFormat string
	Rename         bool
	NoPrompt       bool
	Protocol       string
	NumParallel    int
	SkipCompleted  bool
	ManifestPath   string
}

type Option

type Option func(*Config)

func WithBasicAuth

func WithBasicAuth(user, pass string) Option

func WithBearerToken

func WithBearerToken(token string) Option

func WithHTTPClient

func WithHTTPClient(h *http.Client) Option

func WithUserAgent

func WithUserAgent(v string) Option

type UploadOptions

type UploadOptions struct {
	Bucket             string
	IncludeSubDirName  bool
	HasMetadata        bool
	Batch              bool
	NumParallel        int
	ManifestPath       string
	RetryFailedLogPath string
	ShowProgress       bool
	ForceMultipart     bool
	GUID               string
}

Directories

Path Synopsis
Package cloud contains client-side data-provider inspection helpers used when a caller needs to talk directly to S3/GCS/Azure object storage.
Package cloud contains client-side data-provider inspection helpers used when a caller needs to talk directly to S3/GCS/Azure object storage.

Jump to

Keyboard shortcuts

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