Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
gre-dev committed Oct 13, 2024
1 parent 2419c84 commit 5a84c25
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,22 @@ The Greip Go library allows you to easily interact with the Greip API to access

## Installation

You can install the Greip library by running:
Add the library to your `go.mod`:

```
module main
go 1.22.1
require (
github.com/greipio/go v0.1.5
)
```

Then, download the Greip library by running:

```bash
go get github.com/Greipio/go
go mod download github.com/greipio/go
```

## Usage
Expand All @@ -31,15 +43,15 @@ package main

import (
"fmt"
"github.com/Greipio/go"
"github.com/greipio/go"
)

func main() {
// Initialize the Greip instance with your API token
greipInstance := greip.NewGreip("YOUR_API_TOKEN")

// Example: Lookup IP information
response, err := greipInstance.Lookup("1.1.1.1")
response, err := greipInstance.Lookup("1.1.1.1", []string{"device", "security"})
if err != nil {
fmt.Println("Error:", err)
return
Expand Down Expand Up @@ -91,7 +103,7 @@ greipInstance := greip.NewGreip("YOUR_API_TOKEN", true)
The library returns error for invalid parameters and request-related issues. Here’s an example of handling errors:

```go
response, err := greipInstance.Lookup("INVALID_IP")
response, err := greipInstance.Lookup("INVALID_IP", nil)
if err != nil {
fmt.Println("Error:", err)
return
Expand Down

0 comments on commit 5a84c25

Please sign in to comment.