docs: update README.md with missing list endpoints examples
This commit is contained in:
@@ -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!")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user