Skip to content

Latest commit

 

History

History
226 lines (169 loc) · 11.2 KB

README.md

File metadata and controls

226 lines (169 loc) · 11.2 KB

Contacts

(Contacts)

Overview

Manage contacts in your audience

Available Operations

PostContactsCreate

Add a contact to your audience.

Example Usage

package main

import(
	loopsgo "github.com/speakeasy-sdks/loops-go"
	"github.com/speakeasy-sdks/loops-go/models/components"
	"context"
	"log"
)

func main() {
    s := loopsgo.New(
        loopsgo.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
    )
    request := components.ContactRequest{
        Email: "[email protected]",
        MailingLists: &components.MailingLists{},
    }
    ctx := context.Background()
    res, err := s.Contacts.PostContactsCreate(ctx, request)
    if err != nil {
        log.Fatal(err)
    }
    if res.ContactSuccessResponse != nil {
        // handle response
    }
}

Parameters

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

Response

*operations.PostContactsCreateResponse, error

Error Object Status Code Content Type
sdkerrors.ContactFailureResponse 400,405,409 application/json
sdkerrors.SDKError 4xx-5xx /

PutContactsUpdate

Update a contact by email or userId.
If you want to update a contact’s email address, the contact will first need a userId value. You can then make a request containing the userId field along with an updated email address.

Example Usage

package main

import(
	loopsgo "github.com/speakeasy-sdks/loops-go"
	"github.com/speakeasy-sdks/loops-go/models/components"
	"context"
	"log"
)

func main() {
    s := loopsgo.New(
        loopsgo.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
    )
    request := components.ContactRequest{
        Email: "[email protected]",
        MailingLists: &components.MailingLists{},
    }
    ctx := context.Background()
    res, err := s.Contacts.PutContactsUpdate(ctx, request)
    if err != nil {
        log.Fatal(err)
    }
    if res.ContactSuccessResponse != nil {
        // handle response
    }
}

Parameters

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

Response

*operations.PutContactsUpdateResponse, error

Error Object Status Code Content Type
sdkerrors.ContactFailureResponse 400,405 application/json
sdkerrors.SDKError 4xx-5xx /

GetContactsFind

Search for a contact by email or userId. Only one parameter is allowed.

Example Usage

package main

import(
	loopsgo "github.com/speakeasy-sdks/loops-go"
	"context"
	"log"
)

func main() {
    s := loopsgo.New(
        loopsgo.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
    )

    ctx := context.Background()
    res, err := s.Contacts.GetContactsFind(ctx, nil, nil)
    if err != nil {
        log.Fatal(err)
    }
    if res.Contacts != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
email *string Email address (URI-encoded)
userID *string N/A
opts []operations.Option The options for this request.

Response

*operations.GetContactsFindResponse, error

Error Object Status Code Content Type
sdkerrors.ContactFailureResponse 400 application/json
sdkerrors.SDKError 4xx-5xx /

PostContactsDelete

Delete a contact by email or userId.

Example Usage

package main

import(
	loopsgo "github.com/speakeasy-sdks/loops-go"
	"github.com/speakeasy-sdks/loops-go/models/components"
	"context"
	"log"
)

func main() {
    s := loopsgo.New(
        loopsgo.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
    )
    request := components.ContactDeleteRequest{
        Email: "[email protected]",
        UserID: "<value>",
    }
    ctx := context.Background()
    res, err := s.Contacts.PostContactsDelete(ctx, request)
    if err != nil {
        log.Fatal(err)
    }
    if res.ContactDeleteResponse != nil {
        // handle response
    }
}

Parameters

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

Response

*operations.PostContactsDeleteResponse, error

Error Object Status Code Content Type
sdkerrors.ContactFailureResponse 400,404 application/json
sdkerrors.SDKError 4xx-5xx /