-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmodels.go
62 lines (56 loc) · 1.57 KB
/
models.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
55
56
57
58
59
60
61
62
package gopiston
import (
"net/http"
)
/*
Client struct to allow the usage of Piston API endpoints.
*/
type Client struct {
HttpClient *http.Client
BaseURL string
ApiKey string
}
/*
Slice Struct that holds all the supported runtimes by the Piston API.
*/
type Runtimes []struct {
Language string `json:"language"`
Version string `json:"version"`
Aliases []string `json:"aliases"`
Runtime string `json:"runtime,omitempty"`
}
/*
Struct for storing the name of the file and content.
*/
type Code struct {
Name string `json:"name,omitempty"`
Content string `json:"content"`
}
/*
Request Body that is sent over to the Piston API for the execute endpoint.
*/
type RequestBody struct {
Language string `json:"language"`
Version string `json:"version"`
Files []Code `json:"files"`
Stdin string `json:"stdin,omitempty"`
Args []string `json:"args,omitempty"`
CompileTimeout int `json:"compile_timeout,omitempty"`
RunTimeout int `json:"run_timeout,omitempty"`
CompileMemoryLimit int `json:"compile_memory_limit,omitempty"`
RunMemoryLimit int `json:"run_memory_limit,omitempty"`
}
/*
Response Received from the Piston API.
*/
type PistonExecution struct {
Language string `json:"language"`
Version string `json:"version"`
Run struct {
Stdout string `json:"stdout,omitempty"`
Stderr string `json:"stderr,omitempty"`
Output string `json:"output,omitempty"`
Code int `json:"code,omitempty"`
Signal string `json:"signal,omitempty"`
} `json:"run"`
}