All URIs are relative to https://api.segmentapis.com
Method | HTTP request | Description |
---|---|---|
CreateAudience | Post /spaces/{spaceId}/audiences | Create Audience |
GetAudience | Get /spaces/{spaceId}/audiences/{id} | Get Audience |
ListAudienceConsumersFromSpaceAndAudience | Get /spaces/{spaceId}/audiences/{id}/audience-references | List Audience Consumers from Space And Audience |
ListAudiences | Get /spaces/{spaceId}/audiences | List Audiences |
RemoveAudienceFromSpace | Delete /spaces/{spaceId}/audiences/{id} | Remove Audience from Space |
UpdateAudienceForSpace | Patch /spaces/{spaceId}/audiences/{id} | Update Audience for Space |
CreateAudience200Response CreateAudience(ctx, spaceId).CreateAudienceAlphaInput(createAudienceAlphaInput).Execute()
Create Audience
package main
import (
"context"
"fmt"
"os"
api "github.com/segmentio/public-api-sdk-go"
)
func main() {
spaceId := "spaceId" // string |
createAudienceAlphaInput := *api.NewCreateAudienceAlphaInput("Name_example", *api.NewAudienceComputationDefinition("Type_example", "Query_example")) // CreateAudienceAlphaInput |
configuration := api.NewConfiguration()
apiClient := api.NewAPIClient(configuration)
token := "<BEARER_TOKEN>"
ctx := context.WithValue(context.Background(), api.ContextAccessToken, token)
resp, r, err := apiClient.AudiencesAPI.CreateAudience(ctx, spaceId).CreateAudienceAlphaInput(createAudienceAlphaInput).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `AudiencesAPI.CreateAudience``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
responseErrors := api.UnwrapFullErrors(err)
if responseErrors != nil {
for _, responseError := range responseErrors.Errors {
fmt.Fprintf(os.Stderr, "Full error message: %v\n", *responseError.Message)
}
}
}
// response from `CreateAudience`: CreateAudience200Response
fmt.Fprintf(os.Stdout, "Response from `AudiencesAPI.CreateAudience`: %v\n", resp.GetData())
}
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
spaceId | string |
Other parameters are passed through a pointer to a apiCreateAudienceRequest struct via the builder pattern
Name | Type | Description | Notes |
---|
createAudienceAlphaInput | CreateAudienceAlphaInput | |
- Content-Type: application/vnd.segment.v1alpha+json
- Accept: application/vnd.segment.v1alpha+json, application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
GetAudience200Response GetAudience(ctx, spaceId, id).Execute()
Get Audience
package main
import (
"context"
"fmt"
"os"
api "github.com/segmentio/public-api-sdk-go"
)
func main() {
spaceId := "spaceId" // string |
id := "id" // string |
configuration := api.NewConfiguration()
apiClient := api.NewAPIClient(configuration)
token := "<BEARER_TOKEN>"
ctx := context.WithValue(context.Background(), api.ContextAccessToken, token)
resp, r, err := apiClient.AudiencesAPI.GetAudience(ctx, spaceId, id).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `AudiencesAPI.GetAudience``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
responseErrors := api.UnwrapFullErrors(err)
if responseErrors != nil {
for _, responseError := range responseErrors.Errors {
fmt.Fprintf(os.Stderr, "Full error message: %v\n", *responseError.Message)
}
}
}
// response from `GetAudience`: GetAudience200Response
fmt.Fprintf(os.Stdout, "Response from `AudiencesAPI.GetAudience`: %v\n", resp.GetData())
}
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
spaceId | string | ||
id | string |
Other parameters are passed through a pointer to a apiGetAudienceRequest struct via the builder pattern
Name | Type | Description | Notes |
---|
- Content-Type: Not defined
- Accept: application/vnd.segment.v1beta+json, application/vnd.segment.v1alpha+json, application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
ListAudienceConsumersFromSpaceAndAudience200Response ListAudienceConsumersFromSpaceAndAudience(ctx, spaceId, id).Pagination(pagination).Execute()
List Audience Consumers from Space And Audience
package main
import (
"context"
"fmt"
"os"
api "github.com/segmentio/public-api-sdk-go"
)
func main() {
spaceId := "spaceId" // string |
id := "ReferencedAudienceId" // string |
pagination := *api.NewPaginationInput(10) // PaginationInput | Information about the pagination of this response. [See pagination](https://docs.segmentapis.com/tag/Pagination/#section/Pagination-parameters) for more info. This parameter exists in alpha. (optional)
configuration := api.NewConfiguration()
apiClient := api.NewAPIClient(configuration)
token := "<BEARER_TOKEN>"
ctx := context.WithValue(context.Background(), api.ContextAccessToken, token)
resp, r, err := apiClient.AudiencesAPI.ListAudienceConsumersFromSpaceAndAudience(ctx, spaceId, id).Pagination(pagination).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `AudiencesAPI.ListAudienceConsumersFromSpaceAndAudience``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
responseErrors := api.UnwrapFullErrors(err)
if responseErrors != nil {
for _, responseError := range responseErrors.Errors {
fmt.Fprintf(os.Stderr, "Full error message: %v\n", *responseError.Message)
}
}
}
// response from `ListAudienceConsumersFromSpaceAndAudience`: ListAudienceConsumersFromSpaceAndAudience200Response
fmt.Fprintf(os.Stdout, "Response from `AudiencesAPI.ListAudienceConsumersFromSpaceAndAudience`: %v\n", resp.GetData())
}
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
spaceId | string | ||
id | string |
Other parameters are passed through a pointer to a apiListAudienceConsumersFromSpaceAndAudienceRequest struct via the builder pattern
Name | Type | Description | Notes |
---|
pagination | PaginationInput | Information about the pagination of this response. See pagination for more info. This parameter exists in alpha. |
ListAudienceConsumersFromSpaceAndAudience200Response
- Content-Type: Not defined
- Accept: application/vnd.segment.v1alpha+json, application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
ListAudiences200Response ListAudiences(ctx, spaceId).Pagination(pagination).Execute()
List Audiences
package main
import (
"context"
"fmt"
"os"
api "github.com/segmentio/public-api-sdk-go"
)
func main() {
spaceId := "spaceId" // string |
pagination := *api.NewPaginationInput(10) // PaginationInput | Information about the pagination of this response. [See pagination](https://docs.segmentapis.com/tag/Pagination/#section/Pagination-parameters) for more info. This parameter exists in alpha. (optional)
configuration := api.NewConfiguration()
apiClient := api.NewAPIClient(configuration)
token := "<BEARER_TOKEN>"
ctx := context.WithValue(context.Background(), api.ContextAccessToken, token)
resp, r, err := apiClient.AudiencesAPI.ListAudiences(ctx, spaceId).Pagination(pagination).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `AudiencesAPI.ListAudiences``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
responseErrors := api.UnwrapFullErrors(err)
if responseErrors != nil {
for _, responseError := range responseErrors.Errors {
fmt.Fprintf(os.Stderr, "Full error message: %v\n", *responseError.Message)
}
}
}
// response from `ListAudiences`: ListAudiences200Response
fmt.Fprintf(os.Stdout, "Response from `AudiencesAPI.ListAudiences`: %v\n", resp.GetData())
}
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
spaceId | string |
Other parameters are passed through a pointer to a apiListAudiencesRequest struct via the builder pattern
Name | Type | Description | Notes |
---|
pagination | PaginationInput | Information about the pagination of this response. See pagination for more info. This parameter exists in alpha. |
- Content-Type: Not defined
- Accept: application/vnd.segment.v1alpha+json, application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
RemoveAudienceFromSpace200Response RemoveAudienceFromSpace(ctx, spaceId, id).Execute()
Remove Audience from Space
package main
import (
"context"
"fmt"
"os"
api "github.com/segmentio/public-api-sdk-go"
)
func main() {
spaceId := "spaceId" // string |
id := "id" // string |
configuration := api.NewConfiguration()
apiClient := api.NewAPIClient(configuration)
token := "<BEARER_TOKEN>"
ctx := context.WithValue(context.Background(), api.ContextAccessToken, token)
resp, r, err := apiClient.AudiencesAPI.RemoveAudienceFromSpace(ctx, spaceId, id).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `AudiencesAPI.RemoveAudienceFromSpace``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
responseErrors := api.UnwrapFullErrors(err)
if responseErrors != nil {
for _, responseError := range responseErrors.Errors {
fmt.Fprintf(os.Stderr, "Full error message: %v\n", *responseError.Message)
}
}
}
// response from `RemoveAudienceFromSpace`: RemoveAudienceFromSpace200Response
fmt.Fprintf(os.Stdout, "Response from `AudiencesAPI.RemoveAudienceFromSpace`: %v\n", resp.GetData())
}
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
spaceId | string | ||
id | string |
Other parameters are passed through a pointer to a apiRemoveAudienceFromSpaceRequest struct via the builder pattern
Name | Type | Description | Notes |
---|
RemoveAudienceFromSpace200Response
- Content-Type: Not defined
- Accept: application/vnd.segment.v1alpha+json, application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
UpdateAudienceForSpace200Response UpdateAudienceForSpace(ctx, spaceId, id).UpdateAudienceForSpaceInput(updateAudienceForSpaceInput).Execute()
Update Audience for Space
package main
import (
"context"
"fmt"
"os"
api "github.com/segmentio/public-api-sdk-go"
)
func main() {
spaceId := "spaceId" // string |
id := "id" // string |
updateAudienceForSpaceInput := *api.NewUpdateAudienceForSpaceInput() // UpdateAudienceForSpaceInput |
configuration := api.NewConfiguration()
apiClient := api.NewAPIClient(configuration)
token := "<BEARER_TOKEN>"
ctx := context.WithValue(context.Background(), api.ContextAccessToken, token)
resp, r, err := apiClient.AudiencesAPI.UpdateAudienceForSpace(ctx, spaceId, id).UpdateAudienceForSpaceInput(updateAudienceForSpaceInput).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `AudiencesAPI.UpdateAudienceForSpace``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
responseErrors := api.UnwrapFullErrors(err)
if responseErrors != nil {
for _, responseError := range responseErrors.Errors {
fmt.Fprintf(os.Stderr, "Full error message: %v\n", *responseError.Message)
}
}
}
// response from `UpdateAudienceForSpace`: UpdateAudienceForSpace200Response
fmt.Fprintf(os.Stdout, "Response from `AudiencesAPI.UpdateAudienceForSpace`: %v\n", resp.GetData())
}
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
spaceId | string | ||
id | string |
Other parameters are passed through a pointer to a apiUpdateAudienceForSpaceRequest struct via the builder pattern
Name | Type | Description | Notes |
---|
updateAudienceForSpaceInput | UpdateAudienceForSpaceInput | |
UpdateAudienceForSpace200Response
- Content-Type: application/vnd.segment.v1alpha+json
- Accept: application/vnd.segment.v1alpha+json, application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]