-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcloudsight_test.go
54 lines (42 loc) · 1.07 KB
/
cloudsight_test.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
53
54
package cloudsight
import (
"fmt"
"os"
"time"
)
func ExampleClient_ImageRequest() {
c, _ := NewClientSimple("api-key")
f, _ := os.Open("some-file.jpg")
defer f.Close()
params := Params{}
// Set the position to 50.0°N 19.0°E
params.SetLatitude(50.0)
params.SetLongitude(19.0)
job, err := c.ImageRequest(f, "some-file.jpg", params)
if err != nil {
panic(err)
}
fmt.Println("Token:", job.Token)
}
func ExampleClient_RemoteImageRequest() {
c, _ := NewClientSimple("api-key")
params := Params{}
// Set the position to 50.0°N 19.0°E
params.SetLatitude(50.0)
params.SetLongitude(19.0)
job, err := c.RemoteImageRequest("http://www.example.com/some-image.jpg", params)
if err != nil {
panic(err)
}
fmt.Println("Token:", job.Token)
}
func ExampleClient_UpdateJob() {
c, _ := NewClientSimple("api-key")
job, _ := c.RemoteImageRequest("http://www.example.com/some-image.jpg", nil)
time.Sleep(3 * time.Second)
for job.Status == StatusNotCompleted {
time.Sleep(1 * time.Second)
c.UpdateJob(job)
}
fmt.Println("Status:", job.Status, job.Status.Description())
}