-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BREAKING CHANGE: this removes the support for the public v7 api, and changes the endpoints
- Loading branch information
1 parent
5224198
commit 7a38e27
Showing
4 changed files
with
295 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package gobalt | ||
|
||
import ( | ||
"context" | ||
"net/url" | ||
"testing" | ||
) | ||
|
||
var ( | ||
urls = []string{ | ||
"https://x.com/tonystatovci/status/1856853985149227419?t=WuK-zVfde8WTofpdt7UBaQ&s=19", | ||
} | ||
) | ||
|
||
func TestClient(t *testing.T) { | ||
client := NewCobaltWithAPI("http://localhost:9000/") | ||
for _, u := range urls { | ||
pURL, _ := url.Parse(u) | ||
t.Run(pURL.Host, func(t *testing.T) { | ||
media, err := client.Post(context.Background(), PostRequest{URL: u}) | ||
if err != nil { | ||
t.Errorf("failed to fetch media for %s url with error: %v", u, err) | ||
} | ||
|
||
if len(media.Filename) == 0 { | ||
t.Error("filename was empty") | ||
} | ||
|
||
s, err := media.Stream(context.Background()) | ||
if err != nil { | ||
t.Errorf("failed to stream media with error: %v", err) | ||
return | ||
} | ||
defer s.Close() | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module github.com/andresperezl/gobalt | ||
module github.com/andresperezl/gobalt/v2 | ||
|
||
go 1.23.0 |
Oops, something went wrong.