diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..76d29a6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.gitpod.yaml +.env +decoded_qrcode.png \ No newline at end of file diff --git a/README.md b/README.md index bba3caa..bae3e04 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ package main import ( "log" + "github.com/gandalf-network/gandalf-sdk-go/connect" "github.com/gandalf-network/gandalf-sdk-go/eyeofsauron/generated" ) @@ -63,17 +64,16 @@ import ( "github.com/gandalf-network/gandalf-sdk-go/eyeofsauron/generated" ) -func getActivity() { - // Initialization - eye, err := generated.NewEyeOfSauron(" ", url) + + + // Call the GenerateQRCode method + qrCode, err := conn.GenerateQRCode() + if err != nil { + log.Fatalf("An error occurred generating QR Code url: %v", err) + } + fmt.Println("Base64 QR Code => ", 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 new file mode 100644 index 0000000..1b09cf5 --- /dev/null +++ b/connect/connect.go @@ -0,0 +1,318 @@ +package connect + +import ( + "context" + "encoding/base64" + "encoding/json" + "fmt" + "log" + "net/url" + "strings" + + "github.com/gandalf-network/gandalf-sdk-go/eyeofsauron/constants" + "github.com/skip2/go-qrcode" + graphqlClient "github.com/gandalf-network/gandalf-sdk-go/eyeofsauron/graphql" +) + +var ( + IOS_APP_CLIP_BASE_URL = "https://appclip.apple.com/id?p=network.gandalf.connect.Clip" + 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" +) + +const ( + InvalidService GandalfErrorCode = iota + InvalidPublicKey + InvalidRedirectURL + QRCodeGenNotSupported + QRCodeNotGenerated + EncodingError +) + +func (e *GandalfError) Error() string { + return fmt.Sprintf("%s (code: %d)", e.Message, e.Code) +} + + +func NewConnect(config Config) (*Connect, error) { + if config.PublicKey == "" || config.RedirectURL == "" { + return nil, fmt.Errorf("invalid parameters") + } + + if config.Platform == "" { + config.Platform = PlatformTypeIOS + } + return &Connect{PublicKey: config.PublicKey, RedirectURL: config.RedirectURL, Data: config.Data, Platform: config.Platform}, nil +} + +func (c *Connect) GenerateURL() (string, error) { + services, err := runValidation(c.PublicKey, c.RedirectURL, c.Data, c.VerificationStatus) + if err != nil { + return "", err + } + + servicesJSON := servicesToJSON(services) + + url, err := c.encodeComponents(string(servicesJSON), c.RedirectURL, c.PublicKey) + if err != nil { + return "", &GandalfError{ + Message: "Encoding Error", + Code: EncodingError, + } + } + return url, nil +} + +func (c *Connect) GenerateQRCode() (string, error) { + if c.Data == nil { + return "", &GandalfError{ + Message: "Invalid input parameters", + Code: QRCodeGenNotSupported, + } + } + + services, err := runValidation(c.PublicKey, c.RedirectURL, c.Data, c.VerificationStatus) + if err != nil { + return "", err + } + + servicesJSON := servicesToJSON(services) + appClipURL, err := c.encodeComponents(string(servicesJSON), c.RedirectURL, c.PublicKey) + if err != nil { + return "", &GandalfError{ + Message: "Encoding Error", + Code: EncodingError, + } + } + + qrCode, err := qrcode.New(appClipURL, qrcode.Medium) + if err != nil { + return "", &GandalfError{ + Message: "QRCode Generation Error", + Code: QRCodeNotGenerated, + } + } + + qrCodeData, err := qrCode.PNG(256) + if err != nil { + return "", &GandalfError{ + Message: "QRCode Generation Error", + Code: QRCodeNotGenerated, + } + } + qrCodeURL := fmt.Sprintf("data:image/png;base64,%s", base64.StdEncoding.EncodeToString(qrCodeData)) + return qrCodeURL, nil +} + +func introspectSauron() IntrospectionResult { + client := graphqlClient.NewClient(SAURON_BASE_URL) + req := graphqlClient.NewRequest(constants.IntrospectionQuery) + + ctx := context.Background() + + var respData IntrospectionResult + + if err := client.Run(ctx, req, &respData); err != nil { + log.Fatalf("Error making introspection query: %v", err) + } + return respData +} + +func validateRedirectURL(rawURL string) error { + _, err := url.ParseRequestURI(rawURL) + if err != nil { + return &GandalfError{ + Message: "Invalid redirect URL", + Code: InvalidRedirectURL, + } + } + return nil +} + +func validatePublicKey(publicKey string) bool { + return publicKeyRequest(publicKey) +} + +func getSupportedServices() []Value { + gqlSchema := introspectSauron() + for _, val := range gqlSchema.Schema.Types { + if val.Kind == "ENUM" && val.Name == "Source" { + return val.EnumValues + } + } + return nil +} + +func validateInputData(input InputData) (InputData, error) { + services := getSupportedServices() + + cleanServices := make(InputData) + unsupportedServices := []string{} + + keys := make([]string, 0, len(input)) + for key := range input { + keys = append(keys, key) + } + + if len(keys) > 1 { + return nil, &GandalfError{ + Message: "Only one service is supported per Connect URL", + Code: InvalidService, + } + } + + for _, key := range keys { + lowerKey := strings.ToUpper(key) + if !contains(services, lowerKey) { + unsupportedServices = append(unsupportedServices, key) + continue + } + + value := input[key] + switch v := value.(type) { + case bool: + if !v { + return nil, &GandalfError{ + Message: "At least one service has to be required", + Code: InvalidService, + } + } + cleanServices[lowerKey] = v + case Service: + if err := validateInputService(v); err != nil { + return nil, err + } + cleanServices[lowerKey] = v + default: + return nil, &GandalfError{ + Message: fmt.Sprintf("Unsupported value type for key %s", key), + Code: InvalidService, + } + } + } + + if len(unsupportedServices) > 0 { + return nil, &GandalfError{ + Message: fmt.Sprintf("These services %s are unsupported", strings.Join(unsupportedServices, " ")), + Code: InvalidService, + } + } + + return cleanServices, nil +} + +func contains(slice []Value, item string) bool { + for _, v := range slice { + if v.Name == item { + return true + } + } + return false +} + +func validateInputService(input Service) error { + if (len(input.Activities) < 1) && (len(input.Traits) < 1) { + return &GandalfError{ + Message: "At least one trait or activity is required", + Code: InvalidService, + } + } + return nil +} + +func publicKeyRequest(publicKey string) bool { + graphqlRequest := graphqlClient.NewRequest(` + query GetAppByPublicKey($publicKey: String!) { + getAppByPublicKey( + publicKey: $publicKey + ) { + appName + gandalfID + } + } + `) + + graphqlRequest.Var("publicKey", publicKey) + client := graphqlClient.NewClient(SAURON_BASE_URL) + + ctx := context.Background() + + var graphqlResponse map[string]interface{} + + if err := client.Run(ctx, graphqlRequest, &graphqlResponse); err != nil { + log.Printf("Error making publicKey request query: %v", err) + return false + } + + responseData, ok := graphqlResponse["getAppByPublicKey"].(map[string]interface{}) + if !ok { + log.Printf("Unexpected response structure: %v", graphqlResponse) + return false + } + + body, err := json.Marshal(responseData) + if err != nil { + return false + } + + var respData Application + err = json.Unmarshal(body, &respData) + if err != nil { + return false + } + return respData.GandalfID > 0 +} + +func runValidation(publicKey string, redirectURL string, input InputData, verificationStatus bool) (InputData, error) { + if !verificationStatus { + isPublicKeyValid := validatePublicKey(publicKey) + if !isPublicKeyValid { + return nil, &GandalfError{ + Message: "Invalid public key", + Code: InvalidPublicKey, + } + } + + err := validateRedirectURL(redirectURL) + if err != nil { + return nil, err + } + + services, err := validateInputData(input) + if err != nil { + return nil, err + } + return services, nil + } + return nil, nil +} + + +func (c *Connect) encodeComponents(data, redirectUrl string, publicKey string) (string, error) { + var baseURL string + switch c.Platform { + case PlatformTypeAndroid: + baseURL = ANDROID_APP_CLIP_BASE_URL + case PlatformUniversal: + baseURL = UNIVERSAL_APP_CLIP_BASE_URL + default: + baseURL = IOS_APP_CLIP_BASE_URL + } + + base64Data := base64.StdEncoding.EncodeToString([]byte(data)) + + encodedServices := url.QueryEscape(string(base64Data)) + encodedRedirectURL := url.QueryEscape(redirectUrl) + encodedPublicKey := url.QueryEscape(publicKey) + + return fmt.Sprintf("%s?data=%s&redirectUrl=%s&publicKey=%s", baseURL, encodedServices, encodedRedirectURL, encodedPublicKey), nil +} + +func servicesToJSON(services InputData) []byte { + servicesJSON, err := json.Marshal(services) + if err != nil { + log.Fatalf("Error marshaling JSON: %v", err) + } + return servicesJSON +} diff --git a/connect/connect_test.go b/connect/connect_test.go new file mode 100644 index 0000000..3d97b4c --- /dev/null +++ b/connect/connect_test.go @@ -0,0 +1,136 @@ +package connect + +import ( + "testing" +) + +func TestGenerateURL(t *testing.T) { + tests := []struct { + name string + config Config + expectedErr error + validPublicKey bool + }{ + { + name: "Valid parameters", + config: Config{ + PublicKey: "0x036518f1c7a10fc77f835becc0aca9916c54505f771c82d87dd5943bb01ba5ca08", + RedirectURL: "https://example.com/redirect", + Data: InputData{ + "uber": Service{ + Traits: []string{"rating"}, + Activities: []string{"trip"}, + }, + }, + Platform: PlatformTypeIOS, + }, + expectedErr: nil, + validPublicKey: true, + }, + { + name: "Invalid public key", + config: Config{ + PublicKey: "invalid-public-key", + RedirectURL: "https://example.com/redirect", + Data: InputData{ + "uber": Service{ + Traits: []string{"rating"}, + Activities: []string{"trip"}, + }, + }, + Platform: PlatformTypeIOS, + }, + expectedErr: &GandalfError{Message: "Invalid public key", Code: InvalidPublicKey}, + validPublicKey: false, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + conn, err := NewConnect(tt.config) + if err != nil { + t.Fatalf("NewConnect() error = %v", err) + } + + url, err := conn.GenerateURL() + if tt.expectedErr != nil { + if err == nil || err.Error() != tt.expectedErr.Error() { + t.Fatalf("GenerateURL() error = %v, expectedErr = %v", err, tt.expectedErr) + } + return + } + if err != nil { + t.Fatalf("GenerateURL() error = %v, expectedErr = %v", err, tt.expectedErr) + } + if url == "" { + t.Fatal("GenerateURL() returned an empty URL") + } + }) + } +} + +func TestGenerateQRCode(t *testing.T) { + tests := []struct { + name string + config Config + expectedErr error + validPublicKey bool + }{ + { + name: "Valid parameters", + config: Config{ + PublicKey: "0x036518f1c7a10fc77f835becc0aca9916c54505f771c82d87dd5943bb01ba5ca08", + RedirectURL: "https://example.com/redirect", + Data: InputData{ + "uber": Service{ + Traits: []string{"rating"}, + Activities: []string{"trip"}, + }, + }, + Platform: PlatformTypeIOS, + }, + expectedErr: nil, + validPublicKey: true, + }, + { + name: "Invalid public key", + config: Config{ + PublicKey: "invalid-public-key", + RedirectURL: "https://example.com/redirect", + Data: InputData{ + "uber": Service{ + Traits: []string{"rating"}, + Activities: []string{"trip"}, + }, + }, + Platform: PlatformTypeIOS, + }, + expectedErr: &GandalfError{Message: "Invalid public key", Code: InvalidPublicKey}, + validPublicKey: false, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + + conn, err := NewConnect(tt.config) + if err != nil { + t.Fatalf("NewConnect() error = %v", err) + } + + qrCode, err := conn.GenerateQRCode() + if tt.expectedErr != nil { + if err == nil || err.Error() != tt.expectedErr.Error() { + t.Fatalf("GenerateQRCode() error = %v, expectedErr = %v", err, tt.expectedErr) + } + return + } + if err != nil { + t.Fatalf("GenerateQRCode() error = %v, expectedErr = %v", err, tt.expectedErr) + } + if qrCode == "" { + t.Fatal("GenerateQRCode() returned an empty QR code URL") + } + }) + } +} diff --git a/connect/example/main.go b/connect/example/main.go new file mode 100644 index 0000000..63ceb5b --- /dev/null +++ b/connect/example/main.go @@ -0,0 +1,84 @@ +package main + +import ( + "os" + "fmt" + "log" + + "encoding/base64" + "github.com/gandalf-network/gandalf-sdk-go/connect" + "strings" +) + +const publicKey = "0x036518f1c7a10fc77f835becc0aca9916c54505f771c82d87dd5943bb01ba5ca08"; +const redirectURL = "https://example.com" + + +func main() { + services := connect.InputData{ + "netflix": connect.Service{ + Traits: []string{"rating"}, + Activities: []string{"watch"}, + }, + } + + config := connect.Config{ + PublicKey: publicKey, + RedirectURL: redirectURL, + Data: services, + } + + conn, err := connect.NewConnect(config) + if err != nil { + 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) + } + fmt.Println("URL => ", url) + + + // Generate QRCode + qrCode, err := conn.GenerateQRCode() + if err != nil { + log.Fatalf("An error occurred generating QR Code url: %v", err) + } + fmt.Println("Base64 QR Code => ", qrCode) + + var base64QRCodeWithPrefix string + if strings.HasPrefix(qrCode, "data:image/png;base64,") { + base64QRCodeWithPrefix = strings.TrimPrefix(qrCode, "data:image/png;base64,") + } + + decodedQRCode, err := base64.StdEncoding.DecodeString(base64QRCodeWithPrefix) + if err != nil { + log.Fatalf("Failed to decode base64 QR code: %v", err) + } + + outputFile := "decoded_qrcode.png" + err = os.WriteFile(outputFile, decodedQRCode, 0644) + if err != nil { + log.Fatalf("Failed to save decoded QR code as PNG: %v", err) + } + + 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/connect/types.go b/connect/types.go new file mode 100644 index 0000000..a3c997f --- /dev/null +++ b/connect/types.go @@ -0,0 +1,104 @@ +package connect + + +type Connect struct { + PublicKey string + RedirectURL string + Platform PlatformType + VerificationStatus bool + Data InputData +} + +type Config struct { + PublicKey string + RedirectURL string + Platform PlatformType + Data InputData +} + +type PlatformType string + +const ( + PlatformTypeIOS PlatformType = "ios" + PlatformTypeAndroid PlatformType = "android" + PlatformUniversal PlatformType = "universal" +) + +type GandalfErrorCode int + +// GandalfError is a custom error type for validation errors +type GandalfError struct { + Message string + Code GandalfErrorCode +} + +type Application struct { + // The human-readable name of the application. + AppName string `json:"appName"` + // A public key associated with the application, used for cryptographic operations such as + // verifying the identity of the application. + PublicKey string `json:"publicKey"` + // The URL pointing to the icon graphic for the application. This URL should link to an image + // that visually represents the application, aiding in its identification and branding. + IconURL string `json:"iconURL"` + // A unique identifier assigned to the application upon registration. + GandalfID int64 `json:"gandalfID"` + // The address of the user who registered the application. + AppRegistrar string `json:"appRegistrar"` +} +// type Application map[string]interface{} + +type SupportedService struct { + Name string `json:"name"` + Description string `json:"description"` + IsDeprecated bool `json:"isDeprecated"` + DeprecationReason string `json:"deprecationReason"` +} + +type Service struct { + Traits []string `json:"traits,omitempty"` + Activities []string `json:"activities,omitempty"` +} + +type InputData map[string]interface{} + +type SupportedServices []Value + +// Type represents a GraphQL type with various properties like kind, name, description, etc. +type Type struct { + Kind string `json:"kind"` + Name string `json:"name"` + Description string `json:"description"` + Fields []Field `json:"fields"` + InputFields []Field `json:"inputFields"` + Interfaces []Type `json:"interfaces"` + EnumValues []Value `json:"enumValues"` + PossibleTypes []Type `json:"possibleTypes"` + OfType *Type `json:"ofType"` +} + +// Field represents a field in a GraphQL type with various properties +type Field struct { + Name string `json:"name"` + Description string `json:"description"` + Type Type `json:"type"` + DefaultValue string `json:"defaultValue"` + IsDeprecated bool `json:"isDeprecated"` + DeprecationReason string `json:"deprecationReason"` + Args []Field `json:"args"` +} + +// Value represents a value in an enum type +type Value struct { + Name string `json:"name"` + Description string `json:"description"` + IsDeprecated bool `json:"isDeprecated"` + DeprecationReason string `json:"deprecationReason"` +} + +// IntrospectionResult represents the schema structure received from the GraphQL introspection query +type IntrospectionResult struct { + Schema struct { + Types []Type `json:"types"` + } `json:"__schema"` +} diff --git a/eyeofsauron/constants.go b/eyeofsauron/constants/constants.go similarity index 95% rename from eyeofsauron/constants.go rename to eyeofsauron/constants/constants.go index 6bbc920..d4ec078 100644 --- a/eyeofsauron/constants.go +++ b/eyeofsauron/constants/constants.go @@ -1,6 +1,6 @@ -package main +package constants -const gqlgenConfig = ` +const GQLGenConfig = ` schema: schema.graphql operations: - genqlient.graphql @@ -16,7 +16,7 @@ bindings: type: time.Time ` -const introspectionQuery = ` +const IntrospectionQuery = ` query { __schema { types { diff --git a/eyeofsauron/example/generated/generated.go b/eyeofsauron/example/generated/generated.go index 39335eb..88b5001 100644 --- a/eyeofsauron/example/generated/generated.go +++ b/eyeofsauron/example/generated/generated.go @@ -720,9 +720,9 @@ func (v *GetActivityActivityResponseDataActivityMetadataInstacartActivityMetadat 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 +// GetItems returns GetActivityActivityResponseDataActivityMetadataInstacartActivityMetadata.Items, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataInstacartActivityMetadata) GetItems() []InstacartActivityMetadataItemsInstacartOrderItem { + return v.InstacartActivityMetadata.Items } func (v *GetActivityActivityResponseDataActivityMetadataInstacartActivityMetadata) UnmarshalJSON(b []byte) error { @@ -765,7 +765,7 @@ type __premarshalGetActivityActivityResponseDataActivityMetadataInstacartActivit StatusString string `json:"statusString"` - InstacartActivityMetadataItems []InstacartActivityMetadataInstacartActivityMetadataItemsInstacartOrderItem `json:"InstacartActivityMetadataItems"` + Items []InstacartActivityMetadataItemsInstacartOrderItem `json:"items"` } func (v *GetActivityActivityResponseDataActivityMetadataInstacartActivityMetadata) MarshalJSON() ([]byte, error) { @@ -786,7 +786,7 @@ func (v *GetActivityActivityResponseDataActivityMetadataInstacartActivityMetadat retval.DateOrdered = v.InstacartActivityMetadata.DateOrdered retval.DateDelivered = v.InstacartActivityMetadata.DateDelivered retval.StatusString = v.InstacartActivityMetadata.StatusString - retval.InstacartActivityMetadataItems = v.InstacartActivityMetadata.InstacartActivityMetadataItems + retval.Items = v.InstacartActivityMetadata.Items return &retval, nil } @@ -997,9 +997,9 @@ func (v *GetActivityActivityResponseDataActivityMetadataUberActivityMetadata) Ge 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 +// GetStatus returns GetActivityActivityResponseDataActivityMetadataUberActivityMetadata.Status, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataUberActivityMetadata) GetStatus() TripStatus { + return v.UberActivityMetadata.Status } func (v *GetActivityActivityResponseDataActivityMetadataUberActivityMetadata) UnmarshalJSON(b []byte) error { @@ -1042,7 +1042,7 @@ type __premarshalGetActivityActivityResponseDataActivityMetadataUberActivityMeta Distance string `json:"distance"` - UberActivityMetadataStatus TripStatus `json:"UberActivityMetadataStatus"` + Status TripStatus `json:"status"` } func (v *GetActivityActivityResponseDataActivityMetadataUberActivityMetadata) MarshalJSON() ([]byte, error) { @@ -1063,7 +1063,7 @@ func (v *GetActivityActivityResponseDataActivityMetadataUberActivityMetadata) __ retval.Cost = v.UberActivityMetadata.Cost retval.City = v.UberActivityMetadata.City retval.Distance = v.UberActivityMetadata.Distance - retval.UberActivityMetadataStatus = v.UberActivityMetadata.UberActivityMetadataStatus + retval.Status = v.UberActivityMetadata.Status return &retval, nil } @@ -1103,14 +1103,14 @@ func (v *GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata 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 +// GetUberEatsActivityMetadataStatus returns GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata.UberEatsActivityMetadataStatus, and is useful for accessing the field via an interface. +func (v *GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata) GetUberEatsActivityMetadataStatus() UberEatsOrderStatus { + return v.UberEatsActivityMetadata.UberEatsActivityMetadataStatus } -// GetItems returns GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata.Items, and is useful for accessing the field via an interface. -func (v *GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata) GetItems() []UberEatsActivityMetadataItemsUberEatsOrderItem { - return v.UberEatsActivityMetadata.Items +// 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 { @@ -1151,9 +1151,9 @@ type __premarshalGetActivityActivityResponseDataActivityMetadataUberEatsActivity TotalPrice float64 `json:"totalPrice"` - Status UberEatsOrderStatus `json:"status"` + UberEatsActivityMetadataStatus UberEatsOrderStatus `json:"UberEatsActivityMetadataStatus"` - Items []UberEatsActivityMetadataItemsUberEatsOrderItem `json:"items"` + UberEatsActivityMetadataItems []UberEatsActivityMetadataUberEatsActivityMetadataItemsUberEatsOrderItem `json:"UberEatsActivityMetadataItems"` } func (v *GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata) MarshalJSON() ([]byte, error) { @@ -1173,8 +1173,8 @@ func (v *GetActivityActivityResponseDataActivityMetadataUberEatsActivityMetadata 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 + retval.UberEatsActivityMetadataStatus = v.UberEatsActivityMetadata.UberEatsActivityMetadataStatus + retval.UberEatsActivityMetadataItems = v.UberEatsActivityMetadata.UberEatsActivityMetadataItems return &retval, nil } @@ -1341,13 +1341,13 @@ const ( // 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"` + 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"` + Items []InstacartActivityMetadataItemsInstacartOrderItem `json:"items"` } // GetSubject returns InstacartActivityMetadata.Subject, and is useful for accessing the field via an interface. @@ -1370,13 +1370,13 @@ func (v *InstacartActivityMetadata) GetDateDelivered() graphqlTypes.Date { retur // 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 +// GetItems returns InstacartActivityMetadata.Items, and is useful for accessing the field via an interface. +func (v *InstacartActivityMetadata) GetItems() []InstacartActivityMetadataItemsInstacartOrderItem { + return v.Items } -// InstacartActivityMetadataInstacartActivityMetadataItemsInstacartOrderItem includes the requested fields of the GraphQL type InstacartOrderItem. -type InstacartActivityMetadataInstacartActivityMetadataItemsInstacartOrderItem struct { +// InstacartActivityMetadataItemsInstacartOrderItem includes the requested fields of the GraphQL type InstacartOrderItem. +type InstacartActivityMetadataItemsInstacartOrderItem struct { ItemID string `json:"itemID"` ProductName string `json:"productName"` UnitPrice string `json:"unitPrice"` @@ -1384,28 +1384,24 @@ type InstacartActivityMetadataInstacartActivityMetadataItemsInstacartOrderItem s 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 -} +// GetItemID returns InstacartActivityMetadataItemsInstacartOrderItem.ItemID, and is useful for accessing the field via an interface. +func (v *InstacartActivityMetadataItemsInstacartOrderItem) GetItemID() string { return v.ItemID } -// GetProductName returns InstacartActivityMetadataInstacartActivityMetadataItemsInstacartOrderItem.ProductName, and is useful for accessing the field via an interface. -func (v *InstacartActivityMetadataInstacartActivityMetadataItemsInstacartOrderItem) GetProductName() string { +// GetProductName returns InstacartActivityMetadataItemsInstacartOrderItem.ProductName, and is useful for accessing the field via an interface. +func (v *InstacartActivityMetadataItemsInstacartOrderItem) 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 -} +// GetUnitPrice returns InstacartActivityMetadataItemsInstacartOrderItem.UnitPrice, and is useful for accessing the field via an interface. +func (v *InstacartActivityMetadataItemsInstacartOrderItem) GetUnitPrice() string { return v.UnitPrice } -// GetStatus returns InstacartActivityMetadataInstacartActivityMetadataItemsInstacartOrderItem.Status, and is useful for accessing the field via an interface. -func (v *InstacartActivityMetadataInstacartActivityMetadataItemsInstacartOrderItem) GetStatus() InstacartItemStatus { +// GetStatus returns InstacartActivityMetadataItemsInstacartOrderItem.Status, and is useful for accessing the field via an interface. +func (v *InstacartActivityMetadataItemsInstacartOrderItem) 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 { +// GetQuantityPurchased returns InstacartActivityMetadataItemsInstacartOrderItem.QuantityPurchased, and is useful for accessing the field via an interface. +func (v *InstacartActivityMetadataItemsInstacartOrderItem) GetQuantityPurchased() graphqlTypes.Int64 { return v.QuantityPurchased } @@ -1915,9 +1911,9 @@ func (v *LookupActivityMetadataInstacartActivityMetadata) GetStatusString() stri 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 +// GetItems returns LookupActivityMetadataInstacartActivityMetadata.Items, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataInstacartActivityMetadata) GetItems() []InstacartActivityMetadataItemsInstacartOrderItem { + return v.InstacartActivityMetadata.Items } func (v *LookupActivityMetadataInstacartActivityMetadata) UnmarshalJSON(b []byte) error { @@ -1960,7 +1956,7 @@ type __premarshalLookupActivityMetadataInstacartActivityMetadata struct { StatusString string `json:"statusString"` - InstacartActivityMetadataItems []InstacartActivityMetadataInstacartActivityMetadataItemsInstacartOrderItem `json:"InstacartActivityMetadataItems"` + Items []InstacartActivityMetadataItemsInstacartOrderItem `json:"items"` } func (v *LookupActivityMetadataInstacartActivityMetadata) MarshalJSON() ([]byte, error) { @@ -1981,7 +1977,7 @@ func (v *LookupActivityMetadataInstacartActivityMetadata) __premarshalJSON() (*_ retval.DateOrdered = v.InstacartActivityMetadata.DateOrdered retval.DateDelivered = v.InstacartActivityMetadata.DateDelivered retval.StatusString = v.InstacartActivityMetadata.StatusString - retval.InstacartActivityMetadataItems = v.InstacartActivityMetadata.InstacartActivityMetadataItems + retval.Items = v.InstacartActivityMetadata.Items return &retval, nil } @@ -2186,9 +2182,9 @@ 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 +// GetStatus returns LookupActivityMetadataUberActivityMetadata.Status, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataUberActivityMetadata) GetStatus() TripStatus { + return v.UberActivityMetadata.Status } func (v *LookupActivityMetadataUberActivityMetadata) UnmarshalJSON(b []byte) error { @@ -2231,7 +2227,7 @@ type __premarshalLookupActivityMetadataUberActivityMetadata struct { Distance string `json:"distance"` - UberActivityMetadataStatus TripStatus `json:"UberActivityMetadataStatus"` + Status TripStatus `json:"status"` } func (v *LookupActivityMetadataUberActivityMetadata) MarshalJSON() ([]byte, error) { @@ -2252,7 +2248,7 @@ func (v *LookupActivityMetadataUberActivityMetadata) __premarshalJSON() (*__prem retval.Cost = v.UberActivityMetadata.Cost retval.City = v.UberActivityMetadata.City retval.Distance = v.UberActivityMetadata.Distance - retval.UberActivityMetadataStatus = v.UberActivityMetadata.UberActivityMetadataStatus + retval.Status = v.UberActivityMetadata.Status return &retval, nil } @@ -2290,14 +2286,14 @@ 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 +// GetUberEatsActivityMetadataStatus returns LookupActivityMetadataUberEatsActivityMetadata.UberEatsActivityMetadataStatus, and is useful for accessing the field via an interface. +func (v *LookupActivityMetadataUberEatsActivityMetadata) GetUberEatsActivityMetadataStatus() UberEatsOrderStatus { + return v.UberEatsActivityMetadata.UberEatsActivityMetadataStatus } -// GetItems returns LookupActivityMetadataUberEatsActivityMetadata.Items, and is useful for accessing the field via an interface. -func (v *LookupActivityMetadataUberEatsActivityMetadata) GetItems() []UberEatsActivityMetadataItemsUberEatsOrderItem { - return v.UberEatsActivityMetadata.Items +// 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 { @@ -2338,9 +2334,9 @@ type __premarshalLookupActivityMetadataUberEatsActivityMetadata struct { TotalPrice float64 `json:"totalPrice"` - Status UberEatsOrderStatus `json:"status"` + UberEatsActivityMetadataStatus UberEatsOrderStatus `json:"UberEatsActivityMetadataStatus"` - Items []UberEatsActivityMetadataItemsUberEatsOrderItem `json:"items"` + UberEatsActivityMetadataItems []UberEatsActivityMetadataUberEatsActivityMetadataItemsUberEatsOrderItem `json:"UberEatsActivityMetadataItems"` } func (v *LookupActivityMetadataUberEatsActivityMetadata) MarshalJSON() ([]byte, error) { @@ -2360,8 +2356,8 @@ func (v *LookupActivityMetadataUberEatsActivityMetadata) __premarshalJSON() (*__ 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 + retval.UberEatsActivityMetadataStatus = v.UberEatsActivityMetadata.UberEatsActivityMetadataStatus + retval.UberEatsActivityMetadataItems = v.UberEatsActivityMetadata.UberEatsActivityMetadataItems return &retval, nil } @@ -2593,13 +2589,13 @@ const ( // 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"` + 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"` + Status TripStatus `json:"status"` } // GetSubject returns UberActivityMetadata.Subject, and is useful for accessing the field via an interface. @@ -2620,10 +2616,8 @@ 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 -} +// GetStatus returns UberActivityMetadata.Status, and is useful for accessing the field via an interface. +func (v *UberActivityMetadata) GetStatus() TripStatus { return v.Status } // UberActivityMetadataSubjectIdentifier includes the requested fields of the GraphQL type Identifier. type UberActivityMetadataSubjectIdentifier struct { @@ -2641,13 +2635,13 @@ func (v *UberActivityMetadataSubjectIdentifier) GetIdentifierType() IdentifierTy // 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"` + 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. @@ -2667,74 +2661,80 @@ 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 } +// GetUberEatsActivityMetadataStatus returns UberEatsActivityMetadata.UberEatsActivityMetadataStatus, and is useful for accessing the field via an interface. +func (v *UberEatsActivityMetadata) GetUberEatsActivityMetadataStatus() UberEatsOrderStatus { + return v.UberEatsActivityMetadataStatus +} -// GetItems returns UberEatsActivityMetadata.Items, and is useful for accessing the field via an interface. -func (v *UberEatsActivityMetadata) GetItems() []UberEatsActivityMetadataItemsUberEatsOrderItem { - return v.Items +// 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"` } -// 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"` +// 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 } -// GetName returns UberEatsActivityMetadataItemsUberEatsOrderItem.Name, and is useful for accessing the field via an interface. -func (v *UberEatsActivityMetadataItemsUberEatsOrderItem) GetName() string { return v.Name } +// 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"` +} -// GetPrice returns UberEatsActivityMetadataItemsUberEatsOrderItem.Price, and is useful for accessing the field via an interface. -func (v *UberEatsActivityMetadataItemsUberEatsOrderItem) GetPrice() string { return v.Price } +// 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 UberEatsActivityMetadataItemsUberEatsOrderItem.QuantityPurchased, and is useful for accessing the field via an interface. -func (v *UberEatsActivityMetadataItemsUberEatsOrderItem) GetQuantityPurchased() graphqlTypes.Int64 { +// 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 UberEatsActivityMetadataItemsUberEatsOrderItem.Customizations, and is useful for accessing the field via an interface. -func (v *UberEatsActivityMetadataItemsUberEatsOrderItem) GetCustomizations() []UberEatsActivityMetadataItemsUberEatsOrderItemCustomizations { +// GetCustomizations returns UberEatsActivityMetadataUberEatsActivityMetadataItemsUberEatsOrderItem.Customizations, and is useful for accessing the field via an interface. +func (v *UberEatsActivityMetadataUberEatsActivityMetadataItemsUberEatsOrderItem) GetCustomizations() []UberEatsActivityMetadataUberEatsActivityMetadataItemsUberEatsOrderItemCustomizations { return v.Customizations } -// UberEatsActivityMetadataItemsUberEatsOrderItemCustomizations includes the requested fields of the GraphQL type UberEatsOrderItemCustomizations. -type UberEatsActivityMetadataItemsUberEatsOrderItemCustomizations struct { +// 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 UberEatsActivityMetadataItemsUberEatsOrderItemCustomizations.Customization, and is useful for accessing the field via an interface. -func (v *UberEatsActivityMetadataItemsUberEatsOrderItemCustomizations) GetCustomization() string { +// GetCustomization returns UberEatsActivityMetadataUberEatsActivityMetadataItemsUberEatsOrderItemCustomizations.Customization, and is useful for accessing the field via an interface. +func (v *UberEatsActivityMetadataUberEatsActivityMetadataItemsUberEatsOrderItemCustomizations) GetCustomization() string { return v.Customization } -// GetValue returns UberEatsActivityMetadataItemsUberEatsOrderItemCustomizations.Value, and is useful for accessing the field via an interface. -func (v *UberEatsActivityMetadataItemsUberEatsOrderItemCustomizations) GetValue() string { +// GetValue returns UberEatsActivityMetadataUberEatsActivityMetadataItemsUberEatsOrderItemCustomizations.Value, and is useful for accessing the field via an interface. +func (v *UberEatsActivityMetadataUberEatsActivityMetadataItemsUberEatsOrderItemCustomizations) 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 { +// GetQuantity returns UberEatsActivityMetadataUberEatsActivityMetadataItemsUberEatsOrderItemCustomizations.Quantity, and is useful for accessing the field via an interface. +func (v *UberEatsActivityMetadataUberEatsActivityMetadataItemsUberEatsOrderItemCustomizations) 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 ( @@ -3004,7 +3004,7 @@ fragment UberActivityMetadata on UberActivityMetadata { cost city distance - UberActivityMetadataStatus: status + status } fragment InstacartActivityMetadata on InstacartActivityMetadata { subject { @@ -3018,7 +3018,7 @@ fragment InstacartActivityMetadata on InstacartActivityMetadata { dateOrdered dateDelivered statusString - InstacartActivityMetadataItems: items { + items { ... on InstacartOrderItem { itemID productName @@ -3039,8 +3039,8 @@ fragment UberEatsActivityMetadata on UberEatsActivityMetadata { restaurant currency totalPrice - status - items { + UberEatsActivityMetadataStatus: status + UberEatsActivityMetadataItems: items { ... on UberEatsOrderItem { name price @@ -3320,7 +3320,7 @@ fragment UberActivityMetadata on UberActivityMetadata { cost city distance - UberActivityMetadataStatus: status + status } fragment InstacartActivityMetadata on InstacartActivityMetadata { subject { @@ -3334,7 +3334,7 @@ fragment InstacartActivityMetadata on InstacartActivityMetadata { dateOrdered dateDelivered statusString - InstacartActivityMetadataItems: items { + items { ... on InstacartOrderItem { itemID productName @@ -3355,8 +3355,8 @@ fragment UberEatsActivityMetadata on UberEatsActivityMetadata { restaurant currency totalPrice - status - items { + UberEatsActivityMetadataStatus: status + UberEatsActivityMetadataItems: items { ... on UberEatsOrderItem { name price diff --git a/eyeofsauron/example/generated/genqlient.graphql b/eyeofsauron/example/generated/genqlient.graphql index 07d33b0..99df021 100644 --- a/eyeofsauron/example/generated/genqlient.graphql +++ b/eyeofsauron/example/generated/genqlient.graphql @@ -1,17 +1,27 @@ -fragment YoutubeActivityMetadata on YoutubeActivityMetadata { - title: title +fragment InstacartActivityMetadata on InstacartActivityMetadata { subject: subject { ... on Identifier { value identifierType } } - date: date - percentageWatched: percentageWatched - contentType: contentType + retailer: retailer + totalOrderAmountSpent: totalOrderAmountSpent + dateOrdered: dateOrdered + dateDelivered: dateDelivered + statusString: statusString + items: items { + ... on InstacartOrderItem { + itemID + productName + unitPrice + status + quantityPurchased + } + } } -fragment NetflixActivityMetadata on NetflixActivityMetadata { +fragment PlaystationActivityMetadata on PlaystationActivityMetadata { title: title subject: subject { ... on Identifier { @@ -19,11 +29,47 @@ fragment NetflixActivityMetadata on NetflixActivityMetadata { identifierType } } - date: date lastPlayedAt: lastPlayedAt } -fragment PlaystationActivityMetadata on PlaystationActivityMetadata { +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 + status: status +} + +fragment YoutubeActivityMetadata on YoutubeActivityMetadata { title: title subject: subject { ... on Identifier { @@ -31,7 +77,9 @@ fragment PlaystationActivityMetadata on PlaystationActivityMetadata { identifierType } } - lastPlayedAt: lastPlayedAt + date: date + percentageWatched: percentageWatched + contentType: contentType } fragment UberEatsActivityMetadata on UberEatsActivityMetadata { @@ -45,8 +93,8 @@ fragment UberEatsActivityMetadata on UberEatsActivityMetadata { restaurant: restaurant currency: currency totalPrice: totalPrice - status: status - items: items { + UberEatsActivityMetadataStatus: status + UberEatsActivityMetadataItems: items { ... on UberEatsOrderItem { name price @@ -62,44 +110,6 @@ fragment UberEatsActivityMetadata on UberEatsActivityMetadata { } } -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 UberActivityMetadata on UberActivityMetadata { - subject: subject { - ... on Identifier { - value - identifierType - } - } - beginTripTime: beginTripTime - dropoffTime: dropoffTime - cost: cost - city: city - distance: distance - UberActivityMetadataStatus: status -} - fragment AmazonActivityMetadata on AmazonActivityMetadata { productName: productName subject: subject { @@ -113,26 +123,16 @@ fragment AmazonActivityMetadata on AmazonActivityMetadata { totalCost: totalCost } -fragment BookingActivityMetadata on BookingActivityMetadata { +fragment NetflixActivityMetadata on NetflixActivityMetadata { + title: title subject: subject { ... on Identifier { value identifierType } } - bookingID: bookingID - price: price - bookings: bookings { - ... on BookingItem { - startDateTime - endDateTime - address - depatureLocation - arrivalLocation - layoverLocations - activityType - } - } + date: date + lastPlayedAt: lastPlayedAt } query getActivity($dataKey: String!, $activityType: [ActivityType], $source: Source!, $limit: Int64!, $page: Int64!) { diff --git a/eyeofsauron/example/main.go b/eyeofsauron/example/main.go index ca01c05..33fd6c5 100644 --- a/eyeofsauron/example/main.go +++ b/eyeofsauron/example/main.go @@ -18,8 +18,8 @@ func main() { response, err := eye.GetActivity( context.Background(), - "BG7u85FMLGnYnUv2ZsFTAXrGT2Xw3TikrBHm2kYz31qq", - []generated.ActivityType{generated.ActivityTypePlay}, + "3pLT1hCieyPQQb876i24D34Qf8y6Yyke5m4rhPRhV67D", + []generated.ActivityType{generated.ActivityTypeWatch}, generated.SourceNetflix, 100, 1, @@ -33,7 +33,7 @@ func main() { activityID, _ := uuid.Parse(activity.Id) response, err := eye.LookupActivity( context.Background(), - "BG7u85FMLGnYnUv2ZsFTAXrGT2Xw3TikrBHm2kYz31qq", + "3pLT1hCieyPQQb876i24D34Qf8y6Yyke5m4rhPRhV67D", activityID, ) @@ -42,6 +42,9 @@ func main() { } printLookupActivityMetadata(response.LookupActivity.GetMetadata()) } + + getTrait() + lookupTrait() } func printGetActivityMetadata(metadata interface{}) { @@ -102,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 12d1fbc..e8bc37d 100644 --- a/eyeofsauron/main.go +++ b/eyeofsauron/main.go @@ -12,6 +12,7 @@ import ( "unicode/utf8" graphqlClient "github.com/gandalf-network/gandalf-sdk-go/eyeofsauron/graphql" + "github.com/gandalf-network/gandalf-sdk-go/eyeofsauron/constants" "github.com/gandalf-network/genqlient/generate" ) @@ -75,8 +76,8 @@ func main() { // Join the CWD with the provided folder path folder = filepath.Join(cwd, folder) - client := graphqlClient.NewClient("https://sauron.gandalf.network/public/gql") - req := graphqlClient.NewRequest(introspectionQuery) + client := graphqlClient.NewClient("https://sauron-staging.gandalf.network/public/gql") + req := graphqlClient.NewRequest(constants.IntrospectionQuery) ctx := context.Background() @@ -100,7 +101,7 @@ func main() { writeToFile(filepath.Join(folder, "genqlient.graphql"), stringBuilder.String()) var gqlgenConfigFilename = filepath.Join(folder, "genqlient.yaml") - writeToFile(gqlgenConfigFilename, gqlgenConfig) + writeToFile(gqlgenConfigFilename, constants.GQLGenConfig) var config *generate.Config 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! +} + diff --git a/go.mod b/go.mod index 785d42f..4940ada 100644 --- a/go.mod +++ b/go.mod @@ -4,10 +4,10 @@ go 1.22.1 require ( github.com/btcsuite/btcd/btcec/v2 v2.3.3 - github.com/davecgh/go-spew v1.1.1 github.com/gandalf-network/genqlient v1.0.2 github.com/google/uuid v1.6.0 github.com/pkg/errors v0.9.1 + github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e ) require ( diff --git a/go.sum b/go.sum index b8ca45e..03639e9 100644 --- a/go.sum +++ b/go.sum @@ -33,6 +33,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= +github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e h1:MRM5ITcdelLK2j1vwZ3Je0FKVCfqOLp5zO6trqMLYs0= +github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e/go.mod h1:XV66xRDqSt+GTGFMVlhk3ULuV0y9ZmzeVGR4mloJI3M= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=