Skip to content

isovalent/credly-go

credly-go

Go Report Card Go Reference License: Apache 2.0

credly-go is a Go client library for interacting with the Credly platform. It provides a simple and convenient way to programmatically access Credly's APIs and handle badges and templates.

Features

  • Badge Management: Issue, retrieve, and manage badges using the Credly API.
  • Badge Template Management: Create, update, retrieve, archive, unarchive, and delete badge templates.

Installation

To install the credly-go library, run:

go get github.com/isovalent/credly-go

Example Usage

package main

import (
    "fmt"
    "github.com/isovalent/credly-go/credly"
)

func main() {
    // Initialize the Credly client
    client := credly.NewClient("your-api-token", "your-credly-org")

    // Get all badges for user [email protected]
    badges, err := client.GetBadges("[email protected]", nil)
    if err != nil {
        fmt.Printf("Error getting badges: %v\n", err)
        return
    }
    
    // Create a new badge template
    newTemplate := &credly.CreateBadgeTemplateParams{
        Name:              "Advanced Networking",
        Description:       "This badge recognizes expertise in advanced networking concepts",
        ImageURL:          "https://yourserver.com/badge-images/networking.png",
        Skills:            []string{"Networking", "Routing", "TCP/IP"},
        GlobalActivityURL: "https://example.com/badge-criteria/networking",
        // Optional fields
        Level:        "Advanced",
        TimeToEarn:   "Months",
        ReportingTags: []string{"technical", "networking"},
    }
    
    template, err := client.CreateBadgeTemplate(newTemplate)
    if err != nil {
        fmt.Printf("Error creating badge template: %v\n", err)
        return
    }
    
    fmt.Printf("Created new badge template with ID: %s\n", template.Id)
}

Contributing

We welcome contributions! Please follow these steps to contribute:

  1. Fork the repository.
  2. Create a new branch with your feature or bug fix.
  3. Make your changes and add tests.
  4. Submit a pull request with a detailed description of your changes.

Running Tests

To run the tests, use:

go test ./...

Make sure to write tests for any new functionality and ensure that all existing tests pass.

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Support

If you have any questions or need help, feel free to open an issue in the GitHub repository.

About

A Go library for the Credly API

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published