Skip to content

Latest commit

 

History

History
402 lines (315 loc) · 25.9 KB

README.md

File metadata and controls

402 lines (315 loc) · 25.9 KB

DocumensoFields

(Templates.Fields)

Overview

Available Operations

Create

Create a single field for a template.

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.Templates.Fields.Create(ctx, operations.FieldCreateTemplateFieldRequestBody{
        TemplateID: 4865.89,
        Field: operations.CreateFieldCreateTemplateFieldFieldFieldCreateTemplateFieldField8(
            operations.FieldCreateTemplateFieldField8{
                Type: operations.FieldCreateTemplateFieldFieldTemplatesFieldsRequestRequestBody8TypeNumber,
                RecipientID: 4174.58,
                PageNumber: 1343.65,
                PageX: 690.25,
                PageY: 7964.74,
                Width: 9510.62,
                Height: 0.86,
            },
        ),
    })
    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.FieldCreateTemplateFieldRequestBody ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.FieldCreateTemplateFieldResponse, error

Errors

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

Get

Returns a single field. If you want to retrieve all the fields for a template, use the "Get Template" 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.Templates.Fields.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.
fieldID float64 ✔️ N/A
opts []operations.Option The options for this request.

Response

*operations.FieldGetTemplateFieldResponse, error

Errors

Error Type Status Code Content Type
apierrors.FieldGetTemplateFieldResponseBody 400 application/json
apierrors.FieldGetTemplateFieldTemplatesFieldsResponseBody 404 application/json
apierrors.FieldGetTemplateFieldTemplatesFieldsResponseResponseBody 500 application/json
apierrors.APIError 4XX, 5XX */*

CreateMany

Create multiple fields for a template.

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.Templates.Fields.CreateMany(ctx, operations.FieldCreateTemplateFieldsRequestBody{
        TemplateID: 5158.41,
        Fields: []operations.FieldCreateTemplateFieldsFields{
            operations.CreateFieldCreateTemplateFieldsFieldsFieldCreateTemplateFieldsFields10(
                operations.FieldCreateTemplateFieldsFields10{
                    Type: operations.FieldCreateTemplateFieldsFieldsTemplatesFieldsRequestRequestBody10TypeCheckbox,
                    RecipientID: 2516.72,
                    PageNumber: 2304.17,
                    PageX: 7760.32,
                    PageY: 3376.66,
                    Width: 3566.94,
                    Height: 2768.94,
                },
            ),
            operations.CreateFieldCreateTemplateFieldsFieldsFieldCreateTemplateFieldsFields8(
                operations.FieldCreateTemplateFieldsFields8{
                    Type: operations.FieldCreateTemplateFieldsFieldsTemplatesFieldsRequestRequestBody8TypeNumber,
                    RecipientID: 5689.64,
                    PageNumber: 6483.69,
                    PageX: 7271.79,
                    PageY: 1891.56,
                    Width: 7263.21,
                    Height: 5043.41,
                },
            ),
        },
    })
    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.FieldCreateTemplateFieldsRequestBody ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.FieldCreateTemplateFieldsResponse, error

Errors

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

Update

Update a single field for a template.

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.Templates.Fields.Update(ctx, operations.FieldUpdateTemplateFieldRequestBody{
        TemplateID: 8574.78,
        Field: operations.CreateFieldUpdateTemplateFieldFieldFieldUpdateTemplateFieldField7(
            operations.FieldUpdateTemplateFieldField7{
                Type: operations.FieldUpdateTemplateFieldFieldTemplatesFieldsRequestRequestBody7TypeText,
                ID: 3446.2,
            },
        ),
    })
    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.FieldUpdateTemplateFieldRequestBody ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.FieldUpdateTemplateFieldResponse, error

Errors

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

UpdateMany

Update multiple fields for a template.

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.Templates.Fields.UpdateMany(ctx, operations.FieldUpdateTemplateFieldsRequestBody{
        TemplateID: 4057.69,
        Fields: []operations.FieldUpdateTemplateFieldsFields{
            operations.CreateFieldUpdateTemplateFieldsFieldsFieldUpdateTemplateFieldsFields6(
                operations.FieldUpdateTemplateFieldsFields6{
                    Type: operations.FieldUpdateTemplateFieldsFieldsTemplatesFieldsRequestRequestBody6TypeDate,
                    ID: 8982.15,
                },
            ),
            operations.CreateFieldUpdateTemplateFieldsFieldsFieldUpdateTemplateFieldsFields4(
                operations.FieldUpdateTemplateFieldsFields4{
                    Type: operations.FieldUpdateTemplateFieldsFieldsTemplatesFieldsRequestRequestBody4TypeName,
                    ID: 310.19,
                },
            ),
        },
    })
    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.FieldUpdateTemplateFieldsRequestBody ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.FieldUpdateTemplateFieldsResponse, error

Errors

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

Delete

Delete template field

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.Templates.Fields.Delete(ctx, operations.FieldDeleteTemplateFieldRequestBody{
        FieldID: 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.FieldDeleteTemplateFieldRequestBody ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.FieldDeleteTemplateFieldResponse, error

Errors

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