diff --git a/.gitpod.yml b/.gitpod.yml deleted file mode 100644 index 29c34fc..0000000 --- a/.gitpod.yml +++ /dev/null @@ -1,11 +0,0 @@ -# This configuration file was automatically generated by Gitpod. -# Please adjust to your needs (see https://www.gitpod.io/docs/introduction/learn-gitpod/gitpod-yaml) -# and commit this file to your remote git repository to share the goodness with others. - -# Learn more from ready-to-use templates: https://www.gitpod.io/docs/introduction/getting-started/quickstart - -tasks: - - init: go get && go build ./... && go test ./... - command: go run . - - diff --git a/README.md b/README.md index d907479..bae3e04 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ go get github.com/gandalf-network/gandalf-sdk-go/eyeofsauron To generate the necessary files, use the following command: ```bash -go run github.com/gandalf-network/gandalf-sdk-go/eyeofsauron -f ./example/generated +go run github.com/gandalf-network/gandalf-sdk-go/eyeofsauron -f generated ``` #### Flags @@ -38,7 +38,8 @@ package main import ( "log" - "github.com/gandalf-network/gandalf-sdk-go/eyeofsauron/example/generated" + "github.com/gandalf-network/gandalf-sdk-go/connect" + "github.com/gandalf-network/gandalf-sdk-go/eyeofsauron/generated" ) func main() { @@ -60,20 +61,19 @@ import ( "fmt" "log" - "github.com/gandalf-network/gandalf-sdk-go/eyeofsauron/example/generated" + "github.com/gandalf-network/gandalf-sdk-go/eyeofsauron/generated" ) -func getActivity() { - // Initialization - eye, err := generated.NewEyeOfSauron(" ", qrCode) } +``` + +#### Generate URL for Android +```go +import ( + ... + "github.com/gandalf-network/gandalf-sdk-go/eyeofsauron/generated" +) + +func main() { + // Define the input data + services := connect.InputData{ + "netflix": connect.Service{ + Traits: []string{"rating"}, + Activities: []string{"watch"}, + }, + } + + // Define the config parameters + config := connect.Config{ + PublicKey: publicKey, + RedirectURL: redirectURL, + Data: services, + Platform: connect.PlatformTypeAndroid, + } + + // Call the GenerateURL method for Android + androidUrl, err := conn.GenerateURL() + if err != nil { + log.Fatalf("An error occurred generating url: %v", err) + } + fmt.Println("URL => ", androidUrl) +} + ``` \ No newline at end of file diff --git a/connect/connect.go b/connect/connect.go index 30f258a..1b09cf5 100644 --- a/connect/connect.go +++ b/connect/connect.go @@ -7,7 +7,6 @@ import ( "fmt" "log" "net/url" - "os" "strings" "github.com/gandalf-network/gandalf-sdk-go/eyeofsauron/constants" @@ -17,8 +16,8 @@ import ( var ( IOS_APP_CLIP_BASE_URL = "https://appclip.apple.com/id?p=network.gandalf.connect.Clip" - ANDROID_APP_CLIP_BASE_URL = os.Getenv("ANDROID_APP_CLIP_BASE_URL") - UNIVERSAL_APP_CLIP_BASE_URL = os.Getenv("UNIVERSAL_APP_CLIP_BASE_URL") + ANDROID_APP_CLIP_BASE_URL = "https://auth.gandalf.network" + UNIVERSAL_APP_CLIP_BASE_URL = "https://auth.gandalf.network" SAURON_BASE_URL = "https://sauron.gandalf.network/public/gql" ) @@ -307,7 +306,7 @@ func (c *Connect) encodeComponents(data, redirectUrl string, publicKey string) ( encodedRedirectURL := url.QueryEscape(redirectUrl) encodedPublicKey := url.QueryEscape(publicKey) - return fmt.Sprintf("%s&data=%s&redirectUrl=%s&publicKey=%s", baseURL, encodedServices, encodedRedirectURL, encodedPublicKey), nil + return fmt.Sprintf("%s?data=%s&redirectUrl=%s&publicKey=%s", baseURL, encodedServices, encodedRedirectURL, encodedPublicKey), nil } func servicesToJSON(services InputData) []byte { diff --git a/connect/example/main.go b/connect/example/main.go index 8205690..63ceb5b 100644 --- a/connect/example/main.go +++ b/connect/example/main.go @@ -33,7 +33,7 @@ func main() { log.Fatalf("An error occurred with initializing connect: %v", err) } - + // Generate URL url, err := conn.GenerateURL() if err != nil { log.Fatalf("An error occurred generating url: %v", err) @@ -41,6 +41,7 @@ func main() { fmt.Println("URL => ", url) + // Generate QRCode qrCode, err := conn.GenerateQRCode() if err != nil { log.Fatalf("An error occurred generating QR Code url: %v", err) @@ -64,4 +65,20 @@ func main() { } fmt.Printf("Decoded QR code saved to %s\n", outputFile) + + + // Set Android Platform + config.Platform = connect.PlatformTypeAndroid + + conn, err = connect.NewConnect(config) + if err != nil { + log.Fatalf("An error occurred with initializing connect: %v", err) + } + + // GenerateURL method for Android + androidUrl, err := conn.GenerateURL() + if err != nil { + log.Fatalf("An error occurred generating url: %v", err) + } + fmt.Println("Android URL => ", androidUrl) } \ No newline at end of file diff --git a/eyeofsauron/example/generated/generated.go b/eyeofsauron/example/generated/generated.go index 75e9bd1..88b5001 100644 --- a/eyeofsauron/example/generated/generated.go +++ b/eyeofsauron/example/generated/generated.go @@ -68,6 +68,16 @@ func SignMessageAsBase64(privKey *ecdsa.PrivateKey, message []byte) (string, err return signatureB64, nil } +type ActivityType string + +const ( + ActivityTypeTrip ActivityType = "TRIP" + ActivityTypeStay ActivityType = "STAY" + ActivityTypeShop ActivityType = "SHOP" + ActivityTypePlay ActivityType = "PLAY" + ActivityTypeWatch ActivityType = "WATCH" +) + // AmazonActivityMetadata includes the GraphQL fields of AmazonActivityMetadata requested by the fragment AmazonActivityMetadata. type AmazonActivityMetadata struct { ProductName string `json:"productName"` @@ -108,6 +118,86 @@ func (v *AmazonActivityMetadataSubjectIdentifier) GetIdentifierType() Identifier return v.IdentifierType } +// BookingActivityMetadata includes the GraphQL fields of BookingActivityMetadata requested by the fragment BookingActivityMetadata. +type BookingActivityMetadata struct { + Subject []BookingActivityMetadataSubjectIdentifier `json:"subject"` + BookingID string `json:"bookingID"` + Price string `json:"price"` + Bookings []BookingActivityMetadataBookingsBookingItem `json:"bookings"` +} + +// GetSubject returns BookingActivityMetadata.Subject, and is useful for accessing the field via an interface. +func (v *BookingActivityMetadata) GetSubject() []BookingActivityMetadataSubjectIdentifier { + return v.Subject +} + +// GetBookingID returns BookingActivityMetadata.BookingID, and is useful for accessing the field via an interface. +func (v *BookingActivityMetadata) GetBookingID() string { return v.BookingID } + +// GetPrice returns BookingActivityMetadata.Price, and is useful for accessing the field via an interface. +func (v *BookingActivityMetadata) GetPrice() string { return v.Price } + +// GetBookings returns BookingActivityMetadata.Bookings, and is useful for accessing the field via an interface. +func (v *BookingActivityMetadata) GetBookings() []BookingActivityMetadataBookingsBookingItem { + return v.Bookings +} + +// BookingActivityMetadataBookingsBookingItem includes the requested fields of the GraphQL type BookingItem. +type BookingActivityMetadataBookingsBookingItem struct { + StartDateTime time.Time `json:"startDateTime"` + EndDateTime time.Time `json:"endDateTime"` + Address string `json:"address"` + DepatureLocation string `json:"depatureLocation"` + ArrivalLocation string `json:"arrivalLocation"` + LayoverLocations []string `json:"layoverLocations"` + ActivityType ActivityType `json:"activityType"` +} + +// GetStartDateTime returns BookingActivityMetadataBookingsBookingItem.StartDateTime, and is useful for accessing the field via an interface. +func (v *BookingActivityMetadataBookingsBookingItem) GetStartDateTime() time.Time { + return v.StartDateTime +} + +// GetEndDateTime returns BookingActivityMetadataBookingsBookingItem.EndDateTime, and is useful for accessing the field via an interface. +func (v *BookingActivityMetadataBookingsBookingItem) GetEndDateTime() time.Time { return v.EndDateTime } + +// GetAddress returns BookingActivityMetadataBookingsBookingItem.Address, and is useful for accessing the field via an interface. +func (v *BookingActivityMetadataBookingsBookingItem) GetAddress() string { return v.Address } + +// GetDepatureLocation returns BookingActivityMetadataBookingsBookingItem.DepatureLocation, and is useful for accessing the field via an interface. +func (v *BookingActivityMetadataBookingsBookingItem) GetDepatureLocation() string { + return v.DepatureLocation +} + +// GetArrivalLocation returns BookingActivityMetadataBookingsBookingItem.ArrivalLocation, and is useful for accessing the field via an interface. +func (v *BookingActivityMetadataBookingsBookingItem) GetArrivalLocation() string { + return v.ArrivalLocation +} + +// GetLayoverLocations returns BookingActivityMetadataBookingsBookingItem.LayoverLocations, and is useful for accessing the field via an interface. +func (v *BookingActivityMetadataBookingsBookingItem) GetLayoverLocations() []string { + return v.LayoverLocations +} + +// GetActivityType returns BookingActivityMetadataBookingsBookingItem.ActivityType, and is useful for accessing the field via an interface. +func (v *BookingActivityMetadataBookingsBookingItem) GetActivityType() ActivityType { + return v.ActivityType +} + +// BookingActivityMetadataSubjectIdentifier includes the requested fields of the GraphQL type Identifier. +type BookingActivityMetadataSubjectIdentifier struct { + Value string `json:"value"` + IdentifierType IdentifierType `json:"identifierType"` +} + +// GetValue returns BookingActivityMetadataSubjectIdentifier.Value, and is useful for accessing the field via an interface. +func (v *BookingActivityMetadataSubjectIdentifier) GetValue() string { return v.Value } + +// GetIdentifierType returns BookingActivityMetadataSubjectIdentifier.IdentifierType, and is useful for accessing the field via an interface. +func (v *BookingActivityMetadataSubjectIdentifier) GetIdentifierType() IdentifierType { + return v.IdentifierType +} + type ContentType string const ( @@ -222,10 +312,12 @@ func (v *GetActivityActivityResponseDataActivity) __premarshalJSON() (*__premars // // GetActivityActivityResponseDataActivityMetadata is implemented by the following types: // GetActivityActivityResponseDataActivityMetadataAmazonActivityMetadata +// GetActivityActivityResponseDataActivityMetadataBookingActivityMetadata // GetActivityActivityResponseDataActivityMetadataInstacartActivityMetadata // GetActivityActivityResponseDataActivityMetadataNetflixActivityMetadata // GetActivityActivityResponseDataActivityMetadataPlaystationActivityMetadata // GetActivityActivityResponseDataActivityMetadataUberActivityMetadata +// GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata // GetActivityActivityResponseDataActivityMetadataYoutubeActivityMetadata type GetActivityActivityResponseDataActivityMetadata interface { implementsGraphQLInterfaceGetActivityActivityResponseDataActivityMetadata() @@ -235,6 +327,8 @@ type GetActivityActivityResponseDataActivityMetadata interface { func (v *GetActivityActivityResponseDataActivityMetadataAmazonActivityMetadata) implementsGraphQLInterfaceGetActivityActivityResponseDataActivityMetadata() { } +func (v *GetActivityActivityResponseDataActivityMetadataBookingActivityMetadata) implementsGraphQLInterfaceGetActivityActivityResponseDataActivityMetadata() { +} func (v *GetActivityActivityResponseDataActivityMetadataInstacartActivityMetadata) implementsGraphQLInterfaceGetActivityActivityResponseDataActivityMetadata() { } func (v *GetActivityActivityResponseDataActivityMetadataNetflixActivityMetadata) implementsGraphQLInterfaceGetActivityActivityResponseDataActivityMetadata() { @@ -243,6 +337,8 @@ func (v *GetActivityActivityResponseDataActivityMetadataPlaystationActivityMetad } func (v *GetActivityActivityResponseDataActivityMetadataUberActivityMetadata) implementsGraphQLInterfaceGetActivityActivityResponseDataActivityMetadata() { } +func (v *GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata) implementsGraphQLInterfaceGetActivityActivityResponseDataActivityMetadata() { +} func (v *GetActivityActivityResponseDataActivityMetadataYoutubeActivityMetadata) implementsGraphQLInterfaceGetActivityActivityResponseDataActivityMetadata() { } @@ -263,6 +359,9 @@ func __unmarshalGetActivityActivityResponseDataActivityMetadata(b []byte, v *Get case "AmazonActivityMetadata": *v = new(GetActivityActivityResponseDataActivityMetadataAmazonActivityMetadata) return json.Unmarshal(b, *v) + case "BookingActivityMetadata": + *v = new(GetActivityActivityResponseDataActivityMetadataBookingActivityMetadata) + return json.Unmarshal(b, *v) case "InstacartActivityMetadata": *v = new(GetActivityActivityResponseDataActivityMetadataInstacartActivityMetadata) return json.Unmarshal(b, *v) @@ -275,6 +374,9 @@ func __unmarshalGetActivityActivityResponseDataActivityMetadata(b []byte, v *Get case "UberActivityMetadata": *v = new(GetActivityActivityResponseDataActivityMetadataUberActivityMetadata) return json.Unmarshal(b, *v) + case "UberEatsActivityMetadata": + *v = new(GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata) + return json.Unmarshal(b, *v) case "YoutubeActivityMetadata": *v = new(GetActivityActivityResponseDataActivityMetadataYoutubeActivityMetadata) return json.Unmarshal(b, *v) @@ -303,6 +405,18 @@ func __marshalGetActivityActivityResponseDataActivityMetadata(v *GetActivityActi *__premarshalGetActivityActivityResponseDataActivityMetadataAmazonActivityMetadata }{typename, premarshaled} return json.Marshal(result) + case *GetActivityActivityResponseDataActivityMetadataBookingActivityMetadata: + typename = "BookingActivityMetadata" + + premarshaled, err := v.__premarshalJSON() + if err != nil { + return nil, err + } + result := struct { + TypeName string `json:"__typename"` + *__premarshalGetActivityActivityResponseDataActivityMetadataBookingActivityMetadata + }{typename, premarshaled} + return json.Marshal(result) case *GetActivityActivityResponseDataActivityMetadataInstacartActivityMetadata: typename = "InstacartActivityMetadata" @@ -351,6 +465,18 @@ func __marshalGetActivityActivityResponseDataActivityMetadata(v *GetActivityActi *__premarshalGetActivityActivityResponseDataActivityMetadataUberActivityMetadata }{typename, premarshaled} return json.Marshal(result) + case *GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata: + typename = "UberEatsActivityMetadata" + + premarshaled, err := v.__premarshalJSON() + if err != nil { + return nil, err + } + result := struct { + TypeName string `json:"__typename"` + *__premarshalGetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata + }{typename, premarshaled} + return json.Marshal(result) case *GetActivityActivityResponseDataActivityMetadataYoutubeActivityMetadata: typename = "YoutubeActivityMetadata" @@ -466,6 +592,93 @@ func (v *GetActivityActivityResponseDataActivityMetadataAmazonActivityMetadata) return &retval, nil } +// GetActivityActivityResponseDataActivityMetadataBookingActivityMetadata includes the requested fields of the GraphQL type BookingActivityMetadata. +type GetActivityActivityResponseDataActivityMetadataBookingActivityMetadata struct { + Typename string `json:"__typename"` + BookingActivityMetadata `json:"-"` +} + +// GetTypename returns GetActivityActivityResponseDataActivityMetadataBookingActivityMetadata.Typename, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataBookingActivityMetadata) GetTypename() string { + return v.Typename +} + +// GetSubject returns GetActivityActivityResponseDataActivityMetadataBookingActivityMetadata.Subject, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataBookingActivityMetadata) GetSubject() []BookingActivityMetadataSubjectIdentifier { + return v.BookingActivityMetadata.Subject +} + +// GetBookingID returns GetActivityActivityResponseDataActivityMetadataBookingActivityMetadata.BookingID, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataBookingActivityMetadata) GetBookingID() string { + return v.BookingActivityMetadata.BookingID +} + +// GetPrice returns GetActivityActivityResponseDataActivityMetadataBookingActivityMetadata.Price, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataBookingActivityMetadata) GetPrice() string { + return v.BookingActivityMetadata.Price +} + +// GetBookings returns GetActivityActivityResponseDataActivityMetadataBookingActivityMetadata.Bookings, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataBookingActivityMetadata) GetBookings() []BookingActivityMetadataBookingsBookingItem { + return v.BookingActivityMetadata.Bookings +} + +func (v *GetActivityActivityResponseDataActivityMetadataBookingActivityMetadata) UnmarshalJSON(b []byte) error { + + if string(b) == "null" { + return nil + } + + var firstPass struct { + *GetActivityActivityResponseDataActivityMetadataBookingActivityMetadata + graphql.NoUnmarshalJSON + } + firstPass.GetActivityActivityResponseDataActivityMetadataBookingActivityMetadata = v + + err := json.Unmarshal(b, &firstPass) + if err != nil { + return err + } + + err = json.Unmarshal( + b, &v.BookingActivityMetadata) + if err != nil { + return err + } + return nil +} + +type __premarshalGetActivityActivityResponseDataActivityMetadataBookingActivityMetadata struct { + Typename string `json:"__typename"` + + Subject []BookingActivityMetadataSubjectIdentifier `json:"subject"` + + BookingID string `json:"bookingID"` + + Price string `json:"price"` + + Bookings []BookingActivityMetadataBookingsBookingItem `json:"bookings"` +} + +func (v *GetActivityActivityResponseDataActivityMetadataBookingActivityMetadata) MarshalJSON() ([]byte, error) { + premarshaled, err := v.__premarshalJSON() + if err != nil { + return nil, err + } + return json.Marshal(premarshaled) +} + +func (v *GetActivityActivityResponseDataActivityMetadataBookingActivityMetadata) __premarshalJSON() (*__premarshalGetActivityActivityResponseDataActivityMetadataBookingActivityMetadata, error) { + var retval __premarshalGetActivityActivityResponseDataActivityMetadataBookingActivityMetadata + + retval.Typename = v.Typename + retval.Subject = v.BookingActivityMetadata.Subject + retval.BookingID = v.BookingActivityMetadata.BookingID + retval.Price = v.BookingActivityMetadata.Price + retval.Bookings = v.BookingActivityMetadata.Bookings + return &retval, nil +} + // GetActivityActivityResponseDataActivityMetadataInstacartActivityMetadata includes the requested fields of the GraphQL type InstacartActivityMetadata. type GetActivityActivityResponseDataActivityMetadataInstacartActivityMetadata struct { Typename string `json:"__typename"` @@ -854,6 +1067,117 @@ func (v *GetActivityActivityResponseDataActivityMetadataUberActivityMetadata) __ return &retval, nil } +// GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata includes the requested fields of the GraphQL type UberEatsActivityMetadata. +type GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata struct { + Typename string `json:"__typename"` + UberEatsActivityMetadata `json:"-"` +} + +// GetTypename returns GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata.Typename, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata) GetTypename() string { + return v.Typename +} + +// GetSubject returns GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata.Subject, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata) GetSubject() []UberEatsActivityMetadataSubjectIdentifier { + return v.UberEatsActivityMetadata.Subject +} + +// GetDate returns GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata.Date, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata) GetDate() graphqlTypes.Date { + return v.UberEatsActivityMetadata.Date +} + +// GetRestaurant returns GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata.Restaurant, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata) GetRestaurant() string { + return v.UberEatsActivityMetadata.Restaurant +} + +// GetCurrency returns GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata.Currency, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata) GetCurrency() string { + return v.UberEatsActivityMetadata.Currency +} + +// GetTotalPrice returns GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata.TotalPrice, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata) GetTotalPrice() float64 { + return v.UberEatsActivityMetadata.TotalPrice +} + +// GetUberEatsActivityMetadataStatus returns GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata.UberEatsActivityMetadataStatus, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata) GetUberEatsActivityMetadataStatus() UberEatsOrderStatus { + return v.UberEatsActivityMetadata.UberEatsActivityMetadataStatus +} + +// GetUberEatsActivityMetadataItems returns GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata.UberEatsActivityMetadataItems, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata) GetUberEatsActivityMetadataItems() []UberEatsActivityMetadataUberEatsActivityMetadataItemsUberEatsOrderItem { + return v.UberEatsActivityMetadata.UberEatsActivityMetadataItems +} + +func (v *GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata) UnmarshalJSON(b []byte) error { + + if string(b) == "null" { + return nil + } + + var firstPass struct { + *GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata + graphql.NoUnmarshalJSON + } + firstPass.GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata = v + + err := json.Unmarshal(b, &firstPass) + if err != nil { + return err + } + + err = json.Unmarshal( + b, &v.UberEatsActivityMetadata) + if err != nil { + return err + } + return nil +} + +type __premarshalGetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata struct { + Typename string `json:"__typename"` + + Subject []UberEatsActivityMetadataSubjectIdentifier `json:"subject"` + + Date graphqlTypes.Date `json:"date"` + + Restaurant string `json:"restaurant"` + + Currency string `json:"currency"` + + TotalPrice float64 `json:"totalPrice"` + + UberEatsActivityMetadataStatus UberEatsOrderStatus `json:"UberEatsActivityMetadataStatus"` + + UberEatsActivityMetadataItems []UberEatsActivityMetadataUberEatsActivityMetadataItemsUberEatsOrderItem `json:"UberEatsActivityMetadataItems"` +} + +func (v *GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata) MarshalJSON() ([]byte, error) { + premarshaled, err := v.__premarshalJSON() + if err != nil { + return nil, err + } + return json.Marshal(premarshaled) +} + +func (v *GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata) __premarshalJSON() (*__premarshalGetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata, error) { + var retval __premarshalGetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata + + retval.Typename = v.Typename + retval.Subject = v.UberEatsActivityMetadata.Subject + retval.Date = v.UberEatsActivityMetadata.Date + retval.Restaurant = v.UberEatsActivityMetadata.Restaurant + retval.Currency = v.UberEatsActivityMetadata.Currency + retval.TotalPrice = v.UberEatsActivityMetadata.TotalPrice + retval.UberEatsActivityMetadataStatus = v.UberEatsActivityMetadata.UberEatsActivityMetadataStatus + retval.UberEatsActivityMetadataItems = v.UberEatsActivityMetadata.UberEatsActivityMetadataItems + return &retval, nil +} + // GetActivityActivityResponseDataActivityMetadataYoutubeActivityMetadata includes the requested fields of the GraphQL type YoutubeActivityMetadata. type GetActivityActivityResponseDataActivityMetadataYoutubeActivityMetadata struct { Typename string `json:"__typename"` @@ -973,6 +1297,30 @@ func (v *GetAppByPublicKeyApplication) GetGandalfID() graphqlTypes.Int64 { retur // GetAppRegistrar returns GetAppByPublicKeyApplication.AppRegistrar, and is useful for accessing the field via an interface. func (v *GetAppByPublicKeyApplication) GetAppRegistrar() string { return v.AppRegistrar } +// GetTraitsTrait includes the requested fields of the GraphQL type Trait. +type GetTraitsTrait struct { + Id uuid.UUID `json:"id"` + Source Source `json:"source"` + Label TraitLabel `json:"label"` + Value string `json:"value"` + Timestamp time.Time `json:"timestamp"` +} + +// GetId returns GetTraitsTrait.Id, and is useful for accessing the field via an interface. +func (v *GetTraitsTrait) GetId() uuid.UUID { return v.Id } + +// GetSource returns GetTraitsTrait.Source, and is useful for accessing the field via an interface. +func (v *GetTraitsTrait) GetSource() Source { return v.Source } + +// GetLabel returns GetTraitsTrait.Label, and is useful for accessing the field via an interface. +func (v *GetTraitsTrait) GetLabel() TraitLabel { return v.Label } + +// GetValue returns GetTraitsTrait.Value, and is useful for accessing the field via an interface. +func (v *GetTraitsTrait) GetValue() string { return v.Value } + +// GetTimestamp returns GetTraitsTrait.Timestamp, and is useful for accessing the field via an interface. +func (v *GetTraitsTrait) GetTimestamp() time.Time { return v.Timestamp } + type IdentifierType string const ( @@ -986,7 +1334,9 @@ const ( IdentifierTypeTvdb IdentifierType = "TVDB" IdentifierTypeTvmaze IdentifierType = "TVMAZE" IdentifierTypeUber IdentifierType = "UBER" + IdentifierTypeBooking IdentifierType = "BOOKING" IdentifierTypeInstacart IdentifierType = "INSTACART" + IdentifierTypeUbereats IdentifierType = "UBEREATS" ) // InstacartActivityMetadata includes the GraphQL fields of InstacartActivityMetadata requested by the fragment InstacartActivityMetadata. @@ -1159,10 +1509,12 @@ func (v *LookupActivity) __premarshalJSON() (*__premarshalLookupActivity, error) // // LookupActivityMetadata is implemented by the following types: // LookupActivityMetadataAmazonActivityMetadata +// LookupActivityMetadataBookingActivityMetadata // LookupActivityMetadataInstacartActivityMetadata // LookupActivityMetadataNetflixActivityMetadata // LookupActivityMetadataPlaystationActivityMetadata // LookupActivityMetadataUberActivityMetadata +// LookupActivityMetadataUberEatsActivityMetadata // LookupActivityMetadataYoutubeActivityMetadata type LookupActivityMetadata interface { implementsGraphQLInterfaceLookupActivityMetadata() @@ -1172,6 +1524,8 @@ type LookupActivityMetadata interface { func (v *LookupActivityMetadataAmazonActivityMetadata) implementsGraphQLInterfaceLookupActivityMetadata() { } +func (v *LookupActivityMetadataBookingActivityMetadata) implementsGraphQLInterfaceLookupActivityMetadata() { +} func (v *LookupActivityMetadataInstacartActivityMetadata) implementsGraphQLInterfaceLookupActivityMetadata() { } func (v *LookupActivityMetadataNetflixActivityMetadata) implementsGraphQLInterfaceLookupActivityMetadata() { @@ -1180,6 +1534,8 @@ func (v *LookupActivityMetadataPlaystationActivityMetadata) implementsGraphQLInt } func (v *LookupActivityMetadataUberActivityMetadata) implementsGraphQLInterfaceLookupActivityMetadata() { } +func (v *LookupActivityMetadataUberEatsActivityMetadata) implementsGraphQLInterfaceLookupActivityMetadata() { +} func (v *LookupActivityMetadataYoutubeActivityMetadata) implementsGraphQLInterfaceLookupActivityMetadata() { } @@ -1200,6 +1556,9 @@ func __unmarshalLookupActivityMetadata(b []byte, v *LookupActivityMetadata) erro case "AmazonActivityMetadata": *v = new(LookupActivityMetadataAmazonActivityMetadata) return json.Unmarshal(b, *v) + case "BookingActivityMetadata": + *v = new(LookupActivityMetadataBookingActivityMetadata) + return json.Unmarshal(b, *v) case "InstacartActivityMetadata": *v = new(LookupActivityMetadataInstacartActivityMetadata) return json.Unmarshal(b, *v) @@ -1212,6 +1571,9 @@ func __unmarshalLookupActivityMetadata(b []byte, v *LookupActivityMetadata) erro case "UberActivityMetadata": *v = new(LookupActivityMetadataUberActivityMetadata) return json.Unmarshal(b, *v) + case "UberEatsActivityMetadata": + *v = new(LookupActivityMetadataUberEatsActivityMetadata) + return json.Unmarshal(b, *v) case "YoutubeActivityMetadata": *v = new(LookupActivityMetadataYoutubeActivityMetadata) return json.Unmarshal(b, *v) @@ -1240,6 +1602,18 @@ func __marshalLookupActivityMetadata(v *LookupActivityMetadata) ([]byte, error) *__premarshalLookupActivityMetadataAmazonActivityMetadata }{typename, premarshaled} return json.Marshal(result) + case *LookupActivityMetadataBookingActivityMetadata: + typename = "BookingActivityMetadata" + + premarshaled, err := v.__premarshalJSON() + if err != nil { + return nil, err + } + result := struct { + TypeName string `json:"__typename"` + *__premarshalLookupActivityMetadataBookingActivityMetadata + }{typename, premarshaled} + return json.Marshal(result) case *LookupActivityMetadataInstacartActivityMetadata: typename = "InstacartActivityMetadata" @@ -1288,6 +1662,18 @@ func __marshalLookupActivityMetadata(v *LookupActivityMetadata) ([]byte, error) *__premarshalLookupActivityMetadataUberActivityMetadata }{typename, premarshaled} return json.Marshal(result) + case *LookupActivityMetadataUberEatsActivityMetadata: + typename = "UberEatsActivityMetadata" + + premarshaled, err := v.__premarshalJSON() + if err != nil { + return nil, err + } + result := struct { + TypeName string `json:"__typename"` + *__premarshalLookupActivityMetadataUberEatsActivityMetadata + }{typename, premarshaled} + return json.Marshal(result) case *LookupActivityMetadataYoutubeActivityMetadata: typename = "YoutubeActivityMetadata" @@ -1401,6 +1787,91 @@ func (v *LookupActivityMetadataAmazonActivityMetadata) __premarshalJSON() (*__pr return &retval, nil } +// LookupActivityMetadataBookingActivityMetadata includes the requested fields of the GraphQL type BookingActivityMetadata. +type LookupActivityMetadataBookingActivityMetadata struct { + Typename string `json:"__typename"` + BookingActivityMetadata `json:"-"` +} + +// GetTypename returns LookupActivityMetadataBookingActivityMetadata.Typename, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataBookingActivityMetadata) GetTypename() string { return v.Typename } + +// GetSubject returns LookupActivityMetadataBookingActivityMetadata.Subject, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataBookingActivityMetadata) GetSubject() []BookingActivityMetadataSubjectIdentifier { + return v.BookingActivityMetadata.Subject +} + +// GetBookingID returns LookupActivityMetadataBookingActivityMetadata.BookingID, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataBookingActivityMetadata) GetBookingID() string { + return v.BookingActivityMetadata.BookingID +} + +// GetPrice returns LookupActivityMetadataBookingActivityMetadata.Price, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataBookingActivityMetadata) GetPrice() string { + return v.BookingActivityMetadata.Price +} + +// GetBookings returns LookupActivityMetadataBookingActivityMetadata.Bookings, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataBookingActivityMetadata) GetBookings() []BookingActivityMetadataBookingsBookingItem { + return v.BookingActivityMetadata.Bookings +} + +func (v *LookupActivityMetadataBookingActivityMetadata) UnmarshalJSON(b []byte) error { + + if string(b) == "null" { + return nil + } + + var firstPass struct { + *LookupActivityMetadataBookingActivityMetadata + graphql.NoUnmarshalJSON + } + firstPass.LookupActivityMetadataBookingActivityMetadata = v + + err := json.Unmarshal(b, &firstPass) + if err != nil { + return err + } + + err = json.Unmarshal( + b, &v.BookingActivityMetadata) + if err != nil { + return err + } + return nil +} + +type __premarshalLookupActivityMetadataBookingActivityMetadata struct { + Typename string `json:"__typename"` + + Subject []BookingActivityMetadataSubjectIdentifier `json:"subject"` + + BookingID string `json:"bookingID"` + + Price string `json:"price"` + + Bookings []BookingActivityMetadataBookingsBookingItem `json:"bookings"` +} + +func (v *LookupActivityMetadataBookingActivityMetadata) MarshalJSON() ([]byte, error) { + premarshaled, err := v.__premarshalJSON() + if err != nil { + return nil, err + } + return json.Marshal(premarshaled) +} + +func (v *LookupActivityMetadataBookingActivityMetadata) __premarshalJSON() (*__premarshalLookupActivityMetadataBookingActivityMetadata, error) { + var retval __premarshalLookupActivityMetadataBookingActivityMetadata + + retval.Typename = v.Typename + retval.Subject = v.BookingActivityMetadata.Subject + retval.BookingID = v.BookingActivityMetadata.BookingID + retval.Price = v.BookingActivityMetadata.Price + retval.Bookings = v.BookingActivityMetadata.Bookings + return &retval, nil +} + // LookupActivityMetadataInstacartActivityMetadata includes the requested fields of the GraphQL type InstacartActivityMetadata. type LookupActivityMetadataInstacartActivityMetadata struct { Typename string `json:"__typename"` @@ -1781,7 +2252,116 @@ func (v *LookupActivityMetadataUberActivityMetadata) __premarshalJSON() (*__prem return &retval, nil } -// LookupActivityMetadataYoutubeActivityMetadata includes the requested fields of the GraphQL type YoutubeActivityMetadata. +// LookupActivityMetadataUberEatsActivityMetadata includes the requested fields of the GraphQL type UberEatsActivityMetadata. +type LookupActivityMetadataUberEatsActivityMetadata struct { + Typename string `json:"__typename"` + UberEatsActivityMetadata `json:"-"` +} + +// GetTypename returns LookupActivityMetadataUberEatsActivityMetadata.Typename, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataUberEatsActivityMetadata) GetTypename() string { return v.Typename } + +// GetSubject returns LookupActivityMetadataUberEatsActivityMetadata.Subject, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataUberEatsActivityMetadata) GetSubject() []UberEatsActivityMetadataSubjectIdentifier { + return v.UberEatsActivityMetadata.Subject +} + +// GetDate returns LookupActivityMetadataUberEatsActivityMetadata.Date, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataUberEatsActivityMetadata) GetDate() graphqlTypes.Date { + return v.UberEatsActivityMetadata.Date +} + +// GetRestaurant returns LookupActivityMetadataUberEatsActivityMetadata.Restaurant, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataUberEatsActivityMetadata) GetRestaurant() string { + return v.UberEatsActivityMetadata.Restaurant +} + +// GetCurrency returns LookupActivityMetadataUberEatsActivityMetadata.Currency, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataUberEatsActivityMetadata) GetCurrency() string { + return v.UberEatsActivityMetadata.Currency +} + +// GetTotalPrice returns LookupActivityMetadataUberEatsActivityMetadata.TotalPrice, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataUberEatsActivityMetadata) GetTotalPrice() float64 { + return v.UberEatsActivityMetadata.TotalPrice +} + +// GetUberEatsActivityMetadataStatus returns LookupActivityMetadataUberEatsActivityMetadata.UberEatsActivityMetadataStatus, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataUberEatsActivityMetadata) GetUberEatsActivityMetadataStatus() UberEatsOrderStatus { + return v.UberEatsActivityMetadata.UberEatsActivityMetadataStatus +} + +// GetUberEatsActivityMetadataItems returns LookupActivityMetadataUberEatsActivityMetadata.UberEatsActivityMetadataItems, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataUberEatsActivityMetadata) GetUberEatsActivityMetadataItems() []UberEatsActivityMetadataUberEatsActivityMetadataItemsUberEatsOrderItem { + return v.UberEatsActivityMetadata.UberEatsActivityMetadataItems +} + +func (v *LookupActivityMetadataUberEatsActivityMetadata) UnmarshalJSON(b []byte) error { + + if string(b) == "null" { + return nil + } + + var firstPass struct { + *LookupActivityMetadataUberEatsActivityMetadata + graphql.NoUnmarshalJSON + } + firstPass.LookupActivityMetadataUberEatsActivityMetadata = v + + err := json.Unmarshal(b, &firstPass) + if err != nil { + return err + } + + err = json.Unmarshal( + b, &v.UberEatsActivityMetadata) + if err != nil { + return err + } + return nil +} + +type __premarshalLookupActivityMetadataUberEatsActivityMetadata struct { + Typename string `json:"__typename"` + + Subject []UberEatsActivityMetadataSubjectIdentifier `json:"subject"` + + Date graphqlTypes.Date `json:"date"` + + Restaurant string `json:"restaurant"` + + Currency string `json:"currency"` + + TotalPrice float64 `json:"totalPrice"` + + UberEatsActivityMetadataStatus UberEatsOrderStatus `json:"UberEatsActivityMetadataStatus"` + + UberEatsActivityMetadataItems []UberEatsActivityMetadataUberEatsActivityMetadataItemsUberEatsOrderItem `json:"UberEatsActivityMetadataItems"` +} + +func (v *LookupActivityMetadataUberEatsActivityMetadata) MarshalJSON() ([]byte, error) { + premarshaled, err := v.__premarshalJSON() + if err != nil { + return nil, err + } + return json.Marshal(premarshaled) +} + +func (v *LookupActivityMetadataUberEatsActivityMetadata) __premarshalJSON() (*__premarshalLookupActivityMetadataUberEatsActivityMetadata, error) { + var retval __premarshalLookupActivityMetadataUberEatsActivityMetadata + + retval.Typename = v.Typename + retval.Subject = v.UberEatsActivityMetadata.Subject + retval.Date = v.UberEatsActivityMetadata.Date + retval.Restaurant = v.UberEatsActivityMetadata.Restaurant + retval.Currency = v.UberEatsActivityMetadata.Currency + retval.TotalPrice = v.UberEatsActivityMetadata.TotalPrice + retval.UberEatsActivityMetadataStatus = v.UberEatsActivityMetadata.UberEatsActivityMetadataStatus + retval.UberEatsActivityMetadataItems = v.UberEatsActivityMetadata.UberEatsActivityMetadataItems + return &retval, nil +} + +// LookupActivityMetadataYoutubeActivityMetadata includes the requested fields of the GraphQL type YoutubeActivityMetadata. type LookupActivityMetadataYoutubeActivityMetadata struct { Typename string `json:"__typename"` YoutubeActivityMetadata `json:"-"` @@ -1874,6 +2454,30 @@ func (v *LookupActivityMetadataYoutubeActivityMetadata) __premarshalJSON() (*__p return &retval, nil } +// LookupTrait includes the requested fields of the GraphQL type Trait. +type LookupTrait struct { + Id uuid.UUID `json:"id"` + Source Source `json:"source"` + Label TraitLabel `json:"label"` + Value string `json:"value"` + Timestamp time.Time `json:"timestamp"` +} + +// GetId returns LookupTrait.Id, and is useful for accessing the field via an interface. +func (v *LookupTrait) GetId() uuid.UUID { return v.Id } + +// GetSource returns LookupTrait.Source, and is useful for accessing the field via an interface. +func (v *LookupTrait) GetSource() Source { return v.Source } + +// GetLabel returns LookupTrait.Label, and is useful for accessing the field via an interface. +func (v *LookupTrait) GetLabel() TraitLabel { return v.Label } + +// GetValue returns LookupTrait.Value, and is useful for accessing the field via an interface. +func (v *LookupTrait) GetValue() string { return v.Value } + +// GetTimestamp returns LookupTrait.Timestamp, and is useful for accessing the field via an interface. +func (v *LookupTrait) GetTimestamp() time.Time { return v.Timestamp } + // NetflixActivityMetadata includes the GraphQL fields of NetflixActivityMetadata requested by the fragment NetflixActivityMetadata. type NetflixActivityMetadata struct { Title string `json:"title"` @@ -1950,7 +2554,29 @@ const ( SourceYoutube Source = "YOUTUBE" SourceAmazon Source = "AMAZON" SourceUber Source = "UBER" + SourceBooking Source = "BOOKING" SourceInstacart Source = "INSTACART" + SourceInstagram Source = "INSTAGRAM" + SourceX Source = "X" + SourceUbereats Source = "UBEREATS" + SourceGandalf Source = "GANDALF" +) + +type TraitLabel string + +const ( + TraitLabelPrimeSubscriber TraitLabel = "PRIME_SUBSCRIBER" + TraitLabelRating TraitLabel = "RATING" + TraitLabelTripCount TraitLabel = "TRIP_COUNT" + TraitLabelAccountCreatedOn TraitLabel = "ACCOUNT_CREATED_ON" + TraitLabelPlan TraitLabel = "PLAN" + TraitLabelGeniusLevel TraitLabel = "GENIUS_LEVEL" + TraitLabelFollowerCount TraitLabel = "FOLLOWER_COUNT" + TraitLabelFollowingCount TraitLabel = "FOLLOWING_COUNT" + TraitLabelUsername TraitLabel = "USERNAME" + TraitLabelPostCount TraitLabel = "POST_COUNT" + TraitLabelEmail TraitLabel = "EMAIL" + TraitLabelOrderCount TraitLabel = "ORDER_COUNT" ) type TripStatus string @@ -2007,6 +2633,118 @@ func (v *UberActivityMetadataSubjectIdentifier) GetIdentifierType() IdentifierTy return v.IdentifierType } +// UberEatsActivityMetadata includes the GraphQL fields of UberEatsActivityMetadata requested by the fragment UberEatsActivityMetadata. +type UberEatsActivityMetadata struct { + Subject []UberEatsActivityMetadataSubjectIdentifier `json:"subject"` + Date graphqlTypes.Date `json:"date"` + Restaurant string `json:"restaurant"` + Currency string `json:"currency"` + TotalPrice float64 `json:"totalPrice"` + UberEatsActivityMetadataStatus UberEatsOrderStatus `json:"UberEatsActivityMetadataStatus"` + UberEatsActivityMetadataItems []UberEatsActivityMetadataUberEatsActivityMetadataItemsUberEatsOrderItem `json:"UberEatsActivityMetadataItems"` +} + +// GetSubject returns UberEatsActivityMetadata.Subject, and is useful for accessing the field via an interface. +func (v *UberEatsActivityMetadata) GetSubject() []UberEatsActivityMetadataSubjectIdentifier { + return v.Subject +} + +// GetDate returns UberEatsActivityMetadata.Date, and is useful for accessing the field via an interface. +func (v *UberEatsActivityMetadata) GetDate() graphqlTypes.Date { return v.Date } + +// GetRestaurant returns UberEatsActivityMetadata.Restaurant, and is useful for accessing the field via an interface. +func (v *UberEatsActivityMetadata) GetRestaurant() string { return v.Restaurant } + +// GetCurrency returns UberEatsActivityMetadata.Currency, and is useful for accessing the field via an interface. +func (v *UberEatsActivityMetadata) GetCurrency() string { return v.Currency } + +// GetTotalPrice returns UberEatsActivityMetadata.TotalPrice, and is useful for accessing the field via an interface. +func (v *UberEatsActivityMetadata) GetTotalPrice() float64 { return v.TotalPrice } + +// GetUberEatsActivityMetadataStatus returns UberEatsActivityMetadata.UberEatsActivityMetadataStatus, and is useful for accessing the field via an interface. +func (v *UberEatsActivityMetadata) GetUberEatsActivityMetadataStatus() UberEatsOrderStatus { + return v.UberEatsActivityMetadataStatus +} + +// GetUberEatsActivityMetadataItems returns UberEatsActivityMetadata.UberEatsActivityMetadataItems, and is useful for accessing the field via an interface. +func (v *UberEatsActivityMetadata) GetUberEatsActivityMetadataItems() []UberEatsActivityMetadataUberEatsActivityMetadataItemsUberEatsOrderItem { + return v.UberEatsActivityMetadataItems +} + +// UberEatsActivityMetadataSubjectIdentifier includes the requested fields of the GraphQL type Identifier. +type UberEatsActivityMetadataSubjectIdentifier struct { + Value string `json:"value"` + IdentifierType IdentifierType `json:"identifierType"` +} + +// GetValue returns UberEatsActivityMetadataSubjectIdentifier.Value, and is useful for accessing the field via an interface. +func (v *UberEatsActivityMetadataSubjectIdentifier) GetValue() string { return v.Value } + +// GetIdentifierType returns UberEatsActivityMetadataSubjectIdentifier.IdentifierType, and is useful for accessing the field via an interface. +func (v *UberEatsActivityMetadataSubjectIdentifier) GetIdentifierType() IdentifierType { + return v.IdentifierType +} + +// UberEatsActivityMetadataUberEatsActivityMetadataItemsUberEatsOrderItem includes the requested fields of the GraphQL type UberEatsOrderItem. +type UberEatsActivityMetadataUberEatsActivityMetadataItemsUberEatsOrderItem struct { + Name string `json:"name"` + Price string `json:"price"` + QuantityPurchased graphqlTypes.Int64 `json:"quantityPurchased"` + Customizations []UberEatsActivityMetadataUberEatsActivityMetadataItemsUberEatsOrderItemCustomizations `json:"customizations"` +} + +// GetName returns UberEatsActivityMetadataUberEatsActivityMetadataItemsUberEatsOrderItem.Name, and is useful for accessing the field via an interface. +func (v *UberEatsActivityMetadataUberEatsActivityMetadataItemsUberEatsOrderItem) GetName() string { + return v.Name +} + +// GetPrice returns UberEatsActivityMetadataUberEatsActivityMetadataItemsUberEatsOrderItem.Price, and is useful for accessing the field via an interface. +func (v *UberEatsActivityMetadataUberEatsActivityMetadataItemsUberEatsOrderItem) GetPrice() string { + return v.Price +} + +// GetQuantityPurchased returns UberEatsActivityMetadataUberEatsActivityMetadataItemsUberEatsOrderItem.QuantityPurchased, and is useful for accessing the field via an interface. +func (v *UberEatsActivityMetadataUberEatsActivityMetadataItemsUberEatsOrderItem) GetQuantityPurchased() graphqlTypes.Int64 { + return v.QuantityPurchased +} + +// GetCustomizations returns UberEatsActivityMetadataUberEatsActivityMetadataItemsUberEatsOrderItem.Customizations, and is useful for accessing the field via an interface. +func (v *UberEatsActivityMetadataUberEatsActivityMetadataItemsUberEatsOrderItem) GetCustomizations() []UberEatsActivityMetadataUberEatsActivityMetadataItemsUberEatsOrderItemCustomizations { + return v.Customizations +} + +// UberEatsActivityMetadataUberEatsActivityMetadataItemsUberEatsOrderItemCustomizations includes the requested fields of the GraphQL type UberEatsOrderItemCustomizations. +type UberEatsActivityMetadataUberEatsActivityMetadataItemsUberEatsOrderItemCustomizations struct { + Customization string `json:"customization"` + Value string `json:"value"` + Quantity graphqlTypes.Int64 `json:"quantity"` +} + +// GetCustomization returns UberEatsActivityMetadataUberEatsActivityMetadataItemsUberEatsOrderItemCustomizations.Customization, and is useful for accessing the field via an interface. +func (v *UberEatsActivityMetadataUberEatsActivityMetadataItemsUberEatsOrderItemCustomizations) GetCustomization() string { + return v.Customization +} + +// GetValue returns UberEatsActivityMetadataUberEatsActivityMetadataItemsUberEatsOrderItemCustomizations.Value, and is useful for accessing the field via an interface. +func (v *UberEatsActivityMetadataUberEatsActivityMetadataItemsUberEatsOrderItemCustomizations) GetValue() string { + return v.Value +} + +// GetQuantity returns UberEatsActivityMetadataUberEatsActivityMetadataItemsUberEatsOrderItemCustomizations.Quantity, and is useful for accessing the field via an interface. +func (v *UberEatsActivityMetadataUberEatsActivityMetadataItemsUberEatsOrderItemCustomizations) GetQuantity() graphqlTypes.Int64 { + return v.Quantity +} + +type UberEatsOrderStatus string + +const ( + UberEatsOrderStatusSuccess UberEatsOrderStatus = "SUCCESS" + UberEatsOrderStatusEaterCancelled UberEatsOrderStatus = "EATER_CANCELLED" + UberEatsOrderStatusRestaurantCancelled UberEatsOrderStatus = "RESTAURANT_CANCELLED" + UberEatsOrderStatusRestaurantUnfulfilled UberEatsOrderStatus = "RESTAURANT_UNFULFILLED" + UberEatsOrderStatusUnknown UberEatsOrderStatus = "UNKNOWN" +) + // YoutubeActivityMetadata includes the GraphQL fields of YoutubeActivityMetadata requested by the fragment YoutubeActivityMetadata. type YoutubeActivityMetadata struct { Title string `json:"title"` @@ -2049,15 +2787,19 @@ func (v *YoutubeActivityMetadataSubjectIdentifier) GetIdentifierType() Identifie // __getActivityInput is used internally by genqlient type __getActivityInput struct { - DataKey string `json:"dataKey"` - Source Source `json:"source"` - Limit graphqlTypes.Int64 `json:"limit"` - Page graphqlTypes.Int64 `json:"page"` + DataKey string `json:"dataKey"` + ActivityType []ActivityType `json:"activityType"` + Source Source `json:"source"` + Limit graphqlTypes.Int64 `json:"limit"` + Page graphqlTypes.Int64 `json:"page"` } // GetDataKey returns __getActivityInput.DataKey, and is useful for accessing the field via an interface. func (v *__getActivityInput) GetDataKey() string { return v.DataKey } +// GetActivityType returns __getActivityInput.ActivityType, and is useful for accessing the field via an interface. +func (v *__getActivityInput) GetActivityType() []ActivityType { return v.ActivityType } + // GetSource returns __getActivityInput.Source, and is useful for accessing the field via an interface. func (v *__getActivityInput) GetSource() Source { return v.Source } @@ -2075,6 +2817,22 @@ type __getAppByPublicKeyInput struct { // GetPublicKey returns __getAppByPublicKeyInput.PublicKey, and is useful for accessing the field via an interface. func (v *__getAppByPublicKeyInput) GetPublicKey() string { return v.PublicKey } +// __getTraitsInput is used internally by genqlient +type __getTraitsInput struct { + DataKey string `json:"dataKey"` + Source Source `json:"source"` + Labels []TraitLabel `json:"labels"` +} + +// GetDataKey returns __getTraitsInput.DataKey, and is useful for accessing the field via an interface. +func (v *__getTraitsInput) GetDataKey() string { return v.DataKey } + +// GetSource returns __getTraitsInput.Source, and is useful for accessing the field via an interface. +func (v *__getTraitsInput) GetSource() Source { return v.Source } + +// GetLabels returns __getTraitsInput.Labels, and is useful for accessing the field via an interface. +func (v *__getTraitsInput) GetLabels() []TraitLabel { return v.Labels } + // __lookupActivityInput is used internally by genqlient type __lookupActivityInput struct { DataKey string `json:"dataKey"` @@ -2087,6 +2845,18 @@ func (v *__lookupActivityInput) GetDataKey() string { return v.DataKey } // GetActivityId returns __lookupActivityInput.ActivityId, and is useful for accessing the field via an interface. func (v *__lookupActivityInput) GetActivityId() uuid.UUID { return v.ActivityId } +// __lookupTraitInput is used internally by genqlient +type __lookupTraitInput struct { + DataKey string `json:"dataKey"` + TraitId uuid.UUID `json:"traitId"` +} + +// GetDataKey returns __lookupTraitInput.DataKey, and is useful for accessing the field via an interface. +func (v *__lookupTraitInput) GetDataKey() string { return v.DataKey } + +// GetTraitId returns __lookupTraitInput.TraitId, and is useful for accessing the field via an interface. +func (v *__lookupTraitInput) GetTraitId() uuid.UUID { return v.TraitId } + // getActivityResponse is returned by getActivity on success. type getActivityResponse struct { GetActivity GetActivityActivityResponse `json:"getActivity"` @@ -2105,6 +2875,14 @@ func (v *getAppByPublicKeyResponse) GetGetAppByPublicKey() GetAppByPublicKeyAppl return v.GetAppByPublicKey } +// getTraitsResponse is returned by getTraits on success. +type getTraitsResponse struct { + GetTraits []GetTraitsTrait `json:"getTraits"` +} + +// GetGetTraits returns getTraitsResponse.GetTraits, and is useful for accessing the field via an interface. +func (v *getTraitsResponse) GetGetTraits() []GetTraitsTrait { return v.GetTraits } + // lookupActivityResponse is returned by lookupActivity on success. type lookupActivityResponse struct { LookupActivity LookupActivity `json:"lookupActivity"` @@ -2113,10 +2891,18 @@ type lookupActivityResponse struct { // GetLookupActivity returns lookupActivityResponse.LookupActivity, and is useful for accessing the field via an interface. func (v *lookupActivityResponse) GetLookupActivity() LookupActivity { return v.LookupActivity } +// lookupTraitResponse is returned by lookupTrait on success. +type lookupTraitResponse struct { + LookupTrait LookupTrait `json:"lookupTrait"` +} + +// GetLookupTrait returns lookupTraitResponse.LookupTrait, and is useful for accessing the field via an interface. +func (v *lookupTraitResponse) GetLookupTrait() LookupTrait { return v.LookupTrait } + // The query or mutation executed by getActivity. const getActivity_Operation = ` -query getActivity ($dataKey: String!, $source: Source!, $limit: Int64!, $page: Int64!) { - getActivity(dataKey: $dataKey, source: $source, limit: $limit, page: $page) { +query getActivity ($dataKey: String!, $activityType: [ActivityType], $source: Source!, $limit: Int64!, $page: Int64!) { + getActivity(dataKey: $dataKey, activityType: $activityType, source: $source, limit: $limit, page: $page) { ... on ActivityResponse { data { ... on Activity { @@ -2126,9 +2912,11 @@ query getActivity ($dataKey: String!, $source: Source!, $limit: Int64!, $page: I ... NetflixActivityMetadata ... PlaystationActivityMetadata ... AmazonActivityMetadata + ... BookingActivityMetadata ... YoutubeActivityMetadata ... UberActivityMetadata ... InstacartActivityMetadata + ... UberEatsActivityMetadata } } } @@ -2171,6 +2959,27 @@ fragment AmazonActivityMetadata on AmazonActivityMetadata { quantityPurchased totalCost } +fragment BookingActivityMetadata on BookingActivityMetadata { + subject { + ... on Identifier { + value + identifierType + } + } + bookingID + price + bookings { + ... on BookingItem { + startDateTime + endDateTime + address + depatureLocation + arrivalLocation + layoverLocations + activityType + } + } +} fragment YoutubeActivityMetadata on YoutubeActivityMetadata { title subject { @@ -2219,11 +3028,39 @@ fragment InstacartActivityMetadata on InstacartActivityMetadata { } } } +fragment UberEatsActivityMetadata on UberEatsActivityMetadata { + subject { + ... on Identifier { + value + identifierType + } + } + date + restaurant + currency + totalPrice + UberEatsActivityMetadataStatus: status + UberEatsActivityMetadataItems: items { + ... on UberEatsOrderItem { + name + price + quantityPurchased + customizations { + ... on UberEatsOrderItemCustomizations { + customization + value + quantity + } + } + } + } +} ` func (eye EyeOfSauron) GetActivity( ctx_ context.Context, dataKey string, + activityType []ActivityType, source Source, limit graphqlTypes.Int64, page graphqlTypes.Int64, @@ -2231,6 +3068,7 @@ func (eye EyeOfSauron) GetActivity( req := graphql2.NewRequest(getActivity_Operation) req.Var("dataKey", dataKey) + req.Var("activityType", activityType) req.Var("source", source) req.Var("limit", limit) req.Var("page", page) @@ -2324,6 +3162,66 @@ func (eye EyeOfSauron) GetAppByPublicKey( return &resp_, nil } +// The query or mutation executed by getTraits. +const getTraits_Operation = ` +query getTraits ($dataKey: String!, $source: Source!, $labels: [TraitLabel]!) { + getTraits(dataKey: $dataKey, source: $source, labels: $labels) { + ... on Trait { + id + source + label + value + timestamp + } + } +} +` + +func (eye EyeOfSauron) GetTraits( + ctx_ context.Context, + dataKey string, + source Source, + labels []TraitLabel, +) (*getTraitsResponse, error) { + req := graphql2.NewRequest(getTraits_Operation) + + req.Var("dataKey", dataKey) + req.Var("source", source) + req.Var("labels", labels) + requestBodyObj := struct { + Query string `json:"query"` + Variables map[string]interface{} `json:"variables"` + }{ + Query: req.Query(), + Variables: req.Vars(), + } + + var requestBody bytes.Buffer + if err := json.NewEncoder(&requestBody).Encode(requestBodyObj); err != nil { + return nil, fmt.Errorf("unable to encode body %s", err) + } + + var err_ error + signatureB64, err_ := SignMessageAsBase64(eye.privateKey, requestBody.Bytes()) + if err_ != nil { + return nil, fmt.Errorf("unable to generate signature: %v", err_) + } + + req.Header.Set("X-Gandalf-Signature", signatureB64) + + var resp_ getTraitsResponse + + if err_ := eye.client.Run( + ctx_, + req, + &resp_, + ); err_ != nil { + return nil, fmt.Errorf("failed to execute request: %v", err_) + } + + return &resp_, nil +} + // The query or mutation executed by lookupActivity. const lookupActivity_Operation = ` query lookupActivity ($dataKey: String!, $activityId: UUID!) { @@ -2335,9 +3233,11 @@ query lookupActivity ($dataKey: String!, $activityId: UUID!) { ... NetflixActivityMetadata ... PlaystationActivityMetadata ... AmazonActivityMetadata + ... BookingActivityMetadata ... YoutubeActivityMetadata ... UberActivityMetadata ... InstacartActivityMetadata + ... UberEatsActivityMetadata } } } @@ -2375,6 +3275,27 @@ fragment AmazonActivityMetadata on AmazonActivityMetadata { quantityPurchased totalCost } +fragment BookingActivityMetadata on BookingActivityMetadata { + subject { + ... on Identifier { + value + identifierType + } + } + bookingID + price + bookings { + ... on BookingItem { + startDateTime + endDateTime + address + depatureLocation + arrivalLocation + layoverLocations + activityType + } + } +} fragment YoutubeActivityMetadata on YoutubeActivityMetadata { title subject { @@ -2423,6 +3344,33 @@ fragment InstacartActivityMetadata on InstacartActivityMetadata { } } } +fragment UberEatsActivityMetadata on UberEatsActivityMetadata { + subject { + ... on Identifier { + value + identifierType + } + } + date + restaurant + currency + totalPrice + UberEatsActivityMetadataStatus: status + UberEatsActivityMetadataItems: items { + ... on UberEatsOrderItem { + name + price + quantityPurchased + customizations { + ... on UberEatsOrderItemCustomizations { + customization + value + quantity + } + } + } + } +} ` func (eye EyeOfSauron) LookupActivity( @@ -2467,3 +3415,61 @@ func (eye EyeOfSauron) LookupActivity( return &resp_, nil } + +// The query or mutation executed by lookupTrait. +const lookupTrait_Operation = ` +query lookupTrait ($dataKey: String!, $traitId: UUID!) { + lookupTrait(dataKey: $dataKey, traitId: $traitId) { + ... on Trait { + id + source + label + value + timestamp + } + } +} +` + +func (eye EyeOfSauron) LookupTrait( + ctx_ context.Context, + dataKey string, + traitId uuid.UUID, +) (*lookupTraitResponse, error) { + req := graphql2.NewRequest(lookupTrait_Operation) + + req.Var("dataKey", dataKey) + req.Var("traitId", traitId) + requestBodyObj := struct { + Query string `json:"query"` + Variables map[string]interface{} `json:"variables"` + }{ + Query: req.Query(), + Variables: req.Vars(), + } + + var requestBody bytes.Buffer + if err := json.NewEncoder(&requestBody).Encode(requestBodyObj); err != nil { + return nil, fmt.Errorf("unable to encode body %s", err) + } + + var err_ error + signatureB64, err_ := SignMessageAsBase64(eye.privateKey, requestBody.Bytes()) + if err_ != nil { + return nil, fmt.Errorf("unable to generate signature: %v", err_) + } + + req.Header.Set("X-Gandalf-Signature", signatureB64) + + var resp_ lookupTraitResponse + + if err_ := eye.client.Run( + ctx_, + req, + &resp_, + ); err_ != nil { + return nil, fmt.Errorf("failed to execute request: %v", err_) + } + + return &resp_, nil +} diff --git a/eyeofsauron/example/generated/genqlient.graphql b/eyeofsauron/example/generated/genqlient.graphql index 65cfb3f..99df021 100644 --- a/eyeofsauron/example/generated/genqlient.graphql +++ b/eyeofsauron/example/generated/genqlient.graphql @@ -1,92 +1,142 @@ -fragment NetflixActivityMetadata on NetflixActivityMetadata { - title - subject { +fragment InstacartActivityMetadata on InstacartActivityMetadata { + subject: subject { ... on Identifier { value identifierType } } - date - lastPlayedAt + retailer: retailer + totalOrderAmountSpent: totalOrderAmountSpent + dateOrdered: dateOrdered + dateDelivered: dateDelivered + statusString: statusString + items: items { + ... on InstacartOrderItem { + itemID + productName + unitPrice + status + quantityPurchased + } + } } -fragment AmazonActivityMetadata on AmazonActivityMetadata { - productName - subject { +fragment PlaystationActivityMetadata on PlaystationActivityMetadata { + title: title + subject: subject { + ... on Identifier { + value + identifierType + } + } + lastPlayedAt: lastPlayedAt +} + +fragment BookingActivityMetadata on BookingActivityMetadata { + subject: subject { + ... on Identifier { + value + identifierType + } + } + bookingID: bookingID + price: price + bookings: bookings { + ... on BookingItem { + startDateTime + endDateTime + address + depatureLocation + arrivalLocation + layoverLocations + activityType + } + } +} + +fragment UberActivityMetadata on UberActivityMetadata { + subject: subject { ... on Identifier { value identifierType } } - date - quantityPurchased - totalCost + beginTripTime: beginTripTime + dropoffTime: dropoffTime + cost: cost + city: city + distance: distance + status: status } fragment YoutubeActivityMetadata on YoutubeActivityMetadata { - title - subject { + title: title + subject: subject { ... on Identifier { value identifierType } } - date - percentageWatched - contentType + date: date + percentageWatched: percentageWatched + contentType: contentType } -fragment InstacartActivityMetadata on InstacartActivityMetadata { - subject { +fragment UberEatsActivityMetadata on UberEatsActivityMetadata { + subject: subject { ... on Identifier { value identifierType } } - retailer - totalOrderAmountSpent - dateOrdered - dateDelivered - statusString - items { - ... on InstacartOrderItem { - itemID - productName - unitPrice - status + date: date + restaurant: restaurant + currency: currency + totalPrice: totalPrice + UberEatsActivityMetadataStatus: status + UberEatsActivityMetadataItems: items { + ... on UberEatsOrderItem { + name + price quantityPurchased + customizations { + ... on UberEatsOrderItemCustomizations { + customization + value + quantity + } + } } } } -fragment PlaystationActivityMetadata on PlaystationActivityMetadata { - title - subject { +fragment AmazonActivityMetadata on AmazonActivityMetadata { + productName: productName + subject: subject { ... on Identifier { value identifierType } } - lastPlayedAt + date: date + quantityPurchased: quantityPurchased + totalCost: totalCost } -fragment UberActivityMetadata on UberActivityMetadata { - subject { +fragment NetflixActivityMetadata on NetflixActivityMetadata { + title: title + subject: subject { ... on Identifier { value identifierType } } - beginTripTime - dropoffTime - cost - city - distance - status + date: date + lastPlayedAt: lastPlayedAt } -query getActivity($dataKey: String!, $source: Source!, $limit: Int64!, $page: Int64!) { - getActivity(dataKey: $dataKey, source: $source, limit: $limit, page: $page) { +query getActivity($dataKey: String!, $activityType: [ActivityType], $source: Source!, $limit: Int64!, $page: Int64!) { + getActivity(dataKey: $dataKey, activityType: $activityType, source: $source, limit: $limit, page: $page) { ... on ActivityResponse { data { ... on Activity { @@ -95,9 +145,11 @@ query getActivity($dataKey: String!, $source: Source!, $limit: Int64!, $page: In ...NetflixActivityMetadata ...PlaystationActivityMetadata ...AmazonActivityMetadata + ...BookingActivityMetadata ...YoutubeActivityMetadata ...UberActivityMetadata ...InstacartActivityMetadata + ...UberEatsActivityMetadata } } } @@ -116,9 +168,11 @@ query lookupActivity($dataKey: String!, $activityId: UUID!) { ...NetflixActivityMetadata ...PlaystationActivityMetadata ...AmazonActivityMetadata + ...BookingActivityMetadata ...YoutubeActivityMetadata ...UberActivityMetadata ...InstacartActivityMetadata + ...UberEatsActivityMetadata } } } @@ -136,3 +190,27 @@ query getAppByPublicKey($publicKey: String!) { } } +query getTraits($dataKey: String!, $source: Source!, $labels: [TraitLabel]!) { + getTraits(dataKey: $dataKey, source: $source, labels: $labels) { + ... on Trait { + id + source + label + value + timestamp + } + } +} + +query lookupTrait($dataKey: String!, $traitId: UUID!) { + lookupTrait(dataKey: $dataKey, traitId: $traitId) { + ... on Trait { + id + source + label + value + timestamp + } + } +} + diff --git a/eyeofsauron/example/generated/schema.graphql b/eyeofsauron/example/generated/schema.graphql index 088eadb..e99bd5e 100644 --- a/eyeofsauron/example/generated/schema.graphql +++ b/eyeofsauron/example/generated/schema.graphql @@ -14,6 +14,14 @@ type ActivityResponse { page: Int64! } +enum ActivityType { + TRIP + STAY + SHOP + PLAY + WATCH +} + type AmazonActivityMetadata implements ActivityMetadata { productName: String! subject: [Identifier] @@ -30,6 +38,23 @@ type Application { appRegistrar: String! } +type BookingActivityMetadata implements ActivityMetadata { + subject: [Identifier] + bookingID: String! + price: String! + bookings: [BookingItem]! +} + +type BookingItem { + startDateTime: Time! + endDateTime: Time! + address: String! + depatureLocation: String! + arrivalLocation: String! + layoverLocations: [String]! + activityType: ActivityType! +} + scalar Boolean enum ContentType { @@ -60,7 +85,9 @@ enum IdentifierType { TVDB TVMAZE UBER + BOOKING INSTACART + UBEREATS } type InstacartActivityMetadata implements ActivityMetadata { @@ -70,7 +97,7 @@ type InstacartActivityMetadata implements ActivityMetadata { dateOrdered: Date! dateDelivered: Date! statusString: String! - items: [InstacartOrderItem!]! + items: [InstacartOrderItem]! } enum InstacartItemStatus { @@ -113,9 +140,11 @@ type PlaystationActivityMetadata implements ActivityMetadata { } type Query { - getActivity(dataKey: String!, source: Source!, limit: Int64!, page: Int64!): ActivityResponse! + getActivity(dataKey: String!, activityType: [ActivityType], source: Source!, limit: Int64!, page: Int64!): ActivityResponse! lookupActivity(dataKey: String!, activityId: UUID!): Activity! getAppByPublicKey(publicKey: String!): Application! + getTraits(dataKey: String!, source: Source!, labels: [TraitLabel]!): [Trait]! + lookupTrait(dataKey: String!, traitId: UUID!): Trait! } enum Source { @@ -124,13 +153,41 @@ enum Source { YOUTUBE AMAZON UBER + BOOKING INSTACART + INSTAGRAM + X + UBEREATS + GANDALF } scalar String scalar Time +type Trait { + id: UUID! + source: Source! + label: TraitLabel! + value: String! + timestamp: Time! +} + +enum TraitLabel { + PRIME_SUBSCRIBER + RATING + TRIP_COUNT + ACCOUNT_CREATED_ON + PLAN + GENIUS_LEVEL + FOLLOWER_COUNT + FOLLOWING_COUNT + USERNAME + POST_COUNT + EMAIL + ORDER_COUNT +} + enum TripStatus { CANCELED COMPLETED @@ -149,6 +206,37 @@ type UberActivityMetadata implements ActivityMetadata { status: TripStatus! } +type UberEatsActivityMetadata implements ActivityMetadata { + subject: [Identifier] + date: Date + restaurant: String! + currency: String! + totalPrice: Float! + status: UberEatsOrderStatus! + items: [UberEatsOrderItem]! +} + +type UberEatsOrderItem { + name: String! + price: String! + quantityPurchased: Int64! + customizations: [UberEatsOrderItemCustomizations]! +} + +type UberEatsOrderItemCustomizations { + customization: String! + value: String! + quantity: Int64! +} + +enum UberEatsOrderStatus { + SUCCESS + EATER_CANCELLED + RESTAURANT_CANCELLED + RESTAURANT_UNFULFILLED + UNKNOWN +} + type YoutubeActivityMetadata implements ActivityMetadata { title: String! subject: [Identifier] diff --git a/eyeofsauron/example/main.go b/eyeofsauron/example/main.go index 4f20984..33fd6c5 100644 --- a/eyeofsauron/example/main.go +++ b/eyeofsauron/example/main.go @@ -18,11 +18,13 @@ func main() { response, err := eye.GetActivity( context.Background(), - "BG7u85FMLGnYnUv2ZsFTAXrGT2Xw3TikrBHm2kYz31qq", + "3pLT1hCieyPQQb876i24D34Qf8y6Yyke5m4rhPRhV67D", + []generated.ActivityType{generated.ActivityTypeWatch}, generated.SourceNetflix, 100, 1, ) + if err != nil { log.Fatalf("failed to run gandalf client: %s", err) } @@ -31,7 +33,7 @@ func main() { activityID, _ := uuid.Parse(activity.Id) response, err := eye.LookupActivity( context.Background(), - "BG7u85FMLGnYnUv2ZsFTAXrGT2Xw3TikrBHm2kYz31qq", + "3pLT1hCieyPQQb876i24D34Qf8y6Yyke5m4rhPRhV67D", activityID, ) @@ -40,6 +42,9 @@ func main() { } printLookupActivityMetadata(response.LookupActivity.GetMetadata()) } + + getTrait() + lookupTrait() } func printGetActivityMetadata(metadata interface{}) { @@ -100,3 +105,37 @@ func printJSON(v interface{}) { } fmt.Println(string(jsonData)) } + +func getTrait() { + // Initialization + eye, err := generated.NewEyeOfSauron("8c48ad0e5892d51d8e2e411a77a1d73ebe764b619c846d1cab3dc45ee172e8ca") + if err != nil { + log.Fatalf("failed to run gandalf client: %s", err) + } + + response, err := eye.GetTraits(context.Background(), "3pLT1hCieyPQQb876i24D34Qf8y6Yyke5m4rhPRhV67D", generated.SourceNetflix, []generated.TraitLabel{generated.TraitLabelPlan}) + if err != nil { + log.Fatalf("failed to get traits: %s", err) + } + + fmt.Println("Get Traits", response.GetGetTraits()) +} + +func lookupTrait() { + // Lookup trait + eye, err := generated.NewEyeOfSauron("8c48ad0e5892d51d8e2e411a77a1d73ebe764b619c846d1cab3dc45ee172e8ca") + if err != nil { + log.Fatalf("failed to run gandalf client: %s", err) + } + + traitID, err := uuid.Parse("e55bf3a6-66a5-4902-b7f2-34e352b65d52") + if err != nil { + log.Fatalf("failed to parse string to uuid") + } + response, err := eye.LookupTrait(context.Background(), "3pLT1hCieyPQQb876i24D34Qf8y6Yyke5m4rhPRhV67D", traitID) + if err != nil { + log.Fatalf("failed to get traits: %s", err) + } + + fmt.Println("Lookup Trait", response.GetLookupTrait()) +} diff --git a/eyeofsauron/main.go b/eyeofsauron/main.go index 4e9f909..e8bc37d 100644 --- a/eyeofsauron/main.go +++ b/eyeofsauron/main.go @@ -8,6 +8,8 @@ import ( "os" "path/filepath" "strings" + "unicode" + "unicode/utf8" graphqlClient "github.com/gandalf-network/gandalf-sdk-go/eyeofsauron/graphql" "github.com/gandalf-network/gandalf-sdk-go/eyeofsauron/constants" @@ -74,7 +76,7 @@ func main() { // Join the CWD with the provided folder path folder = filepath.Join(cwd, folder) - client := graphqlClient.NewClient("https://sauron.gandalf.network/public/gql") + client := graphqlClient.NewClient("https://sauron-staging.gandalf.network/public/gql") req := graphqlClient.NewRequest(constants.IntrospectionQuery) ctx := context.Background() @@ -290,6 +292,8 @@ func findInnermostType(t *Type) *Type { } func generateFragments(sb *strings.Builder, typesMap map[string]Type, interfaceImplementations map[string][]string) string { + typeFieldMap := make(map[string]map[string]string) + for typeName, typeValue := range typesMap { fields := typeValue.Fields if len(typeValue.Interfaces) == 0 { @@ -298,9 +302,25 @@ func generateFragments(sb *strings.Builder, typesMap map[string]Type, interfaceI sb.WriteString(fmt.Sprintf("fragment %s on %s {\n", typeName, typeName)) for _, field := range fields { - sb.WriteString(fmt.Sprintf(" %s", field.Name)) - + fieldName := field.Name innermostType := findInnermostType(&field.Type) + + if _, exists := typeFieldMap[fieldName]; !exists { + typeFieldMap[fieldName] = make(map[string]string) + } + + if alias, ok := typeFieldMap[fieldName][innermostType.Name]; ok { + sb.WriteString(fmt.Sprintf(" %s: %s", alias, field.Name)) + } else { + alias := fieldName + if _, exists := typeFieldMap[fieldName]["default"]; exists { + alias = fmt.Sprintf("%s%s", typeName, upperFirst(fieldName)) + } + typeFieldMap[fieldName]["default"] = alias + typeFieldMap[fieldName][innermostType.Name] = alias + sb.WriteString(fmt.Sprintf(" %s: %s", alias, field.Name)) + } + if innermostType.Kind == "INTERFACE" { sb.WriteString(fmt.Sprintf(" {\n ...%s\n }\n", innermostType.Name)) } else if innermostType.Kind == "OBJECT" { @@ -377,7 +397,9 @@ func writeFieldSelection(sb *strings.Builder, t Type, typesMap map[string]Type, sb.WriteString(" {\n") typeValue := typesMap[t.Name] for _, field := range typeValue.Fields { + sb.WriteString(fmt.Sprintf(" %s", field.Name)) + if len(field.Args) > 0 { sb.WriteString("(") for i, arg := range field.Args { @@ -397,9 +419,13 @@ func writeFieldSelection(sb *strings.Builder, t Type, typesMap map[string]Type, } sb.WriteString(" }\n") } else if field.Type.OfType.Kind == "OBJECT" || field.Type.OfType.Kind == "UNION" || field.Type.OfType.Kind == "LIST" { - sb.WriteString(" {\n") - writeFieldSelection(sb, *field.Type.OfType, typesMap, interfaceImplementations) - sb.WriteString(" }\n") + if field.Type.OfType.OfType != nil && field.Type.OfType.OfType.Kind != "SCALAR" { + sb.WriteString(" {\n") + writeFieldSelection(sb, *field.Type.OfType, typesMap, interfaceImplementations) + sb.WriteString(" }\n") + } else { + sb.WriteString(" \n") + } } else { sb.WriteString("\n") } @@ -408,8 +434,6 @@ func writeFieldSelection(sb *strings.Builder, t Type, typesMap map[string]Type, } } sb.WriteString(" }\n") - } else { - sb.WriteString(fmt.Sprintf(" %s\n", t.Name)) } } @@ -423,3 +447,15 @@ func writeToFile(filename, content string) { log.Fatalf("Error writing to file %s: %v", filename, err) } } + +func changeFirst(s string, f func(rune) rune) string { + c, n := utf8.DecodeRuneInString(s) + if c == utf8.RuneError { + return s + } + return string(f(c)) + s[n:] +} + +func upperFirst(s string) string { + return changeFirst(strings.TrimLeft(s, "_"), unicode.ToUpper) +} diff --git a/generated/generated.go b/generated/generated.go new file mode 100644 index 0000000..39335eb --- /dev/null +++ b/generated/generated.go @@ -0,0 +1,3475 @@ +// Code generated by github.com/gandalf-network/gandalf-sdk-go/eyeofsauron, DO NOT EDIT. + +package generated + +import ( + "bytes" + "context" + "crypto/ecdsa" + "crypto/rand" + "crypto/sha256" + "encoding/base64" + "encoding/hex" + "encoding/json" + "fmt" + "strings" + "time" + + "github.com/btcsuite/btcd/btcec/v2" + graphql2 "github.com/gandalf-network/gandalf-sdk-go/eyeofsauron/graphql" + "github.com/gandalf-network/gandalf-sdk-go/eyeofsauron/graphqlTypes" + "github.com/gandalf-network/genqlient/graphql" + "github.com/google/uuid" +) + +type EyeOfSauron struct { + client *graphql2.Client + privateKey *ecdsa.PrivateKey +} + +func NewEyeOfSauron(privateKey string) (*EyeOfSauron, error) { + client := graphql2.NewClient("https://sauron.gandalf.network/public/gql") + privKey, err := HexToECDSAPrivateKey(privateKey) + if err != nil { + return nil, fmt.Errorf("failed to parse private key: %v", err) + } + return &EyeOfSauron{ + privateKey: privKey, + client: client, + }, nil +} + +// HexToECDSAPrivateKey converts a hexadecimal string representing a private key +// into an *ecdsa.PrivateKey for the secp256k1 curve. +func HexToECDSAPrivateKey(hexKey string) (*ecdsa.PrivateKey, error) { + trimmedHexKey := strings.TrimPrefix(hexKey, "0x") + + privKeyBytes, err := hex.DecodeString(trimmedHexKey) + if err != nil { + return nil, fmt.Errorf("failed to decode hex string: %v", err) + } + + privKey, _ := btcec.PrivKeyFromBytes(privKeyBytes) + + return privKey.ToECDSA(), nil +} + +// SignMessage signs a message using the given ECDSA private key. +func SignMessageAsBase64(privKey *ecdsa.PrivateKey, message []byte) (string, error) { + hash := sha256.Sum256(message) + + signature, err := ecdsa.SignASN1(rand.Reader, privKey, hash[:]) + if err != nil { + return "", fmt.Errorf("failed to sign message: %v", err) + } + + signatureB64 := base64.StdEncoding.EncodeToString(signature) + + return signatureB64, nil +} + +type ActivityType string + +const ( + ActivityTypeTrip ActivityType = "TRIP" + ActivityTypeStay ActivityType = "STAY" + ActivityTypeShop ActivityType = "SHOP" + ActivityTypePlay ActivityType = "PLAY" + ActivityTypeWatch ActivityType = "WATCH" +) + +// AmazonActivityMetadata includes the GraphQL fields of AmazonActivityMetadata requested by the fragment AmazonActivityMetadata. +type AmazonActivityMetadata struct { + ProductName string `json:"productName"` + Subject []AmazonActivityMetadataSubjectIdentifier `json:"subject"` + Date graphqlTypes.Date `json:"date"` + QuantityPurchased int `json:"quantityPurchased"` + TotalCost string `json:"totalCost"` +} + +// GetProductName returns AmazonActivityMetadata.ProductName, and is useful for accessing the field via an interface. +func (v *AmazonActivityMetadata) GetProductName() string { return v.ProductName } + +// GetSubject returns AmazonActivityMetadata.Subject, and is useful for accessing the field via an interface. +func (v *AmazonActivityMetadata) GetSubject() []AmazonActivityMetadataSubjectIdentifier { + return v.Subject +} + +// GetDate returns AmazonActivityMetadata.Date, and is useful for accessing the field via an interface. +func (v *AmazonActivityMetadata) GetDate() graphqlTypes.Date { return v.Date } + +// GetQuantityPurchased returns AmazonActivityMetadata.QuantityPurchased, and is useful for accessing the field via an interface. +func (v *AmazonActivityMetadata) GetQuantityPurchased() int { return v.QuantityPurchased } + +// GetTotalCost returns AmazonActivityMetadata.TotalCost, and is useful for accessing the field via an interface. +func (v *AmazonActivityMetadata) GetTotalCost() string { return v.TotalCost } + +// AmazonActivityMetadataSubjectIdentifier includes the requested fields of the GraphQL type Identifier. +type AmazonActivityMetadataSubjectIdentifier struct { + Value string `json:"value"` + IdentifierType IdentifierType `json:"identifierType"` +} + +// GetValue returns AmazonActivityMetadataSubjectIdentifier.Value, and is useful for accessing the field via an interface. +func (v *AmazonActivityMetadataSubjectIdentifier) GetValue() string { return v.Value } + +// GetIdentifierType returns AmazonActivityMetadataSubjectIdentifier.IdentifierType, and is useful for accessing the field via an interface. +func (v *AmazonActivityMetadataSubjectIdentifier) GetIdentifierType() IdentifierType { + return v.IdentifierType +} + +// BookingActivityMetadata includes the GraphQL fields of BookingActivityMetadata requested by the fragment BookingActivityMetadata. +type BookingActivityMetadata struct { + Subject []BookingActivityMetadataSubjectIdentifier `json:"subject"` + BookingID string `json:"bookingID"` + Price string `json:"price"` + Bookings []BookingActivityMetadataBookingsBookingItem `json:"bookings"` +} + +// GetSubject returns BookingActivityMetadata.Subject, and is useful for accessing the field via an interface. +func (v *BookingActivityMetadata) GetSubject() []BookingActivityMetadataSubjectIdentifier { + return v.Subject +} + +// GetBookingID returns BookingActivityMetadata.BookingID, and is useful for accessing the field via an interface. +func (v *BookingActivityMetadata) GetBookingID() string { return v.BookingID } + +// GetPrice returns BookingActivityMetadata.Price, and is useful for accessing the field via an interface. +func (v *BookingActivityMetadata) GetPrice() string { return v.Price } + +// GetBookings returns BookingActivityMetadata.Bookings, and is useful for accessing the field via an interface. +func (v *BookingActivityMetadata) GetBookings() []BookingActivityMetadataBookingsBookingItem { + return v.Bookings +} + +// BookingActivityMetadataBookingsBookingItem includes the requested fields of the GraphQL type BookingItem. +type BookingActivityMetadataBookingsBookingItem struct { + StartDateTime time.Time `json:"startDateTime"` + EndDateTime time.Time `json:"endDateTime"` + Address string `json:"address"` + DepatureLocation string `json:"depatureLocation"` + ArrivalLocation string `json:"arrivalLocation"` + LayoverLocations []string `json:"layoverLocations"` + ActivityType ActivityType `json:"activityType"` +} + +// GetStartDateTime returns BookingActivityMetadataBookingsBookingItem.StartDateTime, and is useful for accessing the field via an interface. +func (v *BookingActivityMetadataBookingsBookingItem) GetStartDateTime() time.Time { + return v.StartDateTime +} + +// GetEndDateTime returns BookingActivityMetadataBookingsBookingItem.EndDateTime, and is useful for accessing the field via an interface. +func (v *BookingActivityMetadataBookingsBookingItem) GetEndDateTime() time.Time { return v.EndDateTime } + +// GetAddress returns BookingActivityMetadataBookingsBookingItem.Address, and is useful for accessing the field via an interface. +func (v *BookingActivityMetadataBookingsBookingItem) GetAddress() string { return v.Address } + +// GetDepatureLocation returns BookingActivityMetadataBookingsBookingItem.DepatureLocation, and is useful for accessing the field via an interface. +func (v *BookingActivityMetadataBookingsBookingItem) GetDepatureLocation() string { + return v.DepatureLocation +} + +// GetArrivalLocation returns BookingActivityMetadataBookingsBookingItem.ArrivalLocation, and is useful for accessing the field via an interface. +func (v *BookingActivityMetadataBookingsBookingItem) GetArrivalLocation() string { + return v.ArrivalLocation +} + +// GetLayoverLocations returns BookingActivityMetadataBookingsBookingItem.LayoverLocations, and is useful for accessing the field via an interface. +func (v *BookingActivityMetadataBookingsBookingItem) GetLayoverLocations() []string { + return v.LayoverLocations +} + +// GetActivityType returns BookingActivityMetadataBookingsBookingItem.ActivityType, and is useful for accessing the field via an interface. +func (v *BookingActivityMetadataBookingsBookingItem) GetActivityType() ActivityType { + return v.ActivityType +} + +// BookingActivityMetadataSubjectIdentifier includes the requested fields of the GraphQL type Identifier. +type BookingActivityMetadataSubjectIdentifier struct { + Value string `json:"value"` + IdentifierType IdentifierType `json:"identifierType"` +} + +// GetValue returns BookingActivityMetadataSubjectIdentifier.Value, and is useful for accessing the field via an interface. +func (v *BookingActivityMetadataSubjectIdentifier) GetValue() string { return v.Value } + +// GetIdentifierType returns BookingActivityMetadataSubjectIdentifier.IdentifierType, and is useful for accessing the field via an interface. +func (v *BookingActivityMetadataSubjectIdentifier) GetIdentifierType() IdentifierType { + return v.IdentifierType +} + +type ContentType string + +const ( + ContentTypeVideo ContentType = "VIDEO" + ContentTypeShorts ContentType = "SHORTS" + ContentTypeMusic ContentType = "MUSIC" +) + +// GetActivityActivityResponse includes the requested fields of the GraphQL type ActivityResponse. +type GetActivityActivityResponse struct { + Data []GetActivityActivityResponseDataActivity `json:"data"` + Limit graphqlTypes.Int64 `json:"limit"` + Total graphqlTypes.Int64 `json:"total"` + Page graphqlTypes.Int64 `json:"page"` +} + +// GetData returns GetActivityActivityResponse.Data, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponse) GetData() []GetActivityActivityResponseDataActivity { + return v.Data +} + +// GetLimit returns GetActivityActivityResponse.Limit, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponse) GetLimit() graphqlTypes.Int64 { return v.Limit } + +// GetTotal returns GetActivityActivityResponse.Total, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponse) GetTotal() graphqlTypes.Int64 { return v.Total } + +// GetPage returns GetActivityActivityResponse.Page, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponse) GetPage() graphqlTypes.Int64 { return v.Page } + +// GetActivityActivityResponseDataActivity includes the requested fields of the GraphQL type Activity. +type GetActivityActivityResponseDataActivity struct { + Id string `json:"id"` + Metadata GetActivityActivityResponseDataActivityMetadata `json:"-"` +} + +// GetId returns GetActivityActivityResponseDataActivity.Id, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivity) GetId() string { return v.Id } + +// GetMetadata returns GetActivityActivityResponseDataActivity.Metadata, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivity) GetMetadata() GetActivityActivityResponseDataActivityMetadata { + return v.Metadata +} + +func (v *GetActivityActivityResponseDataActivity) UnmarshalJSON(b []byte) error { + + if string(b) == "null" { + return nil + } + + var firstPass struct { + *GetActivityActivityResponseDataActivity + Metadata json.RawMessage `json:"metadata"` + graphql.NoUnmarshalJSON + } + firstPass.GetActivityActivityResponseDataActivity = v + + err := json.Unmarshal(b, &firstPass) + if err != nil { + return err + } + + { + dst := &v.Metadata + src := firstPass.Metadata + if len(src) != 0 && string(src) != "null" { + err = __unmarshalGetActivityActivityResponseDataActivityMetadata( + src, dst) + if err != nil { + return fmt.Errorf( + "unable to unmarshal GetActivityActivityResponseDataActivity.Metadata: %w", err) + } + } + } + return nil +} + +type __premarshalGetActivityActivityResponseDataActivity struct { + Id string `json:"id"` + + Metadata json.RawMessage `json:"metadata"` +} + +func (v *GetActivityActivityResponseDataActivity) MarshalJSON() ([]byte, error) { + premarshaled, err := v.__premarshalJSON() + if err != nil { + return nil, err + } + return json.Marshal(premarshaled) +} + +func (v *GetActivityActivityResponseDataActivity) __premarshalJSON() (*__premarshalGetActivityActivityResponseDataActivity, error) { + var retval __premarshalGetActivityActivityResponseDataActivity + + retval.Id = v.Id + { + + dst := &retval.Metadata + src := v.Metadata + var err error + *dst, err = __marshalGetActivityActivityResponseDataActivityMetadata( + &src) + if err != nil { + return nil, fmt.Errorf( + "unable to marshal GetActivityActivityResponseDataActivity.Metadata: %w", err) + } + } + return &retval, nil +} + +// GetActivityActivityResponseDataActivityMetadata includes the requested fields of the GraphQL interface ActivityMetadata. +// +// GetActivityActivityResponseDataActivityMetadata is implemented by the following types: +// GetActivityActivityResponseDataActivityMetadataAmazonActivityMetadata +// GetActivityActivityResponseDataActivityMetadataBookingActivityMetadata +// GetActivityActivityResponseDataActivityMetadataInstacartActivityMetadata +// GetActivityActivityResponseDataActivityMetadataNetflixActivityMetadata +// GetActivityActivityResponseDataActivityMetadataPlaystationActivityMetadata +// GetActivityActivityResponseDataActivityMetadataUberActivityMetadata +// GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata +// GetActivityActivityResponseDataActivityMetadataYoutubeActivityMetadata +type GetActivityActivityResponseDataActivityMetadata interface { + implementsGraphQLInterfaceGetActivityActivityResponseDataActivityMetadata() + // GetTypename returns the receiver's concrete GraphQL type-name (see interface doc for possible values). + GetTypename() string +} + +func (v *GetActivityActivityResponseDataActivityMetadataAmazonActivityMetadata) implementsGraphQLInterfaceGetActivityActivityResponseDataActivityMetadata() { +} +func (v *GetActivityActivityResponseDataActivityMetadataBookingActivityMetadata) implementsGraphQLInterfaceGetActivityActivityResponseDataActivityMetadata() { +} +func (v *GetActivityActivityResponseDataActivityMetadataInstacartActivityMetadata) implementsGraphQLInterfaceGetActivityActivityResponseDataActivityMetadata() { +} +func (v *GetActivityActivityResponseDataActivityMetadataNetflixActivityMetadata) implementsGraphQLInterfaceGetActivityActivityResponseDataActivityMetadata() { +} +func (v *GetActivityActivityResponseDataActivityMetadataPlaystationActivityMetadata) implementsGraphQLInterfaceGetActivityActivityResponseDataActivityMetadata() { +} +func (v *GetActivityActivityResponseDataActivityMetadataUberActivityMetadata) implementsGraphQLInterfaceGetActivityActivityResponseDataActivityMetadata() { +} +func (v *GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata) implementsGraphQLInterfaceGetActivityActivityResponseDataActivityMetadata() { +} +func (v *GetActivityActivityResponseDataActivityMetadataYoutubeActivityMetadata) implementsGraphQLInterfaceGetActivityActivityResponseDataActivityMetadata() { +} + +func __unmarshalGetActivityActivityResponseDataActivityMetadata(b []byte, v *GetActivityActivityResponseDataActivityMetadata) error { + if string(b) == "null" { + return nil + } + + var tn struct { + TypeName string `json:"__typename"` + } + err := json.Unmarshal(b, &tn) + if err != nil { + return err + } + + switch tn.TypeName { + case "AmazonActivityMetadata": + *v = new(GetActivityActivityResponseDataActivityMetadataAmazonActivityMetadata) + return json.Unmarshal(b, *v) + case "BookingActivityMetadata": + *v = new(GetActivityActivityResponseDataActivityMetadataBookingActivityMetadata) + return json.Unmarshal(b, *v) + case "InstacartActivityMetadata": + *v = new(GetActivityActivityResponseDataActivityMetadataInstacartActivityMetadata) + return json.Unmarshal(b, *v) + case "NetflixActivityMetadata": + *v = new(GetActivityActivityResponseDataActivityMetadataNetflixActivityMetadata) + return json.Unmarshal(b, *v) + case "PlaystationActivityMetadata": + *v = new(GetActivityActivityResponseDataActivityMetadataPlaystationActivityMetadata) + return json.Unmarshal(b, *v) + case "UberActivityMetadata": + *v = new(GetActivityActivityResponseDataActivityMetadataUberActivityMetadata) + return json.Unmarshal(b, *v) + case "UberEatsActivityMetadata": + *v = new(GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata) + return json.Unmarshal(b, *v) + case "YoutubeActivityMetadata": + *v = new(GetActivityActivityResponseDataActivityMetadataYoutubeActivityMetadata) + return json.Unmarshal(b, *v) + case "": + return fmt.Errorf( + "response was missing ActivityMetadata.__typename") + default: + return fmt.Errorf( + `unexpected concrete type for GetActivityActivityResponseDataActivityMetadata: "%v"`, tn.TypeName) + } +} + +func __marshalGetActivityActivityResponseDataActivityMetadata(v *GetActivityActivityResponseDataActivityMetadata) ([]byte, error) { + + var typename string + switch v := (*v).(type) { + case *GetActivityActivityResponseDataActivityMetadataAmazonActivityMetadata: + typename = "AmazonActivityMetadata" + + premarshaled, err := v.__premarshalJSON() + if err != nil { + return nil, err + } + result := struct { + TypeName string `json:"__typename"` + *__premarshalGetActivityActivityResponseDataActivityMetadataAmazonActivityMetadata + }{typename, premarshaled} + return json.Marshal(result) + case *GetActivityActivityResponseDataActivityMetadataBookingActivityMetadata: + typename = "BookingActivityMetadata" + + premarshaled, err := v.__premarshalJSON() + if err != nil { + return nil, err + } + result := struct { + TypeName string `json:"__typename"` + *__premarshalGetActivityActivityResponseDataActivityMetadataBookingActivityMetadata + }{typename, premarshaled} + return json.Marshal(result) + case *GetActivityActivityResponseDataActivityMetadataInstacartActivityMetadata: + typename = "InstacartActivityMetadata" + + premarshaled, err := v.__premarshalJSON() + if err != nil { + return nil, err + } + result := struct { + TypeName string `json:"__typename"` + *__premarshalGetActivityActivityResponseDataActivityMetadataInstacartActivityMetadata + }{typename, premarshaled} + return json.Marshal(result) + case *GetActivityActivityResponseDataActivityMetadataNetflixActivityMetadata: + typename = "NetflixActivityMetadata" + + premarshaled, err := v.__premarshalJSON() + if err != nil { + return nil, err + } + result := struct { + TypeName string `json:"__typename"` + *__premarshalGetActivityActivityResponseDataActivityMetadataNetflixActivityMetadata + }{typename, premarshaled} + return json.Marshal(result) + case *GetActivityActivityResponseDataActivityMetadataPlaystationActivityMetadata: + typename = "PlaystationActivityMetadata" + + premarshaled, err := v.__premarshalJSON() + if err != nil { + return nil, err + } + result := struct { + TypeName string `json:"__typename"` + *__premarshalGetActivityActivityResponseDataActivityMetadataPlaystationActivityMetadata + }{typename, premarshaled} + return json.Marshal(result) + case *GetActivityActivityResponseDataActivityMetadataUberActivityMetadata: + typename = "UberActivityMetadata" + + premarshaled, err := v.__premarshalJSON() + if err != nil { + return nil, err + } + result := struct { + TypeName string `json:"__typename"` + *__premarshalGetActivityActivityResponseDataActivityMetadataUberActivityMetadata + }{typename, premarshaled} + return json.Marshal(result) + case *GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata: + typename = "UberEatsActivityMetadata" + + premarshaled, err := v.__premarshalJSON() + if err != nil { + return nil, err + } + result := struct { + TypeName string `json:"__typename"` + *__premarshalGetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata + }{typename, premarshaled} + return json.Marshal(result) + case *GetActivityActivityResponseDataActivityMetadataYoutubeActivityMetadata: + typename = "YoutubeActivityMetadata" + + premarshaled, err := v.__premarshalJSON() + if err != nil { + return nil, err + } + result := struct { + TypeName string `json:"__typename"` + *__premarshalGetActivityActivityResponseDataActivityMetadataYoutubeActivityMetadata + }{typename, premarshaled} + return json.Marshal(result) + case nil: + return []byte("null"), nil + default: + return nil, fmt.Errorf( + `unexpected concrete type for GetActivityActivityResponseDataActivityMetadata: "%T"`, v) + } +} + +// GetActivityActivityResponseDataActivityMetadataAmazonActivityMetadata includes the requested fields of the GraphQL type AmazonActivityMetadata. +type GetActivityActivityResponseDataActivityMetadataAmazonActivityMetadata struct { + Typename string `json:"__typename"` + AmazonActivityMetadata `json:"-"` +} + +// GetTypename returns GetActivityActivityResponseDataActivityMetadataAmazonActivityMetadata.Typename, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataAmazonActivityMetadata) GetTypename() string { + return v.Typename +} + +// GetProductName returns GetActivityActivityResponseDataActivityMetadataAmazonActivityMetadata.ProductName, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataAmazonActivityMetadata) GetProductName() string { + return v.AmazonActivityMetadata.ProductName +} + +// GetSubject returns GetActivityActivityResponseDataActivityMetadataAmazonActivityMetadata.Subject, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataAmazonActivityMetadata) GetSubject() []AmazonActivityMetadataSubjectIdentifier { + return v.AmazonActivityMetadata.Subject +} + +// GetDate returns GetActivityActivityResponseDataActivityMetadataAmazonActivityMetadata.Date, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataAmazonActivityMetadata) GetDate() graphqlTypes.Date { + return v.AmazonActivityMetadata.Date +} + +// GetQuantityPurchased returns GetActivityActivityResponseDataActivityMetadataAmazonActivityMetadata.QuantityPurchased, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataAmazonActivityMetadata) GetQuantityPurchased() int { + return v.AmazonActivityMetadata.QuantityPurchased +} + +// GetTotalCost returns GetActivityActivityResponseDataActivityMetadataAmazonActivityMetadata.TotalCost, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataAmazonActivityMetadata) GetTotalCost() string { + return v.AmazonActivityMetadata.TotalCost +} + +func (v *GetActivityActivityResponseDataActivityMetadataAmazonActivityMetadata) UnmarshalJSON(b []byte) error { + + if string(b) == "null" { + return nil + } + + var firstPass struct { + *GetActivityActivityResponseDataActivityMetadataAmazonActivityMetadata + graphql.NoUnmarshalJSON + } + firstPass.GetActivityActivityResponseDataActivityMetadataAmazonActivityMetadata = v + + err := json.Unmarshal(b, &firstPass) + if err != nil { + return err + } + + err = json.Unmarshal( + b, &v.AmazonActivityMetadata) + if err != nil { + return err + } + return nil +} + +type __premarshalGetActivityActivityResponseDataActivityMetadataAmazonActivityMetadata struct { + Typename string `json:"__typename"` + + ProductName string `json:"productName"` + + Subject []AmazonActivityMetadataSubjectIdentifier `json:"subject"` + + Date graphqlTypes.Date `json:"date"` + + QuantityPurchased int `json:"quantityPurchased"` + + TotalCost string `json:"totalCost"` +} + +func (v *GetActivityActivityResponseDataActivityMetadataAmazonActivityMetadata) MarshalJSON() ([]byte, error) { + premarshaled, err := v.__premarshalJSON() + if err != nil { + return nil, err + } + return json.Marshal(premarshaled) +} + +func (v *GetActivityActivityResponseDataActivityMetadataAmazonActivityMetadata) __premarshalJSON() (*__premarshalGetActivityActivityResponseDataActivityMetadataAmazonActivityMetadata, error) { + var retval __premarshalGetActivityActivityResponseDataActivityMetadataAmazonActivityMetadata + + retval.Typename = v.Typename + retval.ProductName = v.AmazonActivityMetadata.ProductName + retval.Subject = v.AmazonActivityMetadata.Subject + retval.Date = v.AmazonActivityMetadata.Date + retval.QuantityPurchased = v.AmazonActivityMetadata.QuantityPurchased + retval.TotalCost = v.AmazonActivityMetadata.TotalCost + return &retval, nil +} + +// GetActivityActivityResponseDataActivityMetadataBookingActivityMetadata includes the requested fields of the GraphQL type BookingActivityMetadata. +type GetActivityActivityResponseDataActivityMetadataBookingActivityMetadata struct { + Typename string `json:"__typename"` + BookingActivityMetadata `json:"-"` +} + +// GetTypename returns GetActivityActivityResponseDataActivityMetadataBookingActivityMetadata.Typename, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataBookingActivityMetadata) GetTypename() string { + return v.Typename +} + +// GetSubject returns GetActivityActivityResponseDataActivityMetadataBookingActivityMetadata.Subject, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataBookingActivityMetadata) GetSubject() []BookingActivityMetadataSubjectIdentifier { + return v.BookingActivityMetadata.Subject +} + +// GetBookingID returns GetActivityActivityResponseDataActivityMetadataBookingActivityMetadata.BookingID, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataBookingActivityMetadata) GetBookingID() string { + return v.BookingActivityMetadata.BookingID +} + +// GetPrice returns GetActivityActivityResponseDataActivityMetadataBookingActivityMetadata.Price, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataBookingActivityMetadata) GetPrice() string { + return v.BookingActivityMetadata.Price +} + +// GetBookings returns GetActivityActivityResponseDataActivityMetadataBookingActivityMetadata.Bookings, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataBookingActivityMetadata) GetBookings() []BookingActivityMetadataBookingsBookingItem { + return v.BookingActivityMetadata.Bookings +} + +func (v *GetActivityActivityResponseDataActivityMetadataBookingActivityMetadata) UnmarshalJSON(b []byte) error { + + if string(b) == "null" { + return nil + } + + var firstPass struct { + *GetActivityActivityResponseDataActivityMetadataBookingActivityMetadata + graphql.NoUnmarshalJSON + } + firstPass.GetActivityActivityResponseDataActivityMetadataBookingActivityMetadata = v + + err := json.Unmarshal(b, &firstPass) + if err != nil { + return err + } + + err = json.Unmarshal( + b, &v.BookingActivityMetadata) + if err != nil { + return err + } + return nil +} + +type __premarshalGetActivityActivityResponseDataActivityMetadataBookingActivityMetadata struct { + Typename string `json:"__typename"` + + Subject []BookingActivityMetadataSubjectIdentifier `json:"subject"` + + BookingID string `json:"bookingID"` + + Price string `json:"price"` + + Bookings []BookingActivityMetadataBookingsBookingItem `json:"bookings"` +} + +func (v *GetActivityActivityResponseDataActivityMetadataBookingActivityMetadata) MarshalJSON() ([]byte, error) { + premarshaled, err := v.__premarshalJSON() + if err != nil { + return nil, err + } + return json.Marshal(premarshaled) +} + +func (v *GetActivityActivityResponseDataActivityMetadataBookingActivityMetadata) __premarshalJSON() (*__premarshalGetActivityActivityResponseDataActivityMetadataBookingActivityMetadata, error) { + var retval __premarshalGetActivityActivityResponseDataActivityMetadataBookingActivityMetadata + + retval.Typename = v.Typename + retval.Subject = v.BookingActivityMetadata.Subject + retval.BookingID = v.BookingActivityMetadata.BookingID + retval.Price = v.BookingActivityMetadata.Price + retval.Bookings = v.BookingActivityMetadata.Bookings + return &retval, nil +} + +// GetActivityActivityResponseDataActivityMetadataInstacartActivityMetadata includes the requested fields of the GraphQL type InstacartActivityMetadata. +type GetActivityActivityResponseDataActivityMetadataInstacartActivityMetadata struct { + Typename string `json:"__typename"` + InstacartActivityMetadata `json:"-"` +} + +// GetTypename returns GetActivityActivityResponseDataActivityMetadataInstacartActivityMetadata.Typename, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataInstacartActivityMetadata) GetTypename() string { + return v.Typename +} + +// GetSubject returns GetActivityActivityResponseDataActivityMetadataInstacartActivityMetadata.Subject, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataInstacartActivityMetadata) GetSubject() []InstacartActivityMetadataSubjectIdentifier { + return v.InstacartActivityMetadata.Subject +} + +// GetRetailer returns GetActivityActivityResponseDataActivityMetadataInstacartActivityMetadata.Retailer, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataInstacartActivityMetadata) GetRetailer() string { + return v.InstacartActivityMetadata.Retailer +} + +// GetTotalOrderAmountSpent returns GetActivityActivityResponseDataActivityMetadataInstacartActivityMetadata.TotalOrderAmountSpent, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataInstacartActivityMetadata) GetTotalOrderAmountSpent() string { + return v.InstacartActivityMetadata.TotalOrderAmountSpent +} + +// GetDateOrdered returns GetActivityActivityResponseDataActivityMetadataInstacartActivityMetadata.DateOrdered, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataInstacartActivityMetadata) GetDateOrdered() graphqlTypes.Date { + return v.InstacartActivityMetadata.DateOrdered +} + +// GetDateDelivered returns GetActivityActivityResponseDataActivityMetadataInstacartActivityMetadata.DateDelivered, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataInstacartActivityMetadata) GetDateDelivered() graphqlTypes.Date { + return v.InstacartActivityMetadata.DateDelivered +} + +// GetStatusString returns GetActivityActivityResponseDataActivityMetadataInstacartActivityMetadata.StatusString, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataInstacartActivityMetadata) GetStatusString() string { + return v.InstacartActivityMetadata.StatusString +} + +// GetInstacartActivityMetadataItems returns GetActivityActivityResponseDataActivityMetadataInstacartActivityMetadata.InstacartActivityMetadataItems, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataInstacartActivityMetadata) GetInstacartActivityMetadataItems() []InstacartActivityMetadataInstacartActivityMetadataItemsInstacartOrderItem { + return v.InstacartActivityMetadata.InstacartActivityMetadataItems +} + +func (v *GetActivityActivityResponseDataActivityMetadataInstacartActivityMetadata) UnmarshalJSON(b []byte) error { + + if string(b) == "null" { + return nil + } + + var firstPass struct { + *GetActivityActivityResponseDataActivityMetadataInstacartActivityMetadata + graphql.NoUnmarshalJSON + } + firstPass.GetActivityActivityResponseDataActivityMetadataInstacartActivityMetadata = v + + err := json.Unmarshal(b, &firstPass) + if err != nil { + return err + } + + err = json.Unmarshal( + b, &v.InstacartActivityMetadata) + if err != nil { + return err + } + return nil +} + +type __premarshalGetActivityActivityResponseDataActivityMetadataInstacartActivityMetadata struct { + Typename string `json:"__typename"` + + Subject []InstacartActivityMetadataSubjectIdentifier `json:"subject"` + + Retailer string `json:"retailer"` + + TotalOrderAmountSpent string `json:"totalOrderAmountSpent"` + + DateOrdered graphqlTypes.Date `json:"dateOrdered"` + + DateDelivered graphqlTypes.Date `json:"dateDelivered"` + + StatusString string `json:"statusString"` + + InstacartActivityMetadataItems []InstacartActivityMetadataInstacartActivityMetadataItemsInstacartOrderItem `json:"InstacartActivityMetadataItems"` +} + +func (v *GetActivityActivityResponseDataActivityMetadataInstacartActivityMetadata) MarshalJSON() ([]byte, error) { + premarshaled, err := v.__premarshalJSON() + if err != nil { + return nil, err + } + return json.Marshal(premarshaled) +} + +func (v *GetActivityActivityResponseDataActivityMetadataInstacartActivityMetadata) __premarshalJSON() (*__premarshalGetActivityActivityResponseDataActivityMetadataInstacartActivityMetadata, error) { + var retval __premarshalGetActivityActivityResponseDataActivityMetadataInstacartActivityMetadata + + retval.Typename = v.Typename + retval.Subject = v.InstacartActivityMetadata.Subject + retval.Retailer = v.InstacartActivityMetadata.Retailer + retval.TotalOrderAmountSpent = v.InstacartActivityMetadata.TotalOrderAmountSpent + retval.DateOrdered = v.InstacartActivityMetadata.DateOrdered + retval.DateDelivered = v.InstacartActivityMetadata.DateDelivered + retval.StatusString = v.InstacartActivityMetadata.StatusString + retval.InstacartActivityMetadataItems = v.InstacartActivityMetadata.InstacartActivityMetadataItems + return &retval, nil +} + +// GetActivityActivityResponseDataActivityMetadataNetflixActivityMetadata includes the requested fields of the GraphQL type NetflixActivityMetadata. +type GetActivityActivityResponseDataActivityMetadataNetflixActivityMetadata struct { + Typename string `json:"__typename"` + NetflixActivityMetadata `json:"-"` +} + +// GetTypename returns GetActivityActivityResponseDataActivityMetadataNetflixActivityMetadata.Typename, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataNetflixActivityMetadata) GetTypename() string { + return v.Typename +} + +// GetTitle returns GetActivityActivityResponseDataActivityMetadataNetflixActivityMetadata.Title, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataNetflixActivityMetadata) GetTitle() string { + return v.NetflixActivityMetadata.Title +} + +// GetSubject returns GetActivityActivityResponseDataActivityMetadataNetflixActivityMetadata.Subject, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataNetflixActivityMetadata) GetSubject() []NetflixActivityMetadataSubjectIdentifier { + return v.NetflixActivityMetadata.Subject +} + +// GetDate returns GetActivityActivityResponseDataActivityMetadataNetflixActivityMetadata.Date, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataNetflixActivityMetadata) GetDate() graphqlTypes.Date { + return v.NetflixActivityMetadata.Date +} + +// GetLastPlayedAt returns GetActivityActivityResponseDataActivityMetadataNetflixActivityMetadata.LastPlayedAt, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataNetflixActivityMetadata) GetLastPlayedAt() graphqlTypes.Date { + return v.NetflixActivityMetadata.LastPlayedAt +} + +func (v *GetActivityActivityResponseDataActivityMetadataNetflixActivityMetadata) UnmarshalJSON(b []byte) error { + + if string(b) == "null" { + return nil + } + + var firstPass struct { + *GetActivityActivityResponseDataActivityMetadataNetflixActivityMetadata + graphql.NoUnmarshalJSON + } + firstPass.GetActivityActivityResponseDataActivityMetadataNetflixActivityMetadata = v + + err := json.Unmarshal(b, &firstPass) + if err != nil { + return err + } + + err = json.Unmarshal( + b, &v.NetflixActivityMetadata) + if err != nil { + return err + } + return nil +} + +type __premarshalGetActivityActivityResponseDataActivityMetadataNetflixActivityMetadata struct { + Typename string `json:"__typename"` + + Title string `json:"title"` + + Subject []NetflixActivityMetadataSubjectIdentifier `json:"subject"` + + Date graphqlTypes.Date `json:"date"` + + LastPlayedAt graphqlTypes.Date `json:"lastPlayedAt"` +} + +func (v *GetActivityActivityResponseDataActivityMetadataNetflixActivityMetadata) MarshalJSON() ([]byte, error) { + premarshaled, err := v.__premarshalJSON() + if err != nil { + return nil, err + } + return json.Marshal(premarshaled) +} + +func (v *GetActivityActivityResponseDataActivityMetadataNetflixActivityMetadata) __premarshalJSON() (*__premarshalGetActivityActivityResponseDataActivityMetadataNetflixActivityMetadata, error) { + var retval __premarshalGetActivityActivityResponseDataActivityMetadataNetflixActivityMetadata + + retval.Typename = v.Typename + retval.Title = v.NetflixActivityMetadata.Title + retval.Subject = v.NetflixActivityMetadata.Subject + retval.Date = v.NetflixActivityMetadata.Date + retval.LastPlayedAt = v.NetflixActivityMetadata.LastPlayedAt + return &retval, nil +} + +// GetActivityActivityResponseDataActivityMetadataPlaystationActivityMetadata includes the requested fields of the GraphQL type PlaystationActivityMetadata. +type GetActivityActivityResponseDataActivityMetadataPlaystationActivityMetadata struct { + Typename string `json:"__typename"` + PlaystationActivityMetadata `json:"-"` +} + +// GetTypename returns GetActivityActivityResponseDataActivityMetadataPlaystationActivityMetadata.Typename, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataPlaystationActivityMetadata) GetTypename() string { + return v.Typename +} + +// GetTitle returns GetActivityActivityResponseDataActivityMetadataPlaystationActivityMetadata.Title, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataPlaystationActivityMetadata) GetTitle() string { + return v.PlaystationActivityMetadata.Title +} + +// GetSubject returns GetActivityActivityResponseDataActivityMetadataPlaystationActivityMetadata.Subject, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataPlaystationActivityMetadata) GetSubject() []PlaystationActivityMetadataSubjectIdentifier { + return v.PlaystationActivityMetadata.Subject +} + +// GetLastPlayedAt returns GetActivityActivityResponseDataActivityMetadataPlaystationActivityMetadata.LastPlayedAt, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataPlaystationActivityMetadata) GetLastPlayedAt() graphqlTypes.Date { + return v.PlaystationActivityMetadata.LastPlayedAt +} + +func (v *GetActivityActivityResponseDataActivityMetadataPlaystationActivityMetadata) UnmarshalJSON(b []byte) error { + + if string(b) == "null" { + return nil + } + + var firstPass struct { + *GetActivityActivityResponseDataActivityMetadataPlaystationActivityMetadata + graphql.NoUnmarshalJSON + } + firstPass.GetActivityActivityResponseDataActivityMetadataPlaystationActivityMetadata = v + + err := json.Unmarshal(b, &firstPass) + if err != nil { + return err + } + + err = json.Unmarshal( + b, &v.PlaystationActivityMetadata) + if err != nil { + return err + } + return nil +} + +type __premarshalGetActivityActivityResponseDataActivityMetadataPlaystationActivityMetadata struct { + Typename string `json:"__typename"` + + Title string `json:"title"` + + Subject []PlaystationActivityMetadataSubjectIdentifier `json:"subject"` + + LastPlayedAt graphqlTypes.Date `json:"lastPlayedAt"` +} + +func (v *GetActivityActivityResponseDataActivityMetadataPlaystationActivityMetadata) MarshalJSON() ([]byte, error) { + premarshaled, err := v.__premarshalJSON() + if err != nil { + return nil, err + } + return json.Marshal(premarshaled) +} + +func (v *GetActivityActivityResponseDataActivityMetadataPlaystationActivityMetadata) __premarshalJSON() (*__premarshalGetActivityActivityResponseDataActivityMetadataPlaystationActivityMetadata, error) { + var retval __premarshalGetActivityActivityResponseDataActivityMetadataPlaystationActivityMetadata + + retval.Typename = v.Typename + retval.Title = v.PlaystationActivityMetadata.Title + retval.Subject = v.PlaystationActivityMetadata.Subject + retval.LastPlayedAt = v.PlaystationActivityMetadata.LastPlayedAt + return &retval, nil +} + +// GetActivityActivityResponseDataActivityMetadataUberActivityMetadata includes the requested fields of the GraphQL type UberActivityMetadata. +type GetActivityActivityResponseDataActivityMetadataUberActivityMetadata struct { + Typename string `json:"__typename"` + UberActivityMetadata `json:"-"` +} + +// GetTypename returns GetActivityActivityResponseDataActivityMetadataUberActivityMetadata.Typename, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataUberActivityMetadata) GetTypename() string { + return v.Typename +} + +// GetSubject returns GetActivityActivityResponseDataActivityMetadataUberActivityMetadata.Subject, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataUberActivityMetadata) GetSubject() []UberActivityMetadataSubjectIdentifier { + return v.UberActivityMetadata.Subject +} + +// GetBeginTripTime returns GetActivityActivityResponseDataActivityMetadataUberActivityMetadata.BeginTripTime, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataUberActivityMetadata) GetBeginTripTime() time.Time { + return v.UberActivityMetadata.BeginTripTime +} + +// GetDropoffTime returns GetActivityActivityResponseDataActivityMetadataUberActivityMetadata.DropoffTime, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataUberActivityMetadata) GetDropoffTime() time.Time { + return v.UberActivityMetadata.DropoffTime +} + +// GetCost returns GetActivityActivityResponseDataActivityMetadataUberActivityMetadata.Cost, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataUberActivityMetadata) GetCost() string { + return v.UberActivityMetadata.Cost +} + +// GetCity returns GetActivityActivityResponseDataActivityMetadataUberActivityMetadata.City, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataUberActivityMetadata) GetCity() string { + return v.UberActivityMetadata.City +} + +// GetDistance returns GetActivityActivityResponseDataActivityMetadataUberActivityMetadata.Distance, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataUberActivityMetadata) GetDistance() string { + return v.UberActivityMetadata.Distance +} + +// GetUberActivityMetadataStatus returns GetActivityActivityResponseDataActivityMetadataUberActivityMetadata.UberActivityMetadataStatus, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataUberActivityMetadata) GetUberActivityMetadataStatus() TripStatus { + return v.UberActivityMetadata.UberActivityMetadataStatus +} + +func (v *GetActivityActivityResponseDataActivityMetadataUberActivityMetadata) UnmarshalJSON(b []byte) error { + + if string(b) == "null" { + return nil + } + + var firstPass struct { + *GetActivityActivityResponseDataActivityMetadataUberActivityMetadata + graphql.NoUnmarshalJSON + } + firstPass.GetActivityActivityResponseDataActivityMetadataUberActivityMetadata = v + + err := json.Unmarshal(b, &firstPass) + if err != nil { + return err + } + + err = json.Unmarshal( + b, &v.UberActivityMetadata) + if err != nil { + return err + } + return nil +} + +type __premarshalGetActivityActivityResponseDataActivityMetadataUberActivityMetadata struct { + Typename string `json:"__typename"` + + Subject []UberActivityMetadataSubjectIdentifier `json:"subject"` + + BeginTripTime time.Time `json:"beginTripTime"` + + DropoffTime time.Time `json:"dropoffTime"` + + Cost string `json:"cost"` + + City string `json:"city"` + + Distance string `json:"distance"` + + UberActivityMetadataStatus TripStatus `json:"UberActivityMetadataStatus"` +} + +func (v *GetActivityActivityResponseDataActivityMetadataUberActivityMetadata) MarshalJSON() ([]byte, error) { + premarshaled, err := v.__premarshalJSON() + if err != nil { + return nil, err + } + return json.Marshal(premarshaled) +} + +func (v *GetActivityActivityResponseDataActivityMetadataUberActivityMetadata) __premarshalJSON() (*__premarshalGetActivityActivityResponseDataActivityMetadataUberActivityMetadata, error) { + var retval __premarshalGetActivityActivityResponseDataActivityMetadataUberActivityMetadata + + retval.Typename = v.Typename + retval.Subject = v.UberActivityMetadata.Subject + retval.BeginTripTime = v.UberActivityMetadata.BeginTripTime + retval.DropoffTime = v.UberActivityMetadata.DropoffTime + retval.Cost = v.UberActivityMetadata.Cost + retval.City = v.UberActivityMetadata.City + retval.Distance = v.UberActivityMetadata.Distance + retval.UberActivityMetadataStatus = v.UberActivityMetadata.UberActivityMetadataStatus + return &retval, nil +} + +// GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata includes the requested fields of the GraphQL type UberEatsActivityMetadata. +type GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata struct { + Typename string `json:"__typename"` + UberEatsActivityMetadata `json:"-"` +} + +// GetTypename returns GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata.Typename, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata) GetTypename() string { + return v.Typename +} + +// GetSubject returns GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata.Subject, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata) GetSubject() []UberEatsActivityMetadataSubjectIdentifier { + return v.UberEatsActivityMetadata.Subject +} + +// GetDate returns GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata.Date, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata) GetDate() graphqlTypes.Date { + return v.UberEatsActivityMetadata.Date +} + +// GetRestaurant returns GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata.Restaurant, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata) GetRestaurant() string { + return v.UberEatsActivityMetadata.Restaurant +} + +// GetCurrency returns GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata.Currency, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata) GetCurrency() string { + return v.UberEatsActivityMetadata.Currency +} + +// GetTotalPrice returns GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata.TotalPrice, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata) GetTotalPrice() float64 { + return v.UberEatsActivityMetadata.TotalPrice +} + +// GetStatus returns GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata.Status, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata) GetStatus() UberEatsOrderStatus { + return v.UberEatsActivityMetadata.Status +} + +// GetItems returns GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata.Items, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata) GetItems() []UberEatsActivityMetadataItemsUberEatsOrderItem { + return v.UberEatsActivityMetadata.Items +} + +func (v *GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata) UnmarshalJSON(b []byte) error { + + if string(b) == "null" { + return nil + } + + var firstPass struct { + *GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata + graphql.NoUnmarshalJSON + } + firstPass.GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata = v + + err := json.Unmarshal(b, &firstPass) + if err != nil { + return err + } + + err = json.Unmarshal( + b, &v.UberEatsActivityMetadata) + if err != nil { + return err + } + return nil +} + +type __premarshalGetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata struct { + Typename string `json:"__typename"` + + Subject []UberEatsActivityMetadataSubjectIdentifier `json:"subject"` + + Date graphqlTypes.Date `json:"date"` + + Restaurant string `json:"restaurant"` + + Currency string `json:"currency"` + + TotalPrice float64 `json:"totalPrice"` + + Status UberEatsOrderStatus `json:"status"` + + Items []UberEatsActivityMetadataItemsUberEatsOrderItem `json:"items"` +} + +func (v *GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata) MarshalJSON() ([]byte, error) { + premarshaled, err := v.__premarshalJSON() + if err != nil { + return nil, err + } + return json.Marshal(premarshaled) +} + +func (v *GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata) __premarshalJSON() (*__premarshalGetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata, error) { + var retval __premarshalGetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata + + retval.Typename = v.Typename + retval.Subject = v.UberEatsActivityMetadata.Subject + retval.Date = v.UberEatsActivityMetadata.Date + retval.Restaurant = v.UberEatsActivityMetadata.Restaurant + retval.Currency = v.UberEatsActivityMetadata.Currency + retval.TotalPrice = v.UberEatsActivityMetadata.TotalPrice + retval.Status = v.UberEatsActivityMetadata.Status + retval.Items = v.UberEatsActivityMetadata.Items + return &retval, nil +} + +// GetActivityActivityResponseDataActivityMetadataYoutubeActivityMetadata includes the requested fields of the GraphQL type YoutubeActivityMetadata. +type GetActivityActivityResponseDataActivityMetadataYoutubeActivityMetadata struct { + Typename string `json:"__typename"` + YoutubeActivityMetadata `json:"-"` +} + +// GetTypename returns GetActivityActivityResponseDataActivityMetadataYoutubeActivityMetadata.Typename, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataYoutubeActivityMetadata) GetTypename() string { + return v.Typename +} + +// GetTitle returns GetActivityActivityResponseDataActivityMetadataYoutubeActivityMetadata.Title, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataYoutubeActivityMetadata) GetTitle() string { + return v.YoutubeActivityMetadata.Title +} + +// GetSubject returns GetActivityActivityResponseDataActivityMetadataYoutubeActivityMetadata.Subject, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataYoutubeActivityMetadata) GetSubject() []YoutubeActivityMetadataSubjectIdentifier { + return v.YoutubeActivityMetadata.Subject +} + +// GetDate returns GetActivityActivityResponseDataActivityMetadataYoutubeActivityMetadata.Date, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataYoutubeActivityMetadata) GetDate() graphqlTypes.Date { + return v.YoutubeActivityMetadata.Date +} + +// GetPercentageWatched returns GetActivityActivityResponseDataActivityMetadataYoutubeActivityMetadata.PercentageWatched, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataYoutubeActivityMetadata) GetPercentageWatched() int { + return v.YoutubeActivityMetadata.PercentageWatched +} + +// GetContentType returns GetActivityActivityResponseDataActivityMetadataYoutubeActivityMetadata.ContentType, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataYoutubeActivityMetadata) GetContentType() ContentType { + return v.YoutubeActivityMetadata.ContentType +} + +func (v *GetActivityActivityResponseDataActivityMetadataYoutubeActivityMetadata) UnmarshalJSON(b []byte) error { + + if string(b) == "null" { + return nil + } + + var firstPass struct { + *GetActivityActivityResponseDataActivityMetadataYoutubeActivityMetadata + graphql.NoUnmarshalJSON + } + firstPass.GetActivityActivityResponseDataActivityMetadataYoutubeActivityMetadata = v + + err := json.Unmarshal(b, &firstPass) + if err != nil { + return err + } + + err = json.Unmarshal( + b, &v.YoutubeActivityMetadata) + if err != nil { + return err + } + return nil +} + +type __premarshalGetActivityActivityResponseDataActivityMetadataYoutubeActivityMetadata struct { + Typename string `json:"__typename"` + + Title string `json:"title"` + + Subject []YoutubeActivityMetadataSubjectIdentifier `json:"subject"` + + Date graphqlTypes.Date `json:"date"` + + PercentageWatched int `json:"percentageWatched"` + + ContentType ContentType `json:"contentType"` +} + +func (v *GetActivityActivityResponseDataActivityMetadataYoutubeActivityMetadata) MarshalJSON() ([]byte, error) { + premarshaled, err := v.__premarshalJSON() + if err != nil { + return nil, err + } + return json.Marshal(premarshaled) +} + +func (v *GetActivityActivityResponseDataActivityMetadataYoutubeActivityMetadata) __premarshalJSON() (*__premarshalGetActivityActivityResponseDataActivityMetadataYoutubeActivityMetadata, error) { + var retval __premarshalGetActivityActivityResponseDataActivityMetadataYoutubeActivityMetadata + + retval.Typename = v.Typename + retval.Title = v.YoutubeActivityMetadata.Title + retval.Subject = v.YoutubeActivityMetadata.Subject + retval.Date = v.YoutubeActivityMetadata.Date + retval.PercentageWatched = v.YoutubeActivityMetadata.PercentageWatched + retval.ContentType = v.YoutubeActivityMetadata.ContentType + return &retval, nil +} + +// GetAppByPublicKeyApplication includes the requested fields of the GraphQL type Application. +type GetAppByPublicKeyApplication struct { + AppName string `json:"appName"` + PublicKey string `json:"publicKey"` + IconURL string `json:"iconURL"` + GandalfID graphqlTypes.Int64 `json:"gandalfID"` + AppRegistrar string `json:"appRegistrar"` +} + +// GetAppName returns GetAppByPublicKeyApplication.AppName, and is useful for accessing the field via an interface. +func (v *GetAppByPublicKeyApplication) GetAppName() string { return v.AppName } + +// GetPublicKey returns GetAppByPublicKeyApplication.PublicKey, and is useful for accessing the field via an interface. +func (v *GetAppByPublicKeyApplication) GetPublicKey() string { return v.PublicKey } + +// GetIconURL returns GetAppByPublicKeyApplication.IconURL, and is useful for accessing the field via an interface. +func (v *GetAppByPublicKeyApplication) GetIconURL() string { return v.IconURL } + +// GetGandalfID returns GetAppByPublicKeyApplication.GandalfID, and is useful for accessing the field via an interface. +func (v *GetAppByPublicKeyApplication) GetGandalfID() graphqlTypes.Int64 { return v.GandalfID } + +// GetAppRegistrar returns GetAppByPublicKeyApplication.AppRegistrar, and is useful for accessing the field via an interface. +func (v *GetAppByPublicKeyApplication) GetAppRegistrar() string { return v.AppRegistrar } + +// GetTraitsTrait includes the requested fields of the GraphQL type Trait. +type GetTraitsTrait struct { + Id uuid.UUID `json:"id"` + Source Source `json:"source"` + Label TraitLabel `json:"label"` + Value string `json:"value"` + Timestamp time.Time `json:"timestamp"` +} + +// GetId returns GetTraitsTrait.Id, and is useful for accessing the field via an interface. +func (v *GetTraitsTrait) GetId() uuid.UUID { return v.Id } + +// GetSource returns GetTraitsTrait.Source, and is useful for accessing the field via an interface. +func (v *GetTraitsTrait) GetSource() Source { return v.Source } + +// GetLabel returns GetTraitsTrait.Label, and is useful for accessing the field via an interface. +func (v *GetTraitsTrait) GetLabel() TraitLabel { return v.Label } + +// GetValue returns GetTraitsTrait.Value, and is useful for accessing the field via an interface. +func (v *GetTraitsTrait) GetValue() string { return v.Value } + +// GetTimestamp returns GetTraitsTrait.Timestamp, and is useful for accessing the field via an interface. +func (v *GetTraitsTrait) GetTimestamp() time.Time { return v.Timestamp } + +type IdentifierType string + +const ( + IdentifierTypeImdb IdentifierType = "IMDB" + IdentifierTypeMoby IdentifierType = "MOBY" + IdentifierTypeRawg IdentifierType = "RAWG" + IdentifierTypeIgdb IdentifierType = "IGDB" + IdentifierTypeAsin IdentifierType = "ASIN" + IdentifierTypePlaystation IdentifierType = "PLAYSTATION" + IdentifierTypeYoutube IdentifierType = "YOUTUBE" + IdentifierTypeTvdb IdentifierType = "TVDB" + IdentifierTypeTvmaze IdentifierType = "TVMAZE" + IdentifierTypeUber IdentifierType = "UBER" + IdentifierTypeBooking IdentifierType = "BOOKING" + IdentifierTypeInstacart IdentifierType = "INSTACART" + IdentifierTypeUbereats IdentifierType = "UBEREATS" +) + +// InstacartActivityMetadata includes the GraphQL fields of InstacartActivityMetadata requested by the fragment InstacartActivityMetadata. +type InstacartActivityMetadata struct { + Subject []InstacartActivityMetadataSubjectIdentifier `json:"subject"` + Retailer string `json:"retailer"` + TotalOrderAmountSpent string `json:"totalOrderAmountSpent"` + DateOrdered graphqlTypes.Date `json:"dateOrdered"` + DateDelivered graphqlTypes.Date `json:"dateDelivered"` + StatusString string `json:"statusString"` + InstacartActivityMetadataItems []InstacartActivityMetadataInstacartActivityMetadataItemsInstacartOrderItem `json:"InstacartActivityMetadataItems"` +} + +// GetSubject returns InstacartActivityMetadata.Subject, and is useful for accessing the field via an interface. +func (v *InstacartActivityMetadata) GetSubject() []InstacartActivityMetadataSubjectIdentifier { + return v.Subject +} + +// GetRetailer returns InstacartActivityMetadata.Retailer, and is useful for accessing the field via an interface. +func (v *InstacartActivityMetadata) GetRetailer() string { return v.Retailer } + +// GetTotalOrderAmountSpent returns InstacartActivityMetadata.TotalOrderAmountSpent, and is useful for accessing the field via an interface. +func (v *InstacartActivityMetadata) GetTotalOrderAmountSpent() string { return v.TotalOrderAmountSpent } + +// GetDateOrdered returns InstacartActivityMetadata.DateOrdered, and is useful for accessing the field via an interface. +func (v *InstacartActivityMetadata) GetDateOrdered() graphqlTypes.Date { return v.DateOrdered } + +// GetDateDelivered returns InstacartActivityMetadata.DateDelivered, and is useful for accessing the field via an interface. +func (v *InstacartActivityMetadata) GetDateDelivered() graphqlTypes.Date { return v.DateDelivered } + +// GetStatusString returns InstacartActivityMetadata.StatusString, and is useful for accessing the field via an interface. +func (v *InstacartActivityMetadata) GetStatusString() string { return v.StatusString } + +// GetInstacartActivityMetadataItems returns InstacartActivityMetadata.InstacartActivityMetadataItems, and is useful for accessing the field via an interface. +func (v *InstacartActivityMetadata) GetInstacartActivityMetadataItems() []InstacartActivityMetadataInstacartActivityMetadataItemsInstacartOrderItem { + return v.InstacartActivityMetadataItems +} + +// InstacartActivityMetadataInstacartActivityMetadataItemsInstacartOrderItem includes the requested fields of the GraphQL type InstacartOrderItem. +type InstacartActivityMetadataInstacartActivityMetadataItemsInstacartOrderItem struct { + ItemID string `json:"itemID"` + ProductName string `json:"productName"` + UnitPrice string `json:"unitPrice"` + Status InstacartItemStatus `json:"status"` + QuantityPurchased graphqlTypes.Int64 `json:"quantityPurchased"` +} + +// GetItemID returns InstacartActivityMetadataInstacartActivityMetadataItemsInstacartOrderItem.ItemID, and is useful for accessing the field via an interface. +func (v *InstacartActivityMetadataInstacartActivityMetadataItemsInstacartOrderItem) GetItemID() string { + return v.ItemID +} + +// GetProductName returns InstacartActivityMetadataInstacartActivityMetadataItemsInstacartOrderItem.ProductName, and is useful for accessing the field via an interface. +func (v *InstacartActivityMetadataInstacartActivityMetadataItemsInstacartOrderItem) GetProductName() string { + return v.ProductName +} + +// GetUnitPrice returns InstacartActivityMetadataInstacartActivityMetadataItemsInstacartOrderItem.UnitPrice, and is useful for accessing the field via an interface. +func (v *InstacartActivityMetadataInstacartActivityMetadataItemsInstacartOrderItem) GetUnitPrice() string { + return v.UnitPrice +} + +// GetStatus returns InstacartActivityMetadataInstacartActivityMetadataItemsInstacartOrderItem.Status, and is useful for accessing the field via an interface. +func (v *InstacartActivityMetadataInstacartActivityMetadataItemsInstacartOrderItem) GetStatus() InstacartItemStatus { + return v.Status +} + +// GetQuantityPurchased returns InstacartActivityMetadataInstacartActivityMetadataItemsInstacartOrderItem.QuantityPurchased, and is useful for accessing the field via an interface. +func (v *InstacartActivityMetadataInstacartActivityMetadataItemsInstacartOrderItem) GetQuantityPurchased() graphqlTypes.Int64 { + return v.QuantityPurchased +} + +// InstacartActivityMetadataSubjectIdentifier includes the requested fields of the GraphQL type Identifier. +type InstacartActivityMetadataSubjectIdentifier struct { + Value string `json:"value"` + IdentifierType IdentifierType `json:"identifierType"` +} + +// GetValue returns InstacartActivityMetadataSubjectIdentifier.Value, and is useful for accessing the field via an interface. +func (v *InstacartActivityMetadataSubjectIdentifier) GetValue() string { return v.Value } + +// GetIdentifierType returns InstacartActivityMetadataSubjectIdentifier.IdentifierType, and is useful for accessing the field via an interface. +func (v *InstacartActivityMetadataSubjectIdentifier) GetIdentifierType() IdentifierType { + return v.IdentifierType +} + +type InstacartItemStatus string + +const ( + InstacartItemStatusFound InstacartItemStatus = "FOUND" + InstacartItemStatusReplaced InstacartItemStatus = "REPLACED" + InstacartItemStatusTorefund InstacartItemStatus = "TOREFUND" +) + +// LookupActivity includes the requested fields of the GraphQL type Activity. +type LookupActivity struct { + Id string `json:"id"` + Metadata LookupActivityMetadata `json:"-"` +} + +// GetId returns LookupActivity.Id, and is useful for accessing the field via an interface. +func (v *LookupActivity) GetId() string { return v.Id } + +// GetMetadata returns LookupActivity.Metadata, and is useful for accessing the field via an interface. +func (v *LookupActivity) GetMetadata() LookupActivityMetadata { return v.Metadata } + +func (v *LookupActivity) UnmarshalJSON(b []byte) error { + + if string(b) == "null" { + return nil + } + + var firstPass struct { + *LookupActivity + Metadata json.RawMessage `json:"metadata"` + graphql.NoUnmarshalJSON + } + firstPass.LookupActivity = v + + err := json.Unmarshal(b, &firstPass) + if err != nil { + return err + } + + { + dst := &v.Metadata + src := firstPass.Metadata + if len(src) != 0 && string(src) != "null" { + err = __unmarshalLookupActivityMetadata( + src, dst) + if err != nil { + return fmt.Errorf( + "unable to unmarshal LookupActivity.Metadata: %w", err) + } + } + } + return nil +} + +type __premarshalLookupActivity struct { + Id string `json:"id"` + + Metadata json.RawMessage `json:"metadata"` +} + +func (v *LookupActivity) MarshalJSON() ([]byte, error) { + premarshaled, err := v.__premarshalJSON() + if err != nil { + return nil, err + } + return json.Marshal(premarshaled) +} + +func (v *LookupActivity) __premarshalJSON() (*__premarshalLookupActivity, error) { + var retval __premarshalLookupActivity + + retval.Id = v.Id + { + + dst := &retval.Metadata + src := v.Metadata + var err error + *dst, err = __marshalLookupActivityMetadata( + &src) + if err != nil { + return nil, fmt.Errorf( + "unable to marshal LookupActivity.Metadata: %w", err) + } + } + return &retval, nil +} + +// LookupActivityMetadata includes the requested fields of the GraphQL interface ActivityMetadata. +// +// LookupActivityMetadata is implemented by the following types: +// LookupActivityMetadataAmazonActivityMetadata +// LookupActivityMetadataBookingActivityMetadata +// LookupActivityMetadataInstacartActivityMetadata +// LookupActivityMetadataNetflixActivityMetadata +// LookupActivityMetadataPlaystationActivityMetadata +// LookupActivityMetadataUberActivityMetadata +// LookupActivityMetadataUberEatsActivityMetadata +// LookupActivityMetadataYoutubeActivityMetadata +type LookupActivityMetadata interface { + implementsGraphQLInterfaceLookupActivityMetadata() + // GetTypename returns the receiver's concrete GraphQL type-name (see interface doc for possible values). + GetTypename() string +} + +func (v *LookupActivityMetadataAmazonActivityMetadata) implementsGraphQLInterfaceLookupActivityMetadata() { +} +func (v *LookupActivityMetadataBookingActivityMetadata) implementsGraphQLInterfaceLookupActivityMetadata() { +} +func (v *LookupActivityMetadataInstacartActivityMetadata) implementsGraphQLInterfaceLookupActivityMetadata() { +} +func (v *LookupActivityMetadataNetflixActivityMetadata) implementsGraphQLInterfaceLookupActivityMetadata() { +} +func (v *LookupActivityMetadataPlaystationActivityMetadata) implementsGraphQLInterfaceLookupActivityMetadata() { +} +func (v *LookupActivityMetadataUberActivityMetadata) implementsGraphQLInterfaceLookupActivityMetadata() { +} +func (v *LookupActivityMetadataUberEatsActivityMetadata) implementsGraphQLInterfaceLookupActivityMetadata() { +} +func (v *LookupActivityMetadataYoutubeActivityMetadata) implementsGraphQLInterfaceLookupActivityMetadata() { +} + +func __unmarshalLookupActivityMetadata(b []byte, v *LookupActivityMetadata) error { + if string(b) == "null" { + return nil + } + + var tn struct { + TypeName string `json:"__typename"` + } + err := json.Unmarshal(b, &tn) + if err != nil { + return err + } + + switch tn.TypeName { + case "AmazonActivityMetadata": + *v = new(LookupActivityMetadataAmazonActivityMetadata) + return json.Unmarshal(b, *v) + case "BookingActivityMetadata": + *v = new(LookupActivityMetadataBookingActivityMetadata) + return json.Unmarshal(b, *v) + case "InstacartActivityMetadata": + *v = new(LookupActivityMetadataInstacartActivityMetadata) + return json.Unmarshal(b, *v) + case "NetflixActivityMetadata": + *v = new(LookupActivityMetadataNetflixActivityMetadata) + return json.Unmarshal(b, *v) + case "PlaystationActivityMetadata": + *v = new(LookupActivityMetadataPlaystationActivityMetadata) + return json.Unmarshal(b, *v) + case "UberActivityMetadata": + *v = new(LookupActivityMetadataUberActivityMetadata) + return json.Unmarshal(b, *v) + case "UberEatsActivityMetadata": + *v = new(LookupActivityMetadataUberEatsActivityMetadata) + return json.Unmarshal(b, *v) + case "YoutubeActivityMetadata": + *v = new(LookupActivityMetadataYoutubeActivityMetadata) + return json.Unmarshal(b, *v) + case "": + return fmt.Errorf( + "response was missing ActivityMetadata.__typename") + default: + return fmt.Errorf( + `unexpected concrete type for LookupActivityMetadata: "%v"`, tn.TypeName) + } +} + +func __marshalLookupActivityMetadata(v *LookupActivityMetadata) ([]byte, error) { + + var typename string + switch v := (*v).(type) { + case *LookupActivityMetadataAmazonActivityMetadata: + typename = "AmazonActivityMetadata" + + premarshaled, err := v.__premarshalJSON() + if err != nil { + return nil, err + } + result := struct { + TypeName string `json:"__typename"` + *__premarshalLookupActivityMetadataAmazonActivityMetadata + }{typename, premarshaled} + return json.Marshal(result) + case *LookupActivityMetadataBookingActivityMetadata: + typename = "BookingActivityMetadata" + + premarshaled, err := v.__premarshalJSON() + if err != nil { + return nil, err + } + result := struct { + TypeName string `json:"__typename"` + *__premarshalLookupActivityMetadataBookingActivityMetadata + }{typename, premarshaled} + return json.Marshal(result) + case *LookupActivityMetadataInstacartActivityMetadata: + typename = "InstacartActivityMetadata" + + premarshaled, err := v.__premarshalJSON() + if err != nil { + return nil, err + } + result := struct { + TypeName string `json:"__typename"` + *__premarshalLookupActivityMetadataInstacartActivityMetadata + }{typename, premarshaled} + return json.Marshal(result) + case *LookupActivityMetadataNetflixActivityMetadata: + typename = "NetflixActivityMetadata" + + premarshaled, err := v.__premarshalJSON() + if err != nil { + return nil, err + } + result := struct { + TypeName string `json:"__typename"` + *__premarshalLookupActivityMetadataNetflixActivityMetadata + }{typename, premarshaled} + return json.Marshal(result) + case *LookupActivityMetadataPlaystationActivityMetadata: + typename = "PlaystationActivityMetadata" + + premarshaled, err := v.__premarshalJSON() + if err != nil { + return nil, err + } + result := struct { + TypeName string `json:"__typename"` + *__premarshalLookupActivityMetadataPlaystationActivityMetadata + }{typename, premarshaled} + return json.Marshal(result) + case *LookupActivityMetadataUberActivityMetadata: + typename = "UberActivityMetadata" + + premarshaled, err := v.__premarshalJSON() + if err != nil { + return nil, err + } + result := struct { + TypeName string `json:"__typename"` + *__premarshalLookupActivityMetadataUberActivityMetadata + }{typename, premarshaled} + return json.Marshal(result) + case *LookupActivityMetadataUberEatsActivityMetadata: + typename = "UberEatsActivityMetadata" + + premarshaled, err := v.__premarshalJSON() + if err != nil { + return nil, err + } + result := struct { + TypeName string `json:"__typename"` + *__premarshalLookupActivityMetadataUberEatsActivityMetadata + }{typename, premarshaled} + return json.Marshal(result) + case *LookupActivityMetadataYoutubeActivityMetadata: + typename = "YoutubeActivityMetadata" + + premarshaled, err := v.__premarshalJSON() + if err != nil { + return nil, err + } + result := struct { + TypeName string `json:"__typename"` + *__premarshalLookupActivityMetadataYoutubeActivityMetadata + }{typename, premarshaled} + return json.Marshal(result) + case nil: + return []byte("null"), nil + default: + return nil, fmt.Errorf( + `unexpected concrete type for LookupActivityMetadata: "%T"`, v) + } +} + +// LookupActivityMetadataAmazonActivityMetadata includes the requested fields of the GraphQL type AmazonActivityMetadata. +type LookupActivityMetadataAmazonActivityMetadata struct { + Typename string `json:"__typename"` + AmazonActivityMetadata `json:"-"` +} + +// GetTypename returns LookupActivityMetadataAmazonActivityMetadata.Typename, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataAmazonActivityMetadata) GetTypename() string { return v.Typename } + +// GetProductName returns LookupActivityMetadataAmazonActivityMetadata.ProductName, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataAmazonActivityMetadata) GetProductName() string { + return v.AmazonActivityMetadata.ProductName +} + +// GetSubject returns LookupActivityMetadataAmazonActivityMetadata.Subject, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataAmazonActivityMetadata) GetSubject() []AmazonActivityMetadataSubjectIdentifier { + return v.AmazonActivityMetadata.Subject +} + +// GetDate returns LookupActivityMetadataAmazonActivityMetadata.Date, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataAmazonActivityMetadata) GetDate() graphqlTypes.Date { + return v.AmazonActivityMetadata.Date +} + +// GetQuantityPurchased returns LookupActivityMetadataAmazonActivityMetadata.QuantityPurchased, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataAmazonActivityMetadata) GetQuantityPurchased() int { + return v.AmazonActivityMetadata.QuantityPurchased +} + +// GetTotalCost returns LookupActivityMetadataAmazonActivityMetadata.TotalCost, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataAmazonActivityMetadata) GetTotalCost() string { + return v.AmazonActivityMetadata.TotalCost +} + +func (v *LookupActivityMetadataAmazonActivityMetadata) UnmarshalJSON(b []byte) error { + + if string(b) == "null" { + return nil + } + + var firstPass struct { + *LookupActivityMetadataAmazonActivityMetadata + graphql.NoUnmarshalJSON + } + firstPass.LookupActivityMetadataAmazonActivityMetadata = v + + err := json.Unmarshal(b, &firstPass) + if err != nil { + return err + } + + err = json.Unmarshal( + b, &v.AmazonActivityMetadata) + if err != nil { + return err + } + return nil +} + +type __premarshalLookupActivityMetadataAmazonActivityMetadata struct { + Typename string `json:"__typename"` + + ProductName string `json:"productName"` + + Subject []AmazonActivityMetadataSubjectIdentifier `json:"subject"` + + Date graphqlTypes.Date `json:"date"` + + QuantityPurchased int `json:"quantityPurchased"` + + TotalCost string `json:"totalCost"` +} + +func (v *LookupActivityMetadataAmazonActivityMetadata) MarshalJSON() ([]byte, error) { + premarshaled, err := v.__premarshalJSON() + if err != nil { + return nil, err + } + return json.Marshal(premarshaled) +} + +func (v *LookupActivityMetadataAmazonActivityMetadata) __premarshalJSON() (*__premarshalLookupActivityMetadataAmazonActivityMetadata, error) { + var retval __premarshalLookupActivityMetadataAmazonActivityMetadata + + retval.Typename = v.Typename + retval.ProductName = v.AmazonActivityMetadata.ProductName + retval.Subject = v.AmazonActivityMetadata.Subject + retval.Date = v.AmazonActivityMetadata.Date + retval.QuantityPurchased = v.AmazonActivityMetadata.QuantityPurchased + retval.TotalCost = v.AmazonActivityMetadata.TotalCost + return &retval, nil +} + +// LookupActivityMetadataBookingActivityMetadata includes the requested fields of the GraphQL type BookingActivityMetadata. +type LookupActivityMetadataBookingActivityMetadata struct { + Typename string `json:"__typename"` + BookingActivityMetadata `json:"-"` +} + +// GetTypename returns LookupActivityMetadataBookingActivityMetadata.Typename, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataBookingActivityMetadata) GetTypename() string { return v.Typename } + +// GetSubject returns LookupActivityMetadataBookingActivityMetadata.Subject, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataBookingActivityMetadata) GetSubject() []BookingActivityMetadataSubjectIdentifier { + return v.BookingActivityMetadata.Subject +} + +// GetBookingID returns LookupActivityMetadataBookingActivityMetadata.BookingID, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataBookingActivityMetadata) GetBookingID() string { + return v.BookingActivityMetadata.BookingID +} + +// GetPrice returns LookupActivityMetadataBookingActivityMetadata.Price, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataBookingActivityMetadata) GetPrice() string { + return v.BookingActivityMetadata.Price +} + +// GetBookings returns LookupActivityMetadataBookingActivityMetadata.Bookings, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataBookingActivityMetadata) GetBookings() []BookingActivityMetadataBookingsBookingItem { + return v.BookingActivityMetadata.Bookings +} + +func (v *LookupActivityMetadataBookingActivityMetadata) UnmarshalJSON(b []byte) error { + + if string(b) == "null" { + return nil + } + + var firstPass struct { + *LookupActivityMetadataBookingActivityMetadata + graphql.NoUnmarshalJSON + } + firstPass.LookupActivityMetadataBookingActivityMetadata = v + + err := json.Unmarshal(b, &firstPass) + if err != nil { + return err + } + + err = json.Unmarshal( + b, &v.BookingActivityMetadata) + if err != nil { + return err + } + return nil +} + +type __premarshalLookupActivityMetadataBookingActivityMetadata struct { + Typename string `json:"__typename"` + + Subject []BookingActivityMetadataSubjectIdentifier `json:"subject"` + + BookingID string `json:"bookingID"` + + Price string `json:"price"` + + Bookings []BookingActivityMetadataBookingsBookingItem `json:"bookings"` +} + +func (v *LookupActivityMetadataBookingActivityMetadata) MarshalJSON() ([]byte, error) { + premarshaled, err := v.__premarshalJSON() + if err != nil { + return nil, err + } + return json.Marshal(premarshaled) +} + +func (v *LookupActivityMetadataBookingActivityMetadata) __premarshalJSON() (*__premarshalLookupActivityMetadataBookingActivityMetadata, error) { + var retval __premarshalLookupActivityMetadataBookingActivityMetadata + + retval.Typename = v.Typename + retval.Subject = v.BookingActivityMetadata.Subject + retval.BookingID = v.BookingActivityMetadata.BookingID + retval.Price = v.BookingActivityMetadata.Price + retval.Bookings = v.BookingActivityMetadata.Bookings + return &retval, nil +} + +// LookupActivityMetadataInstacartActivityMetadata includes the requested fields of the GraphQL type InstacartActivityMetadata. +type LookupActivityMetadataInstacartActivityMetadata struct { + Typename string `json:"__typename"` + InstacartActivityMetadata `json:"-"` +} + +// GetTypename returns LookupActivityMetadataInstacartActivityMetadata.Typename, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataInstacartActivityMetadata) GetTypename() string { return v.Typename } + +// GetSubject returns LookupActivityMetadataInstacartActivityMetadata.Subject, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataInstacartActivityMetadata) GetSubject() []InstacartActivityMetadataSubjectIdentifier { + return v.InstacartActivityMetadata.Subject +} + +// GetRetailer returns LookupActivityMetadataInstacartActivityMetadata.Retailer, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataInstacartActivityMetadata) GetRetailer() string { + return v.InstacartActivityMetadata.Retailer +} + +// GetTotalOrderAmountSpent returns LookupActivityMetadataInstacartActivityMetadata.TotalOrderAmountSpent, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataInstacartActivityMetadata) GetTotalOrderAmountSpent() string { + return v.InstacartActivityMetadata.TotalOrderAmountSpent +} + +// GetDateOrdered returns LookupActivityMetadataInstacartActivityMetadata.DateOrdered, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataInstacartActivityMetadata) GetDateOrdered() graphqlTypes.Date { + return v.InstacartActivityMetadata.DateOrdered +} + +// GetDateDelivered returns LookupActivityMetadataInstacartActivityMetadata.DateDelivered, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataInstacartActivityMetadata) GetDateDelivered() graphqlTypes.Date { + return v.InstacartActivityMetadata.DateDelivered +} + +// GetStatusString returns LookupActivityMetadataInstacartActivityMetadata.StatusString, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataInstacartActivityMetadata) GetStatusString() string { + return v.InstacartActivityMetadata.StatusString +} + +// GetInstacartActivityMetadataItems returns LookupActivityMetadataInstacartActivityMetadata.InstacartActivityMetadataItems, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataInstacartActivityMetadata) GetInstacartActivityMetadataItems() []InstacartActivityMetadataInstacartActivityMetadataItemsInstacartOrderItem { + return v.InstacartActivityMetadata.InstacartActivityMetadataItems +} + +func (v *LookupActivityMetadataInstacartActivityMetadata) UnmarshalJSON(b []byte) error { + + if string(b) == "null" { + return nil + } + + var firstPass struct { + *LookupActivityMetadataInstacartActivityMetadata + graphql.NoUnmarshalJSON + } + firstPass.LookupActivityMetadataInstacartActivityMetadata = v + + err := json.Unmarshal(b, &firstPass) + if err != nil { + return err + } + + err = json.Unmarshal( + b, &v.InstacartActivityMetadata) + if err != nil { + return err + } + return nil +} + +type __premarshalLookupActivityMetadataInstacartActivityMetadata struct { + Typename string `json:"__typename"` + + Subject []InstacartActivityMetadataSubjectIdentifier `json:"subject"` + + Retailer string `json:"retailer"` + + TotalOrderAmountSpent string `json:"totalOrderAmountSpent"` + + DateOrdered graphqlTypes.Date `json:"dateOrdered"` + + DateDelivered graphqlTypes.Date `json:"dateDelivered"` + + StatusString string `json:"statusString"` + + InstacartActivityMetadataItems []InstacartActivityMetadataInstacartActivityMetadataItemsInstacartOrderItem `json:"InstacartActivityMetadataItems"` +} + +func (v *LookupActivityMetadataInstacartActivityMetadata) MarshalJSON() ([]byte, error) { + premarshaled, err := v.__premarshalJSON() + if err != nil { + return nil, err + } + return json.Marshal(premarshaled) +} + +func (v *LookupActivityMetadataInstacartActivityMetadata) __premarshalJSON() (*__premarshalLookupActivityMetadataInstacartActivityMetadata, error) { + var retval __premarshalLookupActivityMetadataInstacartActivityMetadata + + retval.Typename = v.Typename + retval.Subject = v.InstacartActivityMetadata.Subject + retval.Retailer = v.InstacartActivityMetadata.Retailer + retval.TotalOrderAmountSpent = v.InstacartActivityMetadata.TotalOrderAmountSpent + retval.DateOrdered = v.InstacartActivityMetadata.DateOrdered + retval.DateDelivered = v.InstacartActivityMetadata.DateDelivered + retval.StatusString = v.InstacartActivityMetadata.StatusString + retval.InstacartActivityMetadataItems = v.InstacartActivityMetadata.InstacartActivityMetadataItems + return &retval, nil +} + +// LookupActivityMetadataNetflixActivityMetadata includes the requested fields of the GraphQL type NetflixActivityMetadata. +type LookupActivityMetadataNetflixActivityMetadata struct { + Typename string `json:"__typename"` + NetflixActivityMetadata `json:"-"` +} + +// GetTypename returns LookupActivityMetadataNetflixActivityMetadata.Typename, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataNetflixActivityMetadata) GetTypename() string { return v.Typename } + +// GetTitle returns LookupActivityMetadataNetflixActivityMetadata.Title, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataNetflixActivityMetadata) GetTitle() string { + return v.NetflixActivityMetadata.Title +} + +// GetSubject returns LookupActivityMetadataNetflixActivityMetadata.Subject, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataNetflixActivityMetadata) GetSubject() []NetflixActivityMetadataSubjectIdentifier { + return v.NetflixActivityMetadata.Subject +} + +// GetDate returns LookupActivityMetadataNetflixActivityMetadata.Date, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataNetflixActivityMetadata) GetDate() graphqlTypes.Date { + return v.NetflixActivityMetadata.Date +} + +// GetLastPlayedAt returns LookupActivityMetadataNetflixActivityMetadata.LastPlayedAt, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataNetflixActivityMetadata) GetLastPlayedAt() graphqlTypes.Date { + return v.NetflixActivityMetadata.LastPlayedAt +} + +func (v *LookupActivityMetadataNetflixActivityMetadata) UnmarshalJSON(b []byte) error { + + if string(b) == "null" { + return nil + } + + var firstPass struct { + *LookupActivityMetadataNetflixActivityMetadata + graphql.NoUnmarshalJSON + } + firstPass.LookupActivityMetadataNetflixActivityMetadata = v + + err := json.Unmarshal(b, &firstPass) + if err != nil { + return err + } + + err = json.Unmarshal( + b, &v.NetflixActivityMetadata) + if err != nil { + return err + } + return nil +} + +type __premarshalLookupActivityMetadataNetflixActivityMetadata struct { + Typename string `json:"__typename"` + + Title string `json:"title"` + + Subject []NetflixActivityMetadataSubjectIdentifier `json:"subject"` + + Date graphqlTypes.Date `json:"date"` + + LastPlayedAt graphqlTypes.Date `json:"lastPlayedAt"` +} + +func (v *LookupActivityMetadataNetflixActivityMetadata) MarshalJSON() ([]byte, error) { + premarshaled, err := v.__premarshalJSON() + if err != nil { + return nil, err + } + return json.Marshal(premarshaled) +} + +func (v *LookupActivityMetadataNetflixActivityMetadata) __premarshalJSON() (*__premarshalLookupActivityMetadataNetflixActivityMetadata, error) { + var retval __premarshalLookupActivityMetadataNetflixActivityMetadata + + retval.Typename = v.Typename + retval.Title = v.NetflixActivityMetadata.Title + retval.Subject = v.NetflixActivityMetadata.Subject + retval.Date = v.NetflixActivityMetadata.Date + retval.LastPlayedAt = v.NetflixActivityMetadata.LastPlayedAt + return &retval, nil +} + +// LookupActivityMetadataPlaystationActivityMetadata includes the requested fields of the GraphQL type PlaystationActivityMetadata. +type LookupActivityMetadataPlaystationActivityMetadata struct { + Typename string `json:"__typename"` + PlaystationActivityMetadata `json:"-"` +} + +// GetTypename returns LookupActivityMetadataPlaystationActivityMetadata.Typename, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataPlaystationActivityMetadata) GetTypename() string { return v.Typename } + +// GetTitle returns LookupActivityMetadataPlaystationActivityMetadata.Title, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataPlaystationActivityMetadata) GetTitle() string { + return v.PlaystationActivityMetadata.Title +} + +// GetSubject returns LookupActivityMetadataPlaystationActivityMetadata.Subject, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataPlaystationActivityMetadata) GetSubject() []PlaystationActivityMetadataSubjectIdentifier { + return v.PlaystationActivityMetadata.Subject +} + +// GetLastPlayedAt returns LookupActivityMetadataPlaystationActivityMetadata.LastPlayedAt, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataPlaystationActivityMetadata) GetLastPlayedAt() graphqlTypes.Date { + return v.PlaystationActivityMetadata.LastPlayedAt +} + +func (v *LookupActivityMetadataPlaystationActivityMetadata) UnmarshalJSON(b []byte) error { + + if string(b) == "null" { + return nil + } + + var firstPass struct { + *LookupActivityMetadataPlaystationActivityMetadata + graphql.NoUnmarshalJSON + } + firstPass.LookupActivityMetadataPlaystationActivityMetadata = v + + err := json.Unmarshal(b, &firstPass) + if err != nil { + return err + } + + err = json.Unmarshal( + b, &v.PlaystationActivityMetadata) + if err != nil { + return err + } + return nil +} + +type __premarshalLookupActivityMetadataPlaystationActivityMetadata struct { + Typename string `json:"__typename"` + + Title string `json:"title"` + + Subject []PlaystationActivityMetadataSubjectIdentifier `json:"subject"` + + LastPlayedAt graphqlTypes.Date `json:"lastPlayedAt"` +} + +func (v *LookupActivityMetadataPlaystationActivityMetadata) MarshalJSON() ([]byte, error) { + premarshaled, err := v.__premarshalJSON() + if err != nil { + return nil, err + } + return json.Marshal(premarshaled) +} + +func (v *LookupActivityMetadataPlaystationActivityMetadata) __premarshalJSON() (*__premarshalLookupActivityMetadataPlaystationActivityMetadata, error) { + var retval __premarshalLookupActivityMetadataPlaystationActivityMetadata + + retval.Typename = v.Typename + retval.Title = v.PlaystationActivityMetadata.Title + retval.Subject = v.PlaystationActivityMetadata.Subject + retval.LastPlayedAt = v.PlaystationActivityMetadata.LastPlayedAt + return &retval, nil +} + +// LookupActivityMetadataUberActivityMetadata includes the requested fields of the GraphQL type UberActivityMetadata. +type LookupActivityMetadataUberActivityMetadata struct { + Typename string `json:"__typename"` + UberActivityMetadata `json:"-"` +} + +// GetTypename returns LookupActivityMetadataUberActivityMetadata.Typename, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataUberActivityMetadata) GetTypename() string { return v.Typename } + +// GetSubject returns LookupActivityMetadataUberActivityMetadata.Subject, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataUberActivityMetadata) GetSubject() []UberActivityMetadataSubjectIdentifier { + return v.UberActivityMetadata.Subject +} + +// GetBeginTripTime returns LookupActivityMetadataUberActivityMetadata.BeginTripTime, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataUberActivityMetadata) GetBeginTripTime() time.Time { + return v.UberActivityMetadata.BeginTripTime +} + +// GetDropoffTime returns LookupActivityMetadataUberActivityMetadata.DropoffTime, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataUberActivityMetadata) GetDropoffTime() time.Time { + return v.UberActivityMetadata.DropoffTime +} + +// GetCost returns LookupActivityMetadataUberActivityMetadata.Cost, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataUberActivityMetadata) GetCost() string { + return v.UberActivityMetadata.Cost +} + +// GetCity returns LookupActivityMetadataUberActivityMetadata.City, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataUberActivityMetadata) GetCity() string { + return v.UberActivityMetadata.City +} + +// GetDistance returns LookupActivityMetadataUberActivityMetadata.Distance, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataUberActivityMetadata) GetDistance() string { + return v.UberActivityMetadata.Distance +} + +// GetUberActivityMetadataStatus returns LookupActivityMetadataUberActivityMetadata.UberActivityMetadataStatus, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataUberActivityMetadata) GetUberActivityMetadataStatus() TripStatus { + return v.UberActivityMetadata.UberActivityMetadataStatus +} + +func (v *LookupActivityMetadataUberActivityMetadata) UnmarshalJSON(b []byte) error { + + if string(b) == "null" { + return nil + } + + var firstPass struct { + *LookupActivityMetadataUberActivityMetadata + graphql.NoUnmarshalJSON + } + firstPass.LookupActivityMetadataUberActivityMetadata = v + + err := json.Unmarshal(b, &firstPass) + if err != nil { + return err + } + + err = json.Unmarshal( + b, &v.UberActivityMetadata) + if err != nil { + return err + } + return nil +} + +type __premarshalLookupActivityMetadataUberActivityMetadata struct { + Typename string `json:"__typename"` + + Subject []UberActivityMetadataSubjectIdentifier `json:"subject"` + + BeginTripTime time.Time `json:"beginTripTime"` + + DropoffTime time.Time `json:"dropoffTime"` + + Cost string `json:"cost"` + + City string `json:"city"` + + Distance string `json:"distance"` + + UberActivityMetadataStatus TripStatus `json:"UberActivityMetadataStatus"` +} + +func (v *LookupActivityMetadataUberActivityMetadata) MarshalJSON() ([]byte, error) { + premarshaled, err := v.__premarshalJSON() + if err != nil { + return nil, err + } + return json.Marshal(premarshaled) +} + +func (v *LookupActivityMetadataUberActivityMetadata) __premarshalJSON() (*__premarshalLookupActivityMetadataUberActivityMetadata, error) { + var retval __premarshalLookupActivityMetadataUberActivityMetadata + + retval.Typename = v.Typename + retval.Subject = v.UberActivityMetadata.Subject + retval.BeginTripTime = v.UberActivityMetadata.BeginTripTime + retval.DropoffTime = v.UberActivityMetadata.DropoffTime + retval.Cost = v.UberActivityMetadata.Cost + retval.City = v.UberActivityMetadata.City + retval.Distance = v.UberActivityMetadata.Distance + retval.UberActivityMetadataStatus = v.UberActivityMetadata.UberActivityMetadataStatus + return &retval, nil +} + +// LookupActivityMetadataUberEatsActivityMetadata includes the requested fields of the GraphQL type UberEatsActivityMetadata. +type LookupActivityMetadataUberEatsActivityMetadata struct { + Typename string `json:"__typename"` + UberEatsActivityMetadata `json:"-"` +} + +// GetTypename returns LookupActivityMetadataUberEatsActivityMetadata.Typename, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataUberEatsActivityMetadata) GetTypename() string { return v.Typename } + +// GetSubject returns LookupActivityMetadataUberEatsActivityMetadata.Subject, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataUberEatsActivityMetadata) GetSubject() []UberEatsActivityMetadataSubjectIdentifier { + return v.UberEatsActivityMetadata.Subject +} + +// GetDate returns LookupActivityMetadataUberEatsActivityMetadata.Date, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataUberEatsActivityMetadata) GetDate() graphqlTypes.Date { + return v.UberEatsActivityMetadata.Date +} + +// GetRestaurant returns LookupActivityMetadataUberEatsActivityMetadata.Restaurant, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataUberEatsActivityMetadata) GetRestaurant() string { + return v.UberEatsActivityMetadata.Restaurant +} + +// GetCurrency returns LookupActivityMetadataUberEatsActivityMetadata.Currency, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataUberEatsActivityMetadata) GetCurrency() string { + return v.UberEatsActivityMetadata.Currency +} + +// GetTotalPrice returns LookupActivityMetadataUberEatsActivityMetadata.TotalPrice, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataUberEatsActivityMetadata) GetTotalPrice() float64 { + return v.UberEatsActivityMetadata.TotalPrice +} + +// GetStatus returns LookupActivityMetadataUberEatsActivityMetadata.Status, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataUberEatsActivityMetadata) GetStatus() UberEatsOrderStatus { + return v.UberEatsActivityMetadata.Status +} + +// GetItems returns LookupActivityMetadataUberEatsActivityMetadata.Items, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataUberEatsActivityMetadata) GetItems() []UberEatsActivityMetadataItemsUberEatsOrderItem { + return v.UberEatsActivityMetadata.Items +} + +func (v *LookupActivityMetadataUberEatsActivityMetadata) UnmarshalJSON(b []byte) error { + + if string(b) == "null" { + return nil + } + + var firstPass struct { + *LookupActivityMetadataUberEatsActivityMetadata + graphql.NoUnmarshalJSON + } + firstPass.LookupActivityMetadataUberEatsActivityMetadata = v + + err := json.Unmarshal(b, &firstPass) + if err != nil { + return err + } + + err = json.Unmarshal( + b, &v.UberEatsActivityMetadata) + if err != nil { + return err + } + return nil +} + +type __premarshalLookupActivityMetadataUberEatsActivityMetadata struct { + Typename string `json:"__typename"` + + Subject []UberEatsActivityMetadataSubjectIdentifier `json:"subject"` + + Date graphqlTypes.Date `json:"date"` + + Restaurant string `json:"restaurant"` + + Currency string `json:"currency"` + + TotalPrice float64 `json:"totalPrice"` + + Status UberEatsOrderStatus `json:"status"` + + Items []UberEatsActivityMetadataItemsUberEatsOrderItem `json:"items"` +} + +func (v *LookupActivityMetadataUberEatsActivityMetadata) MarshalJSON() ([]byte, error) { + premarshaled, err := v.__premarshalJSON() + if err != nil { + return nil, err + } + return json.Marshal(premarshaled) +} + +func (v *LookupActivityMetadataUberEatsActivityMetadata) __premarshalJSON() (*__premarshalLookupActivityMetadataUberEatsActivityMetadata, error) { + var retval __premarshalLookupActivityMetadataUberEatsActivityMetadata + + retval.Typename = v.Typename + retval.Subject = v.UberEatsActivityMetadata.Subject + retval.Date = v.UberEatsActivityMetadata.Date + retval.Restaurant = v.UberEatsActivityMetadata.Restaurant + retval.Currency = v.UberEatsActivityMetadata.Currency + retval.TotalPrice = v.UberEatsActivityMetadata.TotalPrice + retval.Status = v.UberEatsActivityMetadata.Status + retval.Items = v.UberEatsActivityMetadata.Items + return &retval, nil +} + +// LookupActivityMetadataYoutubeActivityMetadata includes the requested fields of the GraphQL type YoutubeActivityMetadata. +type LookupActivityMetadataYoutubeActivityMetadata struct { + Typename string `json:"__typename"` + YoutubeActivityMetadata `json:"-"` +} + +// GetTypename returns LookupActivityMetadataYoutubeActivityMetadata.Typename, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataYoutubeActivityMetadata) GetTypename() string { return v.Typename } + +// GetTitle returns LookupActivityMetadataYoutubeActivityMetadata.Title, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataYoutubeActivityMetadata) GetTitle() string { + return v.YoutubeActivityMetadata.Title +} + +// GetSubject returns LookupActivityMetadataYoutubeActivityMetadata.Subject, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataYoutubeActivityMetadata) GetSubject() []YoutubeActivityMetadataSubjectIdentifier { + return v.YoutubeActivityMetadata.Subject +} + +// GetDate returns LookupActivityMetadataYoutubeActivityMetadata.Date, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataYoutubeActivityMetadata) GetDate() graphqlTypes.Date { + return v.YoutubeActivityMetadata.Date +} + +// GetPercentageWatched returns LookupActivityMetadataYoutubeActivityMetadata.PercentageWatched, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataYoutubeActivityMetadata) GetPercentageWatched() int { + return v.YoutubeActivityMetadata.PercentageWatched +} + +// GetContentType returns LookupActivityMetadataYoutubeActivityMetadata.ContentType, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataYoutubeActivityMetadata) GetContentType() ContentType { + return v.YoutubeActivityMetadata.ContentType +} + +func (v *LookupActivityMetadataYoutubeActivityMetadata) UnmarshalJSON(b []byte) error { + + if string(b) == "null" { + return nil + } + + var firstPass struct { + *LookupActivityMetadataYoutubeActivityMetadata + graphql.NoUnmarshalJSON + } + firstPass.LookupActivityMetadataYoutubeActivityMetadata = v + + err := json.Unmarshal(b, &firstPass) + if err != nil { + return err + } + + err = json.Unmarshal( + b, &v.YoutubeActivityMetadata) + if err != nil { + return err + } + return nil +} + +type __premarshalLookupActivityMetadataYoutubeActivityMetadata struct { + Typename string `json:"__typename"` + + Title string `json:"title"` + + Subject []YoutubeActivityMetadataSubjectIdentifier `json:"subject"` + + Date graphqlTypes.Date `json:"date"` + + PercentageWatched int `json:"percentageWatched"` + + ContentType ContentType `json:"contentType"` +} + +func (v *LookupActivityMetadataYoutubeActivityMetadata) MarshalJSON() ([]byte, error) { + premarshaled, err := v.__premarshalJSON() + if err != nil { + return nil, err + } + return json.Marshal(premarshaled) +} + +func (v *LookupActivityMetadataYoutubeActivityMetadata) __premarshalJSON() (*__premarshalLookupActivityMetadataYoutubeActivityMetadata, error) { + var retval __premarshalLookupActivityMetadataYoutubeActivityMetadata + + retval.Typename = v.Typename + retval.Title = v.YoutubeActivityMetadata.Title + retval.Subject = v.YoutubeActivityMetadata.Subject + retval.Date = v.YoutubeActivityMetadata.Date + retval.PercentageWatched = v.YoutubeActivityMetadata.PercentageWatched + retval.ContentType = v.YoutubeActivityMetadata.ContentType + return &retval, nil +} + +// LookupTrait includes the requested fields of the GraphQL type Trait. +type LookupTrait struct { + Id uuid.UUID `json:"id"` + Source Source `json:"source"` + Label TraitLabel `json:"label"` + Value string `json:"value"` + Timestamp time.Time `json:"timestamp"` +} + +// GetId returns LookupTrait.Id, and is useful for accessing the field via an interface. +func (v *LookupTrait) GetId() uuid.UUID { return v.Id } + +// GetSource returns LookupTrait.Source, and is useful for accessing the field via an interface. +func (v *LookupTrait) GetSource() Source { return v.Source } + +// GetLabel returns LookupTrait.Label, and is useful for accessing the field via an interface. +func (v *LookupTrait) GetLabel() TraitLabel { return v.Label } + +// GetValue returns LookupTrait.Value, and is useful for accessing the field via an interface. +func (v *LookupTrait) GetValue() string { return v.Value } + +// GetTimestamp returns LookupTrait.Timestamp, and is useful for accessing the field via an interface. +func (v *LookupTrait) GetTimestamp() time.Time { return v.Timestamp } + +// NetflixActivityMetadata includes the GraphQL fields of NetflixActivityMetadata requested by the fragment NetflixActivityMetadata. +type NetflixActivityMetadata struct { + Title string `json:"title"` + Subject []NetflixActivityMetadataSubjectIdentifier `json:"subject"` + Date graphqlTypes.Date `json:"date"` + LastPlayedAt graphqlTypes.Date `json:"lastPlayedAt"` +} + +// GetTitle returns NetflixActivityMetadata.Title, and is useful for accessing the field via an interface. +func (v *NetflixActivityMetadata) GetTitle() string { return v.Title } + +// GetSubject returns NetflixActivityMetadata.Subject, and is useful for accessing the field via an interface. +func (v *NetflixActivityMetadata) GetSubject() []NetflixActivityMetadataSubjectIdentifier { + return v.Subject +} + +// GetDate returns NetflixActivityMetadata.Date, and is useful for accessing the field via an interface. +func (v *NetflixActivityMetadata) GetDate() graphqlTypes.Date { return v.Date } + +// GetLastPlayedAt returns NetflixActivityMetadata.LastPlayedAt, and is useful for accessing the field via an interface. +func (v *NetflixActivityMetadata) GetLastPlayedAt() graphqlTypes.Date { return v.LastPlayedAt } + +// NetflixActivityMetadataSubjectIdentifier includes the requested fields of the GraphQL type Identifier. +type NetflixActivityMetadataSubjectIdentifier struct { + Value string `json:"value"` + IdentifierType IdentifierType `json:"identifierType"` +} + +// GetValue returns NetflixActivityMetadataSubjectIdentifier.Value, and is useful for accessing the field via an interface. +func (v *NetflixActivityMetadataSubjectIdentifier) GetValue() string { return v.Value } + +// GetIdentifierType returns NetflixActivityMetadataSubjectIdentifier.IdentifierType, and is useful for accessing the field via an interface. +func (v *NetflixActivityMetadataSubjectIdentifier) GetIdentifierType() IdentifierType { + return v.IdentifierType +} + +// PlaystationActivityMetadata includes the GraphQL fields of PlaystationActivityMetadata requested by the fragment PlaystationActivityMetadata. +type PlaystationActivityMetadata struct { + Title string `json:"title"` + Subject []PlaystationActivityMetadataSubjectIdentifier `json:"subject"` + LastPlayedAt graphqlTypes.Date `json:"lastPlayedAt"` +} + +// GetTitle returns PlaystationActivityMetadata.Title, and is useful for accessing the field via an interface. +func (v *PlaystationActivityMetadata) GetTitle() string { return v.Title } + +// GetSubject returns PlaystationActivityMetadata.Subject, and is useful for accessing the field via an interface. +func (v *PlaystationActivityMetadata) GetSubject() []PlaystationActivityMetadataSubjectIdentifier { + return v.Subject +} + +// GetLastPlayedAt returns PlaystationActivityMetadata.LastPlayedAt, and is useful for accessing the field via an interface. +func (v *PlaystationActivityMetadata) GetLastPlayedAt() graphqlTypes.Date { return v.LastPlayedAt } + +// PlaystationActivityMetadataSubjectIdentifier includes the requested fields of the GraphQL type Identifier. +type PlaystationActivityMetadataSubjectIdentifier struct { + Value string `json:"value"` + IdentifierType IdentifierType `json:"identifierType"` +} + +// GetValue returns PlaystationActivityMetadataSubjectIdentifier.Value, and is useful for accessing the field via an interface. +func (v *PlaystationActivityMetadataSubjectIdentifier) GetValue() string { return v.Value } + +// GetIdentifierType returns PlaystationActivityMetadataSubjectIdentifier.IdentifierType, and is useful for accessing the field via an interface. +func (v *PlaystationActivityMetadataSubjectIdentifier) GetIdentifierType() IdentifierType { + return v.IdentifierType +} + +type Source string + +const ( + SourceNetflix Source = "NETFLIX" + SourcePlaystation Source = "PLAYSTATION" + SourceYoutube Source = "YOUTUBE" + SourceAmazon Source = "AMAZON" + SourceUber Source = "UBER" + SourceBooking Source = "BOOKING" + SourceInstacart Source = "INSTACART" + SourceInstagram Source = "INSTAGRAM" + SourceX Source = "X" + SourceUbereats Source = "UBEREATS" + SourceGandalf Source = "GANDALF" +) + +type TraitLabel string + +const ( + TraitLabelPrimeSubscriber TraitLabel = "PRIME_SUBSCRIBER" + TraitLabelRating TraitLabel = "RATING" + TraitLabelTripCount TraitLabel = "TRIP_COUNT" + TraitLabelAccountCreatedOn TraitLabel = "ACCOUNT_CREATED_ON" + TraitLabelPlan TraitLabel = "PLAN" + TraitLabelGeniusLevel TraitLabel = "GENIUS_LEVEL" + TraitLabelFollowerCount TraitLabel = "FOLLOWER_COUNT" + TraitLabelFollowingCount TraitLabel = "FOLLOWING_COUNT" + TraitLabelUsername TraitLabel = "USERNAME" + TraitLabelPostCount TraitLabel = "POST_COUNT" + TraitLabelEmail TraitLabel = "EMAIL" + TraitLabelOrderCount TraitLabel = "ORDER_COUNT" +) + +type TripStatus string + +const ( + TripStatusCanceled TripStatus = "CANCELED" + TripStatusCompleted TripStatus = "COMPLETED" + TripStatusUnfulfilled TripStatus = "UNFULFILLED" +) + +// UberActivityMetadata includes the GraphQL fields of UberActivityMetadata requested by the fragment UberActivityMetadata. +type UberActivityMetadata struct { + Subject []UberActivityMetadataSubjectIdentifier `json:"subject"` + BeginTripTime time.Time `json:"beginTripTime"` + DropoffTime time.Time `json:"dropoffTime"` + Cost string `json:"cost"` + City string `json:"city"` + Distance string `json:"distance"` + UberActivityMetadataStatus TripStatus `json:"UberActivityMetadataStatus"` +} + +// GetSubject returns UberActivityMetadata.Subject, and is useful for accessing the field via an interface. +func (v *UberActivityMetadata) GetSubject() []UberActivityMetadataSubjectIdentifier { return v.Subject } + +// GetBeginTripTime returns UberActivityMetadata.BeginTripTime, and is useful for accessing the field via an interface. +func (v *UberActivityMetadata) GetBeginTripTime() time.Time { return v.BeginTripTime } + +// GetDropoffTime returns UberActivityMetadata.DropoffTime, and is useful for accessing the field via an interface. +func (v *UberActivityMetadata) GetDropoffTime() time.Time { return v.DropoffTime } + +// GetCost returns UberActivityMetadata.Cost, and is useful for accessing the field via an interface. +func (v *UberActivityMetadata) GetCost() string { return v.Cost } + +// GetCity returns UberActivityMetadata.City, and is useful for accessing the field via an interface. +func (v *UberActivityMetadata) GetCity() string { return v.City } + +// GetDistance returns UberActivityMetadata.Distance, and is useful for accessing the field via an interface. +func (v *UberActivityMetadata) GetDistance() string { return v.Distance } + +// GetUberActivityMetadataStatus returns UberActivityMetadata.UberActivityMetadataStatus, and is useful for accessing the field via an interface. +func (v *UberActivityMetadata) GetUberActivityMetadataStatus() TripStatus { + return v.UberActivityMetadataStatus +} + +// UberActivityMetadataSubjectIdentifier includes the requested fields of the GraphQL type Identifier. +type UberActivityMetadataSubjectIdentifier struct { + Value string `json:"value"` + IdentifierType IdentifierType `json:"identifierType"` +} + +// GetValue returns UberActivityMetadataSubjectIdentifier.Value, and is useful for accessing the field via an interface. +func (v *UberActivityMetadataSubjectIdentifier) GetValue() string { return v.Value } + +// GetIdentifierType returns UberActivityMetadataSubjectIdentifier.IdentifierType, and is useful for accessing the field via an interface. +func (v *UberActivityMetadataSubjectIdentifier) GetIdentifierType() IdentifierType { + return v.IdentifierType +} + +// UberEatsActivityMetadata includes the GraphQL fields of UberEatsActivityMetadata requested by the fragment UberEatsActivityMetadata. +type UberEatsActivityMetadata struct { + Subject []UberEatsActivityMetadataSubjectIdentifier `json:"subject"` + Date graphqlTypes.Date `json:"date"` + Restaurant string `json:"restaurant"` + Currency string `json:"currency"` + TotalPrice float64 `json:"totalPrice"` + Status UberEatsOrderStatus `json:"status"` + Items []UberEatsActivityMetadataItemsUberEatsOrderItem `json:"items"` +} + +// GetSubject returns UberEatsActivityMetadata.Subject, and is useful for accessing the field via an interface. +func (v *UberEatsActivityMetadata) GetSubject() []UberEatsActivityMetadataSubjectIdentifier { + return v.Subject +} + +// GetDate returns UberEatsActivityMetadata.Date, and is useful for accessing the field via an interface. +func (v *UberEatsActivityMetadata) GetDate() graphqlTypes.Date { return v.Date } + +// GetRestaurant returns UberEatsActivityMetadata.Restaurant, and is useful for accessing the field via an interface. +func (v *UberEatsActivityMetadata) GetRestaurant() string { return v.Restaurant } + +// GetCurrency returns UberEatsActivityMetadata.Currency, and is useful for accessing the field via an interface. +func (v *UberEatsActivityMetadata) GetCurrency() string { return v.Currency } + +// GetTotalPrice returns UberEatsActivityMetadata.TotalPrice, and is useful for accessing the field via an interface. +func (v *UberEatsActivityMetadata) GetTotalPrice() float64 { return v.TotalPrice } + +// GetStatus returns UberEatsActivityMetadata.Status, and is useful for accessing the field via an interface. +func (v *UberEatsActivityMetadata) GetStatus() UberEatsOrderStatus { return v.Status } + +// GetItems returns UberEatsActivityMetadata.Items, and is useful for accessing the field via an interface. +func (v *UberEatsActivityMetadata) GetItems() []UberEatsActivityMetadataItemsUberEatsOrderItem { + return v.Items +} + +// UberEatsActivityMetadataItemsUberEatsOrderItem includes the requested fields of the GraphQL type UberEatsOrderItem. +type UberEatsActivityMetadataItemsUberEatsOrderItem struct { + Name string `json:"name"` + Price string `json:"price"` + QuantityPurchased graphqlTypes.Int64 `json:"quantityPurchased"` + Customizations []UberEatsActivityMetadataItemsUberEatsOrderItemCustomizations `json:"customizations"` +} + +// GetName returns UberEatsActivityMetadataItemsUberEatsOrderItem.Name, and is useful for accessing the field via an interface. +func (v *UberEatsActivityMetadataItemsUberEatsOrderItem) GetName() string { return v.Name } + +// GetPrice returns UberEatsActivityMetadataItemsUberEatsOrderItem.Price, and is useful for accessing the field via an interface. +func (v *UberEatsActivityMetadataItemsUberEatsOrderItem) GetPrice() string { return v.Price } + +// GetQuantityPurchased returns UberEatsActivityMetadataItemsUberEatsOrderItem.QuantityPurchased, and is useful for accessing the field via an interface. +func (v *UberEatsActivityMetadataItemsUberEatsOrderItem) GetQuantityPurchased() graphqlTypes.Int64 { + return v.QuantityPurchased +} + +// GetCustomizations returns UberEatsActivityMetadataItemsUberEatsOrderItem.Customizations, and is useful for accessing the field via an interface. +func (v *UberEatsActivityMetadataItemsUberEatsOrderItem) GetCustomizations() []UberEatsActivityMetadataItemsUberEatsOrderItemCustomizations { + return v.Customizations +} + +// UberEatsActivityMetadataItemsUberEatsOrderItemCustomizations includes the requested fields of the GraphQL type UberEatsOrderItemCustomizations. +type UberEatsActivityMetadataItemsUberEatsOrderItemCustomizations struct { + Customization string `json:"customization"` + Value string `json:"value"` + Quantity graphqlTypes.Int64 `json:"quantity"` +} + +// GetCustomization returns UberEatsActivityMetadataItemsUberEatsOrderItemCustomizations.Customization, and is useful for accessing the field via an interface. +func (v *UberEatsActivityMetadataItemsUberEatsOrderItemCustomizations) GetCustomization() string { + return v.Customization +} + +// GetValue returns UberEatsActivityMetadataItemsUberEatsOrderItemCustomizations.Value, and is useful for accessing the field via an interface. +func (v *UberEatsActivityMetadataItemsUberEatsOrderItemCustomizations) GetValue() string { + return v.Value +} + +// GetQuantity returns UberEatsActivityMetadataItemsUberEatsOrderItemCustomizations.Quantity, and is useful for accessing the field via an interface. +func (v *UberEatsActivityMetadataItemsUberEatsOrderItemCustomizations) GetQuantity() graphqlTypes.Int64 { + return v.Quantity +} + +// UberEatsActivityMetadataSubjectIdentifier includes the requested fields of the GraphQL type Identifier. +type UberEatsActivityMetadataSubjectIdentifier struct { + Value string `json:"value"` + IdentifierType IdentifierType `json:"identifierType"` +} + +// GetValue returns UberEatsActivityMetadataSubjectIdentifier.Value, and is useful for accessing the field via an interface. +func (v *UberEatsActivityMetadataSubjectIdentifier) GetValue() string { return v.Value } + +// GetIdentifierType returns UberEatsActivityMetadataSubjectIdentifier.IdentifierType, and is useful for accessing the field via an interface. +func (v *UberEatsActivityMetadataSubjectIdentifier) GetIdentifierType() IdentifierType { + return v.IdentifierType +} + +type UberEatsOrderStatus string + +const ( + UberEatsOrderStatusSuccess UberEatsOrderStatus = "SUCCESS" + UberEatsOrderStatusEaterCancelled UberEatsOrderStatus = "EATER_CANCELLED" + UberEatsOrderStatusRestaurantCancelled UberEatsOrderStatus = "RESTAURANT_CANCELLED" + UberEatsOrderStatusRestaurantUnfulfilled UberEatsOrderStatus = "RESTAURANT_UNFULFILLED" + UberEatsOrderStatusUnknown UberEatsOrderStatus = "UNKNOWN" +) + +// YoutubeActivityMetadata includes the GraphQL fields of YoutubeActivityMetadata requested by the fragment YoutubeActivityMetadata. +type YoutubeActivityMetadata struct { + Title string `json:"title"` + Subject []YoutubeActivityMetadataSubjectIdentifier `json:"subject"` + Date graphqlTypes.Date `json:"date"` + PercentageWatched int `json:"percentageWatched"` + ContentType ContentType `json:"contentType"` +} + +// GetTitle returns YoutubeActivityMetadata.Title, and is useful for accessing the field via an interface. +func (v *YoutubeActivityMetadata) GetTitle() string { return v.Title } + +// GetSubject returns YoutubeActivityMetadata.Subject, and is useful for accessing the field via an interface. +func (v *YoutubeActivityMetadata) GetSubject() []YoutubeActivityMetadataSubjectIdentifier { + return v.Subject +} + +// GetDate returns YoutubeActivityMetadata.Date, and is useful for accessing the field via an interface. +func (v *YoutubeActivityMetadata) GetDate() graphqlTypes.Date { return v.Date } + +// GetPercentageWatched returns YoutubeActivityMetadata.PercentageWatched, and is useful for accessing the field via an interface. +func (v *YoutubeActivityMetadata) GetPercentageWatched() int { return v.PercentageWatched } + +// GetContentType returns YoutubeActivityMetadata.ContentType, and is useful for accessing the field via an interface. +func (v *YoutubeActivityMetadata) GetContentType() ContentType { return v.ContentType } + +// YoutubeActivityMetadataSubjectIdentifier includes the requested fields of the GraphQL type Identifier. +type YoutubeActivityMetadataSubjectIdentifier struct { + Value string `json:"value"` + IdentifierType IdentifierType `json:"identifierType"` +} + +// GetValue returns YoutubeActivityMetadataSubjectIdentifier.Value, and is useful for accessing the field via an interface. +func (v *YoutubeActivityMetadataSubjectIdentifier) GetValue() string { return v.Value } + +// GetIdentifierType returns YoutubeActivityMetadataSubjectIdentifier.IdentifierType, and is useful for accessing the field via an interface. +func (v *YoutubeActivityMetadataSubjectIdentifier) GetIdentifierType() IdentifierType { + return v.IdentifierType +} + +// __getActivityInput is used internally by genqlient +type __getActivityInput struct { + DataKey string `json:"dataKey"` + ActivityType []ActivityType `json:"activityType"` + Source Source `json:"source"` + Limit graphqlTypes.Int64 `json:"limit"` + Page graphqlTypes.Int64 `json:"page"` +} + +// GetDataKey returns __getActivityInput.DataKey, and is useful for accessing the field via an interface. +func (v *__getActivityInput) GetDataKey() string { return v.DataKey } + +// GetActivityType returns __getActivityInput.ActivityType, and is useful for accessing the field via an interface. +func (v *__getActivityInput) GetActivityType() []ActivityType { return v.ActivityType } + +// GetSource returns __getActivityInput.Source, and is useful for accessing the field via an interface. +func (v *__getActivityInput) GetSource() Source { return v.Source } + +// GetLimit returns __getActivityInput.Limit, and is useful for accessing the field via an interface. +func (v *__getActivityInput) GetLimit() graphqlTypes.Int64 { return v.Limit } + +// GetPage returns __getActivityInput.Page, and is useful for accessing the field via an interface. +func (v *__getActivityInput) GetPage() graphqlTypes.Int64 { return v.Page } + +// __getAppByPublicKeyInput is used internally by genqlient +type __getAppByPublicKeyInput struct { + PublicKey string `json:"publicKey"` +} + +// GetPublicKey returns __getAppByPublicKeyInput.PublicKey, and is useful for accessing the field via an interface. +func (v *__getAppByPublicKeyInput) GetPublicKey() string { return v.PublicKey } + +// __getTraitsInput is used internally by genqlient +type __getTraitsInput struct { + DataKey string `json:"dataKey"` + Source Source `json:"source"` + Labels []TraitLabel `json:"labels"` +} + +// GetDataKey returns __getTraitsInput.DataKey, and is useful for accessing the field via an interface. +func (v *__getTraitsInput) GetDataKey() string { return v.DataKey } + +// GetSource returns __getTraitsInput.Source, and is useful for accessing the field via an interface. +func (v *__getTraitsInput) GetSource() Source { return v.Source } + +// GetLabels returns __getTraitsInput.Labels, and is useful for accessing the field via an interface. +func (v *__getTraitsInput) GetLabels() []TraitLabel { return v.Labels } + +// __lookupActivityInput is used internally by genqlient +type __lookupActivityInput struct { + DataKey string `json:"dataKey"` + ActivityId uuid.UUID `json:"activityId"` +} + +// GetDataKey returns __lookupActivityInput.DataKey, and is useful for accessing the field via an interface. +func (v *__lookupActivityInput) GetDataKey() string { return v.DataKey } + +// GetActivityId returns __lookupActivityInput.ActivityId, and is useful for accessing the field via an interface. +func (v *__lookupActivityInput) GetActivityId() uuid.UUID { return v.ActivityId } + +// __lookupTraitInput is used internally by genqlient +type __lookupTraitInput struct { + DataKey string `json:"dataKey"` + TraitId uuid.UUID `json:"traitId"` +} + +// GetDataKey returns __lookupTraitInput.DataKey, and is useful for accessing the field via an interface. +func (v *__lookupTraitInput) GetDataKey() string { return v.DataKey } + +// GetTraitId returns __lookupTraitInput.TraitId, and is useful for accessing the field via an interface. +func (v *__lookupTraitInput) GetTraitId() uuid.UUID { return v.TraitId } + +// getActivityResponse is returned by getActivity on success. +type getActivityResponse struct { + GetActivity GetActivityActivityResponse `json:"getActivity"` +} + +// GetGetActivity returns getActivityResponse.GetActivity, and is useful for accessing the field via an interface. +func (v *getActivityResponse) GetGetActivity() GetActivityActivityResponse { return v.GetActivity } + +// getAppByPublicKeyResponse is returned by getAppByPublicKey on success. +type getAppByPublicKeyResponse struct { + GetAppByPublicKey GetAppByPublicKeyApplication `json:"getAppByPublicKey"` +} + +// GetGetAppByPublicKey returns getAppByPublicKeyResponse.GetAppByPublicKey, and is useful for accessing the field via an interface. +func (v *getAppByPublicKeyResponse) GetGetAppByPublicKey() GetAppByPublicKeyApplication { + return v.GetAppByPublicKey +} + +// getTraitsResponse is returned by getTraits on success. +type getTraitsResponse struct { + GetTraits []GetTraitsTrait `json:"getTraits"` +} + +// GetGetTraits returns getTraitsResponse.GetTraits, and is useful for accessing the field via an interface. +func (v *getTraitsResponse) GetGetTraits() []GetTraitsTrait { return v.GetTraits } + +// lookupActivityResponse is returned by lookupActivity on success. +type lookupActivityResponse struct { + LookupActivity LookupActivity `json:"lookupActivity"` +} + +// GetLookupActivity returns lookupActivityResponse.LookupActivity, and is useful for accessing the field via an interface. +func (v *lookupActivityResponse) GetLookupActivity() LookupActivity { return v.LookupActivity } + +// lookupTraitResponse is returned by lookupTrait on success. +type lookupTraitResponse struct { + LookupTrait LookupTrait `json:"lookupTrait"` +} + +// GetLookupTrait returns lookupTraitResponse.LookupTrait, and is useful for accessing the field via an interface. +func (v *lookupTraitResponse) GetLookupTrait() LookupTrait { return v.LookupTrait } + +// The query or mutation executed by getActivity. +const getActivity_Operation = ` +query getActivity ($dataKey: String!, $activityType: [ActivityType], $source: Source!, $limit: Int64!, $page: Int64!) { + getActivity(dataKey: $dataKey, activityType: $activityType, source: $source, limit: $limit, page: $page) { + ... on ActivityResponse { + data { + ... on Activity { + id + metadata { + __typename + ... NetflixActivityMetadata + ... PlaystationActivityMetadata + ... AmazonActivityMetadata + ... BookingActivityMetadata + ... YoutubeActivityMetadata + ... UberActivityMetadata + ... InstacartActivityMetadata + ... UberEatsActivityMetadata + } + } + } + limit + total + page + } + } +} +fragment NetflixActivityMetadata on NetflixActivityMetadata { + title + subject { + ... on Identifier { + value + identifierType + } + } + date + lastPlayedAt +} +fragment PlaystationActivityMetadata on PlaystationActivityMetadata { + title + subject { + ... on Identifier { + value + identifierType + } + } + lastPlayedAt +} +fragment AmazonActivityMetadata on AmazonActivityMetadata { + productName + subject { + ... on Identifier { + value + identifierType + } + } + date + quantityPurchased + totalCost +} +fragment BookingActivityMetadata on BookingActivityMetadata { + subject { + ... on Identifier { + value + identifierType + } + } + bookingID + price + bookings { + ... on BookingItem { + startDateTime + endDateTime + address + depatureLocation + arrivalLocation + layoverLocations + activityType + } + } +} +fragment YoutubeActivityMetadata on YoutubeActivityMetadata { + title + subject { + ... on Identifier { + value + identifierType + } + } + date + percentageWatched + contentType +} +fragment UberActivityMetadata on UberActivityMetadata { + subject { + ... on Identifier { + value + identifierType + } + } + beginTripTime + dropoffTime + cost + city + distance + UberActivityMetadataStatus: status +} +fragment InstacartActivityMetadata on InstacartActivityMetadata { + subject { + ... on Identifier { + value + identifierType + } + } + retailer + totalOrderAmountSpent + dateOrdered + dateDelivered + statusString + InstacartActivityMetadataItems: items { + ... on InstacartOrderItem { + itemID + productName + unitPrice + status + quantityPurchased + } + } +} +fragment UberEatsActivityMetadata on UberEatsActivityMetadata { + subject { + ... on Identifier { + value + identifierType + } + } + date + restaurant + currency + totalPrice + status + items { + ... on UberEatsOrderItem { + name + price + quantityPurchased + customizations { + ... on UberEatsOrderItemCustomizations { + customization + value + quantity + } + } + } + } +} +` + +func (eye EyeOfSauron) GetActivity( + ctx_ context.Context, + dataKey string, + activityType []ActivityType, + source Source, + limit graphqlTypes.Int64, + page graphqlTypes.Int64, +) (*getActivityResponse, error) { + req := graphql2.NewRequest(getActivity_Operation) + + req.Var("dataKey", dataKey) + req.Var("activityType", activityType) + req.Var("source", source) + req.Var("limit", limit) + req.Var("page", page) + requestBodyObj := struct { + Query string `json:"query"` + Variables map[string]interface{} `json:"variables"` + }{ + Query: req.Query(), + Variables: req.Vars(), + } + + var requestBody bytes.Buffer + if err := json.NewEncoder(&requestBody).Encode(requestBodyObj); err != nil { + return nil, fmt.Errorf("unable to encode body %s", err) + } + + var err_ error + signatureB64, err_ := SignMessageAsBase64(eye.privateKey, requestBody.Bytes()) + if err_ != nil { + return nil, fmt.Errorf("unable to generate signature: %v", err_) + } + + req.Header.Set("X-Gandalf-Signature", signatureB64) + + var resp_ getActivityResponse + + if err_ := eye.client.Run( + ctx_, + req, + &resp_, + ); err_ != nil { + return nil, fmt.Errorf("failed to execute request: %v", err_) + } + + return &resp_, nil +} + +// The query or mutation executed by getAppByPublicKey. +const getAppByPublicKey_Operation = ` +query getAppByPublicKey ($publicKey: String!) { + getAppByPublicKey(publicKey: $publicKey) { + ... on Application { + appName + publicKey + iconURL + gandalfID + appRegistrar + } + } +} +` + +func (eye EyeOfSauron) GetAppByPublicKey( + ctx_ context.Context, + publicKey string, +) (*getAppByPublicKeyResponse, error) { + req := graphql2.NewRequest(getAppByPublicKey_Operation) + + req.Var("publicKey", publicKey) + requestBodyObj := struct { + Query string `json:"query"` + Variables map[string]interface{} `json:"variables"` + }{ + Query: req.Query(), + Variables: req.Vars(), + } + + var requestBody bytes.Buffer + if err := json.NewEncoder(&requestBody).Encode(requestBodyObj); err != nil { + return nil, fmt.Errorf("unable to encode body %s", err) + } + + var err_ error + signatureB64, err_ := SignMessageAsBase64(eye.privateKey, requestBody.Bytes()) + if err_ != nil { + return nil, fmt.Errorf("unable to generate signature: %v", err_) + } + + req.Header.Set("X-Gandalf-Signature", signatureB64) + + var resp_ getAppByPublicKeyResponse + + if err_ := eye.client.Run( + ctx_, + req, + &resp_, + ); err_ != nil { + return nil, fmt.Errorf("failed to execute request: %v", err_) + } + + return &resp_, nil +} + +// The query or mutation executed by getTraits. +const getTraits_Operation = ` +query getTraits ($dataKey: String!, $source: Source!, $labels: [TraitLabel]!) { + getTraits(dataKey: $dataKey, source: $source, labels: $labels) { + ... on Trait { + id + source + label + value + timestamp + } + } +} +` + +func (eye EyeOfSauron) GetTraits( + ctx_ context.Context, + dataKey string, + source Source, + labels []TraitLabel, +) (*getTraitsResponse, error) { + req := graphql2.NewRequest(getTraits_Operation) + + req.Var("dataKey", dataKey) + req.Var("source", source) + req.Var("labels", labels) + requestBodyObj := struct { + Query string `json:"query"` + Variables map[string]interface{} `json:"variables"` + }{ + Query: req.Query(), + Variables: req.Vars(), + } + + var requestBody bytes.Buffer + if err := json.NewEncoder(&requestBody).Encode(requestBodyObj); err != nil { + return nil, fmt.Errorf("unable to encode body %s", err) + } + + var err_ error + signatureB64, err_ := SignMessageAsBase64(eye.privateKey, requestBody.Bytes()) + if err_ != nil { + return nil, fmt.Errorf("unable to generate signature: %v", err_) + } + + req.Header.Set("X-Gandalf-Signature", signatureB64) + + var resp_ getTraitsResponse + + if err_ := eye.client.Run( + ctx_, + req, + &resp_, + ); err_ != nil { + return nil, fmt.Errorf("failed to execute request: %v", err_) + } + + return &resp_, nil +} + +// The query or mutation executed by lookupActivity. +const lookupActivity_Operation = ` +query lookupActivity ($dataKey: String!, $activityId: UUID!) { + lookupActivity(dataKey: $dataKey, activityId: $activityId) { + ... on Activity { + id + metadata { + __typename + ... NetflixActivityMetadata + ... PlaystationActivityMetadata + ... AmazonActivityMetadata + ... BookingActivityMetadata + ... YoutubeActivityMetadata + ... UberActivityMetadata + ... InstacartActivityMetadata + ... UberEatsActivityMetadata + } + } + } +} +fragment NetflixActivityMetadata on NetflixActivityMetadata { + title + subject { + ... on Identifier { + value + identifierType + } + } + date + lastPlayedAt +} +fragment PlaystationActivityMetadata on PlaystationActivityMetadata { + title + subject { + ... on Identifier { + value + identifierType + } + } + lastPlayedAt +} +fragment AmazonActivityMetadata on AmazonActivityMetadata { + productName + subject { + ... on Identifier { + value + identifierType + } + } + date + quantityPurchased + totalCost +} +fragment BookingActivityMetadata on BookingActivityMetadata { + subject { + ... on Identifier { + value + identifierType + } + } + bookingID + price + bookings { + ... on BookingItem { + startDateTime + endDateTime + address + depatureLocation + arrivalLocation + layoverLocations + activityType + } + } +} +fragment YoutubeActivityMetadata on YoutubeActivityMetadata { + title + subject { + ... on Identifier { + value + identifierType + } + } + date + percentageWatched + contentType +} +fragment UberActivityMetadata on UberActivityMetadata { + subject { + ... on Identifier { + value + identifierType + } + } + beginTripTime + dropoffTime + cost + city + distance + UberActivityMetadataStatus: status +} +fragment InstacartActivityMetadata on InstacartActivityMetadata { + subject { + ... on Identifier { + value + identifierType + } + } + retailer + totalOrderAmountSpent + dateOrdered + dateDelivered + statusString + InstacartActivityMetadataItems: items { + ... on InstacartOrderItem { + itemID + productName + unitPrice + status + quantityPurchased + } + } +} +fragment UberEatsActivityMetadata on UberEatsActivityMetadata { + subject { + ... on Identifier { + value + identifierType + } + } + date + restaurant + currency + totalPrice + status + items { + ... on UberEatsOrderItem { + name + price + quantityPurchased + customizations { + ... on UberEatsOrderItemCustomizations { + customization + value + quantity + } + } + } + } +} +` + +func (eye EyeOfSauron) LookupActivity( + ctx_ context.Context, + dataKey string, + activityId uuid.UUID, +) (*lookupActivityResponse, error) { + req := graphql2.NewRequest(lookupActivity_Operation) + + req.Var("dataKey", dataKey) + req.Var("activityId", activityId) + requestBodyObj := struct { + Query string `json:"query"` + Variables map[string]interface{} `json:"variables"` + }{ + Query: req.Query(), + Variables: req.Vars(), + } + + var requestBody bytes.Buffer + if err := json.NewEncoder(&requestBody).Encode(requestBodyObj); err != nil { + return nil, fmt.Errorf("unable to encode body %s", err) + } + + var err_ error + signatureB64, err_ := SignMessageAsBase64(eye.privateKey, requestBody.Bytes()) + if err_ != nil { + return nil, fmt.Errorf("unable to generate signature: %v", err_) + } + + req.Header.Set("X-Gandalf-Signature", signatureB64) + + var resp_ lookupActivityResponse + + if err_ := eye.client.Run( + ctx_, + req, + &resp_, + ); err_ != nil { + return nil, fmt.Errorf("failed to execute request: %v", err_) + } + + return &resp_, nil +} + +// The query or mutation executed by lookupTrait. +const lookupTrait_Operation = ` +query lookupTrait ($dataKey: String!, $traitId: UUID!) { + lookupTrait(dataKey: $dataKey, traitId: $traitId) { + ... on Trait { + id + source + label + value + timestamp + } + } +} +` + +func (eye EyeOfSauron) LookupTrait( + ctx_ context.Context, + dataKey string, + traitId uuid.UUID, +) (*lookupTraitResponse, error) { + req := graphql2.NewRequest(lookupTrait_Operation) + + req.Var("dataKey", dataKey) + req.Var("traitId", traitId) + requestBodyObj := struct { + Query string `json:"query"` + Variables map[string]interface{} `json:"variables"` + }{ + Query: req.Query(), + Variables: req.Vars(), + } + + var requestBody bytes.Buffer + if err := json.NewEncoder(&requestBody).Encode(requestBodyObj); err != nil { + return nil, fmt.Errorf("unable to encode body %s", err) + } + + var err_ error + signatureB64, err_ := SignMessageAsBase64(eye.privateKey, requestBody.Bytes()) + if err_ != nil { + return nil, fmt.Errorf("unable to generate signature: %v", err_) + } + + req.Header.Set("X-Gandalf-Signature", signatureB64) + + var resp_ lookupTraitResponse + + if err_ := eye.client.Run( + ctx_, + req, + &resp_, + ); err_ != nil { + return nil, fmt.Errorf("failed to execute request: %v", err_) + } + + return &resp_, nil +} diff --git a/generated/genqlient.graphql b/generated/genqlient.graphql new file mode 100644 index 0000000..3d5847e --- /dev/null +++ b/generated/genqlient.graphql @@ -0,0 +1,216 @@ +fragment AmazonActivityMetadata on AmazonActivityMetadata { + productName: productName + subject: subject { + ... on Identifier { + value + identifierType + } + } + date: date + quantityPurchased: quantityPurchased + totalCost: totalCost +} + +fragment NetflixActivityMetadata on NetflixActivityMetadata { + title: title + subject: subject { + ... on Identifier { + value + identifierType + } + } + date: date + lastPlayedAt: lastPlayedAt +} + +fragment UberEatsActivityMetadata on UberEatsActivityMetadata { + subject: subject { + ... on Identifier { + value + identifierType + } + } + date: date + restaurant: restaurant + currency: currency + totalPrice: totalPrice + status: status + items: items { + ... on UberEatsOrderItem { + name + price + quantityPurchased + customizations { + ... on UberEatsOrderItemCustomizations { + customization + value + quantity + } + } + } + } +} + +fragment InstacartActivityMetadata on InstacartActivityMetadata { + subject: subject { + ... on Identifier { + value + identifierType + } + } + retailer: retailer + totalOrderAmountSpent: totalOrderAmountSpent + dateOrdered: dateOrdered + dateDelivered: dateDelivered + statusString: statusString + InstacartActivityMetadataItems: items { + ... on InstacartOrderItem { + itemID + productName + unitPrice + status + quantityPurchased + } + } +} + +fragment PlaystationActivityMetadata on PlaystationActivityMetadata { + title: title + subject: subject { + ... on Identifier { + value + identifierType + } + } + lastPlayedAt: lastPlayedAt +} + +fragment BookingActivityMetadata on BookingActivityMetadata { + subject: subject { + ... on Identifier { + value + identifierType + } + } + bookingID: bookingID + price: price + bookings: bookings { + ... on BookingItem { + startDateTime + endDateTime + address + depatureLocation + arrivalLocation + layoverLocations + activityType + } + } +} + +fragment UberActivityMetadata on UberActivityMetadata { + subject: subject { + ... on Identifier { + value + identifierType + } + } + beginTripTime: beginTripTime + dropoffTime: dropoffTime + cost: cost + city: city + distance: distance + UberActivityMetadataStatus: status +} + +fragment YoutubeActivityMetadata on YoutubeActivityMetadata { + title: title + subject: subject { + ... on Identifier { + value + identifierType + } + } + date: date + percentageWatched: percentageWatched + contentType: contentType +} + +query getActivity($dataKey: String!, $activityType: [ActivityType], $source: Source!, $limit: Int64!, $page: Int64!) { + getActivity(dataKey: $dataKey, activityType: $activityType, source: $source, limit: $limit, page: $page) { + ... on ActivityResponse { + data { + ... on Activity { + id + metadata { + ...NetflixActivityMetadata + ...PlaystationActivityMetadata + ...AmazonActivityMetadata + ...BookingActivityMetadata + ...YoutubeActivityMetadata + ...UberActivityMetadata + ...InstacartActivityMetadata + ...UberEatsActivityMetadata + } + } + } + limit + total + page + } + } +} + +query lookupActivity($dataKey: String!, $activityId: UUID!) { + lookupActivity(dataKey: $dataKey, activityId: $activityId) { + ... on Activity { + id + metadata { + ...NetflixActivityMetadata + ...PlaystationActivityMetadata + ...AmazonActivityMetadata + ...BookingActivityMetadata + ...YoutubeActivityMetadata + ...UberActivityMetadata + ...InstacartActivityMetadata + ...UberEatsActivityMetadata + } + } + } +} + +query getAppByPublicKey($publicKey: String!) { + getAppByPublicKey(publicKey: $publicKey) { + ... on Application { + appName + publicKey + iconURL + gandalfID + appRegistrar + } + } +} + +query getTraits($dataKey: String!, $source: Source!, $labels: [TraitLabel]!) { + getTraits(dataKey: $dataKey, source: $source, labels: $labels) { + ... on Trait { + id + source + label + value + timestamp + } + } +} + +query lookupTrait($dataKey: String!, $traitId: UUID!) { + lookupTrait(dataKey: $dataKey, traitId: $traitId) { + ... on Trait { + id + source + label + value + timestamp + } + } +} + diff --git a/generated/genqlient.yaml b/generated/genqlient.yaml new file mode 100644 index 0000000..18dc746 --- /dev/null +++ b/generated/genqlient.yaml @@ -0,0 +1,14 @@ + +schema: schema.graphql +operations: +- genqlient.graphql +generated: generated.go +bindings: + Int64: + type: github.com/gandalf-network/gandalf-sdk-go/eyeofsauron/graphqlTypes.Int64 + Date: + type: github.com/gandalf-network/gandalf-sdk-go/eyeofsauron/graphqlTypes.Date + UUID: + type: github.com/google/uuid.UUID + Time: + type: time.Time diff --git a/generated/schema.graphql b/generated/schema.graphql new file mode 100644 index 0000000..e99bd5e --- /dev/null +++ b/generated/schema.graphql @@ -0,0 +1,247 @@ +type Activity { + id: String! + metadata: ActivityMetadata! +} + +interface ActivityMetadata { + subject: [Identifier] +} + +type ActivityResponse { + data: [Activity]! + limit: Int64! + total: Int64! + page: Int64! +} + +enum ActivityType { + TRIP + STAY + SHOP + PLAY + WATCH +} + +type AmazonActivityMetadata implements ActivityMetadata { + productName: String! + subject: [Identifier] + date: Date + quantityPurchased: Int! + totalCost: String! +} + +type Application { + appName: String! + publicKey: String! + iconURL: String! + gandalfID: Int64! + appRegistrar: String! +} + +type BookingActivityMetadata implements ActivityMetadata { + subject: [Identifier] + bookingID: String! + price: String! + bookings: [BookingItem]! +} + +type BookingItem { + startDateTime: Time! + endDateTime: Time! + address: String! + depatureLocation: String! + arrivalLocation: String! + layoverLocations: [String]! + activityType: ActivityType! +} + +scalar Boolean + +enum ContentType { + VIDEO + SHORTS + MUSIC +} + +scalar Date + +scalar Float + +scalar ID + +type Identifier { + value: String! + identifierType: IdentifierType! +} + +enum IdentifierType { + IMDB + MOBY + RAWG + IGDB + ASIN + PLAYSTATION + YOUTUBE + TVDB + TVMAZE + UBER + BOOKING + INSTACART + UBEREATS +} + +type InstacartActivityMetadata implements ActivityMetadata { + subject: [Identifier] + retailer: String! + totalOrderAmountSpent: String! + dateOrdered: Date! + dateDelivered: Date! + statusString: String! + items: [InstacartOrderItem]! +} + +enum InstacartItemStatus { + FOUND + REPLACED + TOREFUND +} + +type InstacartOrderItem { + itemID: String! + productName: String! + unitPrice: String! + status: InstacartItemStatus! + quantityPurchased: Int64! +} + +enum InstacartOrderStatus { + COMPLETE +} + +scalar Int + +scalar Int64 + +scalar JSON + +scalar Map + +type NetflixActivityMetadata implements ActivityMetadata { + title: String! + subject: [Identifier] + date: Date + lastPlayedAt: Date +} + +type PlaystationActivityMetadata implements ActivityMetadata { + title: String! + subject: [Identifier] + lastPlayedAt: Date +} + +type Query { + getActivity(dataKey: String!, activityType: [ActivityType], source: Source!, limit: Int64!, page: Int64!): ActivityResponse! + lookupActivity(dataKey: String!, activityId: UUID!): Activity! + getAppByPublicKey(publicKey: String!): Application! + getTraits(dataKey: String!, source: Source!, labels: [TraitLabel]!): [Trait]! + lookupTrait(dataKey: String!, traitId: UUID!): Trait! +} + +enum Source { + NETFLIX + PLAYSTATION + YOUTUBE + AMAZON + UBER + BOOKING + INSTACART + INSTAGRAM + X + UBEREATS + GANDALF +} + +scalar String + +scalar Time + +type Trait { + id: UUID! + source: Source! + label: TraitLabel! + value: String! + timestamp: Time! +} + +enum TraitLabel { + PRIME_SUBSCRIBER + RATING + TRIP_COUNT + ACCOUNT_CREATED_ON + PLAN + GENIUS_LEVEL + FOLLOWER_COUNT + FOLLOWING_COUNT + USERNAME + POST_COUNT + EMAIL + ORDER_COUNT +} + +enum TripStatus { + CANCELED + COMPLETED + UNFULFILLED +} + +scalar UUID + +type UberActivityMetadata implements ActivityMetadata { + subject: [Identifier] + beginTripTime: Time! + dropoffTime: Time + cost: String! + city: String! + distance: String! + status: TripStatus! +} + +type UberEatsActivityMetadata implements ActivityMetadata { + subject: [Identifier] + date: Date + restaurant: String! + currency: String! + totalPrice: Float! + status: UberEatsOrderStatus! + items: [UberEatsOrderItem]! +} + +type UberEatsOrderItem { + name: String! + price: String! + quantityPurchased: Int64! + customizations: [UberEatsOrderItemCustomizations]! +} + +type UberEatsOrderItemCustomizations { + customization: String! + value: String! + quantity: Int64! +} + +enum UberEatsOrderStatus { + SUCCESS + EATER_CANCELLED + RESTAURANT_CANCELLED + RESTAURANT_UNFULFILLED + UNKNOWN +} + +type YoutubeActivityMetadata implements ActivityMetadata { + title: String! + subject: [Identifier] + date: Date + percentageWatched: Int! + contentType: ContentType! +} +