pandadoc

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: MIT Imports: 13 Imported by: 0

README

📄  go-pandadoc

Unofficial Go SDK for the PandaDoc API.


Release Go Version License


CI / CD    Build Last Commit      Quality    Go Report Coverage
Security    Scorecard Security      Community    Contributors Bitcoin


Project Navigation
📦 Installation 🚀 Quick Start 📚 Features
📊 API Coverage 🧪 Examples & Tests 📚 Documentation
🛠️ Code Standards 🤖 AI Guidelines 👥 Maintainers
🤝 Contributing 📝 License

📦 Installation

go get github.com/mrz1836/go-pandadoc

🚀 Quick Start

package main

import (
    "context"
    "fmt"
    "log"
    "os"

    "github.com/mrz1836/go-pandadoc"
)

func main() {
    apiKey := os.Getenv("PANDADOC_API_KEY")
    if apiKey == "" {
        log.Fatal("PANDADOC_API_KEY is required")
    }

    client, err := pandadoc.NewClientWithAPIKey(apiKey)
    if err != nil {
        log.Fatal(err)
    }

    status := pandadoc.DocumentStatusCompleted
    docs, err := client.Documents().List(context.Background(), &pandadoc.ListDocumentsOptions{
        Count:  10,
        Status: &status,
    })
    if err != nil {
        log.Fatal(err)
    }

    for _, doc := range docs.Results {
        fmt.Printf("Document: %s (%s)\n", doc.Name, doc.Status)
    }
}

📚 Features

Auth Modes
// API key auth
client, err := pandadoc.NewClientWithAPIKey("api-key")
_ = client

// OAuth bearer auth
client, err = pandadoc.NewClientWithAccessToken("access-token")
_ = client
_ = err
Client Options
import "time"

client, err := pandadoc.NewClientWithAPIKey("api-key",
    pandadoc.WithTimeout(60 * time.Second),
    pandadoc.WithUserAgent("my-app/1.0"),
    pandadoc.WithBaseURL("https://api.pandadoc.com/"),
    pandadoc.WithRetryPolicy(pandadoc.DefaultRetryPolicy()),
)
Documents Service
// List documents
docs, err := client.Documents().List(ctx, &pandadoc.ListDocumentsOptions{Count: 25})
_ = docs

// Create a document from JSON payload
created, err := client.Documents().Create(ctx, pandadoc.DocumentCreateRequest{
    "name":          "Proposal",
    "template_uuid": "template-id",
    "recipients": []map[string]any{
        {"email": "jane@example.com", "first_name": "Jane", "last_name": "Doe", "role": "Signer"},
    },
})
_ = created

// Get status/details
status, err := client.Documents().Status(ctx, "document-id")
details, err := client.Documents().Details(ctx, "document-id")
_ = status
_ = details

// Update (204 no content)
err = client.Documents().Update(ctx, "document-id", pandadoc.DocumentUpdateRequest{
    "name": "Updated Name",
})
_ = err
Product Catalog Service
// Search catalog
items, err := client.ProductCatalog().Search(ctx, &pandadoc.SearchProductCatalogItemsOptions{
    Query:   "coffee",
    PerPage: 20,
})
_ = items

// Create/update/get/delete
createdItem, err := client.ProductCatalog().Create(ctx, pandadoc.CreateProductCatalogItemRequest{
    "type":  "regular",
    "title": "New Product",
})
item, err := client.ProductCatalog().Get(ctx, createdItem.UUID)
updated, err := client.ProductCatalog().Update(ctx, createdItem.UUID, pandadoc.UpdateProductCatalogItemRequest{
    "title": "Updated Product",
})
err = client.ProductCatalog().Delete(ctx, createdItem.UUID)
_ = item
_ = updated
_ = err
OAuth Token Exchange
oauthClient, err := pandadoc.NewClient()
token, err := oauthClient.OAuth().Token(ctx, &pandadoc.OAuthTokenRequest{
    GrantType:    "authorization_code",
    ClientID:     "client-id",
    ClientSecret: "client-secret",
    Code:         "authorization-code",
    Scope:        "read+write",
})
_ = token
_ = err
Webhooks
// Subscriptions
subs, err := client.WebhookSubscriptions().List(ctx, &pandadoc.ListWebhookSubscriptionsOptions{Count: 50, Page: 1})
createdSub, err := client.WebhookSubscriptions().Create(ctx, &pandadoc.WebhookSubscriptionRequest{
    Name: "my-subscription",
    URL:  "https://example.com/pandadoc/webhooks",
    Triggers: []pandadoc.WebhookTrigger{
        pandadoc.WebhookTriggerDocumentUpdated,
        pandadoc.WebhookTriggerDocumentStateChanged,
    },
})
sub, err := client.WebhookSubscriptions().Get(ctx, createdSub.UUID)
updatedSub, err := client.WebhookSubscriptions().Update(ctx, createdSub.UUID, &pandadoc.WebhookSubscriptionRequest{Name: "updated-name"})
key, err := client.WebhookSubscriptions().RegenerateSharedKey(ctx, createdSub.UUID)
err = client.WebhookSubscriptions().Delete(ctx, createdSub.UUID)
_ = subs
_ = sub
_ = updatedSub
_ = key

// Events
events, err := client.WebhookEvents().List(ctx, &pandadoc.ListWebhookEventsOptions{
    Type: "document_updated",
})
if len(events.Items) > 0 {
    event, err := client.WebhookEvents().Get(ctx, events.Items[0].UUID)
    _ = event
    _ = err
}
Unit Testing & Mocking

The SDK now defines interfaces for all service interactions, making it easy to mock the client in your tests.

// Create a mock struct that implements pandadoc.DocumentsService
type mockDocuments struct {
    pandadoc.DocumentsService // Embed interface to skip implementing all methods if not needed
}

func (m *mockDocuments) List(ctx context.Context, opts *pandadoc.ListDocumentsOptions) (*pandadoc.DocumentListResponse, error) {
    return &pandadoc.DocumentListResponse{
        Results: []pandadoc.DocumentSummary{
            {ID: "mock-doc-1", Name: "Mock Document"},
        },
    }, nil
}
Observability

You can inject a custom logger to monitor SDK operations. The logger must implement the pandadoc.Logger interface.

type myLogger struct{}

func (l *myLogger) Debugf(format string, args ...interface{}) { log.Printf("[DEBUG] "+format, args...) }
func (l *myLogger) Infof(format string, args ...interface{})  { log.Printf("[INFO] "+format, args...) }
func (l *myLogger) Errorf(format string, args ...interface{}) { log.Printf("[ERROR] "+format, args...) }

func main() {
    client, _ := pandadoc.NewClientWithAPIKey("key",
        pandadoc.WithLogger(&myLogger{}),
    )
}

📊 API Coverage

This SDK implements core PandaDoc API functionality. Below is a comprehensive comparison of all available endpoints vs. what's currently supported.

View Complete API Endpoint Coverage (115 endpoints)
Coverage Summary
  • Implemented: 5 services, 34 endpoints (~30% coverage)
  • 📝 Available in API: 26 services, 115 endpoints
  • 🎯 Focus Areas: Documents, Product Catalog, Webhooks, OAuth

Legend
  • ✅ = Fully implemented in SDK
  • ⚠️ = Partially implemented
  • ❌ = Not yet implemented
  • 📄 [Docs] = Link to PandaDoc API reference

1. Documents ⚠️

Core document lifecycle management - 20 of 22 endpoints implemented

Status Method Endpoint SDK Method API Docs
GET /public/v1/documents Documents().List() 📄
POST /public/v1/documents Documents().Create() 📄
POST /public/v1/documents?upload Documents().CreateFromUpload() 📄
GET /public/v1/documents/{id} Documents().Status() 📄
PATCH /public/v1/documents/{id} Documents().Update() 📄
DELETE /public/v1/documents/{id} Documents().Delete() 📄
GET /public/v1/documents/{id}/details Documents().Details() 📄
GET /public/v1/documents/{id}/download Documents().Download() 📄
GET /public/v1/documents/{id}/download-protected Documents().DownloadProtected() 📄
POST /public/v1/documents/{id}/send Documents().Send() 📄
POST /public/v1/documents/{id}/session Documents().CreateSession() 📄
POST /public/v1/documents/{id}/editing-sessions Documents().CreateEditingSession() 📄
PATCH /public/v1/documents/{id}/status Documents().ChangeStatus() 📄
PATCH /public/v1/documents/{id}/status?upload Documents().ChangeStatusWithUpload() 📄
POST /public/v1/documents/{id}/draft Documents().RevertToDraft() 📄
GET /public/v1/documents/{document_id}/esign-disclosure Documents().ESignDisclosure() 📄
POST /public/v1/documents/{id}/move-to-folder/{folder_id} Documents().MoveToFolder() 📄
PATCH /public/v1/documents/{id}/ownership Documents().TransferOwnership() 📄
PATCH /public/v1/documents/ownership Documents().TransferAllOwnership() 📄
POST /public/v1/documents/{id}/append-content-library-item Documents().AppendContentLibraryItem() 📄
POST /public/beta/documents/{document_id}/docx-export-tasks Not implemented 📄
GET /public/beta/documents/{document_id}/docx-export-tasks/{task_id} Not implemented 📄

2. Product Catalog ✅

Manage product catalog items - 5 of 5 endpoints implemented

Status Method Endpoint SDK Method API Docs
GET /public/v2/product-catalog/items/search ProductCatalog().Search() 📄
POST /public/v2/product-catalog/items ProductCatalog().Create() 📄
GET /public/v2/product-catalog/items/{item_uuid} ProductCatalog().Get() 📄
PATCH /public/v2/product-catalog/items/{item_uuid} ProductCatalog().Update() 📄
DELETE /public/v2/product-catalog/items/{item_uuid} ProductCatalog().Delete() 📄

3. Webhook Subscriptions ✅

Manage webhook endpoints and subscriptions - 6 of 6 endpoints implemented

Status Method Endpoint SDK Method API Docs
GET /public/v1/webhook-subscriptions WebhookSubscriptions().List() 📄
POST /public/v1/webhook-subscriptions WebhookSubscriptions().Create() 📄
GET /public/v1/webhook-subscriptions/{id} WebhookSubscriptions().Get() 📄
PATCH /public/v1/webhook-subscriptions/{id} WebhookSubscriptions().Update() 📄
DELETE /public/v1/webhook-subscriptions/{id} WebhookSubscriptions().Delete() 📄
PATCH /public/v1/webhook-subscriptions/{id}/shared-key WebhookSubscriptions().RegenerateSharedKey() 📄

4. Webhook Events ✅

Retrieve webhook event history - 2 of 2 endpoints implemented

Status Method Endpoint SDK Method API Docs
GET /public/v1/webhook-events WebhookEvents().List() 📄
GET /public/v1/webhook-events/{id} WebhookEvents().Get() 📄

5. OAuth 2.0 Authentication ✅

Handle OAuth token creation and refresh - 1 of 1 endpoint implemented

Status Method Endpoint SDK Method API Docs
POST /oauth2/access_token OAuth().Token() 📄

6. Templates ❌

Template management and operations - 0 of 8 endpoints implemented

Status Method Endpoint SDK Method API Docs
GET /public/v1/templates Not implemented 📄
POST /public/v1/templates Not implemented 📄
POST /public/v1/templates?upload Not implemented 📄
GET /public/v1/templates/{id} Not implemented 📄
GET /public/v1/templates/{id}/details Not implemented 📄
PATCH /public/v1/templates/{id} Not implemented 📄
DELETE /public/v1/templates/{id} Not implemented 📄
POST /public/v1/templates/{id}/editing-sessions Not implemented 📄

7. Document Recipients ❌

Manage document recipients and signers - 0 of 4 endpoints implemented

Status Method Endpoint SDK Method API Docs
POST /public/v1/documents/{id}/recipients Not implemented 📄
PATCH /public/v1/documents/{id}/recipients/recipient/{recipient_id} Not implemented 📄
DELETE /public/v1/documents/{id}/recipients/{recipient_id} Not implemented 📄
POST /public/v1/documents/{id}/recipients/{recipient_id}/reassign Not implemented 📄

8. Document Fields ❌

Manage fillable fields in documents - 0 of 2 endpoints implemented

Status Method Endpoint SDK Method API Docs
GET /public/v1/documents/{id}/fields Not implemented 📄
POST /public/v1/documents/{id}/fields Not implemented 📄

9. Document Attachments ❌

Manage document attachments and uploads - 0 of 6 endpoints implemented

Status Method Endpoint SDK Method API Docs
GET /public/v1/documents/{id}/attachments Not implemented 📄
POST /public/v1/documents/{id}/attachments Not implemented 📄
POST /public/v1/documents/{id}/attachments?upload Not implemented 📄
GET /public/v1/documents/{id}/attachments/{attachment_id} Not implemented 📄
DELETE /public/v1/documents/{id}/attachments/{attachment_id} Not implemented 📄
GET /public/v1/documents/{id}/attachments/{attachment_id}/download Not implemented 📄

10. Document Reminders ❌

Auto-reminders and manual reminders for document recipients - 0 of 4 endpoints implemented

Status Method Endpoint SDK Method API Docs
GET /public/v1/documents/{document_id}/auto-reminders Not implemented 📄
PATCH /public/v1/documents/{document_id}/auto-reminders Not implemented 📄
GET /public/v1/documents/{document_id}/auto-reminders/status Not implemented 📄
POST /public/v1/documents/{document_id}/send-reminder Not implemented 📄

11. Document Sections (Bundles) ❌

Manage document sections/bundles - 0 of 6 endpoints implemented

Status Method Endpoint SDK Method API Docs
GET /public/v1/documents/{document_id}/sections Not implemented 📄
POST /public/v1/documents/{document_id}/sections/uploads Not implemented 📄
POST /public/v1/documents/{document_id}/sections/uploads?upload Not implemented 📄
GET /public/v1/documents/{document_id}/sections/uploads/{upload_id} Not implemented 📄
GET /public/v1/documents/{document_id}/sections/{section_id} Not implemented 📄
DELETE /public/v1/documents/{document_id}/sections/{section_id} Not implemented 📄

Link documents to CRM systems and objects - 0 of 4 endpoints implemented

Status Method Endpoint SDK Method API Docs
GET /public/v1/documents/linked-objects Not implemented 📄
GET /public/v1/documents/{id}/linked-objects Not implemented 📄
POST /public/v1/documents/{id}/linked-objects Not implemented 📄
DELETE /public/v1/documents/{id}/linked-objects/{linked_object_id} Not implemented 📄

13. Contacts ❌

Manage contact information - 0 of 5 endpoints implemented

Status Method Endpoint SDK Method API Docs
GET /public/v1/contacts Not implemented 📄
POST /public/v1/contacts Not implemented 📄
GET /public/v1/contacts/{id} Not implemented 📄
PATCH /public/v1/contacts/{id} Not implemented 📄
DELETE /public/v1/contacts/{id} Not implemented 📄

14. Content Library Items ❌

Manage reusable content library items - 0 of 5 endpoints implemented

Status Method Endpoint SDK Method API Docs
GET /public/v1/content-library-items Not implemented 📄
POST /public/v1/content-library-items Not implemented 📄
POST /public/v1/content-library-items?upload Not implemented 📄
GET /public/v1/content-library-items/{id} Not implemented 📄
GET /public/v1/content-library-items/{id}/details Not implemented 📄

15. Forms ❌

Retrieve forms information - 0 of 1 endpoint implemented

Status Method Endpoint SDK Method API Docs
GET /public/v1/forms Not implemented 📄

16. Folders ❌

Organize documents and templates into folders - 0 of 6 endpoints implemented

Status Method Endpoint SDK Method API Docs
GET /public/v1/documents/folders Not implemented 📄
POST /public/v1/documents/folders Not implemented 📄
PUT /public/v1/documents/folders/{id} Not implemented 📄
GET /public/v1/templates/folders Not implemented 📄
POST /public/v1/templates/folders Not implemented 📄
PUT /public/v1/templates/folders/{id} Not implemented 📄

17. Quotes ❌

Manage quotes within documents - 0 of 1 endpoint implemented

Status Method Endpoint SDK Method API Docs
PUT /public/v1/documents/{document_id}/quotes/{quote_id} Not implemented 📄

18. Members ❌

Manage workspace members and users - 0 of 4 endpoints implemented

Status Method Endpoint SDK Method API Docs
GET /public/v1/members Not implemented 📄
GET /public/v1/members/current Not implemented 📄
GET /public/v1/members/{id} Not implemented 📄
POST /public/v1/members/{member_id}/token Not implemented 📄

19. User and Workspace Management ❌

Manage users, workspaces, and organizational settings - 0 of 8 endpoints implemented

Status Method Endpoint SDK Method API Docs
GET /public/v1/users Not implemented 📄
POST /public/v1/users Not implemented 📄
GET /public/v1/workspaces Not implemented 📄
POST /public/v1/workspaces Not implemented 📄
POST /public/v1/workspaces/{workspace_id}/api-keys Not implemented 📄
POST /public/v1/workspaces/{workspace_id}/deactivate Not implemented 📄
POST /public/v1/workspaces/{workspace_id}/members Not implemented 📄
DELETE /public/v1/workspaces/{workspace_id}/members/{member_id} Not implemented 📄

20. API Logs ❌

Retrieve API activity logs - 0 of 4 endpoints implemented

Status Method Endpoint SDK Method API Docs
GET /public/v1/logs Not implemented 📄
GET /public/v1/logs/{id} Not implemented 📄
GET /public/v2/logs Not implemented 📄
GET /public/v2/logs/{id} Not implemented 📄

21. Document Settings (v2) ❌

Manage document-specific settings - 0 of 2 endpoints implemented

Status Method Endpoint SDK Method API Docs
GET /public/v2/documents/{document_id}/settings Not implemented 📄
PATCH /public/v2/documents/{document_id}/settings Not implemented 📄

22. Template Settings (v2) ❌

Manage template-specific settings - 0 of 2 endpoints implemented

Status Method Endpoint SDK Method API Docs
GET /public/v2/templates/{template_id}/settings Not implemented 📄
PATCH /public/v2/templates/{template_id}/settings Not implemented 📄

23. Document Audit Trail (v2) ❌

Retrieve document audit logs - 0 of 1 endpoint implemented

Status Method Endpoint SDK Method API Docs
GET /public/v2/documents/{document_id}/audit-trail Not implemented 📄

24. Document Structure View (v2) ❌

Add named items to document structure - 0 of 1 endpoint implemented

Status Method Endpoint SDK Method API Docs
POST /public/v2/dsv/{document_id}/add-named-items Not implemented 📄

25. Notary (v2) ❌

Manage notarization requests and services - 0 of 4 endpoints implemented

Status Method Endpoint SDK Method API Docs
GET /public/v2/notary/notaries Not implemented 📄
POST /public/v2/notary/notarization-requests Not implemented 📄
GET /public/v2/notary/notarization-requests/{session_request_id} Not implemented 📄
DELETE /public/v2/notary/notarization-requests/{session_request_id} Not implemented 📄

26. Communication Preferences ❌

Manage SMS opt-outs - 0 of 1 endpoint implemented

Status Method Endpoint SDK Method API Docs
GET /public/v1/sms-opt-outs Not implemented 📄


🧪 Examples & Tests

All unit tests and fuzz tests run via GitHub Actions and use Go version 1.24.x. View the configuration file.

Run all tests (fast):

magex test

Run all tests with race detector (slower):

magex test:race

📚 Documentation


🛠️ Code Standards

Read more about this Go project's code standards.


🤖 AI Usage & Assistant Guidelines

Read the AI Usage & Assistant Guidelines for details on how AI is used in this project and how to interact with the AI assistants.


👥 Maintainers

MrZ
MrZ

🤝 Contributing

View the contributing guidelines and please follow the code of conduct.

How can I help?

All kinds of contributions are welcome 🙌! The most basic way to show your support is to star 🌟 the project, or to raise issues 💬. You can also support this project by becoming a sponsor on GitHub 👏 or by making a bitcoin donation to ensure this journey continues indefinitely! 🚀

Stars


📝 License

License

Documentation

Overview

Package pandadoc provides a pure-stdlib Go SDK for the PandaDoc Public API.

Index

Constants

View Source
const (
	// DefaultBaseURL is the default PandaDoc API base URL.
	DefaultBaseURL = "https://api.pandadoc.com/"

	// DefaultTimeout is the default HTTP timeout.
	DefaultTimeout = 30 * time.Second

	// DefaultUserAgent is the default user-agent sent to PandaDoc.
	DefaultUserAgent = "go-pandadoc/0.2.0"
)

Variables

View Source
var (
	// ErrInvalidBaseURL indicates the configured API base URL is invalid.
	ErrInvalidBaseURL = stderrors.New("invalid base URL")

	// ErrNilHTTPClient indicates a nil HTTP client was provided.
	ErrNilHTTPClient = stderrors.New("http client cannot be nil")

	// ErrMissingAuthentication indicates no auth method is configured for an authenticated call.
	ErrMissingAuthentication = stderrors.New("missing authentication credentials")

	// ErrMultipleAuthenticationMethods indicates both API-Key and Bearer auth were configured.
	ErrMultipleAuthenticationMethods = stderrors.New("only one authentication method can be configured")

	// ErrEmptyPathParameter indicates a required path parameter was empty.
	ErrEmptyPathParameter = stderrors.New("path parameter cannot be empty")

	// ErrNilRequest indicates a required request payload is nil.
	ErrNilRequest = stderrors.New("request payload cannot be nil")

	// ErrNilFileReader indicates an upload request has no file reader.
	ErrNilFileReader = stderrors.New("file reader is required")
)

Functions

func IsForbidden

func IsForbidden(err error) bool

IsForbidden returns true if err is a 403 API error.

func IsNotFound

func IsNotFound(err error) bool

IsNotFound returns true if err is a 404 API error.

func IsRateLimited

func IsRateLimited(err error) bool

IsRateLimited returns true if err is a 429 API error.

func IsUnauthorized

func IsUnauthorized(err error) bool

IsUnauthorized returns true if err is a 401 API error.

Types

type APIError

type APIError struct {
	StatusCode int
	Code       string
	Message    string
	Details    any

	RequestID  string
	RetryAfter string
	RawBody    string
	Headers    http.Header
}

APIError represents a non-2xx response from PandaDoc.

func (*APIError) Error

func (e *APIError) Error() string

Error implements error.

type APIListResponse

type APIListResponse[T any] struct {
	Items []T `json:"items"`
}

APIListResponse models list responses that return items.

type AppendContentLibraryItemRequest

type AppendContentLibraryItemRequest map[string]any

AppendContentLibraryItemRequest is a flexible append-content payload.

type AppendContentLibraryItemResponse

type AppendContentLibraryItemResponse struct {
	BlockMapping map[string]string `json:"block_mapping,omitempty"`
	CLI          RawObject         `json:"cli,omitempty"`
}

AppendContentLibraryItemResponse models append-content response.

type ChangeDocumentStatusRequest

type ChangeDocumentStatusRequest struct {
	Status           DocumentStatusCode `json:"status"`
	Note             string             `json:"note,omitempty"`
	NotifyRecipients *bool              `json:"notify_recipients,omitempty"`
}

ChangeDocumentStatusRequest changes a document status.

type ChangeDocumentStatusWithUploadRequest

type ChangeDocumentStatusWithUploadRequest struct {
	Status           DocumentStatusCode
	Note             string
	NotifyRecipients *bool
	FileField        string
	FileName         string
	File             io.Reader
	Fields           map[string]string
}

ChangeDocumentStatusWithUploadRequest changes status with multipart payload.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the root PandaDoc SDK client.

func NewClient

func NewClient(opts ...Option) (*Client, error)

NewClient creates a new PandaDoc client.

If no auth option is configured, only OAuth token exchange calls are available.

func NewClientWithAPIKey

func NewClientWithAPIKey(apiKey string, opts ...Option) (*Client, error)

NewClientWithAPIKey creates a new PandaDoc client using API-Key auth.

func NewClientWithAccessToken

func NewClientWithAccessToken(token string, opts ...Option) (*Client, error)

NewClientWithAccessToken creates a new PandaDoc client using Bearer auth.

func (*Client) Documents

func (c *Client) Documents() DocumentsService

Documents exposes document-related endpoints.

func (*Client) OAuth

func (c *Client) OAuth() OAuthService

OAuth exposes OAuth token operations.

func (*Client) ProductCatalog

func (c *Client) ProductCatalog() ProductCatalogService

ProductCatalog exposes product-catalog endpoints.

func (*Client) WebhookEvents

func (c *Client) WebhookEvents() WebhookEventsService

WebhookEvents exposes webhook-event endpoints.

func (*Client) WebhookSubscriptions

func (c *Client) WebhookSubscriptions() WebhookSubscriptionsService

WebhookSubscriptions exposes webhook-subscription endpoints.

type CreateDocumentEditingSessionRequest

type CreateDocumentEditingSessionRequest map[string]any

CreateDocumentEditingSessionRequest is a flexible editing-session payload.

type CreateDocumentEditingSessionResponse

type CreateDocumentEditingSessionResponse struct {
	ID         string `json:"id,omitempty"`
	Token      string `json:"token,omitempty"`
	Key        string `json:"key,omitempty"`
	Email      string `json:"email,omitempty"`
	ExpiresAt  string `json:"expires_at,omitempty"`
	DocumentID string `json:"document_id,omitempty"`
}

CreateDocumentEditingSessionResponse models editing-session response.

type CreateDocumentFromUploadRequest

type CreateDocumentFromUploadRequest struct {
	FileField string
	FileName  string
	File      io.Reader
	Fields    map[string]string
}

CreateDocumentFromUploadRequest uploads a file and creates a document.

type CreateDocumentSessionRequest

type CreateDocumentSessionRequest map[string]any

CreateDocumentSessionRequest is a flexible embedded-session payload.

type CreateDocumentSessionResponse

type CreateDocumentSessionResponse struct {
	ID        string `json:"id,omitempty"`
	ExpiresAt string `json:"expires_at,omitempty"`
}

CreateDocumentSessionResponse is returned by document session endpoint.

type CreateProductCatalogItemRequest

type CreateProductCatalogItemRequest map[string]any

CreateProductCatalogItemRequest is a flexible create payload.

type DocumentCreateRequest

type DocumentCreateRequest map[string]any

DocumentCreateRequest is a flexible create-document payload.

type DocumentCreateResponse

type DocumentCreateResponse struct {
	DocumentSummary

	Links       []DocumentLink `json:"links,omitempty"`
	InfoMessage string         `json:"info_message,omitempty"`
}

DocumentCreateResponse is returned when creating a document.

type DocumentDetailsResponse

type DocumentDetailsResponse struct {
	ApprovalExecution               any                        `json:"approval_execution,omitempty"`
	AutonumberingSequenceNamePrefix string                     `json:"autonumbering_sequence_name_prefix,omitempty"`
	ContentDateModified             string                     `json:"content_date_modified,omitempty"`
	CreatedBy                       *UserReference             `json:"created_by,omitempty"`
	DateCompleted                   string                     `json:"date_completed,omitempty"`
	DateCreated                     string                     `json:"date_created,omitempty"`
	DateModified                    string                     `json:"date_modified,omitempty"`
	DateSent                        string                     `json:"date_sent,omitempty"`
	ExpirationDate                  string                     `json:"expiration_date,omitempty"`
	Fields                          []DocumentField            `json:"fields,omitempty"`
	FolderUUID                      string                     `json:"folder_uuid,omitempty"`
	GrandTotal                      *MoneyAmount               `json:"grand_total,omitempty"`
	ID                              string                     `json:"id,omitempty"`
	Images                          []NamedContentBlock        `json:"images,omitempty"`
	LinkedObjects                   []LinkedObject             `json:"linked_objects,omitempty"`
	Metadata                        map[string]any             `json:"metadata,omitempty"`
	Name                            string                     `json:"name,omitempty"`
	Pricing                         RawJSON                    `json:"pricing,omitempty"`
	Recipients                      []DocumentRecipient        `json:"recipients,omitempty"`
	RefNumber                       string                     `json:"ref_number,omitempty"`
	SentBy                          *UserReference             `json:"sent_by,omitempty"`
	Status                          string                     `json:"status,omitempty"`
	Tables                          []NamedContentBlock        `json:"tables,omitempty"`
	Tags                            []string                   `json:"tags,omitempty"`
	Template                        *DocumentTemplateReference `json:"template,omitempty"`
	Texts                           []NamedContentBlock        `json:"texts,omitempty"`
	Tokens                          []DocumentToken            `json:"tokens,omitempty"`
	Version                         string                     `json:"version,omitempty"`
}

DocumentDetailsResponse is returned by GET /documents/{id}/details.

type DocumentESignDisclosure

type DocumentESignDisclosure struct {
	IsEnabled           bool   `json:"is_enabled"`
	CompanyName         string `json:"company_name,omitempty"`
	ESignDisclosureText string `json:"esign_disclosure_text,omitempty"`
}

DocumentESignDisclosure contains disclosure details.

type DocumentESignDisclosureResponse

type DocumentESignDisclosureResponse struct {
	Result *DocumentESignDisclosure `json:"result,omitempty"`
}

DocumentESignDisclosureResponse models e-sign disclosure settings for a document.

type DocumentField

type DocumentField struct {
	UUID        string  `json:"uuid,omitempty"`
	Name        string  `json:"name,omitempty"`
	Title       string  `json:"title,omitempty"`
	MergeField  string  `json:"merge_field,omitempty"`
	Placeholder string  `json:"placeholder,omitempty"`
	FieldID     string  `json:"field_id,omitempty"`
	Type        string  `json:"type,omitempty"`
	Value       any     `json:"value,omitempty"`
	AssignedTo  RawJSON `json:"assigned_to,omitempty"`
}

DocumentField represents a field entry in document details.

type DocumentLink struct {
	Rel  string `json:"rel,omitempty"`
	Href string `json:"href,omitempty"`
	Type string `json:"type,omitempty"`
}

DocumentLink is a link object from create responses.

type DocumentListResponse

type DocumentListResponse struct {
	Results []DocumentSummary `json:"results"`
}

DocumentListResponse is returned by list/search documents endpoint.

type DocumentOrderBy

type DocumentOrderBy string

DocumentOrderBy controls document list ordering.

const (
	// DocumentOrderByName orders by document name.
	DocumentOrderByName DocumentOrderBy = "name"
	// DocumentOrderByDateCreated orders by creation date.
	DocumentOrderByDateCreated DocumentOrderBy = "date_created"
	// DocumentOrderByDateStatusChange orders by status change date.
	DocumentOrderByDateStatusChange DocumentOrderBy = "date_status_changed"
	// DocumentOrderByDateLastAction orders by last action date.
	DocumentOrderByDateLastAction DocumentOrderBy = "date_of_last_action"
	// DocumentOrderByDateModified orders by modification date.
	DocumentOrderByDateModified DocumentOrderBy = "date_modified"
	// DocumentOrderByDateSent orders by sent date.
	DocumentOrderByDateSent DocumentOrderBy = "date_sent"
	// DocumentOrderByDateCompleted orders by completion date.
	DocumentOrderByDateCompleted DocumentOrderBy = "date_completed"
	// DocumentOrderByDateExpiration orders by expiration date.
	DocumentOrderByDateExpiration DocumentOrderBy = "date_expiration"
	// DocumentOrderByDateDeclined orders by declined date.
	DocumentOrderByDateDeclined DocumentOrderBy = "date_declined"
	// DocumentOrderByStatus orders by status.
	DocumentOrderByStatus DocumentOrderBy = "status"
	// DocumentOrderByNameDesc orders by document name descending.
	DocumentOrderByNameDesc DocumentOrderBy = "-name"
	// DocumentOrderByDateCreatedDesc orders by creation date descending.
	DocumentOrderByDateCreatedDesc DocumentOrderBy = "-date_created"
	// DocumentOrderByStatusChangeDesc orders by status change date descending.
	DocumentOrderByStatusChangeDesc DocumentOrderBy = "-date_status_changed"
	// DocumentOrderByLastActionDesc orders by last action date descending.
	DocumentOrderByLastActionDesc DocumentOrderBy = "-date_of_last_action"
	// DocumentOrderByDateModifiedDesc orders by modification date descending.
	DocumentOrderByDateModifiedDesc DocumentOrderBy = "-date_modified"
	// DocumentOrderByDateSentDesc orders by sent date descending.
	DocumentOrderByDateSentDesc DocumentOrderBy = "-date_sent"
	// DocumentOrderByDateCompletedDes orders by completion date descending.
	DocumentOrderByDateCompletedDes DocumentOrderBy = "-date_completed"
	// DocumentOrderByDateExpirationDe orders by expiration date descending.
	DocumentOrderByDateExpirationDe DocumentOrderBy = "-date_expiration"
	// DocumentOrderByDateDeclinedDesc orders by declined date descending.
	DocumentOrderByDateDeclinedDesc DocumentOrderBy = "-date_declined"
	// DocumentOrderByStatusDesc orders by status descending.
	DocumentOrderByStatusDesc DocumentOrderBy = "-status"
)

Document order by constants.

type DocumentRecipient

type DocumentRecipient struct {
	ID            string `json:"id,omitempty"`
	ContactID     string `json:"contact_id,omitempty"`
	FirstName     string `json:"first_name,omitempty"`
	LastName      string `json:"last_name,omitempty"`
	Email         string `json:"email,omitempty"`
	Role          string `json:"role,omitempty"`
	RecipientType string `json:"recipient_type,omitempty"`
	HasCompleted  bool   `json:"has_completed,omitempty"`
}

DocumentRecipient is a compact recipient payload.

type DocumentRevertToDraftResponse

type DocumentRevertToDraftResponse = DocumentSummary

DocumentRevertToDraftResponse is returned by revert-to-draft endpoint.

type DocumentSendRequest

type DocumentSendRequest map[string]any

DocumentSendRequest is a flexible send payload.

type DocumentSendResponse

type DocumentSendResponse struct {
	DocumentSummary

	Recipients []DocumentRecipient `json:"recipients,omitempty"`
}

DocumentSendResponse is returned by send endpoint.

type DocumentStatusCode

type DocumentStatusCode int

DocumentStatusCode is the numeric status code used in some document requests.

const (
	// DocumentStatusDraft represents the draft status.
	DocumentStatusDraft DocumentStatusCode = 0
	// DocumentStatusSent represents the sent status.
	DocumentStatusSent DocumentStatusCode = 1
	// DocumentStatusCompleted represents the completed status.
	DocumentStatusCompleted DocumentStatusCode = 2
	// DocumentStatusUploaded represents the uploaded status.
	DocumentStatusUploaded DocumentStatusCode = 3
	// DocumentStatusError represents the error status.
	DocumentStatusError DocumentStatusCode = 4
	// DocumentStatusViewed represents the viewed status.
	DocumentStatusViewed DocumentStatusCode = 5
	// DocumentStatusWaitingApproval represents the waiting approval status.
	DocumentStatusWaitingApproval DocumentStatusCode = 6
	// DocumentStatusApproved represents the approved status.
	DocumentStatusApproved DocumentStatusCode = 7
	// DocumentStatusRejected represents the rejected status.
	DocumentStatusRejected DocumentStatusCode = 8
	// DocumentStatusWaitingPay represents the waiting pay status.
	DocumentStatusWaitingPay DocumentStatusCode = 9
	// DocumentStatusPaid represents the paid status.
	DocumentStatusPaid DocumentStatusCode = 10
	// DocumentStatusVoided represents the voided status.
	DocumentStatusVoided DocumentStatusCode = 11
	// DocumentStatusDeclined represents the declined status.
	DocumentStatusDeclined DocumentStatusCode = 12
	// DocumentStatusExternalReview represents the external review status.
	DocumentStatusExternalReview DocumentStatusCode = 13
)

Document status code constants.

type DocumentStatusResponse

type DocumentStatusResponse = DocumentSummary

DocumentStatusResponse is returned by GET /documents/{id}.

type DocumentSummary

type DocumentSummary struct {
	ID             string `json:"id,omitempty"`
	UUID           string `json:"uuid,omitempty"`
	Name           string `json:"name,omitempty"`
	Status         string `json:"status,omitempty"`
	DateCreated    string `json:"date_created,omitempty"`
	DateModified   string `json:"date_modified,omitempty"`
	DateCompleted  string `json:"date_completed,omitempty"`
	ExpirationDate string `json:"expiration_date,omitempty"`
	Version        string `json:"version,omitempty"`
}

DocumentSummary represents core document fields used by multiple endpoints.

type DocumentTemplateReference

type DocumentTemplateReference struct {
	ID   string `json:"id,omitempty"`
	Name string `json:"name,omitempty"`
}

DocumentTemplateReference is a template descriptor in details responses.

type DocumentToken

type DocumentToken struct {
	Name  string `json:"name,omitempty"`
	Value any    `json:"value,omitempty"`
}

DocumentToken is a token/value pair from document details.

type DocumentUpdateRequest

type DocumentUpdateRequest map[string]any

DocumentUpdateRequest is a flexible update-document payload.

type DocumentsService

type DocumentsService interface {
	List(ctx context.Context, opts *ListDocumentsOptions) (*DocumentListResponse, error)
	Create(ctx context.Context, reqBody DocumentCreateRequest) (*DocumentCreateResponse, error)
	CreateFromUpload(ctx context.Context, reqBody *CreateDocumentFromUploadRequest) (*DocumentCreateResponse, error)
	Status(ctx context.Context, id string) (*DocumentStatusResponse, error)
	Delete(ctx context.Context, id string) error
	Update(ctx context.Context, id string, reqBody DocumentUpdateRequest) error
	ESignDisclosure(ctx context.Context, documentID string) (*DocumentESignDisclosureResponse, error)
	ChangeStatus(ctx context.Context, id string, reqBody *ChangeDocumentStatusRequest) error
	ChangeStatusWithUpload(ctx context.Context, id string, reqBody *ChangeDocumentStatusWithUploadRequest) error
	RevertToDraft(ctx context.Context, id string) (*DocumentRevertToDraftResponse, error)
	Details(ctx context.Context, id string) (*DocumentDetailsResponse, error)
	Send(ctx context.Context, id string, reqBody DocumentSendRequest) (*DocumentSendResponse, error)
	CreateEditingSession(ctx context.Context, id string, reqBody CreateDocumentEditingSessionRequest) (*CreateDocumentEditingSessionResponse, error)
	CreateSession(ctx context.Context, id string, reqBody CreateDocumentSessionRequest) (*CreateDocumentSessionResponse, error)
	Download(ctx context.Context, id string) (*DownloadResponse, error)
	DownloadProtected(ctx context.Context, id string) (*DownloadResponse, error)
	TransferOwnership(ctx context.Context, id string, reqBody TransferDocumentOwnershipRequest) error
	TransferAllOwnership(ctx context.Context, reqBody TransferAllDocumentsOwnershipRequest) error
	MoveToFolder(ctx context.Context, id, folderID string) error
	AppendContentLibraryItem(ctx context.Context, id string, reqBody AppendContentLibraryItemRequest) (*AppendContentLibraryItemResponse, error)
}

DocumentsService handles document-related PandaDoc API calls.

type DownloadResponse

type DownloadResponse struct {
	Body               io.ReadCloser
	Headers            http.Header
	StatusCode         int
	ContentType        string
	ContentDisposition string
	ContentLength      int64
}

DownloadResponse is a streaming response for binary download endpoints.

func (*DownloadResponse) Close

func (d *DownloadResponse) Close() error

Close closes the response body.

type LinkedObject

type LinkedObject struct {
	ID         string `json:"id,omitempty"`
	Provider   string `json:"provider,omitempty"`
	EntityType string `json:"entity_type,omitempty"`
	EntityID   string `json:"entity_id,omitempty"`
}

LinkedObject represents a linked CRM object reference.

type ListDocumentsOptions

type ListDocumentsOptions struct {
	TemplateID    string
	FormID        string
	FolderUUID    string
	ContactID     string
	Count         int
	Page          int
	OrderBy       DocumentOrderBy
	CreatedFrom   string
	CreatedTo     string
	Deleted       *bool
	ID            string
	CompletedFrom string
	CompletedTo   string
	MembershipID  string
	Metadata      map[string]string
	ModifiedFrom  string
	ModifiedTo    string
	Q             string
	Status        *DocumentStatusCode
	StatusNot     *DocumentStatusCode
	Tag           string
}

ListDocumentsOptions controls list/search behavior for documents.

type ListWebhookEventsOptions

type ListWebhookEventsOptions struct {
	Since          string
	To             string
	Type           string
	HTTPStatusCode int
	Error          *bool
}

ListWebhookEventsOptions configures webhook event listing.

type ListWebhookSubscriptionsOptions

type ListWebhookSubscriptionsOptions struct {
	Count int
	Page  int
}

ListWebhookSubscriptionsOptions configures webhook-subscription listing.

type Logger

type Logger interface {
	Debugf(format string, args ...interface{})
	Infof(format string, args ...interface{})
	Errorf(format string, args ...interface{})
}

Logger defines the logging interface used by the client.

type MoneyAmount

type MoneyAmount struct {
	Amount   string `json:"amount,omitempty"`
	Currency string `json:"currency,omitempty"`
}

MoneyAmount represents an amount/currency pair.

type NamedContentBlock

type NamedContentBlock struct {
	Name string `json:"name,omitempty"`
}

NamedContentBlock is used by document detail payloads for image/table/text blocks.

type OAuthService

type OAuthService interface {
	Token(ctx context.Context, req *OAuthTokenRequest) (*OAuthTokenResponse, error)
}

OAuthService handles OAuth token operations.

type OAuthTokenRequest

type OAuthTokenRequest struct {
	GrantType    string
	ClientID     string
	ClientSecret string //nolint:gosec // G117: intentional OAuth credential field
	Code         string
	RefreshToken string //nolint:gosec // G117: intentional OAuth credential field
	Scope        string
	RedirectURI  string
}

OAuthTokenRequest is used for create/refresh token operations.

type OAuthTokenResponse

type OAuthTokenResponse struct {
	AccessToken  string `json:"access_token"`            //nolint:gosec // G117: intentional OAuth credential field
	RefreshToken string `json:"refresh_token,omitempty"` //nolint:gosec // G117: intentional OAuth credential field
	TokenType    string `json:"token_type"`
	Scope        string `json:"scope,omitempty"`
	ExpiresIn    int    `json:"expires_in"`
}

OAuthTokenResponse is the OAuth access-token response.

type Option

type Option func(*clientConfig) error

Option configures the client.

func WithAPIKey

func WithAPIKey(apiKey string) Option

WithAPIKey sets API-Key auth.

func WithAccessToken

func WithAccessToken(token string) Option

WithAccessToken sets OAuth Bearer auth.

func WithBaseURL

func WithBaseURL(baseURL string) Option

WithBaseURL sets a custom API base URL.

func WithHTTPClient

func WithHTTPClient(client *http.Client) Option

WithHTTPClient sets a custom HTTP client.

func WithLogger

func WithLogger(logger Logger) Option

WithLogger sets a custom logger.

func WithRetryPolicy

func WithRetryPolicy(policy RetryPolicy) Option

WithRetryPolicy sets a custom retry policy.

func WithTimeout

func WithTimeout(timeout time.Duration) Option

WithTimeout sets the HTTP timeout for requests.

func WithUserAgent

func WithUserAgent(userAgent string) Option

WithUserAgent sets a custom User-Agent.

type ProductCatalogBillingType

type ProductCatalogBillingType string

ProductCatalogBillingType is the catalog billing type enum.

const (
	// ProductCatalogBillingTypeOneTime represents a one-time billing type.
	ProductCatalogBillingTypeOneTime ProductCatalogBillingType = "one_time"
	// ProductCatalogBillingTypeRecurring represents a recurring billing type.
	ProductCatalogBillingTypeRecurring ProductCatalogBillingType = "recurring"
)

Product catalog billing type constants.

type ProductCatalogItemResponse

type ProductCatalogItemResponse struct {
	UUID                      string  `json:"uuid,omitempty"`
	Title                     string  `json:"title,omitempty"`
	Type                      string  `json:"type,omitempty"`
	CategoryID                string  `json:"category_id,omitempty"`
	CategoryName              string  `json:"category_name,omitempty"`
	CreatedBy                 string  `json:"created_by,omitempty"`
	ModifiedBy                string  `json:"modified_by,omitempty"`
	DateCreated               string  `json:"date_created,omitempty"`
	DateModified              string  `json:"date_modified,omitempty"`
	DefaultPriceConfiguration RawJSON `json:"default_price_configuration,omitempty"`
	Variants                  RawJSON `json:"variants,omitempty"`
	BundleItems               RawJSON `json:"bundle_items,omitempty"`
}

ProductCatalogItemResponse is returned by create/get/update endpoints.

type ProductCatalogItemType

type ProductCatalogItemType string

ProductCatalogItemType is the catalog item type enum.

const (
	// ProductCatalogItemTypeRegular represents a regular catalog item.
	ProductCatalogItemTypeRegular ProductCatalogItemType = "regular"
	// ProductCatalogItemTypeBundle represents a bundle catalog item.
	ProductCatalogItemTypeBundle ProductCatalogItemType = "bundle"
)

Product catalog item type constants.

type ProductCatalogSearchItem

type ProductCatalogSearchItem struct {
	UUID             string   `json:"uuid,omitempty"`
	WorkspaceID      string   `json:"workspace_id,omitempty"`
	Title            string   `json:"title,omitempty"`
	SKU              string   `json:"sku,omitempty"`
	Description      string   `json:"description,omitempty"`
	Type             string   `json:"type,omitempty"`
	BillingType      string   `json:"billing_type,omitempty"`
	BillingCycle     int      `json:"billing_cycle,omitempty"`
	Currency         string   `json:"currency,omitempty"`
	CategoryID       string   `json:"category_id,omitempty"`
	CategoryName     string   `json:"category_name,omitempty"`
	CreatedBy        string   `json:"created_by,omitempty"`
	ModifiedBy       string   `json:"modified_by,omitempty"`
	DateCreated      string   `json:"date_created,omitempty"`
	DateModified     string   `json:"date_modified,omitempty"`
	PricingMethod    int      `json:"pricing_method,omitempty"`
	BundleItemsCount int      `json:"bundle_items_count,omitempty"`
	ImageSrc         string   `json:"image_src,omitempty"`
	Price            *float64 `json:"price,omitempty"`
	Cost             *float64 `json:"cost,omitempty"`
	MinTierValue     *float64 `json:"min_tier_value,omitempty"`
	MaxTierValue     *float64 `json:"max_tier_value,omitempty"`
	CustomFields     RawJSON  `json:"custom_fields,omitempty"`
	Images           RawJSON  `json:"images,omitempty"`
	Highlights       RawJSON  `json:"highlights,omitempty"`
	Tiers            RawJSON  `json:"tiers,omitempty"`
}

ProductCatalogSearchItem is a search result entry.

type ProductCatalogService

ProductCatalogService handles product-catalog API operations.

type RawJSON

type RawJSON = json.RawMessage

RawJSON is a helper alias for nested payloads that are intentionally untyped.

type RawObject

type RawObject map[string]any

RawObject is a flexible JSON object shape for endpoints with wide payload variance.

type RetryPolicy

type RetryPolicy struct {
	MaxRetries     int
	InitialBackoff time.Duration
	MaxBackoff     time.Duration
	RetryOn429     bool
	RetryOn5xx     bool
}

RetryPolicy controls transport-level retries.

func DefaultRetryPolicy

func DefaultRetryPolicy() RetryPolicy

DefaultRetryPolicy returns a safe retry policy for API clients.

type SearchProductCatalogItemsOptions

type SearchProductCatalogItemsOptions struct {
	Page         int
	PerPage      int
	Query        string
	OrderBy      string
	Types        []ProductCatalogItemType
	BillingTypes []ProductCatalogBillingType
	ExcludeUUIDs []string
	CategoryID   string
	NoCategory   *bool
}

SearchProductCatalogItemsOptions controls catalog search filters.

type SearchProductCatalogItemsResponse

type SearchProductCatalogItemsResponse struct {
	Items        []ProductCatalogSearchItem `json:"items"`
	HasMoreItems bool                       `json:"has_more_items"`
	Total        int                        `json:"total"`
}

SearchProductCatalogItemsResponse is returned by catalog search.

type TransferAllDocumentsOwnershipRequest

type TransferAllDocumentsOwnershipRequest map[string]any

TransferAllDocumentsOwnershipRequest is a flexible bulk ownership transfer payload.

type TransferDocumentOwnershipRequest

type TransferDocumentOwnershipRequest map[string]any

TransferDocumentOwnershipRequest is a flexible ownership transfer payload.

type UpdateProductCatalogItemRequest

type UpdateProductCatalogItemRequest map[string]any

UpdateProductCatalogItemRequest is a flexible update payload.

type UpdateWebhookSubscriptionSharedKeyResponse

type UpdateWebhookSubscriptionSharedKeyResponse struct {
	SharedKey string `json:"shared_key"`
}

UpdateWebhookSubscriptionSharedKeyResponse contains regenerated shared-key.

type UserReference

type UserReference struct {
	ID           string `json:"id,omitempty"`
	MembershipID string `json:"membership_id,omitempty"`
	Email        string `json:"email,omitempty"`
	FirstName    string `json:"first_name,omitempty"`
	LastName     string `json:"last_name,omitempty"`
	Avatar       string `json:"avatar,omitempty"`
}

UserReference is a compact user descriptor used across multiple endpoints.

type WebhookEventDetailsResponse

type WebhookEventDetailsResponse struct {
	UUID            string  `json:"uuid,omitempty"`
	Name            string  `json:"name,omitempty"`
	Type            string  `json:"type,omitempty"`
	EventTime       string  `json:"event_time,omitempty"`
	DeliveryTime    string  `json:"delivery_time,omitempty"`
	URL             string  `json:"url,omitempty"`
	HTTPStatusCode  int     `json:"http_status_code,omitempty"`
	Error           bool    `json:"error"`
	RequestBody     RawJSON `json:"request_body,omitempty"`
	ResponseBody    RawJSON `json:"response_body,omitempty"`
	ResponseHeaders RawJSON `json:"response_headers,omitempty"`
	Signature       string  `json:"signature,omitempty"`
}

WebhookEventDetailsResponse represents a single webhook event payload.

type WebhookEventItem

type WebhookEventItem struct {
	UUID           string `json:"uuid,omitempty"`
	Name           string `json:"name,omitempty"`
	Type           string `json:"type,omitempty"`
	HTTPStatusCode int    `json:"http_status_code,omitempty"`
	DeliveryTime   string `json:"delivery_time,omitempty"`
	Error          bool   `json:"error"`
}

WebhookEventItem is a compact event-list entry.

type WebhookEventListResponse

type WebhookEventListResponse struct {
	Items []WebhookEventItem `json:"items"`
}

WebhookEventListResponse represents webhook event pages.

type WebhookEventsService

type WebhookEventsService interface {
	List(ctx context.Context, opts *ListWebhookEventsOptions) (*WebhookEventListResponse, error)
	Get(ctx context.Context, id string) (*WebhookEventDetailsResponse, error)
}

WebhookEventsService handles webhook-event endpoints.

type WebhookPayloadOption

type WebhookPayloadOption string

WebhookPayloadOption controls additional payload sections in webhook deliveries.

const (
	// WebhookPayloadMetadata includes metadata in webhook payload.
	WebhookPayloadMetadata WebhookPayloadOption = "metadata"
	// WebhookPayloadFields includes fields in webhook payload.
	WebhookPayloadFields WebhookPayloadOption = "fields"
	// WebhookPayloadProducts includes products in webhook payload.
	WebhookPayloadProducts WebhookPayloadOption = "products"
	// WebhookPayloadTokens includes tokens in webhook payload.
	WebhookPayloadTokens WebhookPayloadOption = "tokens"
	// WebhookPayloadPricing includes pricing in webhook payload.
	WebhookPayloadPricing WebhookPayloadOption = "pricing"
)

Webhook payload option constants.

type WebhookSubscription

type WebhookSubscription struct {
	UUID      string                 `json:"uuid,omitempty"`
	Workspace string                 `json:"workspace_id,omitempty"`
	Name      string                 `json:"name,omitempty"`
	URL       string                 `json:"url,omitempty"`
	Active    bool                   `json:"active"`
	Status    string                 `json:"status,omitempty"`
	SharedKey string                 `json:"shared_key,omitempty"`
	Triggers  []WebhookTrigger       `json:"triggers,omitempty"`
	Payload   []WebhookPayloadOption `json:"payload,omitempty"`
}

WebhookSubscription represents a webhook subscription item.

type WebhookSubscriptionListResponse

type WebhookSubscriptionListResponse struct {
	Items []WebhookSubscription `json:"items"`
}

WebhookSubscriptionListResponse lists webhook subscriptions.

type WebhookSubscriptionRequest

type WebhookSubscriptionRequest struct {
	Name     string                 `json:"name,omitempty"`
	URL      string                 `json:"url,omitempty"`
	Active   *bool                  `json:"active,omitempty"`
	Triggers []WebhookTrigger       `json:"triggers,omitempty"`
	Payload  []WebhookPayloadOption `json:"payload,omitempty"`
}

WebhookSubscriptionRequest creates/updates webhook subscriptions.

type WebhookSubscriptionsService

WebhookSubscriptionsService handles webhook-subscription endpoints.

type WebhookTrigger

type WebhookTrigger string

WebhookTrigger controls which events trigger subscription deliveries.

const (
	// WebhookTriggerRecipientCompleted triggers when a recipient completes.
	WebhookTriggerRecipientCompleted WebhookTrigger = "recipient_completed"
	// WebhookTriggerDocumentUpdated triggers when a document is updated.
	WebhookTriggerDocumentUpdated WebhookTrigger = "document_updated"
	// WebhookTriggerDocumentDeleted triggers when a document is deleted.
	WebhookTriggerDocumentDeleted WebhookTrigger = "document_deleted"
	// WebhookTriggerDocumentStateChanged triggers when document state changes.
	WebhookTriggerDocumentStateChanged WebhookTrigger = "document_state_changed"
	// WebhookTriggerDocumentCreationFailed triggers when document creation fails.
	WebhookTriggerDocumentCreationFailed WebhookTrigger = "document_creation_failed"
	// WebhookTriggerDocumentCompletedPDFReady triggers when completed PDF is ready.
	WebhookTriggerDocumentCompletedPDFReady WebhookTrigger = "document_completed_pdf_ready"
	// WebhookTriggerDocumentSectionAdded triggers when a document section is added.
	WebhookTriggerDocumentSectionAdded WebhookTrigger = "document_section_added"
	// WebhookTriggerQuoteUpdated triggers when a quote is updated.
	WebhookTriggerQuoteUpdated WebhookTrigger = "quote_updated"
	// WebhookTriggerTemplateCreated triggers when a template is created.
	WebhookTriggerTemplateCreated WebhookTrigger = "template_created"
	// WebhookTriggerTemplateUpdated triggers when a template is updated.
	WebhookTriggerTemplateUpdated WebhookTrigger = "template_updated"
	// WebhookTriggerTemplateDeleted triggers when a template is deleted.
	WebhookTriggerTemplateDeleted WebhookTrigger = "template_deleted"
	// WebhookTriggerContentLibraryItemCreated triggers when content library item is created.
	WebhookTriggerContentLibraryItemCreated WebhookTrigger = "content_library_item_created"
	// WebhookTriggerContentLibraryItemCreationFail triggers when content library creation fails.
	WebhookTriggerContentLibraryItemCreationFail WebhookTrigger = "content_library_item_creation_failed"
)

Webhook trigger constants.

Directories

Path Synopsis
examples
get_document_fields command
Example: Get document details and fields from PandaDoc
Example: Get document details and fields from PandaDoc
list_catalog command
Example: List catalog items from PandaDoc
Example: List catalog items from PandaDoc
list_documents command
Example: List documents from PandaDoc
Example: List documents from PandaDoc
internal
cmd/specsync command
Package main is the specsync command that synchronizes the SDK against OpenAPI spec changes.
Package main is the specsync command that synchronizes the SDK against OpenAPI spec changes.
spec
Package spec provides the generated operation manifest for the PandaDoc API.
Package spec provides the generated operation manifest for the PandaDoc API.

Jump to

Keyboard shortcuts

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