Skip to content

erkanay/graphcommons-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

graphcommons-go

Go wrapper for Graphcommons API.

Installation

go get github.com/erkanay/graphcommons-go

Usage

Authentication

import . "github.com/erkanay/graphcommons-go"

gc, _ := GraphCommons("API_KEY")
resp := gc.Status()
fmt.Println(resp) // {"msg":"Working"}

New Graph

body := Graph{
    Name: "Go graph",
    Description: "Go wrapper helps to create graph",
    Status: 1,
    Subtitle: "Graphcommons-go",
    Signals: []Signal{
        Signal{
            Action: "edge_create",
            FromName: "Erkan",
            FromType: "Person",
            ToName: "Maximé",
            ToType: "Person",
            Name:"COLLABORATED",
            Weight: 1,
        },
    },
}
resp := gc.CreateGraph(body)

Get Graph

resp := gc.Graphs("49beddc2-9616-409e-83aa-dd34335c69ee")

Update Graph

type Signals struct{
	Signals  []Signal `json:"signals"`
}
body := Signals{
    Signals: []Signal{
        Signal{
            Action: "edge_create",
            FromName: "Aude",
            FromType: "Person",
            ToName: "Maximé",
            ToType: "Person",
            Name: "COLLABORATED",
            Weight: 1,
        },
        Signal{
            Action: "edge_create",
            FromName: "Kosta",
            FromType: "Person",
            ToName: "Bogdan",
            ToType: "Person",
            Name: "COLLABORATED",
            Weight: 1,
        },
    },
}
resp := gc.UpdateGraph("49beddc2-9616-409e-83aa-dd34335c69ee", body)

Constituted graph is here.

Delete Graph

resp := gc.DeleteGraph("49beddc2-9616-409e-83aa-dd34335c69ee")

About

Go wrapper for Graphcommons API

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages