1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00
2019-09-21 04:04:22 -07:00

60 lines
1.9 KiB
Go

// --------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// --------------------------------------------------------------------------------------------
// Generated file, DO NOT EDIT
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
// --------------------------------------------------------------------------------------------
package operations
import (
"context"
"github.com/google/uuid"
"github.com/microsoft/azure-devops-go-api/azuredevops"
"net/http"
"net/url"
)
type Client struct {
Client azuredevops.Client
}
func NewClient(ctx context.Context, connection *azuredevops.Connection) *Client {
client := connection.GetClientByUrl(connection.BaseUrl)
return &Client{
Client: *client,
}
}
// Gets an operation from the the operationId using the given pluginId.
func (client *Client) GetOperation(ctx context.Context, args GetOperationArgs) (*Operation, error) {
routeValues := make(map[string]string)
if args.OperationId == nil {
return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.OperationId"}
}
routeValues["operationId"] = (*args.OperationId).String()
queryParams := url.Values{}
if args.PluginId != nil {
queryParams.Add("pluginId", (*args.PluginId).String())
}
locationId, _ := uuid.Parse("9a1b74b4-2ca8-4a9f-8470-c2f2e6fdc949")
resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil)
if err != nil {
return nil, err
}
var responseValue Operation
err = client.Client.UnmarshalBody(resp, &responseValue)
return &responseValue, err
}
// Arguments for the GetOperation function
type GetOperationArgs struct {
// (required) The ID for the operation.
OperationId *uuid.UUID
// (optional) The ID for the plugin.
PluginId *uuid.UUID
}