Skip to content

Conversation

@TE-tatuonagamatu
Copy link

This is pull request for resolving Issue: Setting avatar does not work

Avatar was added to User structure. But it is not in reqeustUser structure. Before posting /user API, User structure is converted to requestUser. Avatar is not defined in requestUser and not copied from User. So avatar setting is not work.

Avatar is added also for requestUser and copied from User.

@TE-tatuonagamatu
Copy link
Author

Checked with following code

package main

import (
	"fmt"

	intercom "github.com/intercom/intercom-go"
)

func main() {
	ic := intercom.NewClient("access_token", "")

	user := intercom.User{
		UserID: "5750790484393984",
		Email:  "nagamatu@gmail.com",
		Name:   "Tatsuo Nagamatsu",
		Avatar: &intercom.UserAvatar{Type: "avatar", ImageURL: "https://avatars2.githubusercontent.com/u/116613?v=4"},
	}
	savedUser, err := ic.Users.Save(&user)
	if err != nil {
		panic(err)
	}

	fmt.Println(savedUser.Avatar.String())
}

@TE-tatuonagamatu
Copy link
Author

TE-tatuonagamatu commented Mar 11, 2019

CustomAttributes are missing in UserCompany that holds information about belonging company. Add this fix to this PR. I created another PR #116 for CustomAttributes issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant