{"id":13466091,"url":"https://github.com/cloudflare/cloudflare-go","last_synced_at":"2026-01-17T01:19:45.599Z","repository":{"id":37445317,"uuid":"47340306","full_name":"cloudflare/cloudflare-go","owner":"cloudflare","description":"The official Go library for the Cloudflare API","archived":false,"fork":false,"pushed_at":"2025-10-15T16:39:58.000Z","size":65447,"stargazers_count":1818,"open_issues_count":12,"forks_count":681,"subscribers_count":42,"default_branch":"main","last_synced_at":"2025-10-19T00:48:29.802Z","etag":null,"topics":["api","cloudflare","sdk","sdk-go","sdk-golang"],"latest_commit_sha":null,"homepage":"https://developers.cloudflare.com/api","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cloudflare.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":"audit_logs/aliases.go","citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2015-12-03T15:21:49.000Z","updated_at":"2025-10-18T09:57:01.000Z","dependencies_parsed_at":"2023-10-13T12:43:00.047Z","dependency_job_id":"16a6d408-7324-4a57-a8d5-6733404b1f1b","html_url":"https://github.com/cloudflare/cloudflare-go","commit_stats":{"total_commits":2669,"total_committers":326,"mean_commits":8.187116564417177,"dds":0.7729486699138254,"last_synced_commit":"8baaca6b76c828c2c3badc48501638e085852698"},"previous_names":["jamesog/cloudflare-go"],"tags_count":230,"template":false,"template_full_name":null,"purl":"pkg:github/cloudflare/cloudflare-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflare%2Fcloudflare-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflare%2Fcloudflare-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflare%2Fcloudflare-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflare%2Fcloudflare-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloudflare","download_url":"https://codeload.github.com/cloudflare/cloudflare-go/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflare%2Fcloudflare-go/sbom","scorecard":{"id":292531,"data":{"date":"2025-08-11","repo":{"name":"github.com/cloudflare/cloudflare-go","commit":"d3656062198c1276336e9a0f2d191c8bb5e0ef89"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":6.2,"checks":[{"name":"Code-Review","score":-1,"reason":"Found no human activity in the last 1 changesets","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":10,"reason":"30 commit(s) and 7 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Warn: no topLevel permission defined: .github/workflows/detect-breaking-changes.yml:1","Warn: no topLevel permission defined: .github/workflows/stale.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":10,"reason":"security policy file detected","details":["Info: security policy file detected: SECURITY.md:1","Info: Found linked content: SECURITY.md:1","Info: Found disclosure, vulnerability, and/or timelines in security policy: SECURITY.md:1","Info: Found text in security policy: SECURITY.md:1"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/cloudflare/cloudflare-go/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/cloudflare/cloudflare-go/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:38: update your workflow using https://app.stepsecurity.io/secureworkflow/cloudflare/cloudflare-go/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:41: update your workflow using https://app.stepsecurity.io/secureworkflow/cloudflare/cloudflare-go/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/detect-breaking-changes.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/cloudflare/cloudflare-go/detect-breaking-changes.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/detect-breaking-changes.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/cloudflare/cloudflare-go/detect-breaking-changes.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/stale.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/cloudflare/cloudflare-go/stale.yml/main?enable=pin","Info:   0 out of   7 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-17T18:39:00.883Z","repository_id":37445317,"created_at":"2025-08-17T18:39:00.884Z","updated_at":"2025-08-17T18:39:00.884Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279679993,"owners_count":26209797,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-19T02:00:07.647Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","cloudflare","sdk","sdk-go","sdk-golang"],"created_at":"2024-07-31T15:00:39.020Z","updated_at":"2026-01-17T01:19:45.594Z","avatar_url":"https://github.com/cloudflare.png","language":"Go","funding_links":[],"categories":["Go","Core Platform \u0026 SDKs"],"sub_categories":["Official SDKs"],"readme":"# Cloudflare Go API Library\n\n\u003ca href=\"https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v6\"\u003e\u003cimg src=\"https://pkg.go.dev/badge/github.com/cloudflare/cloudflare-go/v4.svg\" alt=\"Go Reference\"\u003e\u003c/a\u003e\n\nThe Cloudflare Go library provides convenient access to the [Cloudflare REST API](https://developers.cloudflare.com/api)\nfrom applications written in Go.\n\nIt is generated with [Stainless](https://www.stainless.com/).\n\n## Installation\n\n\u003c!-- x-release-please-start-version --\u003e\n\n```go\nimport (\n\t\"github.com/cloudflare/cloudflare-go/v6\" // imported as cloudflare\n)\n```\n\n\u003c!-- x-release-please-end --\u003e\n\nOr to pin the version:\n\n\u003c!-- x-release-please-start-version --\u003e\n\n```sh\ngo get -u 'github.com/cloudflare/cloudflare-go/v4@v6.6.0'\n```\n\n\u003c!-- x-release-please-end --\u003e\n\n## Requirements\n\nThis library requires Go 1.22+.\n\n## Usage\n\nThe full API of this library can be found in [api.md](api.md).\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/cloudflare/cloudflare-go/v6\"\n\t\"github.com/cloudflare/cloudflare-go/v6/option\"\n\t\"github.com/cloudflare/cloudflare-go/v6/zones\"\n)\n\nfunc main() {\n\tclient := cloudflare.NewClient(\n\t\toption.WithAPIToken(\"Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY\"), // defaults to os.LookupEnv(\"CLOUDFLARE_API_TOKEN\")\n\t)\n\tzone, err := client.Zones.New(context.TODO(), zones.ZoneNewParams{\n\t\tAccount: cloudflare.F(zones.ZoneNewParamsAccount{\n\t\t\tID: cloudflare.F(\"023e105f4ecef8ad9ca31a8372d0c353\"),\n\t\t}),\n\t\tName: cloudflare.F(\"example.com\"),\n\t\tType: cloudflare.F(zones.TypeFull),\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", zone.ID)\n}\n\n```\n\n### Request fields\n\nAll request parameters are wrapped in a generic `Field` type,\nwhich we use to distinguish zero values from null or omitted fields.\n\nThis prevents accidentally sending a zero value if you forget a required parameter,\nand enables explicitly sending `null`, `false`, `''`, or `0` on optional parameters.\nAny field not specified is not sent.\n\nTo construct fields with values, use the helpers `String()`, `Int()`, `Float()`, or most commonly, the generic `F[T]()`.\nTo send a null, use `Null[T]()`, and to send a nonconforming value, use `Raw[T](any)`. For example:\n\n```go\nparams := FooParams{\n\tName: cloudflare.F(\"hello\"),\n\n\t// Explicitly send `\"description\": null`\n\tDescription: cloudflare.Null[string](),\n\n\tPoint: cloudflare.F(cloudflare.Point{\n\t\tX: cloudflare.Int(0),\n\t\tY: cloudflare.Int(1),\n\n\t\t// In cases where the API specifies a given type,\n\t\t// but you want to send something else, use `Raw`:\n\t\tZ: cloudflare.Raw[int64](0.01), // sends a float\n\t}),\n}\n```\n\n### Response objects\n\nAll fields in response structs are value types (not pointers or wrappers).\n\nIf a given field is `null`, not present, or invalid, the corresponding field\nwill simply be its zero value.\n\nAll response structs also include a special `JSON` field, containing more detailed\ninformation about each property, which you can use like so:\n\n```go\nif res.Name == \"\" {\n\t// true if `\"name\"` is either not present or explicitly null\n\tres.JSON.Name.IsNull()\n\n\t// true if the `\"name\"` key was not present in the response JSON at all\n\tres.JSON.Name.IsMissing()\n\n\t// When the API returns data that cannot be coerced to the expected type:\n\tif res.JSON.Name.IsInvalid() {\n\t\traw := res.JSON.Name.Raw()\n\n\t\tlegacyName := struct{\n\t\t\tFirst string `json:\"first\"`\n\t\t\tLast  string `json:\"last\"`\n\t\t}{}\n\t\tjson.Unmarshal([]byte(raw), \u0026legacyName)\n\t\tname = legacyName.First + \" \" + legacyName.Last\n\t}\n}\n```\n\nThese `.JSON` structs also include an `Extras` map containing\nany properties in the json response that were not specified\nin the struct. This can be useful for API features not yet\npresent in the SDK.\n\n```go\nbody := res.JSON.ExtraFields[\"my_unexpected_field\"].Raw()\n```\n\n### RequestOptions\n\nThis library uses the functional options pattern. Functions defined in the\n`option` package return a `RequestOption`, which is a closure that mutates a\n`RequestConfig`. These options can be supplied to the client or at individual\nrequests. For example:\n\n```go\nclient := cloudflare.NewClient(\n\t// Adds a header to every request made by the client\n\toption.WithHeader(\"X-Some-Header\", \"custom_header_info\"),\n)\n\nclient.Zones.New(context.TODO(), ...,\n\t// Override the header\n\toption.WithHeader(\"X-Some-Header\", \"some_other_custom_header_info\"),\n\t// Add an undocumented field to the request body, using sjson syntax\n\toption.WithJSONSet(\"some.json.path\", map[string]string{\"my\": \"object\"}),\n)\n```\n\nSee the [full list of request options](https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v4/option).\n\n### Pagination\n\nThis library provides some conveniences for working with paginated list endpoints.\n\nYou can use `.ListAutoPaging()` methods to iterate through items across all pages:\n\n```go\niter := client.Accounts.ListAutoPaging(context.TODO(), accounts.AccountListParams{})\n// Automatically fetches more pages as needed.\nfor iter.Next() {\n\taccount := iter.Current()\n\tfmt.Printf(\"%+v\\n\", account)\n}\nif err := iter.Err(); err != nil {\n\tpanic(err.Error())\n}\n```\n\nOr you can use simple `.List()` methods to fetch a single page and receive a standard response object\nwith additional helper methods like `.GetNextPage()`, e.g.:\n\n```go\npage, err := client.Accounts.List(context.TODO(), accounts.AccountListParams{})\nfor page != nil {\n\tfor _, account := range page.Result {\n\t\tfmt.Printf(\"%+v\\n\", account)\n\t}\n\tpage, err = page.GetNextPage()\n}\nif err != nil {\n\tpanic(err.Error())\n}\n```\n\n### Errors\n\nWhen the API returns a non-success status code, we return an error with type\n`*cloudflare.Error`. This contains the `StatusCode`, `*http.Request`, and\n`*http.Response` values of the request, as well as the JSON of the error body\n(much like other response objects in the SDK).\n\nTo handle errors, we recommend that you use the `errors.As` pattern:\n\n```go\n_, err := client.Zones.Get(context.TODO(), zones.ZoneGetParams{\n\tZoneID: cloudflare.F(\"023e105f4ecef8ad9ca31a8372d0c353\"),\n})\nif err != nil {\n\tvar apierr *cloudflare.Error\n\tif errors.As(err, \u0026apierr) {\n\t\tprintln(string(apierr.DumpRequest(true)))  // Prints the serialized HTTP request\n\t\tprintln(string(apierr.DumpResponse(true))) // Prints the serialized HTTP response\n\t}\n\tpanic(err.Error()) // GET \"/zones/{zone_id}\": 400 Bad Request { ... }\n}\n```\n\nWhen other errors occur, they are returned unwrapped; for example,\nif HTTP transport fails, you might receive `*url.Error` wrapping `*net.OpError`.\n\n### Timeouts\n\nRequests do not time out by default; use context to configure a timeout for a request lifecycle.\n\nNote that if a request is [retried](#retries), the context timeout does not start over.\nTo set a per-retry timeout, use `option.WithRequestTimeout()`.\n\n```go\n// This sets the timeout for the request, including all the retries.\nctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)\ndefer cancel()\nclient.Zones.Edit(\n\tctx,\n\tzones.ZoneEditParams{\n\t\tZoneID: cloudflare.F(\"023e105f4ecef8ad9ca31a8372d0c353\"),\n\t},\n\t// This sets the per-retry timeout\n\toption.WithRequestTimeout(20*time.Second),\n)\n```\n\n### File uploads\n\nRequest parameters that correspond to file uploads in multipart requests are typed as\n`param.Field[io.Reader]`. The contents of the `io.Reader` will by default be sent as a multipart form\npart with the file name of \"anonymous_file\" and content-type of \"application/octet-stream\".\n\nThe file name and content-type can be customized by implementing `Name() string` or `ContentType()\nstring` on the run-time type of `io.Reader`. Note that `os.File` implements `Name() string`, so a\nfile returned by `os.Open` will be sent with the file name on disk.\n\nWe also provide a helper `cloudflare.FileParam(reader io.Reader, filename string, contentType string)`\nwhich can be used to wrap any `io.Reader` with the appropriate file name and content type.\n\n```go\n// A file from the file system\nfile, err := os.Open(\"/path/to/file\")\napi_gateway.UserSchemaNewParams{\n\tZoneID: cloudflare.F(\"023e105f4ecef8ad9ca31a8372d0c353\"),\n\tFile:   cloudflare.F[io.Reader](file),\n\tKind:   cloudflare.F(api_gateway.UserSchemaNewParamsKindOpenAPIV3),\n}\n\n// A file from a string\napi_gateway.UserSchemaNewParams{\n\tZoneID: cloudflare.F(\"023e105f4ecef8ad9ca31a8372d0c353\"),\n\tFile:   cloudflare.F[io.Reader](strings.NewReader(\"my file contents\")),\n\tKind:   cloudflare.F(api_gateway.UserSchemaNewParamsKindOpenAPIV3),\n}\n\n// With a custom filename and contentType\napi_gateway.UserSchemaNewParams{\n\tZoneID: cloudflare.F(\"023e105f4ecef8ad9ca31a8372d0c353\"),\n\tFile:   cloudflare.FileParam(strings.NewReader(`{\"hello\": \"foo\"}`), \"file.go\", \"application/json\"),\n\tKind:   cloudflare.F(api_gateway.UserSchemaNewParamsKindOpenAPIV3),\n}\n```\n\n### Retries\n\nCertain errors will be automatically retried 2 times by default, with a short exponential backoff.\nWe retry by default all connection errors, 408 Request Timeout, 409 Conflict, 429 Rate Limit,\nand \u003e=500 Internal errors.\n\nYou can use the `WithMaxRetries` option to configure or disable this:\n\n```go\n// Configure the default for all requests:\nclient := cloudflare.NewClient(\n\toption.WithMaxRetries(0), // default is 2\n)\n\n// Override per-request:\nclient.Zones.Get(\n\tcontext.TODO(),\n\tzones.ZoneGetParams{\n\t\tZoneID: cloudflare.F(\"023e105f4ecef8ad9ca31a8372d0c353\"),\n\t},\n\toption.WithMaxRetries(5),\n)\n```\n\n### Accessing raw response data (e.g. response headers)\n\nYou can access the raw HTTP response data by using the `option.WithResponseInto()` request option. This is useful when\nyou need to examine response headers, status codes, or other details.\n\n```go\n// Create a variable to store the HTTP response\nvar response *http.Response\nzone, err := client.Zones.New(\n\tcontext.TODO(),\n\tzones.ZoneNewParams{\n\t\tAccount: cloudflare.F(zones.ZoneNewParamsAccount{\n\t\t\tID: cloudflare.F(\"023e105f4ecef8ad9ca31a8372d0c353\"),\n\t\t}),\n\t\tName: cloudflare.F(\"example.com\"),\n\t\tType: cloudflare.F(zones.TypeFull),\n\t},\n\toption.WithResponseInto(\u0026response),\n)\nif err != nil {\n\t// handle error\n}\nfmt.Printf(\"%+v\\n\", zone)\n\nfmt.Printf(\"Status Code: %d\\n\", response.StatusCode)\nfmt.Printf(\"Headers: %+#v\\n\", response.Header)\n```\n\n### Making custom/undocumented requests\n\nThis library is typed for convenient access to the documented API. If you need to access undocumented\nendpoints, params, or response properties, the library can still be used.\n\n#### Undocumented endpoints\n\nTo make requests to undocumented endpoints, you can use `client.Get`, `client.Post`, and other HTTP verbs.\n`RequestOptions` on the client, such as retries, will be respected when making these requests.\n\n```go\nvar (\n    // params can be an io.Reader, a []byte, an encoding/json serializable object,\n    // or a \"…Params\" struct defined in this library.\n    params map[string]interface{}\n\n    // result can be an []byte, *http.Response, a encoding/json deserializable object,\n    // or a model defined in this library.\n    result *http.Response\n)\nerr := client.Post(context.Background(), \"/unspecified\", params, \u0026result)\nif err != nil {\n    …\n}\n```\n\n#### Undocumented request params\n\nTo make requests using undocumented parameters, you may use either the `option.WithQuerySet()`\nor the `option.WithJSONSet()` methods.\n\n```go\nparams := FooNewParams{\n    ID:   cloudflare.F(\"id_xxxx\"),\n    Data: cloudflare.F(FooNewParamsData{\n        FirstName: cloudflare.F(\"John\"),\n    }),\n}\nclient.Foo.New(context.Background(), params, option.WithJSONSet(\"data.last_name\", \"Doe\"))\n```\n\n#### Undocumented response properties\n\nTo access undocumented response properties, you may either access the raw JSON of the response as a string\nwith `result.JSON.RawJSON()`, or get the raw JSON of a particular field on the result with\n`result.JSON.Foo.Raw()`.\n\nAny fields that are not present on the response struct will be saved and can be accessed by `result.JSON.ExtraFields()` which returns the extra fields as a `map[string]Field`.\n\n### Middleware\n\nWe provide `option.WithMiddleware` which applies the given\nmiddleware to requests.\n\n```go\nfunc Logger(req *http.Request, next option.MiddlewareNext) (res *http.Response, err error) {\n\t// Before the request\n\tstart := time.Now()\n\tLogReq(req)\n\n\t// Forward the request to the next handler\n\tres, err = next(req)\n\n\t// Handle stuff after the request\n\tend := time.Now()\n\tLogRes(res, err, start - end)\n\n    return res, err\n}\n\nclient := cloudflare.NewClient(\n\toption.WithMiddleware(Logger),\n)\n```\n\nWhen multiple middlewares are provided as variadic arguments, the middlewares\nare applied left to right. If `option.WithMiddleware` is given\nmultiple times, for example first in the client then the method, the\nmiddleware in the client will run first and the middleware given in the method\nwill run next.\n\nYou may also replace the default `http.Client` with\n`option.WithHTTPClient(client)`. Only one http client is\naccepted (this overwrites any previous client) and receives requests after any\nmiddleware has been applied.\n\n## Semantic versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n2. Changes that we do not expect to impact the vast majority of users in practice.\n\n## Maintenance\n\nThis SDK is actively maintained, however, many issues are tracked outside of GitHub on internal Cloudflare systems. Members of the community are welcome to join and discuss your issues during our twice monthly triage meetings. For urgent issues, please contact [Cloudflare support](https://www.support.cloudflare.com/s/?language=en_US). \n\n* [Community triage meeting](https://calendar.google.com/calendar/embed?src=c_dbf6ce250643f2e60f806d28f3fc09a9de24cbe0ab3ffb699838303d2adfc9e4%40group.calendar.google.com\u0026ctz=America%2FLos_Angeles)\n\n## Contributing\n\nSee [the contributing documentation](./CONTRIBUTING.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudflare%2Fcloudflare-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloudflare%2Fcloudflare-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudflare%2Fcloudflare-go/lists"}