click

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2021 License: BSD-3-Clause Imports: 6 Imported by: 0

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/ICGGroup/esign"
	"github.com/ICGGroup/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

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 CreateOp

type CreateOp esign.Op

CreateOp creates a clickwrap for an account

func (*CreateOp) Do

func (op *CreateOp) Do(ctx context.Context) (*Summary, error)

Do executes the operation

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

type GetAgreementsOp esign.Op

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

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

type ListOp esign.Op

ListOp gets all the clickwraps for an account

func (*ListOp) Do

func (op *ListOp) Do(ctx context.Context) (*Listing, error)

Do executes the operation

func (*ListOp) FromDate

func (op *ListOp) FromDate(val time.Time) *ListOp

FromDate (optional) sets the date from which created clickwaps will be returned (optional)

func (*ListOp) Name

func (op *ListOp) Name(val string) *ListOp

Name sets the name of clickwraps to return (optional)

func (*ListOp) Page

func (op *ListOp) Page(val int32) *ListOp

Page sets the page number of the clickwraps to return

func (*ListOp) Status

func (op *ListOp) Status(vals ...string) *ListOp

Status filters the statuses of the clickwrapts to return. Valid values are active, inactive and deleted.

func (*ListOp) ToDate

func (op *ListOp) ToDate(val time.Time) *ListOp

ToDate sets the date up to which created clickwraps will be returned (optional)

func (*ListOp) VersionNumber

func (op *ListOp) VersionNumber(val int32) *ListOp

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) Create

func (s *Service) Create(clickwrap *Clickwrap) *CreateOp

Create builds a CreateOp using the passed clickwrap

func (*Service) GetAgreements

func (s *Service) GetAgreements(clickwrapID string) *GetAgreementsOp

GetAgreements builds a GetAgreementsOp for the passed clickwrapID

func (*Service) List

func (s *Service) List() *ListOp

List builds the ListOp

func (*Service) SetAgreement

func (s *Service) SetAgreement(clickwrapID string, agreement *UserAgreement) *SetAgreementOp

SetAgreement builds a SetAgreementOp for creating/updating

func (*Service) Update

func (s *Service) Update(id string, clickwrap *Clickwrap) *UpdateOp

Update builds an UpdateOp to create a new version

type SetAgreementOp

type SetAgreementOp esign.Op

SetAgreementOp creates/update as user agreement for a client

func (*SetAgreementOp) Do

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 UpdateOp

type UpdateOp esign.Op

UpdateOp updates an existing clickwrap and creates a new version.

func (*UpdateOp) Do

func (op *UpdateOp) Do(ctx context.Context) (*Summary, error)

Do executes the operation

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

Jump to

Keyboard shortcuts

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