Repository: cloudflare/cloudflare-go (go)

Issue:
Stream API Metadata
### Current cloudflare-go version

v0.48.0

### Description

Add metadata support to the StreamCreateVideoDirectURL function.
According to [Cloudflare Docs](https://developers.cloudflare.com/stream/uploading-videos/direct-creator-uploads/) it is possible by adding "meta" field to the request.

### Use cases

Use case is self explanatory

### Potential cloudflare-go usage

```go
StreamCreateVideoDirectURL(ctx, cloudflare.StreamCreateVideoParameters{
	AccountID:          accountId,
	MaxDurationSeconds: 600,
	Creator:            "test",
	Metadata:           map[string]interface{}{
            "env": "production",
        },
})
```


### References

_No response_

Pull request:
Stream: added metadata support
## Description

This adds ability to add metadata to videos.
Resolves #1062 

## Has your change been tested?

I've added the tests and also manually tested with Postman

## Types of changes

What sort of change does your code introduce/modify?

- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] 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.

[1]: https://help.github.com/articles/closing-issues-using-keywords/


Patch:
diff --git a/.changelog/1088.txt b/.changelog/1088.txt
new file mode 100644
index 000000000..ac1759d7a
--- /dev/null
+++ b/.changelog/1088.txt
@@ -0,0 +1,3 @@
+```release-note:enhancement
+stream: added metadata support
+```
\ No newline at end of file
diff --git a/stream.go b/stream.go
index e12630495..af04468c2 100644
--- a/stream.go
+++ b/stream.go
@@ -103,6 +103,7 @@ type StreamUploadFromURLParameters struct {
 	AllowedOrigins        []string                `json:"allowedOrigins,omitempty"`
 	RequiredSignedURLs    bool                    `json:"requiredSignedURLs,omitempty"`
 	Watermark             UploadVideoURLWatermark `json:"watermark,omitempty"`
+	Meta                  map[string]interface{}  `json:"meta,omitempty"`
 }
 
 // StreamCreateVideoParameters are parameters used when creating a video.
@@ -115,6 +116,7 @@ type StreamCreateVideoParameters struct {
 	AllowedOrigins        []string                `json:"allowedOrigins,omitempty"`
 	RequiredSignedURLs    bool                    `json:"requiredSignedURLs,omitempty"`
 	Watermark             UploadVideoURLWatermark `json:"watermark,omitempty"`
+	Meta                  map[string]interface{}  `json:"meta,omitempty"`
 }
 
 // UploadVideoURLWatermark represents UID of an existing watermark.


Test patch:
diff --git a/stream_test.go b/stream_test.go
index eb821cec6..5472da1ce 100644
--- a/stream_test.go
+++ b/stream_test.go
@@ -28,7 +28,9 @@ const (
       "width": 1920
     },
     "maxDurationSeconds": 300,
-    "meta": {},
+    "meta": {
+	  "name": "My First Stream Video"
+	},
     "modified": "2014-01-02T02:20:00Z",
     "uploadExpiry": "2014-01-02T02:20:00Z",
     "playback": {
@@ -121,7 +123,9 @@ func createTestVideo() StreamVideo {
 			Scale:          0.1,
 			Position:       "center",
 		},
-		Meta: map[string]interface{}{},
+		Meta: map[string]interface{}{
+			"name": "My First Stream Video",
+		},
 		NFT: StreamVideoNFTParameters{
 			Token:    5,
 			Contract: "0x57f1887a8bf19b14fc0d912b9b2acc9af147ea85",
@@ -155,6 +159,9 @@ func TestStream_StreamUploadFromURL(t *testing.T) {
 	input := StreamUploadFromURLParameters{
 		AccountID: testAccountID,
 		URL:       "https://example.com/myvideo.mp4",
+		Meta: map[string]interface{}{
+			"name": "My First Stream Video",
+		},
 	}
 
 	out, err := client.StreamUploadFromURL(context.Background(), input)
@@ -241,7 +248,9 @@ func TestStream_CreateVideoDirectURL(t *testing.T) {
 		assert.Equal(t, ErrMissingMaxDuration, err)
 	}
 
-	input := StreamCreateVideoParameters{AccountID: testAccountID, MaxDurationSeconds: 300}
+	input := StreamCreateVideoParameters{AccountID: testAccountID, MaxDurationSeconds: 300, Meta: map[string]interface{}{
+		"name": "My First Stream Video",
+	}}
 	out, err := client.StreamCreateVideoDirectURL(context.Background(), input)
 
 	created, _ := time.Parse(time.RFC3339, "2014-01-02T02:20:00Z")
@@ -291,7 +300,9 @@ func TestStream_ListVideos(t *testing.T) {
       "width": 1920
     },
     "maxDurationSeconds": 300,
-    "meta": {},
+    "meta": {
+	  "name": "My First Stream Video"
+	},
     "modified": "2014-01-02T02:20:00Z",
     "uploadExpiry": "2014-01-02T02:20:00Z",
     "playback": {