Skip to content

Latest commit

 

History

History
375 lines (288 loc) · 23.6 KB

README.md

File metadata and controls

375 lines (288 loc) · 23.6 KB

Recipients

(Documents.Recipients)

Overview

Available Operations

  • Get - Get document recipient
  • Create - Create document recipient
  • CreateMany - Create document recipients
  • Update - Update document recipient
  • UpdateMany - Update document recipients
  • Delete - Delete document recipient

Get

Returns a single recipient. If you want to retrieve all the recipients for a document, use the "Get Document" endpoint.

Example Usage

package main

import(
	"context"
	"os"
	sdkgo "github.com/documenso/sdk-go"
	"log"
)

func main() {
    ctx := context.Background()
    
    s := sdkgo.New(
        sdkgo.WithSecurity(os.Getenv("DOCUMENSO_API_KEY")),
    )

    res, err := s.Documents.Recipients.Get(ctx, 7003.47)
    if err != nil {
        log.Fatal(err)
    }
    if res.Object != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
recipientID float64 ✔️ N/A
opts []operations.Option The options for this request.

Response

*operations.RecipientGetDocumentRecipientResponse, error

Errors

Error Type Status Code Content Type
apierrors.ErrorBADREQUEST 400 application/json
apierrors.ErrorNOTFOUND 404 application/json
apierrors.ERRORINTERNALSERVERERROR 500 application/json
apierrors.APIError 4XX, 5XX */*

Create

Create a single recipient for a document.

Example Usage

package main

import(
	"context"
	"os"
	sdkgo "github.com/documenso/sdk-go"
	"github.com/documenso/sdk-go/models/operations"
	"log"
)

func main() {
    ctx := context.Background()
    
    s := sdkgo.New(
        sdkgo.WithSecurity(os.Getenv("DOCUMENSO_API_KEY")),
    )

    res, err := s.Documents.Recipients.Create(ctx, operations.RecipientCreateDocumentRecipientRequestBody{
        DocumentID: 4865.89,
        Recipient: operations.Recipient{
            Email: "[email protected]",
            Name: "<value>",
            Role: operations.RecipientCreateDocumentRecipientRoleCc,
        },
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.Object != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request operations.RecipientCreateDocumentRecipientRequestBody ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.RecipientCreateDocumentRecipientResponse, error

Errors

Error Type Status Code Content Type
apierrors.ErrorBADREQUEST 400 application/json
apierrors.ERRORINTERNALSERVERERROR 500 application/json
apierrors.APIError 4XX, 5XX */*

CreateMany

Create multiple recipients for a document.

Example Usage

package main

import(
	"context"
	"os"
	sdkgo "github.com/documenso/sdk-go"
	"github.com/documenso/sdk-go/models/operations"
	"log"
)

func main() {
    ctx := context.Background()
    
    s := sdkgo.New(
        sdkgo.WithSecurity(os.Getenv("DOCUMENSO_API_KEY")),
    )

    res, err := s.Documents.Recipients.CreateMany(ctx, operations.RecipientCreateDocumentRecipientsRequestBody{
        DocumentID: 5158.41,
        Recipients: []operations.RecipientCreateDocumentRecipientsRecipients{
            operations.RecipientCreateDocumentRecipientsRecipients{
                Email: "[email protected]",
                Name: "<value>",
                Role: operations.RecipientCreateDocumentRecipientsRoleViewer,
            },
            operations.RecipientCreateDocumentRecipientsRecipients{
                Email: "[email protected]",
                Name: "<value>",
                Role: operations.RecipientCreateDocumentRecipientsRoleApprover,
            },
        },
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.Object != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request operations.RecipientCreateDocumentRecipientsRequestBody ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.RecipientCreateDocumentRecipientsResponse, error

Errors

Error Type Status Code Content Type
apierrors.ErrorBADREQUEST 400 application/json
apierrors.ERRORINTERNALSERVERERROR 500 application/json
apierrors.APIError 4XX, 5XX */*

Update

Update a single recipient for a document.

Example Usage

package main

import(
	"context"
	"os"
	sdkgo "github.com/documenso/sdk-go"
	"github.com/documenso/sdk-go/models/operations"
	"log"
)

func main() {
    ctx := context.Background()
    
    s := sdkgo.New(
        sdkgo.WithSecurity(os.Getenv("DOCUMENSO_API_KEY")),
    )

    res, err := s.Documents.Recipients.Update(ctx, operations.RecipientUpdateDocumentRecipientRequestBody{
        DocumentID: 8574.78,
        Recipient: operations.RecipientUpdateDocumentRecipientRecipient{
            ID: 5971.29,
        },
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.Object != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request operations.RecipientUpdateDocumentRecipientRequestBody ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.RecipientUpdateDocumentRecipientResponse, error

Errors

Error Type Status Code Content Type
apierrors.ErrorBADREQUEST 400 application/json
apierrors.ERRORINTERNALSERVERERROR 500 application/json
apierrors.APIError 4XX, 5XX */*

UpdateMany

Update multiple recipients for a document.

Example Usage

package main

import(
	"context"
	"os"
	sdkgo "github.com/documenso/sdk-go"
	"github.com/documenso/sdk-go/models/operations"
	"log"
)

func main() {
    ctx := context.Background()
    
    s := sdkgo.New(
        sdkgo.WithSecurity(os.Getenv("DOCUMENSO_API_KEY")),
    )

    res, err := s.Documents.Recipients.UpdateMany(ctx, operations.RecipientUpdateDocumentRecipientsRequestBody{
        DocumentID: 4057.69,
        Recipients: []operations.RecipientUpdateDocumentRecipientsRecipients{
            operations.RecipientUpdateDocumentRecipientsRecipients{
                ID: 5359.16,
            },
            operations.RecipientUpdateDocumentRecipientsRecipients{
                ID: 8982.15,
            },
        },
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.Object != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request operations.RecipientUpdateDocumentRecipientsRequestBody ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.RecipientUpdateDocumentRecipientsResponse, error

Errors

Error Type Status Code Content Type
apierrors.ErrorBADREQUEST 400 application/json
apierrors.ERRORINTERNALSERVERERROR 500 application/json
apierrors.APIError 4XX, 5XX */*

Delete

Delete document recipient

Example Usage

package main

import(
	"context"
	"os"
	sdkgo "github.com/documenso/sdk-go"
	"github.com/documenso/sdk-go/models/operations"
	"log"
)

func main() {
    ctx := context.Background()
    
    s := sdkgo.New(
        sdkgo.WithSecurity(os.Getenv("DOCUMENSO_API_KEY")),
    )

    res, err := s.Documents.Recipients.Delete(ctx, operations.RecipientDeleteDocumentRecipientRequestBody{
        RecipientID: 5459.07,
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.Object != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request operations.RecipientDeleteDocumentRecipientRequestBody ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.RecipientDeleteDocumentRecipientResponse, error

Errors

Error Type Status Code Content Type
apierrors.ErrorBADREQUEST 400 application/json
apierrors.ERRORINTERNALSERVERERROR 500 application/json
apierrors.APIError 4XX, 5XX */*