package main
import (
	"context"
	"encoding/hex"
	"encoding/json"
	"fmt"
	"log"
	"github.com/onflow/flow/protobuf/go/flow/access"
)
func main() {
	// Requires authenticating before making the request. Refer to Intro Page on how Authentication can be done.
	client, err := getAccessClientWithBasicAuth("ENDPOINT-NAME", "TOKEN_GOES_HERE")
	ctx := context.Background()
	if err != nil {
		log.Fatalf("err: %v", err)
	}
	// Get Collection by ID
	collectionId, err := hex.DecodeString("eb6733050812a58450310980032ea2fdbee8a7c5f6aad252abf1ef9d82fd8ff5")
	collectionResp, err := client.GetCollectionByID(ctx, &access.GetCollectionByIDRequest{Id: collectionId})
	respJSON, err := json.Marshal(collectionResp)
	if err != nil {
		log.Fatal("get collection by ID failed: ", err)
	}
	fmt.Println("Get Collection by ID:", string(respJSON))
}