Documentation
¶
Overview ¶
Package contractsign provides a Go client for the ContractSign API.
Create contracts, send them for digital signing, manage templates, and track signing status — all from Go.
client := contractsign.New("cs_...")
contract, err := client.Contracts.Create(ctx, contractsign.CreateContractInput{
Title: "Consulting Agreement",
Content: "<h1>Consulting Agreement</h1><p>...</p>",
})
Index ¶
- Variables
- func Ptr[T any](v T) *T
- type APIError
- type APIKey
- type AccountService
- func (s *AccountService) CreateAPIKey(ctx context.Context, input CreateAPIKeyInput) (*CreateAPIKeyResponse, error)
- func (s *AccountService) DeleteAPIKey(ctx context.Context, id string) error
- func (s *AccountService) GetOrganization(ctx context.Context) (*Organization, error)
- func (s *AccountService) ListAPIKeys(ctx context.Context) ([]APIKey, error)
- func (s *AccountService) Me(ctx context.Context) (*Me, error)
- func (s *AccountService) UpdateOrganization(ctx context.Context, input UpdateOrganizationInput) (*Organization, error)
- type AuditLog
- type Client
- type Contract
- type ContractListItem
- type ContractStatus
- type ContractsService
- func (s *ContractsService) Create(ctx context.Context, input CreateContractInput) (*Contract, error)
- func (s *ContractsService) CreateParty(ctx context.Context, contractID string, input CreatePartyInput) (*Party, error)
- func (s *ContractsService) Delete(ctx context.Context, id string) error
- func (s *ContractsService) DeleteParty(ctx context.Context, contractID, partyID string) error
- func (s *ContractsService) Duplicate(ctx context.Context, id string) (*Contract, error)
- func (s *ContractsService) Get(ctx context.Context, id string) (*Contract, error)
- func (s *ContractsService) List(ctx context.Context, params *ListContractsParams) (*PaginatedResponse[ContractListItem], error)
- func (s *ContractsService) ListParties(ctx context.Context, contractID string) ([]Party, error)
- func (s *ContractsService) PDF(ctx context.Context, id string) (*http.Response, error)
- func (s *ContractsService) Update(ctx context.Context, id string, input UpdateContractInput) (*Contract, error)
- func (s *ContractsService) UpdateParty(ctx context.Context, contractID, partyID string, input UpdatePartyInput) (*Party, error)
- type CreateAPIKeyInput
- type CreateAPIKeyResponse
- type CreateContractInput
- type CreateFolderInput
- type CreatePartyInput
- type CreateSigningInput
- type CreateSigningResponse
- type CreateTagInput
- type CreateTemplateInput
- type DefaultSigner
- type FieldCategory
- type FieldOption
- type FieldType
- type FieldValue
- type FieldValueInput
- type Folder
- type FoldersService
- func (s *FoldersService) Create(ctx context.Context, input CreateFolderInput) (*Folder, error)
- func (s *FoldersService) Delete(ctx context.Context, id string) error
- func (s *FoldersService) Get(ctx context.Context, id string) (*Folder, error)
- func (s *FoldersService) List(ctx context.Context) ([]Folder, error)
- func (s *FoldersService) Update(ctx context.Context, id string, input UpdateFolderInput) (*Folder, error)
- type GetSigningResponse
- type ListContractsParams
- type ListTemplatesParams
- type Me
- type NameRef
- type Option
- type Organization
- type PaginatedResponse
- type Party
- type PartyType
- type RemindOptions
- type RemindResponse
- type RenderedEmail
- type Signer
- type SignerFieldValue
- type SignerHint
- type SignerInput
- type SignerRole
- type SignerStatus
- type SigningLink
- type SigningMethod
- type SigningOrder
- type SigningRequest
- type SigningService
- func (s *SigningService) Cancel(ctx context.Context, id string) error
- func (s *SigningService) Create(ctx context.Context, input CreateSigningInput) (*CreateSigningResponse, error)
- func (s *SigningService) Get(ctx context.Context, id string) (*GetSigningResponse, error)
- func (s *SigningService) GetLinks(ctx context.Context, id string) ([]SigningLink, error)
- func (s *SigningService) Remind(ctx context.Context, id string, opts *RemindOptions) (*RemindResponse, error)
- type Tag
- type TagRef
- type TagWithCount
- type TagsService
- func (s *TagsService) Create(ctx context.Context, input CreateTagInput) (*Tag, error)
- func (s *TagsService) Delete(ctx context.Context, id string) error
- func (s *TagsService) List(ctx context.Context) ([]TagWithCount, error)
- func (s *TagsService) Update(ctx context.Context, id string, input UpdateTagInput) (*Tag, error)
- type Template
- type TemplateField
- type TemplateFieldInput
- type TemplateListItem
- type TemplatesService
- func (s *TemplatesService) Create(ctx context.Context, input CreateTemplateInput) (*Template, error)
- func (s *TemplatesService) Delete(ctx context.Context, id string) error
- func (s *TemplatesService) Get(ctx context.Context, id string) (*Template, error)
- func (s *TemplatesService) List(ctx context.Context, params *ListTemplatesParams) (*PaginatedResponse[TemplateListItem], error)
- func (s *TemplatesService) Update(ctx context.Context, id string, input UpdateTemplateInput) (*Template, error)
- type UpdateContractInput
- type UpdateFolderInput
- type UpdateOrganizationInput
- type UpdatePartyInput
- type UpdateTagInput
- type UpdateTemplateInput
- type UserRef
Constants ¶
This section is empty.
Variables ¶
var ( ErrNotFound = errors.New("not found") ErrForbidden = errors.New("forbidden") ErrRateLimited = errors.New("rate limited") )
Sentinel errors for common API failure modes. Use errors.Is to match these in caller code.
Functions ¶
Types ¶
type APIError ¶
type APIError struct {
// StatusCode is the HTTP status code returned by the API.
StatusCode int
// Method is the HTTP method of the failed request (e.g. "GET").
Method string
// Path is the API path of the failed request (e.g. "/contracts/abc").
Path string
// Body is the raw response body.
Body json.RawMessage
// Message is the parsed error message, if available.
Message string
// contains filtered or unexported fields
}
APIError is returned when the API responds with a non-2xx status code. It wraps a sentinel error for common status codes so that callers can use errors.Is(err, contractsign.ErrNotFound) instead of inspecting StatusCode.
type APIKey ¶
type APIKey struct {
ID string `json:"id"`
Name string `json:"name"`
KeyPrefix string `json:"keyPrefix"`
LastUsedAt *string `json:"lastUsedAt"`
ExpiresAt *string `json:"expiresAt"`
CreatedAt string `json:"createdAt"`
User UserRef `json:"user"`
}
APIKey represents an API key for the organization.
type AccountService ¶
type AccountService struct {
// contains filtered or unexported fields
}
AccountService handles account, organization, and API key operations.
func (*AccountService) CreateAPIKey ¶
func (s *AccountService) CreateAPIKey(ctx context.Context, input CreateAPIKeyInput) (*CreateAPIKeyResponse, error)
CreateAPIKey creates a new API key. The full key is only returned once.
func (*AccountService) DeleteAPIKey ¶
func (s *AccountService) DeleteAPIKey(ctx context.Context, id string) error
DeleteAPIKey deletes an API key.
func (*AccountService) GetOrganization ¶
func (s *AccountService) GetOrganization(ctx context.Context) (*Organization, error)
GetOrganization retrieves the current organization.
func (*AccountService) ListAPIKeys ¶
func (s *AccountService) ListAPIKeys(ctx context.Context) ([]APIKey, error)
ListAPIKeys returns all API keys for the organization.
func (*AccountService) Me ¶
func (s *AccountService) Me(ctx context.Context) (*Me, error)
Me returns the authenticated user and their organization.
func (*AccountService) UpdateOrganization ¶
func (s *AccountService) UpdateOrganization(ctx context.Context, input UpdateOrganizationInput) (*Organization, error)
UpdateOrganization updates the current organization.
type AuditLog ¶
type AuditLog struct {
ID string `json:"id"`
Action string `json:"action"`
Metadata any `json:"metadata"`
CreatedAt string `json:"createdAt"`
}
AuditLog is a single audit trail entry.
type Client ¶
type Client struct {
Contracts *ContractsService
Signing *SigningService
Templates *TemplatesService
Folders *FoldersService
Tags *TagsService
Account *AccountService
}
Client is the top-level ContractSign API client.
type Contract ¶
type Contract struct {
ID string `json:"id"`
Title string `json:"title"`
Content string `json:"content"`
Status ContractStatus `json:"status"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
TemplateID *string `json:"templateId"`
FolderID *string `json:"folderId"`
Tags []TagRef `json:"tags"`
Template *NameRef `json:"template"`
Folder *NameRef `json:"folder"`
CreatedBy UserRef `json:"createdBy"`
SigningRequest *SigningRequest `json:"signingRequest"`
Parties []Party `json:"parties"`
FieldValues []FieldValue `json:"fieldValues"`
SignerFieldValues []SignerFieldValue `json:"signerFieldValues"`
AuditLogs []AuditLog `json:"auditLogs"`
}
Contract is the full representation of a contract with all relations.
type ContractListItem ¶
type ContractListItem struct {
ID string `json:"id"`
Title string `json:"title"`
Status ContractStatus `json:"status"`
UpdatedAt string `json:"updatedAt"`
Tags []TagRef `json:"tags"`
Template *NameRef `json:"template"`
Folder *NameRef `json:"folder"`
CreatedBy UserRef `json:"createdBy"`
SigningRequest *struct {
ID string `json:"id"`
Status string `json:"status"`
} `json:"signingRequest"`
}
ContractListItem is a lightweight contract representation for list endpoints.
type ContractStatus ¶
type ContractStatus string
const ( StatusDraft ContractStatus = "draft" StatusPending ContractStatus = "pending" StatusSigning ContractStatus = "signing" StatusCompleted ContractStatus = "completed" StatusCancelled ContractStatus = "cancelled" StatusExpired ContractStatus = "expired" )
ContractStatus values.
type ContractsService ¶
type ContractsService struct {
// contains filtered or unexported fields
}
ContractsService handles contract CRUD and party management.
func (*ContractsService) Create ¶
func (s *ContractsService) Create(ctx context.Context, input CreateContractInput) (*Contract, error)
Create creates a new contract.
func (*ContractsService) CreateParty ¶
func (s *ContractsService) CreateParty(ctx context.Context, contractID string, input CreatePartyInput) (*Party, error)
CreateParty adds a party to a contract.
func (*ContractsService) Delete ¶
func (s *ContractsService) Delete(ctx context.Context, id string) error
Delete deletes a contract.
func (*ContractsService) DeleteParty ¶
func (s *ContractsService) DeleteParty(ctx context.Context, contractID, partyID string) error
DeleteParty removes a party from a contract.
func (*ContractsService) List ¶
func (s *ContractsService) List(ctx context.Context, params *ListContractsParams) (*PaginatedResponse[ContractListItem], error)
List returns a paginated list of contracts.
func (*ContractsService) ListParties ¶
ListParties returns all parties on a contract.
func (*ContractsService) PDF ¶
PDF downloads the signed PDF for a completed contract. The caller must close the response body.
func (*ContractsService) Update ¶
func (s *ContractsService) Update(ctx context.Context, id string, input UpdateContractInput) (*Contract, error)
Update updates an existing contract.
func (*ContractsService) UpdateParty ¶
func (s *ContractsService) UpdateParty(ctx context.Context, contractID, partyID string, input UpdatePartyInput) (*Party, error)
UpdateParty updates a party on a contract.
type CreateAPIKeyInput ¶
type CreateAPIKeyInput struct {
Name string `json:"name"`
ExpiresAt *string `json:"expiresAt,omitempty"`
}
CreateAPIKeyInput is the payload for creating an API key.
type CreateAPIKeyResponse ¶
type CreateAPIKeyResponse struct {
Key string `json:"key"`
Prefix string `json:"prefix"`
Name string `json:"name"`
APIKey APIKey `json:"apiKey"`
}
CreateAPIKeyResponse is returned when creating an API key. The Key field contains the full API key and is only available at creation time.
type CreateContractInput ¶
type CreateContractInput struct {
Title string `json:"title"`
Content string `json:"content"`
TemplateID *string `json:"templateId,omitempty"`
FolderID *string `json:"folderId,omitempty"`
TagIDs []string `json:"tagIds,omitempty"`
FieldValues []FieldValueInput `json:"fieldValues,omitempty"`
}
CreateContractInput is the payload for creating a contract.
type CreateFolderInput ¶
type CreateFolderInput struct {
Name string `json:"name"`
ParentID *string `json:"parentId,omitempty"`
Color *string `json:"color,omitempty"`
Position *int `json:"position,omitempty"`
}
CreateFolderInput is the payload for creating a folder.
type CreatePartyInput ¶
type CreatePartyInput struct {
Type PartyType `json:"type"`
Name string `json:"name"`
Address *string `json:"address,omitempty"`
City *string `json:"city,omitempty"`
Zip *string `json:"zip,omitempty"`
Country string `json:"country"`
RegistrationNumber *string `json:"registrationNumber,omitempty"`
ReferredAs *string `json:"referredAs,omitempty"`
SignerHints []SignerHint `json:"signerHints,omitempty"`
Order *int `json:"order,omitempty"`
}
CreatePartyInput is the payload for adding a party to a contract.
type CreateSigningInput ¶
type CreateSigningInput struct {
ContractID string `json:"contractId"`
Message *string `json:"message,omitempty"`
SigningOrder *SigningOrder `json:"signingOrder,omitempty"`
ExpiresAt *string `json:"expiresAt,omitempty"`
SuppressEmails *bool `json:"suppressEmails,omitempty"`
Signers []SignerInput `json:"signers"`
}
CreateSigningInput is the payload for creating a signing request.
type CreateSigningResponse ¶
type CreateSigningResponse struct {
SigningRequest
Emails []RenderedEmail `json:"emails,omitempty"`
}
CreateSigningResponse is the response from creating a signing request. When SuppressEmails was set to true, Emails contains the rendered email payloads.
type CreateTagInput ¶
CreateTagInput is the payload for creating a tag.
type CreateTemplateInput ¶
type CreateTemplateInput struct {
Name string `json:"name"`
Description *string `json:"description,omitempty"`
Content string `json:"content"`
Fields []TemplateFieldInput `json:"fields,omitempty"`
DefaultSigners []DefaultSigner `json:"defaultSigners,omitempty"`
}
CreateTemplateInput is the payload for creating a template.
type DefaultSigner ¶
type DefaultSigner struct {
Name string `json:"name"`
Email string `json:"email"`
Phone *string `json:"phone,omitempty"`
Role SignerRole `json:"role"`
SigningMethod SigningMethod `json:"signingMethod"`
PartyName *string `json:"partyName,omitempty"`
}
DefaultSigner is a pre-configured signer on a template.
type FieldCategory ¶
type FieldCategory string
const ( CategoryTemplateVariable FieldCategory = "template_variable" CategoryInteractive FieldCategory = "interactive" )
FieldCategory values.
type FieldOption ¶
FieldOption is a selectable option for a template field.
type FieldValue ¶
type FieldValue struct {
ID string `json:"id"`
Value *string `json:"value"`
SignatureData *string `json:"signatureData"`
FilledAt *string `json:"filledAt"`
TemplateField TemplateField `json:"templateField"`
}
FieldValue is a filled value for a template field on a contract.
type FieldValueInput ¶
type FieldValueInput struct {
TemplateFieldID string `json:"templateFieldId"`
Value *string `json:"value,omitempty"`
SignatureData *string `json:"signatureData,omitempty"`
}
FieldValueInput is used when setting field values on a contract.
type Folder ¶
type Folder struct {
ID string `json:"id"`
Name string `json:"name"`
Color *string `json:"color"`
Position int `json:"position"`
ParentID *string `json:"parentId"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
Count struct {
Contracts int `json:"contracts"`
Children int `json:"children"`
} `json:"_count"`
}
Folder represents a contract folder.
type FoldersService ¶
type FoldersService struct {
// contains filtered or unexported fields
}
FoldersService handles folder CRUD operations.
func (*FoldersService) Create ¶
func (s *FoldersService) Create(ctx context.Context, input CreateFolderInput) (*Folder, error)
Create creates a new folder.
func (*FoldersService) Delete ¶
func (s *FoldersService) Delete(ctx context.Context, id string) error
Delete deletes a folder.
func (*FoldersService) List ¶
func (s *FoldersService) List(ctx context.Context) ([]Folder, error)
List returns all folders.
func (*FoldersService) Update ¶
func (s *FoldersService) Update(ctx context.Context, id string, input UpdateFolderInput) (*Folder, error)
Update updates an existing folder.
type GetSigningResponse ¶
type GetSigningResponse struct {
SigningRequest
Contract struct {
ID string `json:"id"`
Title string `json:"title"`
Status string `json:"status"`
} `json:"contract"`
}
GetSigningResponse includes the signing request and its associated contract.
type ListContractsParams ¶
type ListContractsParams struct {
Limit *int `json:"limit,omitempty"`
Offset *int `json:"offset,omitempty"`
Status *ContractStatus `json:"status,omitempty"`
FolderID *string `json:"folderId,omitempty"`
TagIDs *string `json:"tagIds,omitempty"`
Search *string `json:"search,omitempty"`
}
ListContractsParams configures contract listing.
type ListTemplatesParams ¶
ListTemplatesParams configures template listing.
type Me ¶
type Me struct {
User UserRef `json:"user"`
Organization struct {
ID string `json:"id"`
Name string `json:"name"`
Slug string `json:"slug"`
} `json:"organization"`
Role string `json:"role"`
}
Me is the authenticated user and their organization.
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option configures the Client.
func WithBaseURL ¶
WithBaseURL overrides the default API base URL (https://contractsign.net).
func WithHTTPClient ¶
WithHTTPClient overrides the default HTTP client used for API requests.
type Organization ¶
type Organization struct {
ID string `json:"id"`
Name string `json:"name"`
Slug string `json:"slug"`
CreatedAt string `json:"createdAt"`
Count struct {
Memberships int `json:"memberships"`
Contracts int `json:"contracts"`
} `json:"_count"`
}
Organization represents an organization account.
type PaginatedResponse ¶
type PaginatedResponse[T any] struct { Data []T `json:"data"` Total int `json:"total"` HasMore bool `json:"hasMore"` }
PaginatedResponse wraps a list endpoint response with pagination metadata.
type Party ¶
type Party struct {
ID string `json:"id"`
Type PartyType `json:"type"`
Name string `json:"name"`
Address *string `json:"address"`
City *string `json:"city"`
Zip *string `json:"zip"`
Country string `json:"country"`
RegistrationNumber *string `json:"registrationNumber"`
ReferredAs *string `json:"referredAs"`
SignerHints []SignerHint `json:"signerHints"`
Order int `json:"order"`
}
Party represents a signatory party on a contract.
type RemindOptions ¶
type RemindOptions struct {
// SuppressEmails prevents sending emails and instead returns rendered payloads.
SuppressEmails bool
}
RemindOptions configures the SigningService.Remind call.
type RemindResponse ¶
type RemindResponse struct {
Reminded int `json:"reminded"`
Signers []Signer `json:"signers"`
Emails []RenderedEmail `json:"emails,omitempty"`
}
RemindResponse is the response from sending reminders.
type RenderedEmail ¶
type RenderedEmail struct {
To string `json:"to"`
Subject string `json:"subject"`
HTML string `json:"html"`
SigningURL string `json:"signingUrl"`
}
RenderedEmail contains a pre-rendered email returned when suppressEmails is true.
type Signer ¶
type Signer struct {
ID string `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
Role SignerRole `json:"role"`
SigningMethod SigningMethod `json:"signingMethod"`
Status SignerStatus `json:"status"`
Order int `json:"order"`
Token string `json:"token"`
SignedAt *string `json:"signedAt"`
DeclinedAt *string `json:"declinedAt"`
DeclineReason *string `json:"declineReason"`
FirstOpenedAt *string `json:"firstOpenedAt"`
LastOpenedAt *string `json:"lastOpenedAt"`
OpenedCount int `json:"openedCount"`
IPAddress *string `json:"ipAddress"`
UserAgent *string `json:"userAgent"`
}
Signer represents an individual signer on a signing request.
type SignerFieldValue ¶
type SignerFieldValue struct {
ID string `json:"id"`
SignerID string `json:"signerId"`
FieldKey string `json:"fieldKey"`
FieldLabel string `json:"fieldLabel"`
FieldType string `json:"fieldType"`
AssignedTo string `json:"assignedTo"`
Value *string `json:"value"`
SignatureData *string `json:"signatureData"`
FilledAt *string `json:"filledAt"`
}
SignerFieldValue is a signer-specific field value.
type SignerHint ¶
type SignerHint struct {
Name string `json:"name"`
Email *string `json:"email,omitempty"`
Title *string `json:"title,omitempty"`
}
SignerHint is a suggested signer associated with a party.
type SignerInput ¶
type SignerInput struct {
Name string `json:"name"`
Email string `json:"email"`
Phone *string `json:"phone,omitempty"`
Role SignerRole `json:"role"`
SigningMethod SigningMethod `json:"signingMethod"`
Order int `json:"order"`
}
SignerInput defines a signer when creating a signing request.
type SignerRole ¶
type SignerRole string
const ( RoleSigner SignerRole = "signer" RoleViewer SignerRole = "viewer" RoleApprover SignerRole = "approver" )
SignerRole values.
type SignerStatus ¶
type SignerStatus string
const ( SignerPending SignerStatus = "pending" SignerNotified SignerStatus = "notified" SignerOpened SignerStatus = "opened" SignerSigned SignerStatus = "signed" SignerDeclined SignerStatus = "declined" )
SignerStatus values.
type SigningLink ¶
type SigningLink struct {
Name string `json:"name"`
Email string `json:"email"`
Status string `json:"status"`
URL string `json:"url"`
}
SigningLink is a direct signing URL for a signer.
type SigningMethod ¶
type SigningMethod string
const ( MethodSMSOTP SigningMethod = "sms_otp" MethodMitID SigningMethod = "mitid" )
SigningMethod values.
type SigningOrder ¶
type SigningOrder string
const ( SigningOrderParallel SigningOrder = "parallel" SigningOrderSequential SigningOrder = "sequential" )
SigningOrder values.
type SigningRequest ¶
type SigningRequest struct {
ID string `json:"id"`
Status string `json:"status"`
SigningOrder SigningOrder `json:"signingOrder"`
Message *string `json:"message"`
CreatedAt string `json:"createdAt"`
CompletedAt *string `json:"completedAt"`
Signers []Signer `json:"signers"`
}
SigningRequest represents a signing campaign for a contract.
type SigningService ¶
type SigningService struct {
// contains filtered or unexported fields
}
SigningService handles signing request operations.
func (*SigningService) Cancel ¶
func (s *SigningService) Cancel(ctx context.Context, id string) error
Cancel cancels a signing request.
func (*SigningService) Create ¶
func (s *SigningService) Create(ctx context.Context, input CreateSigningInput) (*CreateSigningResponse, error)
Create creates a new signing request. When input.SuppressEmails is true, emails are not sent — instead the rendered email payloads are returned in CreateSigningResponse.Emails.
func (*SigningService) Get ¶
func (s *SigningService) Get(ctx context.Context, id string) (*GetSigningResponse, error)
Get retrieves a signing request by ID.
func (*SigningService) GetLinks ¶
func (s *SigningService) GetLinks(ctx context.Context, id string) ([]SigningLink, error)
GetLinks returns direct signing URLs for each signer on a signing request. Useful when email delivery fails and links need to be shared manually.
func (*SigningService) Remind ¶
func (s *SigningService) Remind(ctx context.Context, id string, opts *RemindOptions) (*RemindResponse, error)
Remind sends reminder emails to pending signers. When opts.SuppressEmails is true, emails are not sent — instead the rendered email payloads are returned in RemindResponse.Emails.
type TagRef ¶
type TagRef struct {
Tag Tag `json:"tag"`
}
TagRef wraps a Tag in a join-table structure.
type TagWithCount ¶
TagWithCount is a Tag with an associated contract count.
type TagsService ¶
type TagsService struct {
// contains filtered or unexported fields
}
TagsService handles tag CRUD operations.
func (*TagsService) Create ¶
func (s *TagsService) Create(ctx context.Context, input CreateTagInput) (*Tag, error)
Create creates a new tag.
func (*TagsService) Delete ¶
func (s *TagsService) Delete(ctx context.Context, id string) error
Delete deletes a tag.
func (*TagsService) List ¶
func (s *TagsService) List(ctx context.Context) ([]TagWithCount, error)
List returns all tags with contract counts.
func (*TagsService) Update ¶
func (s *TagsService) Update(ctx context.Context, id string, input UpdateTagInput) (*Tag, error)
Update updates an existing tag.
type Template ¶
type Template struct {
ID string `json:"id"`
Name string `json:"name"`
Description *string `json:"description"`
Content string `json:"content"`
Version int `json:"version"`
IsActive bool `json:"isActive"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
Fields []TemplateField `json:"fields"`
DefaultSigners []DefaultSigner `json:"defaultSigners"`
}
Template is the full representation of a contract template.
type TemplateField ¶
type TemplateField struct {
ID string `json:"id"`
Key string `json:"key"`
Label string `json:"label"`
Type FieldType `json:"type"`
Category FieldCategory `json:"category"`
Required bool `json:"required"`
DefaultValue *string `json:"defaultValue"`
Placeholder *string `json:"placeholder"`
Position int `json:"position"`
Options []FieldOption `json:"options"`
}
TemplateField defines a fillable field in a template.
type TemplateFieldInput ¶
type TemplateFieldInput struct {
Key string `json:"key"`
Label string `json:"label"`
Type FieldType `json:"type"`
Category FieldCategory `json:"category"`
Required bool `json:"required"`
DefaultValue *string `json:"defaultValue,omitempty"`
Placeholder *string `json:"placeholder,omitempty"`
Position int `json:"position"`
Options []FieldOption `json:"options,omitempty"`
}
TemplateFieldInput defines a field when creating or updating a template.
type TemplateListItem ¶
type TemplateListItem struct {
ID string `json:"id"`
Name string `json:"name"`
Description *string `json:"description"`
Version int `json:"version"`
UpdatedAt string `json:"updatedAt"`
CreatedBy UserRef `json:"createdBy"`
Count struct {
Contracts int `json:"contracts"`
Fields int `json:"fields"`
} `json:"_count"`
}
TemplateListItem is a lightweight template for list endpoints.
type TemplatesService ¶
type TemplatesService struct {
// contains filtered or unexported fields
}
TemplatesService handles template CRUD operations.
func (*TemplatesService) Create ¶
func (s *TemplatesService) Create(ctx context.Context, input CreateTemplateInput) (*Template, error)
Create creates a new template.
func (*TemplatesService) Delete ¶
func (s *TemplatesService) Delete(ctx context.Context, id string) error
Delete deletes a template.
func (*TemplatesService) List ¶
func (s *TemplatesService) List(ctx context.Context, params *ListTemplatesParams) (*PaginatedResponse[TemplateListItem], error)
List returns a paginated list of templates.
func (*TemplatesService) Update ¶
func (s *TemplatesService) Update(ctx context.Context, id string, input UpdateTemplateInput) (*Template, error)
Update updates an existing template.
type UpdateContractInput ¶
type UpdateContractInput struct {
Title *string `json:"title,omitempty"`
Content *string `json:"content,omitempty"`
Status *ContractStatus `json:"status,omitempty"`
FolderID *string `json:"folderId,omitempty"`
TagIDs []string `json:"tagIds,omitempty"`
FieldValues []FieldValueInput `json:"fieldValues,omitempty"`
}
UpdateContractInput is the payload for updating a contract.
type UpdateFolderInput ¶
type UpdateFolderInput struct {
Name *string `json:"name,omitempty"`
ParentID *string `json:"parentId,omitempty"`
Color *string `json:"color,omitempty"`
Position *int `json:"position,omitempty"`
}
UpdateFolderInput is the payload for updating a folder.
type UpdateOrganizationInput ¶
type UpdateOrganizationInput struct {
Name *string `json:"name,omitempty"`
Slug *string `json:"slug,omitempty"`
}
UpdateOrganizationInput is the payload for updating an organization.
type UpdatePartyInput ¶
type UpdatePartyInput struct {
Type *PartyType `json:"type,omitempty"`
Name *string `json:"name,omitempty"`
Address *string `json:"address,omitempty"`
City *string `json:"city,omitempty"`
Zip *string `json:"zip,omitempty"`
Country *string `json:"country,omitempty"`
RegistrationNumber *string `json:"registrationNumber,omitempty"`
ReferredAs *string `json:"referredAs,omitempty"`
SignerHints []SignerHint `json:"signerHints,omitempty"`
Order *int `json:"order,omitempty"`
}
UpdatePartyInput is the payload for updating a party.
type UpdateTagInput ¶
type UpdateTagInput struct {
Name *string `json:"name,omitempty"`
Color *string `json:"color,omitempty"`
}
UpdateTagInput is the payload for updating a tag.
type UpdateTemplateInput ¶
type UpdateTemplateInput struct {
Name *string `json:"name,omitempty"`
Description *string `json:"description,omitempty"`
Content *string `json:"content,omitempty"`
Fields []TemplateFieldInput `json:"fields,omitempty"`
DefaultSigners []DefaultSigner `json:"defaultSigners,omitempty"`
}
UpdateTemplateInput is the payload for updating a template.




