Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confluence V2 Space.Bulk cannot unmarshal string into Go struct field SpaceSchemeV2.results.id of type int #256

Closed
1 of 5 tasks
piyushwadhwanicppib opened this issue Feb 21, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@piyushwadhwanicppib
Copy link

go-atlassian version

go-atlassian component

  • Jira Software Cloud
  • Jira Agile Cloud
  • Jira Service Management Cloud
  • Confluence Cloud
  • Atlassian Admin Cloud

Describe the bug 🐛
while running example mentioned in
https://docs.go-atlassian.io/confluence-cloud/v2/space

cannot unmarshal string into Go struct field SpaceSchemeV2.results.id of type int

To Reproduce 🚧

https://docs.go-atlassian.io/confluence-cloud/v2/space

Expected behavior

spaces should be return

Screenshots 📄

Additional context
Add any other context about the problem here.

Code snippet

package main

import (
	"context"
	"fmt"
	confluence "github.com/ctreminiom/go-atlassian/confluence/v2"
	"github.com/ctreminiom/go-atlassian/pkg/infra/models"
	"log"
	"net/url"
	"os"
)

func main() {

	var (
		host  = os.Getenv("HOST")
		mail  = os.Getenv("MAIL")
		token = os.Getenv("TOKEN")
	)

	instance, err := confluence.New(nil, host)
	if err != nil {
		log.Fatal(err)
	}

	instance.Auth.SetBasicAuth(mail, token)
	instance.Auth.SetUserAgent("curl/7.54.0")

	options := &models.GetSpacesOptionSchemeV2{
		IDs:               nil,
		Keys:              nil,
		Type:              "",
		Status:            "",
		Labels:            nil,
		Sort:              "",
		DescriptionFormat: "",
		SerializeIDs:      false,
	}

	var cursor string
	for {

		spaces, response, err := instance.Space.Bulk(context.Background(), options, cursor, 20)
		if err != nil {
			log.Fatal(err)
		}

		for _, space := range spaces.Results {
			fmt.Println(space)
		}

		log.Println("Endpoint:", response.Endpoint)
		log.Println("Status Code:", response.Code)

		if spaces.Links.Next == "" {
			break
		}

		values, err := url.ParseQuery(spaces.Links.Next)
		if err != nil {
			log.Fatal(err)
		}

		_, containsCursor := values["cursor"]
		if containsCursor {
			cursor = values["cursor"][0]
		}
	}
}
@piyushwadhwanicppib piyushwadhwanicppib added the bug Something isn't working label Feb 21, 2024
@piyushwadhwanicppib
Copy link
Author

This has already been fixed , can we please create a new release ?

@ctreminiom
Copy link
Owner

Hi @piyushwadhwanicppib, I just release the version v1.6.0.

Can you please confirm the new behavior?

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants