Skip to content

Commit

Permalink
Merge pull request #135 from microsoftgraph/dependabot/go_modules/git…
Browse files Browse the repository at this point in the history
…hub.com/microsoft/kiota-abstractions-go-0.12.0

Bump github.com/microsoft/kiota-abstractions-go from 0.11.0 to 0.12.0
  • Loading branch information
baywet authored Oct 5, 2022
2 parents 72adea9 + 14152bc commit efb4b6b
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 16 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- Adds ability to batch requests.
- Adds tracing support via Open Telemetry.

## [0.29.0]- 2022-09-27

Expand Down
7 changes: 4 additions & 3 deletions batch_request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ package msgraphgocore
import (
"context"
"fmt"
"github.com/microsoft/kiota-abstractions-go/serialization"
"github.com/microsoftgraph/msgraph-sdk-go-core/internal"
"net/http"
"net/http/httptest"
"net/url"
"testing"

"github.com/microsoft/kiota-abstractions-go/serialization"
"github.com/microsoftgraph/msgraph-sdk-go-core/internal"

abstractions "github.com/microsoft/kiota-abstractions-go"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -98,7 +99,7 @@ func TestContentSentToServer(t *testing.T) {
baseUrl, err := getBaseUrl(reqAdapter)
require.NoError(t, err)

requestInfo, err := buildRequestInfo(reqAdapter, batch, baseUrl)
requestInfo, err := buildRequestInfo(context.Background(), reqAdapter, batch, baseUrl)
require.NoError(t, err)
content := string(requestInfo.Content)
expected := "{\"requests\":[{\"id\":\"123\",\"method\":\"GET\",\"url\":\"\",\"headers\":{\"content-type\":\"application/json\"},\"body\":{\"username\":\"name\"},\"dependsOn\":[]}]}"
Expand Down
15 changes: 8 additions & 7 deletions batch_requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ import (
"encoding/gob"
"encoding/json"
"errors"
"net/url"
"reflect"
"strconv"
"strings"

"github.com/google/uuid"
abs "github.com/microsoft/kiota-abstractions-go"
abstractions "github.com/microsoft/kiota-abstractions-go"
"github.com/microsoft/kiota-abstractions-go/serialization"
absser "github.com/microsoft/kiota-abstractions-go/serialization"
"net/url"
"reflect"
"strconv"
"strings"
)

const BatchRequestErrorRegistryKey = "BATCH_REQUEST_ERROR_REGISTRY_KEY"
Expand Down Expand Up @@ -141,7 +142,7 @@ func (br *batchRequest) Send(ctx context.Context, adapter abstractions.RequestAd
return nil, err
}

requestInfo, err := buildRequestInfo(adapter, br, baseUrl)
requestInfo, err := buildRequestInfo(ctx, adapter, br, baseUrl)
if err != nil {
return nil, err
}
Expand All @@ -152,12 +153,12 @@ func getBaseUrl(adapter abstractions.RequestAdapter) (*url.URL, error) {
return url.Parse(adapter.GetBaseUrl())
}

func buildRequestInfo(adapter abstractions.RequestAdapter, body BatchRequest, baseUrl *url.URL) (*abstractions.RequestInformation, error) {
func buildRequestInfo(ctx context.Context, adapter abstractions.RequestAdapter, body BatchRequest, baseUrl *url.URL) (*abstractions.RequestInformation, error) {
requestInfo := abstractions.NewRequestInformation()
requestInfo.Method = abstractions.POST
requestInfo.UrlTemplate = "{+baseurl}/$batch"
requestInfo.SetUri(*baseUrl)
err := requestInfo.SetContentFromParsable(adapter, "application/json", body)
err := requestInfo.SetContentFromParsable(ctx, adapter, "application/json", body)
if err != nil {
return nil, err
}
Expand Down
8 changes: 6 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,21 @@ go 1.18

require (
github.com/google/uuid v1.3.0
github.com/microsoft/kiota-abstractions-go v0.11.0
github.com/microsoft/kiota-http-go v0.8.1
github.com/microsoft/kiota-abstractions-go v0.12.0
github.com/microsoft/kiota-http-go v0.9.0
github.com/microsoft/kiota-serialization-json-go v0.7.2
github.com/stretchr/testify v1.8.0
)

require (
github.com/cjlapao/common-go v0.0.27 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/yosida95/uritemplate/v3 v3.0.2 // indirect
go.opentelemetry.io/otel v1.10.0 // indirect
go.opentelemetry.io/otel/trace v1.10.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

Expand Down
18 changes: 14 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@ github.com/cjlapao/common-go v0.0.27/go.mod h1:OyTAY388jfEj8uaRzx0uYneFghKDLL5KP
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0=
github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/microsoft/kiota-abstractions-go v0.11.0 h1:JSelh3pj9CQlSYNYIpCUcE60flTR5Ninc+XnF4nC/FI=
github.com/microsoft/kiota-abstractions-go v0.11.0/go.mod h1:wOO+hpReDIJa3BxbLNz4qvtZk2llS555mejkMc203bQ=
github.com/microsoft/kiota-http-go v0.8.1 h1:d6Zvxsb3zvMqEYzHQAVBOuNPSQ8xGZnqnVoHQFeFflw=
github.com/microsoft/kiota-http-go v0.8.1/go.mod h1:HuQ45wG0Wzl7JdMRwCAvSWZZ0Ba2IpBP69Kl+ZHuC3o=
github.com/microsoft/kiota-abstractions-go v0.12.0 h1:oqrwh4iVun94C4i/8/nKconS/R3NfJ9AAa02KdMeCRg=
github.com/microsoft/kiota-abstractions-go v0.12.0/go.mod h1:Y555rARnJ3qqIvZXwrvxscUQ+HNsO7fGhFUXe2UpSbk=
github.com/microsoft/kiota-http-go v0.9.0 h1:q/JZpWOvHFbxrOjbd8pbODuTx4dlcLahTemM48di/y8=
github.com/microsoft/kiota-http-go v0.9.0/go.mod h1:F652dnY3jVNmwSk46qHXt+HeEbxLkbbn3dUi3lSLHws=
github.com/microsoft/kiota-serialization-json-go v0.7.2 h1:DSb4fNDi5O+DqJwrHo+vRy2kSvfxG5VtN6m1EHzn5Vw=
github.com/microsoft/kiota-serialization-json-go v0.7.2/go.mod h1:Ojum5prlijopyCOZ2XctRcVlE2pU8h+43r3tMdiWoDU=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand All @@ -20,6 +26,10 @@ github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PK
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/yosida95/uritemplate/v3 v3.0.2 h1:Ed3Oyj9yrmi9087+NczuL5BwkIc4wvTb5zIM+UJPGz4=
github.com/yosida95/uritemplate/v3 v3.0.2/go.mod h1:ILOh0sOhIJR3+L/8afwt/kE++YT040gmv5BQTMR2HP4=
go.opentelemetry.io/otel v1.10.0 h1:Y7DTJMR6zs1xkS/upamJYk0SxxN4C9AqRd77jmZnyY4=
go.opentelemetry.io/otel v1.10.0/go.mod h1:NbvWjCthWHKBEUMpf0/v8ZRZlni86PpGFEMA9pnQSnQ=
go.opentelemetry.io/otel/trace v1.10.0 h1:npQMbR8o7mum8uF95yFbOEJffhs1sbCOfDh8zAJiH5E=
go.opentelemetry.io/otel/trace v1.10.0/go.mod h1:Sij3YYczqAdz+EhmGhE6TpTxUO5/F/AzrK+kxfGqySM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
Expand Down

0 comments on commit efb4b6b

Please sign in to comment.