Developer-friendly & type-safe Go SDK specifically designed to leverage the FastPix platform API.
The FastPix Go SDK simplifies integration with the FastPix platform. This SDK is designed for secure and efficient communication with the FastPix API, enabling easy management of media uploads, live streaming, and simulcasting.
- Media API
- Upload Media: Upload media files seamlessly from URLs or devices
- Manage Media: List, fetch, update, and delete media assets
- Playback IDs: Generate and manage playback IDs for media access
- Live API
- Create & Manage Live Streams: Create, list, update, and delete live streams
- Control Stream Access: Generate playback IDs for live streams to control and manage access
- Simulcast to Multiple Platforms: Stream content to multiple platforms simultaneously
For detailed usage, refer to the FastPix API Reference.
- Go 1.20 or later
- FastPix API credentials (Username and Password)
To get started with the FastPix Go SDK, ensure you have the following:
- FastPix APIs are authenticated using a Username and Password (HTTP Basic Auth). You must generate these credentials to use the SDK.
- Follow the steps in the Authentication section to obtain your credentials.
- SDK Installation
- Initialization
- SDK Example Usage
- Available Resources and Operations
- Error Handling
- Server Selection
- Development
- Maturity
- Detailed Usage
go get github.com/FastPix/fastpix-go@v0.1.0
You can set the security parameters using the WithSecurity
option when initializing the SDK client instance. For example:
package main
import (
"context"
fastpixgo "github.com/FastPix/fastpix-go"
"github.com/FastPix/fastpix-go/models/components"
)
func main() {
ctx := context.Background()
sdk := fastpixgo.New(
fastpixgo.WithSecurity(components.Security{
Username: fastpixgo.String("your-username"),
Password: fastpixgo.String("your-password"),
}),
)
// Use sdk...
}
package main
import (
"context"
fastpixgo "github.com/FastPix/fastpix-go"
"github.com/FastPix/fastpix-go/models/components"
"log"
)
func main() {
ctx := context.Background()
s := fastpixgo.New(
fastpixgo.WithSecurity(components.Security{
Username: fastpixgo.String(""),
Password: fastpixgo.String(""),
}),
)
res, err := s.StartLiveStream.CreateNewStream(ctx, &components.CreateLiveStreamRequest{
PlaybackSettings: components.PlaybackSettings{},
InputMediaSettings: components.InputMediaSettings{
Metadata: &components.CreateLiveStreamRequestMetadata{},
},
})
if err != nil {
log.Fatal(err)
}
if res.LiveStreamResponseDTO != nil {
// handle response
}
}
- CreateMedia - Create media from URL
- DirectUploadVideoMedia - Upload media from device
- GetAllStreams - Get all live streams
- GetLiveStreamByID - Get stream by ID
- DeleteLiveStream - Delete a stream
- UpdateLiveStream - Update a stream
- ListMedia - Get list of all media
- GetMedia - Get a media by ID
- UpdatedMedia - Update a media by ID
- DeleteMedia - Delete a media by ID
- RetrieveMediaInputInfo - Get info of media inputs
- CreatePlaybackIDOfStream - Create a playbackId
- DeletePlaybackIDOfStream - Delete a playbackId
- GetLiveStreamPlaybackID - Get stream's playbackId
- CreateMediaPlaybackID - Create a playback ID
- DeleteMediaPlaybackID - Delete a playback ID
- CreateSimulcastOfStream - Create a simulcast
- DeleteSimulcastOfStream - Delete a simulcast
- GetSpecificSimulcastOfStream - Get a specific simulcast of a stream
- UpdateSpecificSimulcastOfStream - Update a specific simulcast of a stream
- CreateNewStream - Create a new stream
All operations return a response object or an error. By default, an API error will return an apierrors.APIError
. When custom error responses are specified for an operation, the SDK may also return their associated error. You can refer to the respective Errors tables in the SDK docs for more details on possible error types for each operation.
For example, the CreateNewStream
function may return the following errors:
Error Type | Status Code | Content Type |
---|---|---|
apierrors.UnauthorizedError | 401 | application/json |
apierrors.InvalidPermissionError | 403 | application/json |
apierrors.ValidationErrorResponse | 422 | application/json |
apierrors.APIError | 4XX, 5XX | / |
The default server can be overridden globally using the WithServerURL(serverURL string)
option when initializing the SDK client instance. For example:
sdk := fastpixgo.New(
fastpixgo.WithServerURL("https://api.fastpix.io/v1/on-demand"),
fastpixgo.WithSecurity(components.Security{
Username: fastpixgo.String("your-username"),
Password: fastpixgo.String("your-password"),
}),
)
This SDK is currently in beta, and breaking changes may occur between versions even without a major version update. To avoid unexpected issues, we recommend pinning your dependency to a specific version. This ensures consistent behavior unless you intentionally update to a newer release.
For a complete understanding of each API's functionality, including request and response details, parameter descriptions, and additional examples, please refer to the FastPix API Reference.