-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
52 lines (39 loc) · 1.01 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package main
import (
"log"
"os"
"github.com/wisdomenigma/algolia-media/algolia_wrapper"
"github.com/wisdomenigma/algolia-media/algolia_wrapper/protos"
)
func main() {
file, err := os.OpenFile("metamask.png", os.O_RDWR|os.O_CREATE, 0755)
if err != nil {
return
}
wrapper := algolia_wrapper.NewAlgolia_Object(file)
client := wrapper.ToConnectAlgolia(&protos.Credentials{
APP_Code: "XNZCWV197B",
Algolia_AMI: "37695cff1374a0e0f2929012fd65b5ef",
})
index := wrapper.Index(client, []string{"MyAvatar"}...)
object, err := wrapper.Put(index)
if err != nil {
log.Println("Error putting image:", err)
return
}
result, err := wrapper.Query(index, object, []string{"MyAvatar"}...)
if err != nil {
log.Println("Error finding image :", err)
return
}
log.Println("Result:", result.Query)
resultSet, _, err := wrapper.Get(index, object)
if err != nil {
log.Println("Error getting image:", err)
return
}
log.Println("Result :", resultSet)
if err = wrapper.Close(); err != nil {
return
}
}