Skip to content

Latest commit

 

History

History
418 lines (281 loc) · 13.4 KB

ComputedTraitsAPI.md

File metadata and controls

418 lines (281 loc) · 13.4 KB

\ComputedTraitsAPI

All URIs are relative to https://api.segmentapis.com

Method HTTP request Description
CreateComputedTrait Post /spaces/{spaceId}/computed-traits Create Computed Trait
GetComputedTrait Get /spaces/{spaceId}/computed-traits/{id} Get Computed Trait
ListComputedTraits Get /spaces/{spaceId}/computed-traits List Computed Traits
RemoveComputedTraitFromSpace Delete /spaces/{spaceId}/computed-traits/{id} Remove Computed Trait from Space
UpdateComputedTraitForSpace Patch /spaces/{spaceId}/computed-traits/{id} Update Computed Trait for Space

Operation: CreateComputedTrait

CreateComputedTrait200Response CreateComputedTrait(ctx, spaceId).CreateComputedTraitAlphaInput(createComputedTraitAlphaInput).Execute()

Create Computed Trait

Example

package main

import (
    "context"
    "fmt"
    "os"
    api "github.com/segmentio/public-api-sdk-go"
)

func main() {
    spaceId := "spaceId" // string | 
    createComputedTraitAlphaInput := *api.NewCreateComputedTraitAlphaInput("Name_example", *api.NewTraitDefinition("Type_example", "Query_example")) // CreateComputedTraitAlphaInput | 

    configuration := api.NewConfiguration()
    apiClient := api.NewAPIClient(configuration)
    token := "<BEARER_TOKEN>"
    ctx := context.WithValue(context.Background(), api.ContextAccessToken, token)
    resp, r, err := apiClient.ComputedTraitsAPI.CreateComputedTrait(ctx, spaceId).CreateComputedTraitAlphaInput(createComputedTraitAlphaInput).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `ComputedTraitsAPI.CreateComputedTrait``: %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 `CreateComputedTrait`: CreateComputedTrait200Response
    fmt.Fprintf(os.Stdout, "Response from `ComputedTraitsAPI.CreateComputedTrait`: %v\n", resp.GetData())
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
spaceId string

Other Parameters

Other parameters are passed through a pointer to a apiCreateComputedTraitRequest struct via the builder pattern

Name Type Description Notes

createComputedTraitAlphaInput | CreateComputedTraitAlphaInput | |

Return type

CreateComputedTrait200Response

Authorization

token

HTTP request headers

  • 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]

Operation: GetComputedTrait

GetComputedTrait200Response GetComputedTrait(ctx, spaceId, id).Execute()

Get Computed Trait

Example

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.ComputedTraitsAPI.GetComputedTrait(ctx, spaceId, id).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `ComputedTraitsAPI.GetComputedTrait``: %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 `GetComputedTrait`: GetComputedTrait200Response
    fmt.Fprintf(os.Stdout, "Response from `ComputedTraitsAPI.GetComputedTrait`: %v\n", resp.GetData())
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
spaceId string
id string

Other Parameters

Other parameters are passed through a pointer to a apiGetComputedTraitRequest struct via the builder pattern

Name Type Description Notes

Return type

GetComputedTrait200Response

Authorization

token

HTTP request headers

  • 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]

Operation: ListComputedTraits

ListComputedTraits200Response ListComputedTraits(ctx, spaceId).Pagination(pagination).Execute()

List Computed Traits

Example

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.ComputedTraitsAPI.ListComputedTraits(ctx, spaceId).Pagination(pagination).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `ComputedTraitsAPI.ListComputedTraits``: %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 `ListComputedTraits`: ListComputedTraits200Response
    fmt.Fprintf(os.Stdout, "Response from `ComputedTraitsAPI.ListComputedTraits`: %v\n", resp.GetData())
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
spaceId string

Other Parameters

Other parameters are passed through a pointer to a apiListComputedTraitsRequest 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. |

Return type

ListComputedTraits200Response

Authorization

token

HTTP request headers

  • 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]

Operation: RemoveComputedTraitFromSpace

RemoveComputedTraitFromSpace200Response RemoveComputedTraitFromSpace(ctx, spaceId, id).Execute()

Remove Computed Trait from Space

Example

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.ComputedTraitsAPI.RemoveComputedTraitFromSpace(ctx, spaceId, id).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `ComputedTraitsAPI.RemoveComputedTraitFromSpace``: %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 `RemoveComputedTraitFromSpace`: RemoveComputedTraitFromSpace200Response
    fmt.Fprintf(os.Stdout, "Response from `ComputedTraitsAPI.RemoveComputedTraitFromSpace`: %v\n", resp.GetData())
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
spaceId string
id string

Other Parameters

Other parameters are passed through a pointer to a apiRemoveComputedTraitFromSpaceRequest struct via the builder pattern

Name Type Description Notes

Return type

RemoveComputedTraitFromSpace200Response

Authorization

token

HTTP request headers

  • 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]

Operation: UpdateComputedTraitForSpace

UpdateComputedTraitForSpace200Response UpdateComputedTraitForSpace(ctx, spaceId, id).UpdateComputedTraitForSpaceAlphaInput(updateComputedTraitForSpaceAlphaInput).Execute()

Update Computed Trait for Space

Example

package main

import (
    "context"
    "fmt"
    "os"
    api "github.com/segmentio/public-api-sdk-go"
)

func main() {
    spaceId := "spaceId" // string | 
    id := "id" // string | 
    updateComputedTraitForSpaceAlphaInput := *api.NewUpdateComputedTraitForSpaceAlphaInput() // UpdateComputedTraitForSpaceAlphaInput | 

    configuration := api.NewConfiguration()
    apiClient := api.NewAPIClient(configuration)
    token := "<BEARER_TOKEN>"
    ctx := context.WithValue(context.Background(), api.ContextAccessToken, token)
    resp, r, err := apiClient.ComputedTraitsAPI.UpdateComputedTraitForSpace(ctx, spaceId, id).UpdateComputedTraitForSpaceAlphaInput(updateComputedTraitForSpaceAlphaInput).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `ComputedTraitsAPI.UpdateComputedTraitForSpace``: %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 `UpdateComputedTraitForSpace`: UpdateComputedTraitForSpace200Response
    fmt.Fprintf(os.Stdout, "Response from `ComputedTraitsAPI.UpdateComputedTraitForSpace`: %v\n", resp.GetData())
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
spaceId string
id string

Other Parameters

Other parameters are passed through a pointer to a apiUpdateComputedTraitForSpaceRequest struct via the builder pattern

Name Type Description Notes

updateComputedTraitForSpaceAlphaInput | UpdateComputedTraitForSpaceAlphaInput | |

Return type

UpdateComputedTraitForSpace200Response

Authorization

token

HTTP request headers

  • 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]