Something went wrong. Try again.
An unofficial terminal client for Tangled, optimized for humans and agents. forked from aly.codes/tg
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041package app
import ( "context" "fmt" "time"
"github.com/alyraffauf/tg/atproto" "github.com/alyraffauf/tg/internal/tangledlex" "github.com/bluesky-social/indigo/atproto/syntax")
// CreateIssue writes a new issue record in the target repository.func (s *Service) CreateIssue(ctx context.Context, t Target, title, body string) (*CreatedRecordResult, error) { atClient, did, err := s.authenticatedPDS(ctx) if err != nil { return nil, err } repoDid, err := s.repoDID(ctx, t) if err != nil { return nil, err } rkey := string(syntax.NewTIDNow(0)) uri, _, err := atClient.PutRecord(ctx, atproto.PutRecordInput{ Repo: did, Collection: issueCollection, Rkey: rkey, Record: tangledlex.RepoIssue{ LexiconTypeID: issueCollection, Repo: repoDid, Title: title, Body: optionalString(body), CreatedAt: time.Now().UTC().Format(time.RFC3339), }, }) if err != nil { return nil, fmt.Errorf("create issue: %w", err) } return &CreatedRecordResult{Rkey: rkey, URI: uri}, nil}