Skip to content

hopinc/go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Mar 14, 2023
ab72883 Â· Mar 14, 2023
Feb 8, 2023
Oct 5, 2022
Oct 6, 2022
Mar 14, 2023
Sep 18, 2022
Nov 14, 2022
Sep 10, 2022
Sep 7, 2022
Oct 6, 2022
Oct 5, 2022
Sep 4, 2022
Sep 10, 2022
Nov 28, 2022
Oct 6, 2022
Feb 26, 2023
Nov 28, 2022
Feb 26, 2023
Sep 18, 2022
Feb 26, 2023
Sep 10, 2022
Feb 10, 2023
Feb 10, 2023
Nov 28, 2022
Feb 10, 2023
Feb 10, 2023
Nov 28, 2022
Oct 5, 2022
Nov 28, 2022
Nov 28, 2022
Nov 28, 2022
Oct 5, 2022
Nov 28, 2022
Feb 14, 2023
Feb 26, 2023
Feb 26, 2023
Mar 14, 2023

Repository files navigation

hop-go

View Hop Documentation | View Source Documentation

Hop's Go library. Requires Go 1.18+.

package main

import (
	"context"
	"fmt"

	"go.hop.io/sdk"
)

func main() {
	myToken := "ptk_xxx"
	c, err := hop.NewClient(myToken)
	if err != nil {
		// Handle errors how you wish here.
		panic(err)
	}

	s, err := c.Projects.Secrets.Create(
		context.Background(),
		"SECRET_NAME",
		"SECRET_VALUE",
		hop.WithProjectID("PROJECT_ID"), // If not using a project token, you will need to specify the project ID.
	)
	if err != nil {
		// Handle errors how you wish here.
		panic(err)
	}
	fmt.Println(s)
}

Client options (such as the project ID) can be set either at a client level like c.AddClientOptions(hop.WithProjectID("PROJECT_ID")) or at a functional level like shown above. If options are provided to the function, they override the client level option configuration.