From 96db9bce8cc893c5198fa3a2ec6f2c45e28a4b8a Mon Sep 17 00:00:00 2001 From: Stevan Freeborn <65925598+StevanFreeborn@users.noreply.github.com> Date: Thu, 26 Mar 2026 10:48:01 -0500 Subject: [PATCH] docs: update README.md with missing list endpoints examples --- README.md | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/README.md b/README.md index 39c56ed..2d3ddbb 100644 --- a/README.md +++ b/README.md @@ -251,4 +251,57 @@ if err != nil { } else { fmt.Printf("Retrieved Field Batch (Count: %d): %+v\n", batch.Count, batch.Items) } +``` + +### Lists + +#### Save List Item + +Create a new list item or update an existing one. To create a new item, omit the `Id` field. To update an existing item, provide the `Id` of the item to update. + +```go +import ( + "context" + "fmt" + "github.com/StevanFreeborn/onspring-api-sdk-go/onspring" +) + +client := onspring.NewClient("your-api-key") + +numericValue := 1.0 +color := "#ff0000" + +item := onspring.SaveListItemRequest{ + Name: "New List Value", + NumericValue: &numericValue, + Color: &color, +} + +response, err := client.Lists.Save(context.TODO(), 1, item) + +if err != nil { + fmt.Printf("Error: %v\n", err) +} else { + fmt.Printf("Saved List Item Id: %s\n", response.Id) +} +``` + +#### Delete List Item + +```go +import ( + "context" + "fmt" + "github.com/StevanFreeborn/onspring-api-sdk-go/onspring" +) + +client := onspring.NewClient("your-api-key") + +err := client.Lists.Delete(context.TODO(), 1, "d4a3c2b1-e5f6-7890-abcd-ef1234567890") + +if err != nil { + fmt.Printf("Error: %v\n", err) +} else { + fmt.Println("List item deleted successfully!") +}