Documentation ¶
Overview ¶
Package click implements DocuSign's click api. Credtials used for this api must be initialized with a scop of click.manageApi documentation for these functions may be found at: https://docs.docusign.com/esign/guide/authentication/legacy_auth.htmlpackage
Example ¶
package main import ( "context" "fmt" "log" "github.com/thaitanloi365/esign" "github.com/thaitanloi365/esign/click" ) func main() { ctx := context.TODO() cfg := &esign.OAuth2Config{ IntegratorKey: "51d1a791-489c-4622-b743-19e0bd6f359e", Secret: "f625e6f7-48e3-4226-adc5-66e434b21355", RedirURL: "https://yourdomain.com/auth", AccountID: "c23357a7-4f00-47f5-8802-94d2b1fb9a29", ExtendedLifetime: true, IsDemo: true, } state := "SomeRandomStringOfSufficientSize" authURL := cfg.AuthURL(state, "click.manage") // Redirect user to consent page. fmt.Printf("Visit %s", authURL) // Enter code returned to redirectURL. var code string if _, err := fmt.Scan(&code); err != nil { log.Fatal(err) } credential, err := cfg.Exchange(ctx, code) if err != nil { log.Fatal(err) } result, err := click.New(credential).List().Do(ctx) if err != nil { log.Fatalf("list clickwraps error: %v", err) } for _, cw := range result.Clickwraps { fmt.Printf("%s: %s", cw.ID, cw.Name) } }
Output:
Index ¶
- type AgreementList
- type Clickwrap
- type CreateOp
- type DisplaySettings
- type Document
- type GetAgreementsOp
- type ListOp
- func (op *ListOp) Do(ctx context.Context) (*Listing, error)
- func (op *ListOp) FromDate(val time.Time) *ListOp
- func (op *ListOp) Name(val string) *ListOp
- func (op *ListOp) Page(val int32) *ListOp
- func (op *ListOp) Status(vals ...string) *ListOp
- func (op *ListOp) ToDate(val time.Time) *ListOp
- func (op *ListOp) VersionNumber(val int32) *ListOp
- type Listing
- type Service
- func (s *Service) Create(clickwrap *Clickwrap) *CreateOp
- func (s *Service) GetAgreements(clickwrapID string) *GetAgreementsOp
- func (s *Service) List() *ListOp
- func (s *Service) SetAgreement(clickwrapID string, agreement *UserAgreement) *SetAgreementOp
- func (s *Service) Update(id string, clickwrap *Clickwrap) *UpdateOp
- type SetAgreementOp
- type Settings
- type Summary
- type UpdateOp
- type UserAgreement
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgreementList ¶
type AgreementList struct { BeginCreatedOn *time.Time `json:"beginCreatedOn,omitempty"` MinimumPagesRemaining int32 `json:"minimumPagesRemaining,omitempty"` Page int32 `json:"page,omitempty"` PageSize int32 `json:"pageSize,omitempty"` UserAgreements []UserAgreement `json:"userAgreements,omitempty"` }
AgreementList is DocuSign's response to a user agreement listing
type Clickwrap ¶
type Clickwrap struct { ID string `json:"clickwrapId,omitempty"` Name string `json:"name,omitempty"` RequireReacceptance bool `json:"requireReacceptance,omitempty"` // Status may be active, inactive or deleted Status string `json:"status,omitempty"` UserID string `json:"userId,omitempty"` DisplaySettings *DisplaySettings `json:"displaySettings,omitempty"` Documents []Document `json:"documents,omitempty"` }
Clickwrap fully describes a clickwrap version
type DisplaySettings ¶
type DisplaySettings struct { BrandID string `json:"brandId,omitempty"` ConsentButtonText string `json:"consentButtonText,omitempty"` DeclineButtonText string `json:"declineButtonText,omitempty"` DisplayName string `json:"displayName,omitempty"` DocumentDisplay string `json:"documentDisplay,omitempty"` Downloadable bool `json:"bool,omitempty"` Format string `json:"format,omitempty"` HasAccept bool `json:"hasAccept,omitempty"` HostOrigin string `json:"hostOrigin,omitempty"` MustRead bool `json:"mustRead,omitempty"` MustView bool `json:"mustView,omitempty"` RequireAccept bool `json:"requireAccept,omitempty"` SendToEmail bool `json:"sendToEmail,omitempty"` Size string `json:"size,omitempty"` }
DisplaySettings provide defaults for the clickwrap
type Document ¶
type Document struct { Base64 []byte `json:"documentBase64,omitempty"` Name string `json:"documentName,omitempty"` FileExt string `json:"fileExtension,omitempty"` Order int32 `json:"order,omitempty"` }
Document used to update/create the original document for a clickwrap
type GetAgreementsOp ¶
GetAgreementsOp lists user agreements for a specific clickwrap
func (*GetAgreementsOp) ClientUserID ¶
func (op *GetAgreementsOp) ClientUserID(val string) *GetAgreementsOp
ClientUserID adds a filter to limit agreements for the client
func (*GetAgreementsOp) Do ¶
func (op *GetAgreementsOp) Do(ctx context.Context) (*AgreementList, error)
Do executes the operation
func (*GetAgreementsOp) Page ¶
func (op *GetAgreementsOp) Page(val int32) *GetAgreementsOp
Page filters agreements to those with the passed page number
type ListOp ¶
ListOp gets all the clickwraps for an account
func (*ListOp) FromDate ¶
FromDate (optional) sets the date from which created clickwaps will be returned (optional)
func (*ListOp) Status ¶
Status filters the statuses of the clickwrapts to return. Valid values are active, inactive and deleted.
func (*ListOp) ToDate ¶
ToDate sets the date up to which created clickwraps will be returned (optional)
func (*ListOp) VersionNumber ¶
VersionNumber sets the version number of the clickwraps to return
type Listing ¶
type Listing struct {
Clickwraps []Summary `json:"clickwraps,omitempty"`
}
Listing contains the response to a clickwrap list method
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service implements DocuSign Clickwrap API operations
func New ¶
func New(cred esign.Credential) *Service
New initializes a accounts service using cred to authorize ops.
func (*Service) GetAgreements ¶
func (s *Service) GetAgreements(clickwrapID string) *GetAgreementsOp
GetAgreements builds a GetAgreementsOp for the passed clickwrapID
func (*Service) SetAgreement ¶
func (s *Service) SetAgreement(clickwrapID string, agreement *UserAgreement) *SetAgreementOp
SetAgreement builds a SetAgreementOp for creating/updating
type SetAgreementOp ¶
SetAgreementOp creates/update as user agreement for a client
func (*SetAgreementOp) Do ¶
func (op *SetAgreementOp) Do(ctx context.Context) (*UserAgreement, error)
Do executes the operation
type Settings ¶
type Settings struct { DocumentDisplay string `json:"documentDisplay,omitempty"` Format string `json:"format,omitempty"` HostOrigin string `json:"hostOrigin,omitempty"` // "small", "medium" or "large" Size string `json:"size,omitempty"` }
Settings are used by a user agreement for determing how to display a clickwrap document
type Summary ¶
type Summary struct { ID string `json:"clickwrapId,omitempty"` Name string `json:"clickwrapName,omitempty"` CreatedTime *time.Time `json:"createdTime,omitempty"` // uuid of user that last modified clickwrap LastModifiedBy string `json:"lastModifiedBy,omitempty"` RequireReacceptance bool `json:"requireReacceptance,omitempty"` // Status may be active, inactive or deleted Status string `json:"status,omitempty"` VersionNumber int32 `json:"versionNumber,omitempty"` }
Summary provides summary data for a created/updated clickwrap
type UserAgreement ¶
type UserAgreement struct { AccountID string `json:"accountId,omitempty"` AgreedOn *time.Time `json:"agreedOn,omitempty"` ID string `json:"agreementID,omitempty"` URL string `json:"agreementUrl,omitempty"` Clickwrap *Clickwrap `json:"clickwrap,omitempty"` ClickWrapID string `json:"clickwrapId,omitempty"` ClientUserID string `json:"clientUserId,omitempty"` CreatedOn *time.Time `json:"createdOn,omitempty"` Settings *DisplaySettings `json:"settings,omitempty"` }
UserAgreement describes a click from a clickwrap for a specific client