Skip to content

Commit

Permalink
Merge pull request #3245 from cloudflare/release-please--branches--de…
Browse files Browse the repository at this point in the history
…velop--changes--next
  • Loading branch information
jacobbednarz authored Jan 10, 2025
2 parents 6c240fb + 59c72bf commit 12285aa
Show file tree
Hide file tree
Showing 1,308 changed files with 139,444 additions and 47,561 deletions.
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "3.1.0"
".": "4.0.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 1336
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-181e01b5bd06b9225e1d9e83df10e41fde7035040d740433d44f1c04ed7a80bb.yml
configured_endpoints: 1493
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-de70b033c163b7a4d4a11c5c66a7bcf7162020c433006b0d6b2d3e43c5b24df4.yml
1 change: 1 addition & 0 deletions Brewfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
brew "go"
242 changes: 242 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

33 changes: 20 additions & 13 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
## Setting up the environment

### Install Go 1.18+
To set up the repository, run:

Install go by following relevant directions [here](https://go.dev/doc/install).
```sh
$ ./scripts/bootstrap
$ ./scripts/build
```

This will install all the required dependencies and build the SDK.

You can also [install go 1.18+ manually](https://go.dev/doc/install).

## Modifying/Adding code

Expand All @@ -14,7 +21,7 @@ modify the contents of the `lib/` and `examples/` directories.

All files in the `examples/` directory are not modified by the generator and can be freely edited or added to.

```bash
```go
# add an example to examples/<your-example>/main.go

package main
Expand All @@ -24,36 +31,36 @@ func main() {
}
```

```bash
go run ./examples/<your-example>
```sh
$ go run ./examples/<your-example>
```

## Using the repository from source

To use a local version of this library from source in another project, edit the `go.mod` with a replace
directive. This can be done through the CLI with the following:

```bash
go mod edit -replace github.com/cloudflare/cloudflare-go/v3=/path/to/cloudflare-go
```sh
$ go mod edit -replace github.com/cloudflare/cloudflare-go/v3=/path/to/cloudflare-go
```

## Running tests

Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests.

```bash
```sh
# you will need npm installed
npx prism mock path/to/your/openapi.yml
$ npx prism mock path/to/your/openapi.yml
```

```bash
go test ./...
```sh
$ ./scripts/test
```

## Formatting

This library uses the standard gofmt code formatter:

```bash
gofmt -s -w .
```sh
$ ./scripts/format
```
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2024 Cloudflare
Copyright 2025 Cloudflare

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Cloudflare Go API Library

<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3"><img src="https://pkg.go.dev/badge/github.com/cloudflare/cloudflare-go/v3.svg" alt="Go Reference"></a>
<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v4"><img src="https://pkg.go.dev/badge/github.com/cloudflare/cloudflare-go/v3.svg" alt="Go Reference"></a>

The Cloudflare Go library provides convenient access to [the Cloudflare REST
API](https://developers.cloudflare.com/api) from applications written in Go. The full API of this library can be found in [api.md](api.md).
Expand All @@ -11,7 +11,7 @@ API](https://developers.cloudflare.com/api) from applications written in Go. The

```go
import (
"github.com/cloudflare/cloudflare-go/v3" // imported as cloudflare
"github.com/cloudflare/cloudflare-go/v4" // imported as cloudflare
)
```

Expand All @@ -22,7 +22,7 @@ Or to pin the version:
<!-- x-release-please-start-version -->

```sh
go get -u 'github.com/cloudflare/cloudflare-go/v3@v3.1.0'
go get -u 'github.com/cloudflare/cloudflare-go/v3@v4.0.0'
```

<!-- x-release-please-end -->
Expand All @@ -42,9 +42,9 @@ import (
"context"
"fmt"

"github.com/cloudflare/cloudflare-go/v3"
"github.com/cloudflare/cloudflare-go/v3/option"
"github.com/cloudflare/cloudflare-go/v3/zones"
"github.com/cloudflare/cloudflare-go/v4"
"github.com/cloudflare/cloudflare-go/v4/option"
"github.com/cloudflare/cloudflare-go/v4/zones"
)

func main() {
Expand Down Expand Up @@ -112,7 +112,7 @@ if res.Name == "" {
// true if `"name"` is either not present or explicitly null
res.JSON.Name.IsNull()

// true if the `"name"` key was not present in the repsonse JSON at all
// true if the `"name"` key was not present in the response JSON at all
res.JSON.Name.IsMissing()

// When the API returns data that cannot be coerced to the expected type:
Expand Down Expand Up @@ -370,9 +370,9 @@ middleware has been applied.
This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:

1. Changes that only affect static types, without breaking runtime behavior.
1. 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)_.
1. Changes to library internals which are technically public but not intended or documented for external use.
1. Changes that we do not expect to impact the vast majority of users in practice.

> [!WARNING]
> In addition to the above, changes to type names, structure or methods _may_ occur as we stabilise the automated codegen pipeline. This will be removed in the future once we are further along and the service owner OpenAPI schemas have reached a higher maturity level where changes are not as constant.
> If this isn't suitable for your project, we recommend pinning to a known version or using the previous major version.
## Contributing

See [the contributing documentation](./CONTRIBUTING.md).
Loading

0 comments on commit 12285aa

Please sign in to comment.