8000 unmarshal error in billing.go - GetStorageBillingOrg function · Issue #2203 · google/go-github · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
unmarshal error in billing.go - GetStorageBillingOrg function #2203
Closed
@gpkmr-genesys

Description

@gpkmr-genesys

Hello - Am trying to get the storage stats for my GitHub org from GetStorageBillingOrg function, But it throws error.
Details as follows.

Go version used: go1.17.2 linux/amd64
Operating system: Ubuntu
Function reference: https://github.com/google/go-github/blob/master/github/billing.go#L79

Error:json: cannot unmarshal number 19.5361328125 into Go struct field StorageBilling.estimated_paid_storage_for_month of type int

The output is on float but the struct field is of type int
https://github.com/google/go-github/blob/master/github/billing.go#L41-L45

Below is my custom function code:

func storage(ctx context.Context, client *github.Client, org string) {
	str, _, err := client.Billing.GetStorageBillingOrg(ctx, org)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(str)
}

Am able to get the response from GitHub API though

curl -s -u $gituser:$token -H "Accept: application/vnd.github.v3+json" https://api.github.com/orgs/$org/settings/billing/shared-storage
{
  "days_left_in_billing_cycle": 16,
  "estimated_paid_storage_for_month": 19.4375,
  "estimated_storage_for_month": 69
}

Metadata

Metadata

Assignees

Labels

Breaking API ChangePR will require a bump to the major version num in next release. Look here to see the change(s).buggood first issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0