Skip to content

Latest commit

 

History

History
388 lines (251 loc) · 11.9 KB

MetricsApi.md

File metadata and controls

388 lines (251 loc) · 11.9 KB

\MetricsApi

All URIs are relative to https://app.launchdarkly.com

Method HTTP request Description
DeleteMetric Delete /api/v2/metrics/{projectKey}/{metricKey} Delete metric
GetMetric Get /api/v2/metrics/{projectKey}/{metricKey} Get metric
GetMetrics Get /api/v2/metrics/{projectKey} List metrics
PatchMetric Patch /api/v2/metrics/{projectKey}/{metricKey} Update metric
PostMetric Post /api/v2/metrics/{projectKey} Create metric

DeleteMetric

DeleteMetric(ctx, projectKey, metricKey).Execute()

Delete metric

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "./openapi"
)

func main() {
    projectKey := "projectKey_example" // string | The project key
    metricKey := "metricKey_example" // string | The metric key

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.MetricsApi.DeleteMetric(context.Background(), projectKey, metricKey).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `MetricsApi.DeleteMetric``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
projectKey string The project key
metricKey string The metric key

Other Parameters

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

Name Type Description Notes

Return type

(empty response body)

Authorization

ApiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetMetric

MetricRep GetMetric(ctx, projectKey, metricKey).Expand(expand).VersionId(versionId).Execute()

Get metric

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "./openapi"
)

func main() {
    projectKey := "projectKey_example" // string | The project key
    metricKey := "metricKey_example" // string | The metric key
    expand := "expand_example" // string | A comma-separated list of properties that can reveal additional information in the response. (optional)
    versionId := "versionId_example" // string | The specific version ID of the metric (optional)

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.MetricsApi.GetMetric(context.Background(), projectKey, metricKey).Expand(expand).VersionId(versionId).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `MetricsApi.GetMetric``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetMetric`: MetricRep
    fmt.Fprintf(os.Stdout, "Response from `MetricsApi.GetMetric`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
projectKey string The project key
metricKey string The metric key

Other Parameters

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

Name Type Description Notes

expand | string | A comma-separated list of properties that can reveal additional information in the response. | versionId | string | The specific version ID of the metric |

Return type

MetricRep

Authorization

ApiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetMetrics

MetricCollectionRep GetMetrics(ctx, projectKey).Expand(expand).Limit(limit).Offset(offset).Sort(sort).Filter(filter).Execute()

List metrics

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "./openapi"
)

func main() {
    projectKey := "projectKey_example" // string | The project key
    expand := "expand_example" // string | A comma-separated list of properties that can reveal additional information in the response. (optional)
    limit := int64(789) // int64 | The number of metrics to return in the response. Defaults to 20. Maximum limit is 50. (optional)
    offset := int64(789) // int64 | Where to start in the list. Use this with pagination. For example, an offset of 10 skips the first ten items and returns the next `limit` items. (optional)
    sort := "sort_example" // string | A field to sort the items by. Prefix field by a dash ( - ) to sort in descending order. This endpoint supports sorting by `createdAt` or `name`. (optional)
    filter := "filter_example" // string | A comma-separated list of filters. This endpoint only accepts filtering by `tags`. To learn more about the filter syntax, read the 'Filtering metrics' section above. (optional)

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.MetricsApi.GetMetrics(context.Background(), projectKey).Expand(expand).Limit(limit).Offset(offset).Sort(sort).Filter(filter).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `MetricsApi.GetMetrics``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetMetrics`: MetricCollectionRep
    fmt.Fprintf(os.Stdout, "Response from `MetricsApi.GetMetrics`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
projectKey string The project key

Other Parameters

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

Name Type Description Notes

expand | string | A comma-separated list of properties that can reveal additional information in the response. | limit | int64 | The number of metrics to return in the response. Defaults to 20. Maximum limit is 50. | offset | int64 | Where to start in the list. Use this with pagination. For example, an offset of 10 skips the first ten items and returns the next `limit` items. | sort | string | A field to sort the items by. Prefix field by a dash ( - ) to sort in descending order. This endpoint supports sorting by `createdAt` or `name`. | filter | string | A comma-separated list of filters. This endpoint only accepts filtering by `tags`. To learn more about the filter syntax, read the 'Filtering metrics' section above. |

Return type

MetricCollectionRep

Authorization

ApiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

PatchMetric

MetricRep PatchMetric(ctx, projectKey, metricKey).PatchOperation(patchOperation).Execute()

Update metric

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "./openapi"
)

func main() {
    projectKey := "projectKey_example" // string | The project key
    metricKey := "metricKey_example" // string | The metric key
    patchOperation := []openapiclient.PatchOperation{*openapiclient.NewPatchOperation("replace", "/exampleField")} // []PatchOperation | 

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.MetricsApi.PatchMetric(context.Background(), projectKey, metricKey).PatchOperation(patchOperation).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `MetricsApi.PatchMetric``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `PatchMetric`: MetricRep
    fmt.Fprintf(os.Stdout, "Response from `MetricsApi.PatchMetric`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
projectKey string The project key
metricKey string The metric key

Other Parameters

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

Name Type Description Notes

patchOperation | []PatchOperation | |

Return type

MetricRep

Authorization

ApiKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

PostMetric

MetricRep PostMetric(ctx, projectKey).MetricPost(metricPost).Execute()

Create metric

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "./openapi"
)

func main() {
    projectKey := "projectKey_example" // string | The project key
    metricPost := *openapiclient.NewMetricPost("metric-key-123abc", "custom") // MetricPost | 

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.MetricsApi.PostMetric(context.Background(), projectKey).MetricPost(metricPost).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `MetricsApi.PostMetric``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `PostMetric`: MetricRep
    fmt.Fprintf(os.Stdout, "Response from `MetricsApi.PostMetric`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
projectKey string The project key

Other Parameters

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

Name Type Description Notes

metricPost | MetricPost | |

Return type

MetricRep

Authorization

ApiKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]