Skip to content

Commit

Permalink
Merge pull request #16 from gildas/release/0.9.2
Browse files Browse the repository at this point in the history
Merge release/0.9.2
  • Loading branch information
gildas authored Jun 21, 2024
2 parents 508d3fb + 1648055 commit d5ebc0f
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 32 deletions.
16 changes: 8 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ require (
github.com/Masterminds/sprig/v3 v3.2.3
github.com/gildas/go-core v0.5.8
github.com/gildas/go-errors v0.3.6
github.com/gildas/go-logger v1.7.1
github.com/gildas/go-request v0.9.5
github.com/gildas/go-logger v1.7.2
github.com/gildas/go-request v0.9.6
github.com/google/uuid v1.6.0
github.com/gorilla/mux v1.8.1
github.com/gorilla/securecookie v1.1.2
github.com/gorilla/websocket v1.5.2
github.com/gorilla/websocket v1.5.3
github.com/joho/godotenv v1.5.1
github.com/matoous/go-nanoid/v2 v2.1.0
github.com/stretchr/testify v1.9.0
Expand All @@ -36,7 +36,7 @@ require (
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/s2a-go v0.1.7 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
github.com/googleapis/gax-go/v2 v2.12.4 // indirect
github.com/googleapis/gax-go/v2 v2.12.5 // indirect
github.com/huandu/xstrings v1.5.0 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
Expand All @@ -57,10 +57,10 @@ require (
golang.org/x/sys v0.21.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/time v0.5.0 // indirect
google.golang.org/api v0.184.0 // indirect
google.golang.org/genproto v0.0.0-20240610135401-a8a62080eff3 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240610135401-a8a62080eff3 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240610135401-a8a62080eff3 // indirect
google.golang.org/api v0.185.0 // indirect
google.golang.org/genproto v0.0.0-20240617180043-68d350f18fd4 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240617180043-68d350f18fd4 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240617180043-68d350f18fd4 // indirect
google.golang.org/grpc v1.64.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
32 changes: 16 additions & 16 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ github.com/gildas/go-core v0.5.8 h1:4j192jB6BqXlnjjw1/EVvm6qXqV4f9ZuI3E6s68ZNb0=
github.com/gildas/go-core v0.5.8/go.mod h1:086mC22MxbhI8bm3cm+w6DBnNwY7+TYkfMe4lUGj8vc=
github.com/gildas/go-errors v0.3.6 h1:/loKTkq/t+eoIcULhKAwd0WBRPHgZxhkd3l+m/uw15c=
github.com/gildas/go-errors v0.3.6/go.mod h1:jqH4hy2BzpU3mdjkUYJhkZvEkn56cWRjWVgz/HNqglQ=
github.com/gildas/go-logger v1.7.1 h1:6gbN5QPLP1vntpbV6cTSObaNwdrjndl1GfLJcbZ8eYw=
github.com/gildas/go-logger v1.7.1/go.mod h1:N2LqqOvcYJsCoGq5GAygIzWJWTr8sIUq072sdXNnyws=
github.com/gildas/go-request v0.9.5 h1:XAV19mXCdZ84UBx4ZU6fu2vL6ocWDEqDMqENz4nlcEY=
github.com/gildas/go-request v0.9.5/go.mod h1:IayVqAs/QDsvXy2HrCN0aiMSknFQFsAcyViwa2itmDs=
github.com/gildas/go-logger v1.7.2 h1:HfESDm0OmJ/JDgZijuHtv3sDqCMWpgUCedEd7jgVmYk=
github.com/gildas/go-logger v1.7.2/go.mod h1:jO6QrO8hnxkLhVjWiEIOH5OeSb7Nrr55SW8qKAEgUUE=
github.com/gildas/go-request v0.9.6 h1:71T3QTC0yE+lG3GCQmDjNT+/fHwtqAxobOCj1vu5ypg=
github.com/gildas/go-request v0.9.6/go.mod h1:kJJTYDTMQbImsGPF5zETpDMqTqMs5DziRkoJLrBjerI=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
Expand Down Expand Up @@ -82,14 +82,14 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/googleapis/enterprise-certificate-proxy v0.3.2 h1:Vie5ybvEvT75RniqhfFxPRy3Bf7vr3h0cechB90XaQs=
github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0=
github.com/googleapis/gax-go/v2 v2.12.4 h1:9gWcmF85Wvq4ryPFvGFaOgPIs1AQX0d0bcbGw4Z96qg=
github.com/googleapis/gax-go/v2 v2.12.4/go.mod h1:KYEYLorsnIGDi/rPC8b5TdlB9kbKoFubselGIoBMCwI=
github.com/googleapis/gax-go/v2 v2.12.5 h1:8gw9KZK8TiVKB6q3zHY3SBzLnrGp6HQjyfYBYGmXdxA=
github.com/googleapis/gax-go/v2 v2.12.5/go.mod h1:BUDKcWo+RaKq5SC9vVYL0wLADa3VcfswbOMMRmB9H3E=
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
github.com/gorilla/securecookie v1.1.2 h1:YCIWL56dvtr73r6715mJs5ZvhtnY73hBvEF8kXD8ePA=
github.com/gorilla/securecookie v1.1.2/go.mod h1:NfCASbcHqRSY+3a8tlWJwsQap2VX5pwzwo4h3eOamfo=
github.com/gorilla/websocket v1.5.2 h1:qoW6V1GT3aZxybsbC6oLnailWnB+qTMVwMreOso9XUw=
github.com/gorilla/websocket v1.5.2/go.mod h1:0n9H61RBAcf5/38py2MCYbxzPIY9rOkpvvMT24Rqs30=
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/huandu/xstrings v1.5.0 h1:2ag3IFq9ZDANvthTwTiqSSZLjDc+BedvHPAp5tJy2TI=
github.com/huandu/xstrings v1.5.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
Expand Down Expand Up @@ -209,19 +209,19 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/api v0.184.0 h1:dmEdk6ZkJNXy1JcDhn/ou0ZUq7n9zropG2/tR4z+RDg=
google.golang.org/api v0.184.0/go.mod h1:CeDTtUEiYENAf8PPG5VZW2yNp2VM3VWbCeTioAZBTBA=
google.golang.org/api v0.185.0 h1:ENEKk1k4jW8SmmaT6RE+ZasxmxezCrD5Vw4npvr+pAU=
google.golang.org/api v0.185.0/go.mod h1:HNfvIkJGlgrIlrbYkAm9W9IdkmKZjOTVh33YltygGbg=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
google.golang.org/genproto v0.0.0-20240610135401-a8a62080eff3 h1:8RTI1cmuvdY9J7q/jpJWEj5UfgWjhV5MCoXaYmwLBYQ=
google.golang.org/genproto v0.0.0-20240610135401-a8a62080eff3/go.mod h1:qb66gsewNb7Ghv1enkhJiRfYGWUklv3n6G8UvprOhzA=
google.golang.org/genproto/googleapis/api v0.0.0-20240610135401-a8a62080eff3 h1:QW9+G6Fir4VcRXVH8x3LilNAb6cxBGLa6+GM4hRwexE=
google.golang.org/genproto/googleapis/api v0.0.0-20240610135401-a8a62080eff3/go.mod h1:kdrSS/OiLkPrNUpzD4aHgCq2rVuC/YRxok32HXZ4vRE=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240610135401-a8a62080eff3 h1:9Xyg6I9IWQZhRVfCWjKK+l6kI0jHcPesVlMnT//aHNo=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240610135401-a8a62080eff3/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0=
google.golang.org/genproto v0.0.0-20240617180043-68d350f18fd4 h1:CUiCqkPw1nNrNQzCCG4WA65m0nAmQiwXHpub3dNyruU=
google.golang.org/genproto v0.0.0-20240617180043-68d350f18fd4/go.mod h1:EvuUDCulqGgV80RvP1BHuom+smhX4qtlhnNatHuroGQ=
google.golang.org/genproto/googleapis/api v0.0.0-20240617180043-68d350f18fd4 h1:MuYw1wJzT+ZkybKfaOXKp5hJiZDn2iHaXRw0mRYdHSc=
google.golang.org/genproto/googleapis/api v0.0.0-20240617180043-68d350f18fd4/go.mod h1:px9SlOOZBg1wM1zdnr8jEL4CNGUBZ+ZKYtNPApNQc4c=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240617180043-68d350f18fd4 h1:Di6ANFilr+S60a4S61ZM00vLdw0IrQOSMS2/6mrnOU0=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240617180043-68d350f18fd4/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
Expand Down
21 changes: 14 additions & 7 deletions openmessaging_integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,9 @@ func (integration *OpenMessagingIntegration) Delete(context context.Context) err
if integration.ID == uuid.Nil {
return nil
}
log := logger.Must(logger.FromContext(context, integration.logger)).Child("integration", "getmessagedata", "integration", integration.ID)
return integration.Client.Delete(
integration.logger.ToContext(context),
log.ToContext(context),
NewURI("/conversations/messaging/integrations/open/%s", integration.ID),
nil,
)
Expand Down Expand Up @@ -184,7 +185,8 @@ func (integration *OpenMessagingIntegration) GetRoutingMessageRecipient(context
if !integration.IsCreated() {
return nil, errors.CreationFailed.With("integration", integration.ID)
}
return Fetch[RoutingMessageRecipient](context, integration.Client, integration)
log := logger.Must(logger.FromContext(context, integration.logger)).Child("integration", "getmessagedata", "integration", integration.ID)
return Fetch[RoutingMessageRecipient](log.ToContext(context), integration.Client, integration)
}

// SendInboundTextMessage sends an Open Message text message from the middleware to GENESYS Cloud
Expand All @@ -210,12 +212,13 @@ func (integration *OpenMessagingIntegration) SendInboundTextMessage(context cont
if len(message.Text) == 0 {
return "", errors.ArgumentMissing.With("text")
}
log := logger.Must(logger.FromContext(context, integration.logger)).Child("integration", "getmessagedata", "integration", integration.ID, "message", message.GetID())
message.Direction = "Inbound"
// TODO: attributes and metadata should be of a new type Metadata that containd a map and a []string for keysToRedact

result := OpenMessageText{}
err = integration.Client.Post(
integration.logger.ToContext(context),
log.ToContext(context),
NewURI("/conversations/messages/%s/inbound/open/message", integration.ID),
message,
&result,
Expand Down Expand Up @@ -254,9 +257,10 @@ func (integration *OpenMessagingIntegration) SendInboundReceipt(context context.
return "", err
}

log := logger.Must(logger.FromContext(context, integration.logger)).Child("integration", "getmessagedata", "integration", integration.ID, "receipt", receipt.GetID())
result := OpenMessageReceipt{}
err = integration.Client.Post(
integration.logger.ToContext(context),
log.ToContext(context),
NewURI("/conversations/messages/%s/inbound/open/receipt", integration.ID),
receipt,
&result,
Expand Down Expand Up @@ -286,8 +290,9 @@ func (integration *OpenMessagingIntegration) SendInboundEvents(context context.C
return "", err
}
result := OpenMessageEvents{}
log := logger.Must(logger.FromContext(context, integration.logger)).Child("integration", "getmessagedata", "integration", integration.ID, "message", events.GetID())
err = integration.Client.Post(
integration.logger.ToContext(context),
log.ToContext(context),
NewURI("/conversations/messages/%s/inbound/open/event", integration.ID),
events,
&result,
Expand All @@ -306,9 +311,10 @@ func (integration *OpenMessagingIntegration) SendOutboundMessage(context context
if integration.ID == uuid.Nil {
return nil, errors.ArgumentMissing.With("ID")
}
log := logger.Must(logger.FromContext(context, integration.logger)).Child("integration", "getmessagedata", "integration", integration.ID)
result := &AgentlessMessageResult{}
err := integration.Client.Post(
integration.logger.ToContext(context),
log.ToContext(context),
"/conversations/messages/agentless",
AgentlessMessage{
From: integration.ID.String(),
Expand All @@ -332,9 +338,10 @@ func (integration *OpenMessagingIntegration) GetMessageData(context context.Cont
if len(message.GetID()) == 0 {
return nil, errors.ArgumentMissing.With("messageID")
}
log := logger.Must(logger.FromContext(context, integration.logger)).Child("integration", "getmessagedata", "integration", integration.ID, "message", message.GetID())
data := &OpenMessageData{}
err := integration.Client.Get(
integration.logger.ToContext(context),
log.ToContext(context),
NewURI("/conversations/messages/%s/details", message.GetID()),
data,
)
Expand Down
1 change: 1 addition & 0 deletions request.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ func (client *Client) SendRequest(context context.Context, uri URI, options *req
options.Logger = log
options.ResponseBodyLogSize = 4096
options.Timeout = client.RequestTimeout
options.InterAttemptUseRetryAfter = true

log.Record("payload", options.Payload).Debugf("Sending request to %s", options.URL)
start := time.Now()
Expand Down
2 changes: 1 addition & 1 deletion version.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package gcloudcx
var commit string

// VERSION is the version of this application
var VERSION = "0.9.1" + commit
var VERSION = "0.9.2" + commit

// APP is the name of the application
const APP string = "GCloudCX Client"

0 comments on commit d5ebc0f

Please sign in to comment.