Skip to content

Latest commit

 

History

History
77 lines (60 loc) · 4.58 KB

File metadata and controls

77 lines (60 loc) · 4.58 KB

Vault.ConnectionConsent

Overview

Available Operations

  • Update - Update consent state

Update

Update the consent state of a connection

Example Usage

package main

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

func main() {
    ctx := context.Background()

    s := sdkgo.New(
        sdkgo.WithConsumerID("test-consumer"),
        sdkgo.WithAppID("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"),
        sdkgo.WithSecurity(os.Getenv("APIDECK_API_KEY")),
    )

    res, err := s.Vault.ConnectionConsent.Update(ctx, operations.VaultConnectionConsentUpdateRequest{
        ServiceID: "pipedrive",
        UnifiedAPI: "crm",
        UpdateConsentRequest: components.UpdateConsentRequest{
            Resources: components.CreateUpdateConsentRequestResourcesTwo(
                components.TwoWildcard,
            ),
            Granted: true,
        },
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.UpdateConsentResponse != nil {
        // handle response
    }
}

Parameters

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

Response

*operations.VaultConnectionConsentUpdateResponse, error

Errors

Error Type Status Code Content Type
apierrors.BadRequestResponse 400 application/json
apierrors.UnauthorizedResponse 401 application/json
apierrors.PaymentRequiredResponse 402 application/json
apierrors.NotFoundResponse 404 application/json
apierrors.UnprocessableResponse 422 application/json
apierrors.APIError 4XX, 5XX */*