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

Update *ListResponse structs to match API responses #425

Merged

Conversation

jacobbednarz
Copy link
Member

@jacobbednarz jacobbednarz commented Mar 8, 2020

When the work for
terraform-providers/terraform-provider-cloudflare#597 was started,
the messages object was either empty array or a single string (per
the original cloudflare.Response struct) but the API response is
now spitting out an array of message objects inside of the current
array.

old

{
  "result": {
    "id": "566f1f64-3b1e-40b3-ae1b-807396f1a107",
    "type": "github",
    "uid": "566f1f64-3b1e-40b3-ae1b-807396f1a107",
    "name": "ytypfrkona",
    "config": {
      "client_id": "test",
      "client_secret": "**********************************",
      "redirect_url": "https://my-domain.cloudflareaccess.com/cdn-cgi/access/callback"
    },
    "version": "267eb3e7f2fc57dae9792a2315895d69"
  },
  "success": true,
  "errors": [],
  "messages": []
}

new

{
  "result": {
    "id": "e0d1a74b-5b19-4dc8-823c-d1f2d42b01b3",
    "type": "github",
    "uid": "e0d1a74b-5b19-4dc8-823c-d1f2d42b01b3",
    "name": "iumxxidzao-updated",
    "config": {
      "client_id": "test",
      "client_secret": "**********************************",
      "redirect_url": "https://my-domain.cloudflareaccess.com/cdn-cgi/access/callback"
    },
    "version": "413f20d9ecce0e7b361843841764492a"
  },
  "success": true,
  "errors": [],
  "messages": [
    {
      "message": "Finish enterprise enablement by going to https://my-domain.cloudflareaccess.com/cdn-cgi/access/enterprise-setup/ZTBkMWE3NGItNWIxOS00ZGM4LTgyM2MtZDFmMmQ0MmIwMWIz246b90e12e49a1ed82f16be7f4433da49b7bd15ad7cea7fd96ee9cef81e571f45e6554b7"
    }
  ]
}

To fix the issue, the two structs have been updated to conform to the
required objects.

When the work for
terraform-providers/terraform-provider-cloudflare#597 was started,
the `messages` object was either empty array or a single string (per
the original `cloudflare.Response`[1] struct) but the API response is
now spitting out an array of `message` objects inside of the current
array.

To fix the issue, the two structs have been updated to conform to the
required objects.

[1]: https://github.com/cloudflare/cloudflare-go/blob/master/cloudflare.go#L363
@patryk patryk merged commit 79e96c5 into cloudflare:master Mar 9, 2020
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.

2 participants