Skip to content

🐛 Bug Report: Unable to access nested structs (e.g. User Preferences) #37

@stnguyen90

Description

@stnguyen90

👟 Reproduction steps

Run:

package main

import (
	"fmt"

	"github.com/appwrite/sdk-for-go/appwrite"
)

func main() {
	client := appwrite.NewClient(
		appwrite.WithEndpoint("https://<REGION>.cloud.appwrite.io/v1"),
		appwrite.WithProject("<PROJECT_ID>"),
		appwrite.WithKey("<API_KEY>"),
	)

	users := appwrite.NewUsers(client)
	user, err := users.Get("<USER_ID>")
	if err != nil {
		panic(err)
	}
	println("User ID:", user.Id)
	println("User Email:", user.Email)
	fmt.Printf("User Prefs: %#v\n", user.Prefs)
	prefs := map[string]interface{}{}
	user.Prefs.Decode(&prefs)
	fmt.Printf("User Prefs: %#v\n", prefs)
}

👍 Expected behavior

The prefs have data

👎 Actual Behavior

User ID: 6797eb6600209d9c9f72
User Email: test1@example.com
User Prefs: models.Preferences{data:[]uint8(nil)}
User Prefs: map[string]interface {}{}

🎲 Appwrite version

Version 0.10.x

💻 Operating system

Linux

🧱 Your Environment

No response

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions