shares

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package shares is a thin HTTP client for the gl-svc-2 journal-share endpoints under /v1/orgs/{orgId}/journals/{journalId}/shares. It backs the bitwave `journal share` subcommands.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	BaseURL       string
	OrgId         string
	TokenResolver func() (string, error)
	HTTPClient    *http.Client
}

func New

func New(baseURL, orgId string, tokenResolver func() (string, error)) *Client

func (*Client) Create

func (c *Client) Create(ctx context.Context, journalId string, req CreateRequest) (*CreateResponse, error)

func (*Client) List

func (c *Client) List(ctx context.Context, journalId string) ([]Share, error)

func (*Client) Revoke

func (c *Client) Revoke(ctx context.Context, journalId, shareId string) (*Share, error)

type CreateRequest

type CreateRequest struct {
	RecipientEmail string `json:"recipientEmail"`
	Message        string `json:"message,omitempty"`
	TTLHours       int    `json:"ttlHours,omitempty"`
}

type CreateResponse

type CreateResponse struct {
	Share
	URL string `json:"url"`
}

type Share

type Share struct {
	ShareId        string    `json:"shareId"`
	OrgId          string    `json:"orgId"`
	JournalId      string    `json:"journalId"`
	Token          string    `json:"token"`
	RecipientEmail string    `json:"recipientEmail"`
	Message        string    `json:"message,omitempty"`
	Status         string    `json:"status"`
	ExpiresAt      time.Time `json:"expiresAt"`
	EmailMessageId string    `json:"emailMessageId,omitempty"`
	EmailFailure   string    `json:"emailFailure,omitempty"`
	ViewCount      int64     `json:"viewCount"`
	CreatedAt      time.Time `json:"createdAt"`
	UpdatedAt      time.Time `json:"updatedAt"`
}

Jump to

Keyboard shortcuts

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