From 12cfd89a4a1fb38fe884ac5009a57e86d3234c4f Mon Sep 17 00:00:00 2001 From: Fernan Buan Date: Fri, 13 Oct 2023 11:55:11 +0800 Subject: [PATCH] refactor: replace the generic to specific type when creating jwt new objects --- go/demo_eventticket.go | 13 +++++++------ go/demo_flight.go | 13 +++++++------ go/demo_giftcard.go | 13 +++++++------ go/demo_loyalty.go | 13 +++++++------ go/demo_offer.go | 13 +++++++------ go/demo_transit.go | 13 +++++++------ 6 files changed, 42 insertions(+), 36 deletions(-) diff --git a/go/demo_eventticket.go b/go/demo_eventticket.go index 11c33ed..6650bc3 100644 --- a/go/demo_eventticket.go +++ b/go/demo_eventticket.go @@ -22,15 +22,16 @@ import ( "bytes" "encoding/json" "fmt" + "io" + "net/http" + "os" + "strings" + "github.com/golang-jwt/jwt" "github.com/google/uuid" "golang.org/x/oauth2" "golang.org/x/oauth2/google" oauthJwt "golang.org/x/oauth2/jwt" - "io" - "net/http" - "os" - "strings" ) // [END imports] @@ -340,8 +341,8 @@ func (d *demoEventticket) createJwtNewObjects(issuerId, classSuffix, objectSuffi var payload map[string]interface{} json.Unmarshal([]byte(fmt.Sprintf(` { - "genericClasses": [%s], - "genericObjects": [%s] + "eventTicketClasses": [%s], + "eventTicketObjects": [%s] } `, newClass, newObject)), &payload) diff --git a/go/demo_flight.go b/go/demo_flight.go index 0e2f1c0..ce29091 100644 --- a/go/demo_flight.go +++ b/go/demo_flight.go @@ -22,15 +22,16 @@ import ( "bytes" "encoding/json" "fmt" + "io" + "net/http" + "os" + "strings" + "github.com/golang-jwt/jwt" "github.com/google/uuid" "golang.org/x/oauth2" "golang.org/x/oauth2/google" oauthJwt "golang.org/x/oauth2/jwt" - "io" - "net/http" - "os" - "strings" ) // [END imports] @@ -320,8 +321,8 @@ func (d *demoFlight) createJwtNewObjects(issuerId, classSuffix, objectSuffix str var payload map[string]interface{} json.Unmarshal([]byte(fmt.Sprintf(` { - "genericClasses": [%s], - "genericObjects": [%s] + "flightClasses": [%s], + "flightObjects": [%s] } `, newClass, newObject)), &payload) diff --git a/go/demo_giftcard.go b/go/demo_giftcard.go index 48031b7..1be19e9 100644 --- a/go/demo_giftcard.go +++ b/go/demo_giftcard.go @@ -22,15 +22,16 @@ import ( "bytes" "encoding/json" "fmt" + "io" + "net/http" + "os" + "strings" + "github.com/golang-jwt/jwt" "github.com/google/uuid" "golang.org/x/oauth2" "golang.org/x/oauth2/google" oauthJwt "golang.org/x/oauth2/jwt" - "io" - "net/http" - "os" - "strings" ) // [END imports] @@ -288,8 +289,8 @@ func (d *demoGiftcard) createJwtNewObjects(issuerId, classSuffix, objectSuffix s var payload map[string]interface{} json.Unmarshal([]byte(fmt.Sprintf(` { - "genericClasses": [%s], - "genericObjects": [%s] + "giftCardClasses": [%s], + "giftCardObjects": [%s] } `, newClass, newObject)), &payload) diff --git a/go/demo_loyalty.go b/go/demo_loyalty.go index 660e5c5..6857f45 100644 --- a/go/demo_loyalty.go +++ b/go/demo_loyalty.go @@ -22,15 +22,16 @@ import ( "bytes" "encoding/json" "fmt" + "io" + "net/http" + "os" + "strings" + "github.com/golang-jwt/jwt" "github.com/google/uuid" "golang.org/x/oauth2" "golang.org/x/oauth2/google" oauthJwt "golang.org/x/oauth2/jwt" - "io" - "net/http" - "os" - "strings" ) // [END imports] @@ -310,8 +311,8 @@ func (d *demoLoyalty) createJwtNewObjects(issuerId, classSuffix, objectSuffix st var payload map[string]interface{} json.Unmarshal([]byte(fmt.Sprintf(` { - "genericClasses": [%s], - "genericObjects": [%s] + "loyaltyClasses": [%s], + "loyaltyObjects": [%s] } `, newClass, newObject)), &payload) diff --git a/go/demo_offer.go b/go/demo_offer.go index 8c3c055..54b0f37 100644 --- a/go/demo_offer.go +++ b/go/demo_offer.go @@ -22,15 +22,16 @@ import ( "bytes" "encoding/json" "fmt" + "io" + "net/http" + "os" + "strings" + "github.com/golang-jwt/jwt" "github.com/google/uuid" "golang.org/x/oauth2" "golang.org/x/oauth2/google" oauthJwt "golang.org/x/oauth2/jwt" - "io" - "net/http" - "os" - "strings" ) // [END imports] @@ -292,8 +293,8 @@ func (d *demoOffer) createJwtNewObjects(issuerId, classSuffix, objectSuffix stri var payload map[string]interface{} json.Unmarshal([]byte(fmt.Sprintf(` { - "genericClasses": [%s], - "genericObjects": [%s] + "offerClasses": [%s], + "offerObjects": [%s] } `, newClass, newObject)), &payload) diff --git a/go/demo_transit.go b/go/demo_transit.go index 49379ab..e0f8327 100644 --- a/go/demo_transit.go +++ b/go/demo_transit.go @@ -22,15 +22,16 @@ import ( "bytes" "encoding/json" "fmt" + "io" + "net/http" + "os" + "strings" + "github.com/golang-jwt/jwt" "github.com/google/uuid" "golang.org/x/oauth2" "golang.org/x/oauth2/google" oauthJwt "golang.org/x/oauth2/jwt" - "io" - "net/http" - "os" - "strings" ) // [END imports] @@ -348,8 +349,8 @@ func (d *demoTransit) createJwtNewObjects(issuerId, classSuffix, objectSuffix st var payload map[string]interface{} json.Unmarshal([]byte(fmt.Sprintf(` { - "genericClasses": [%s], - "genericObjects": [%s] + "transitClasses": [%s], + "transitObjects": [%s] } `, newClass, newObject)), &payload)