Help us shape the future of Go! Take the 2026 Go Developer Survey

upstream

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package upstream provides HTTP helpers for fetching workspace-scoped data from the rysh-server using the local upstream API key.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchWorkspaceID

func FetchWorkspaceID(up config.UpstreamConfig) (string, error)

FetchWorkspaceID queries the upstream server's /api/server-info endpoint with the workspace API key and returns the workspace id (UUID). The id is the globally unique NATS namespace token (ws.{id}.*); workspace names are unique per user, so the name cannot be used on the wire.

func ResolveWorkspaceID

func ResolveWorkspaceID(up config.UpstreamConfig) string

ResolveWorkspaceID returns the upstream NATS namespace token for the given upstream config. When the configured workspace value is already a UUID it is returned unchanged (no network call). Otherwise — when sharing is enabled and an api_key is present — it resolves the workspace id from the server via the api key. On any failure it falls back to the configured value so the CLI still starts (sharing simply won't line up until the id is correct).

Types

type ConnectionCredentials

type ConnectionCredentials struct {
	ConnectionID   string            `json:"connection_id"`
	WorkspaceID    string            `json:"workspace_id"`
	Name           string            `json:"name"`
	ConnectionType string            `json:"connection_type"`
	Config         map[string]string `json:"config"`
	Secrets        map[string]string `json:"secrets"`
}

ConnectionCredentials carries decrypted secrets plus public config for an external connection of a given type, fetched from the rysh-server.

func FetchConnectionCredentials

func FetchConnectionCredentials(cfg config.Config, connType string) (*ConnectionCredentials, error)

FetchConnectionCredentials retrieves the decrypted credentials for the workspace's enabled connection of the given type (e.g. "slack", "whatsapp"). Returns an error if upstream is not configured, the request fails, or the workspace has no enabled connection of that type.

type RemoteShare

type RemoteShare struct {
	ID          string `json:"id"`
	ShareID     string `json:"share_id"`
	EntityType  string `json:"entity_type"`
	EntityID    string `json:"entity_id"`
	EntityAlias string `json:"entity_alias"`
	ShareMode   string `json:"share_mode"`
	State       string `json:"state"`
	Origin      string `json:"origin"`
	SessionName string `json:"session_name"`
	CreatedAt   string `json:"created_at"`
}

RemoteShare represents a shared entity returned by the upstream server.

func FetchRemoteShares

func FetchRemoteShares(cfg config.Config) ([]RemoteShare, error)

FetchRemoteShares retrieves all active shares in the workspace from the upstream server. The workspace API key scopes the query to the key's workspace only.

Jump to

Keyboard shortcuts

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