api

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package api holds Conduit's JSON:API DTOs and their domain mappers.

Index

Constants

View Source
const ResourceTypeConnection resource.Type = "connections"
View Source
const ResourceTypeConnector resource.Type = "connectors"
View Source
const ResourceTypeCredential resource.Type = "credentials"

Variables

This section is empty.

Functions

func ConnectionFromDTO

func ConnectionFromDTO(dto *ConnectionDTO) domain.Connection

Types

type ConnectionDTO

type ConnectionDTO struct {
	resource.RestDTO

	ROwner     string     `jsonapi:"attr,owner,omitempty"`
	RConnector string     `jsonapi:"attr,connector,omitempty"`
	RStatus    string     `jsonapi:"attr,status,omitempty"`
	RScopes    []string   `jsonapi:"attr,scopes,omitempty"`
	RExpiresAt *time.Time `jsonapi:"attr,expiresAt,omitempty"`
	RCreatedAt time.Time  `jsonapi:"attr,createdAt,omitempty"`
	RUpdatedAt time.Time  `jsonapi:"attr,updatedAt,omitempty"`
}

ConnectionDTO is the wire shape of a connection. Owner is an opaque key the caller supplies on create and Conduit scopes by.

func ConnectionToDTO

func ConnectionToDTO(c domain.Connection) *ConnectionDTO

type ConnectorDTO

type ConnectorDTO struct {
	resource.RestDTO

	RName       string   `jsonapi:"attr,name,omitempty"`
	RAuthType   string   `jsonapi:"attr,authType,omitempty"`
	RAuthURL    string   `jsonapi:"attr,authUrl,omitempty"`
	RTokenURL   string   `jsonapi:"attr,tokenUrl,omitempty"`
	RScopes     []string `jsonapi:"attr,scopes,omitempty"`
	RRateLimit  int      `jsonapi:"attr,rateLimit,omitempty"`
	RRateWindow string   `jsonapi:"attr,rateWindow,omitempty"`
}

ConnectorDTO is the read-only wire shape of a provider definition.

func ConnectorToDTO

func ConnectorToDTO(c domain.Connector) *ConnectorDTO

type CredentialDTO

type CredentialDTO struct {
	resource.RestDTO

	RKind       string                    `jsonapi:"attr,kind,omitempty"`
	RKeyID      string                    `jsonapi:"attr,keyId,omitempty"`
	RExpiresAt  *time.Time                `jsonapi:"attr,expiresAt,omitempty"`
	RConnection *resource.RelationshipDTO `jsonapi:"rel,connection,omitempty"`
}

CredentialDTO is the read-safe wire shape: metadata only, never plaintext.

func CredentialToDTO

func CredentialToDTO(c domain.Credential) *CredentialDTO

type CredentialInputDTO

type CredentialInputDTO struct {
	resource.RestDTO

	RKind         string     `jsonapi:"attr,kind,omitempty"`
	RAccessToken  string     `jsonapi:"attr,accessToken,omitempty"`
	RRefreshToken string     `jsonapi:"attr,refreshToken,omitempty"`
	RAPIKey       string     `jsonapi:"attr,apiKey,omitempty"`
	RAPISecret    string     `jsonapi:"attr,apiSecret,omitempty"`
	RExpiresAt    *time.Time `jsonapi:"attr,expiresAt,omitempty"`
}

CredentialInputDTO is the write-only intake for storing a connection's secret. It is never returned with plaintext; reads use CredentialDTO.

Jump to

Keyboard shortcuts

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