Repository: cloudflare/cloudflare-go (go)

Issue:
Stream API wrong type
### Confirmation

- [X] My issue isn't already found on the issue tracker.
- [X] I have replicated my issue using the latest version of the library and it is still present.

### cloudflare-go version

v0.48.0

### Go environment

GO111MODULE="on"
GOARCH="arm64"
GOBIN=""
GOCACHE="/Users/tomaz/Library/Caches/go-build"
GOENV="/Users/tomaz/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/tomaz/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/tomaz/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/opt/homebrew/Cellar/go/1.18.5/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/homebrew/Cellar/go/1.18.5/libexec/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.18.5"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/tomaz/GolandProjects/vpl_backend/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/2s/nnn7f20d4md80pjm0wdgdy340000gn/T/go-build3324721000=/tmp/go-build -gno-record-gcc-switches -fno-common"

### Expected output

Expected to get StreamVideo struct from the method.

### Actual output

json: cannot unmarshal string into Go struct field StreamVideoStatus.result.status.pctComplete of type int

### Code demonstrating the issue

api.StreamGetVideo(ctx, cloudflare.StreamParameters{
  AccountID: accountId,
  VideoID:   videoId,
})


### Steps to reproduce

api.StreamGetVideo(ctx, cloudflare.StreamParameters{
  AccountID: accountId,
  VideoID:   videoId,
})


### References

_No response_

Pull request:
Correct type for stream api
## Description
Updates the type of `pct` to string from int

Fixes #1061 

## Has your change been tested?

Updated unit tests and they pass

## Types of changes

What sort of change does your code introduce/modify?

- [X] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)

## Checklist:

- [X] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [X] I have added tests to cover my changes.
- [X] All new and existing tests passed.
- [X] This change is using publicly documented (api.cloudflare.com or developers.cloudflare.com) and stable APIs. (will be)


Patch:
diff --git a/.changelog/1066.txt b/.changelog/1066.txt
new file mode 100644
index 000000000..9e0282172
--- /dev/null
+++ b/.changelog/1066.txt
@@ -0,0 +1,3 @@
+```release-note:bug
+stream: Update pctComplete to string from int
+```
diff --git a/stream.go b/stream.go
index 9529c4025..e12630495 100644
--- a/stream.go
+++ b/stream.go
@@ -65,7 +65,7 @@ type StreamVideoPlayback struct {
 // StreamVideoStatus represents the status of a stream video.
 type StreamVideoStatus struct {
 	State           string `json:"state,omitempty"`
-	PctComplete     int    `json:"pctComplete,omitempty"`
+	PctComplete     string `json:"pctComplete,omitempty"`
 	ErrorReasonCode string `json:"errorReasonCode,omitempty"`
 	ErrorReasonText string `json:"errorReasonText,omitempty"`
 }


Test patch:
diff --git a/stream_test.go b/stream_test.go
index 094d794d0..eb821cec6 100644
--- a/stream_test.go
+++ b/stream_test.go
@@ -41,7 +41,7 @@ const (
     "size": 4190963,
     "status": {
       "state": "inprogress",
-      "pctComplete": 51,
+      "pctComplete": "51",
       "errorReasonCode": "ERR_NON_VIDEO",
       "errorReasonText": "The file was not recognized as a valid video file."
     },
@@ -98,7 +98,7 @@ func createTestVideo() StreamVideo {
 		Size:               4190963,
 		Status: StreamVideoStatus{
 			State:           "inprogress",
-			PctComplete:     51,
+			PctComplete:     "51",
 			ErrorReasonCode: "ERR_NON_VIDEO",
 			ErrorReasonText: "The file was not recognized as a valid video file.",
 		},
@@ -304,7 +304,7 @@ func TestStream_ListVideos(t *testing.T) {
     "size": 4190963,
     "status": {
       "state": "inprogress",
-      "pctComplete": 51,
+      "pctComplete": "51",
       "errorReasonCode": "ERR_NON_VIDEO",
       "errorReasonText": "The file was not recognized as a valid video file."
     },