https://github.com/kejjtoli/scratchgonnect
Scratch API wrapper for Go
https://github.com/kejjtoli/scratchgonnect
api api-wrapper go go-package golang scratch scratch3
Last synced: 7 months ago
JSON representation
Scratch API wrapper for Go
- Host: GitHub
- URL: https://github.com/kejjtoli/scratchgonnect
- Owner: kejjtoli
- License: gpl-3.0
- Created: 2025-01-12T23:16:37.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2025-01-20T11:29:55.000Z (9 months ago)
- Last Synced: 2025-01-20T12:31:52.198Z (9 months ago)
- Topics: api, api-wrapper, go, go-package, golang, scratch, scratch3
- Language: Go
- Homepage:
- Size: 85 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![]()

**Send Scratch API requests with ease.**
ScratchGonnect is a Scratch API wrapper written in Go and allows you to easily and quickly interface with the Scratch API. It allows you to post comments, change project data and much more.
## Installation
**Run this command in your terminal in order to use this package**
```
go get github.com/kejjtoli/ScratchGonnect@latest
```## Examples
**Creating a new session (lets you use features that require logging in)**
```go
// Log into a scratch session
session := scratchgonnect.NewSession("username", "pass")
```
Posting a comment under a project
```go
// Get a project by id
project := scratchgonnect.GetProject("535962801")// Post comment with given content, parent_id, commentee_id
project.PostComment(*session, "Comment Content", "", "")
```
Following a user and getting his followers
```go
// Get a user by username
user := scratchgonnect.GetUser("kajtolmation")// Follow user
user.Follow(*session)// Get array of user objects
followers := user.GetFollowers()
```
**Connecting to Turbowarp cloud**
```go
// Connect to turbowarp websocket
cloud := scratchgonnect.ConnectTurbowarpCloud("username", "1121839236")
```
Setting a cloud variable
```go
// Sets the value of a cloud variable
cloud.SetVariable("t1", 314)
```
Listening to cloud variable changes
```go
// Listens to all set variable messages
cloud.Listen(cloud_listener)// Prints out name and new value of changed variable
func cloud_listener(connection *scratchgonnect.CloudSocket, variable_name string, value int) {
fmt.Println(variable_name, value)
}
```*More examples in examples/example.go file*
## License
ScratchGonnect is licensed under the GPL-3.0 license and is free to use and open-source.