Documentation
¶
Index ¶
- func BuildAuthURL(integrationKey string) string
- func OAuthBaseURL() string
- func RedirectURI() string
- func RemoveTokens() error
- func TokenFilePath() (string, error)
- func WriteTokens(tokens *TokenData) error
- type AuditEvent
- type AuditEventsResponse
- type Client
- func (c *Client) CreateEnvelope(ctx context.Context, req CreateEnvelopeRequest) (*EnvelopeDetail, error)
- func (c *Client) CreateRecipientView(ctx context.Context, envelopeID string, req RecipientViewRequest) (*ViewURL, error)
- func (c *Client) DownloadDocument(ctx context.Context, envelopeID, documentID string) ([]byte, error)
- func (c *Client) GetAuditEvents(ctx context.Context, envelopeID string) (*AuditEventsResponse, error)
- func (c *Client) GetEnvelope(ctx context.Context, envelopeID string) (*EnvelopeDetail, error)
- func (c *Client) GetTemplate(ctx context.Context, templateID string) (*Template, error)
- func (c *Client) ListDocuments(ctx context.Context, envelopeID string) (*DocumentsListResponse, error)
- func (c *Client) ListEnvelopes(ctx context.Context, fromDate, status string, count int) (*EnvelopesListResponse, error)
- func (c *Client) ListRecipients(ctx context.Context, envelopeID string) (*RecipientsListResponse, error)
- func (c *Client) ListTemplates(ctx context.Context, search string, count int) (*TemplatesListResponse, error)
- func (c *Client) SendEnvelope(ctx context.Context, envelopeID string) error
- func (c *Client) VoidEnvelope(ctx context.Context, envelopeID, reason string) error
- type CreateEnvelopeRequest
- type Document
- type DocumentInfo
- type DocumentsListResponse
- type Envelope
- type EnvelopeDetail
- type EnvelopesListResponse
- type EventField
- type RecipientInfo
- type RecipientViewRequest
- type Recipients
- type RecipientsListResponse
- type Signer
- type Template
- type TemplatesListResponse
- type TokenData
- type TokenResponse
- type UserinfoAccount
- type UserinfoResponse
- type ViewURL
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildAuthURL ¶
BuildAuthURL constructs the OAuth authorization URL.
func OAuthBaseURL ¶
func OAuthBaseURL() string
OAuthBaseURL returns the OAuth base URL from env or default.
func RedirectURI ¶
func RedirectURI() string
RedirectURI returns the redirect URI from env or default.
func TokenFilePath ¶
TokenFilePath returns the path to the token file (~/.docusign/tokens.json).
func WriteTokens ¶
WriteTokens writes the token data to the token file.
Types ¶
type AuditEvent ¶
type AuditEvent struct {
EventFields []EventField `json:"event_fields"`
}
type AuditEventsResponse ¶
type AuditEventsResponse struct {
AuditEvents []AuditEvent `json:"audit_events"`
}
type Client ¶
Client wraps the API client with DocuSign-specific methods.
func (*Client) CreateEnvelope ¶
func (c *Client) CreateEnvelope(ctx context.Context, req CreateEnvelopeRequest) (*EnvelopeDetail, error)
func (*Client) CreateRecipientView ¶
func (*Client) DownloadDocument ¶
func (*Client) GetAuditEvents ¶
func (*Client) GetEnvelope ¶
func (*Client) GetTemplate ¶
func (*Client) ListDocuments ¶
func (*Client) ListEnvelopes ¶
func (*Client) ListRecipients ¶
func (*Client) ListTemplates ¶
func (*Client) SendEnvelope ¶
type CreateEnvelopeRequest ¶
type CreateEnvelopeRequest struct {
EmailSubject string `json:"email_subject"`
EmailBlurb string `json:"email_blurb,omitempty"`
Status string `json:"status"`
Documents []Document `json:"documents"`
Recipients *Recipients `json:"recipients"`
}
type DocumentInfo ¶
type DocumentsListResponse ¶
type DocumentsListResponse struct {
EnvelopeID string `json:"envelope_id"`
EnvelopeDocuments []DocumentInfo `json:"envelope_documents"`
}
type Envelope ¶
type Envelope struct {
EnvelopeID string `json:"envelope_id"`
Status string `json:"status"`
EmailSubject string `json:"email_subject"`
SentDateTime string `json:"sent_date_time,omitempty"`
StatusDateTime string `json:"status_changed_date_time,omitempty"`
CreatedAt string `json:"created_date_time,omitempty"`
}
type EnvelopeDetail ¶
type EnvelopeDetail struct {
EnvelopeID string `json:"envelope_id"`
Status string `json:"status"`
EmailSubject string `json:"email_subject"`
EmailBlurb string `json:"email_blurb,omitempty"`
SentDateTime string `json:"sent_date_time,omitempty"`
StatusDateTime string `json:"status_changed_date_time,omitempty"`
CreatedAt string `json:"created_date_time,omitempty"`
}
type EnvelopesListResponse ¶
type EventField ¶
type RecipientInfo ¶
type RecipientInfo struct {
RecipientID string `json:"recipient_id"`
RecipientIDGUID string `json:"recipient_id_guid,omitempty"`
Name string `json:"name"`
Email string `json:"email"`
Status string `json:"status,omitempty"`
RoutingOrder string `json:"routing_order,omitempty"`
DeliveredAt string `json:"delivered_date_time,omitempty"`
SignedAt string `json:"signed_date_time,omitempty"`
}
type RecipientViewRequest ¶
type Recipients ¶
type Recipients struct {
Signers []Signer `json:"signers"`
}
type RecipientsListResponse ¶
type RecipientsListResponse struct {
Signers []RecipientInfo `json:"signers"`
CarbonCopies []RecipientInfo `json:"carbon_copies,omitempty"`
CertifiedDelivs []RecipientInfo `json:"certified_deliveries,omitempty"`
}
type TemplatesListResponse ¶
type TokenData ¶
type TokenData struct {
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
ExpiresIn int64 `json:"expires_in"`
ExpiresAt int64 `json:"expires_at"`
TokenType string `json:"token_type"`
}
TokenData represents the stored OAuth tokens.
func ReadTokens ¶
ReadTokens reads the token data from the token file.
type TokenResponse ¶
type TokenResponse struct {
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
ExpiresIn int64 `json:"expires_in"`
TokenType string `json:"token_type"`
}
TokenResponse represents the OAuth token endpoint response.
func ExchangeCode ¶
func ExchangeCode(ctx context.Context, integrationKey, secretKey, code string) (*TokenResponse, error)
ExchangeCode exchanges an authorization code for tokens.
func RefreshAccessToken ¶
func RefreshAccessToken(ctx context.Context, integrationKey, secretKey, refreshToken string) (*TokenResponse, error)
RefreshAccessToken refreshes an expired access token using a refresh token.
type UserinfoAccount ¶
type UserinfoAccount struct {
AccountID string `json:"account_id"`
IsDefault bool `json:"is_default"`
AccountName string `json:"account_name"`
BaseURI string `json:"base_uri"`
}
UserinfoAccount represents an account in the userinfo response.
func FindDefaultAccount ¶
func FindDefaultAccount(info *UserinfoResponse) (*UserinfoAccount, error)
FindDefaultAccount finds the default account from userinfo response.
type UserinfoResponse ¶
type UserinfoResponse struct {
Sub string `json:"sub"`
Accounts []UserinfoAccount `json:"accounts"`
}
UserinfoResponse represents the /oauth/userinfo response.
func GetUserinfo ¶
func GetUserinfo(ctx context.Context, accessToken string) (*UserinfoResponse, error)
GetUserinfo calls the /oauth/userinfo endpoint.