author | Mikael Berthe <mikael@lilotux.net> |
Sat, 15 Apr 2017 21:08:34 +0200 | |
changeset 125 | 2bbb72b9ebf6 |
parent 123 | 9b566c020a17 |
child 130 | c450bb73f59a |
permissions | -rw-r--r-- |
7 | 1 |
package gondole |
2 |
||
21
555716349f64
Move App stuff into app.go.
Ollivier Robert <roberto@keltia.net>
parents:
13
diff
changeset
|
3 |
import ( |
83
adc39ae774c0
Make it work with non-defaut instances
Mikael Berthe <mikael@lilotux.net>
parents:
77
diff
changeset
|
4 |
"errors" |
21
555716349f64
Move App stuff into app.go.
Ollivier Robert <roberto@keltia.net>
parents:
13
diff
changeset
|
5 |
) |
7 | 6 |
|
120 | 7 |
// apiCallParams is a map with the parameters for an API call |
8 |
type apiCallParams map[string]string |
|
9 |
||
7 | 10 |
const ( |
83
adc39ae774c0
Make it work with non-defaut instances
Mikael Berthe <mikael@lilotux.net>
parents:
77
diff
changeset
|
11 |
// GondoleVersion contains the version of the Gondole implementation |
adc39ae774c0
Make it work with non-defaut instances
Mikael Berthe <mikael@lilotux.net>
parents:
77
diff
changeset
|
12 |
GondoleVersion = "0.0" |
12
4f58e9f1e2bc
Add APIEndpoint. Fill in Gondole variable.
Ollivier Robert <roberto@keltia.net>
parents:
7
diff
changeset
|
13 |
|
83
adc39ae774c0
Make it work with non-defaut instances
Mikael Berthe <mikael@lilotux.net>
parents:
77
diff
changeset
|
14 |
defaultInstanceURL = "https://mastodon.social" |
adc39ae774c0
Make it work with non-defaut instances
Mikael Berthe <mikael@lilotux.net>
parents:
77
diff
changeset
|
15 |
apiVersion = "v1" // That is not overridable |
adc39ae774c0
Make it work with non-defaut instances
Mikael Berthe <mikael@lilotux.net>
parents:
77
diff
changeset
|
16 |
defaultAPIPath = "/api/" + apiVersion |
77
603dd20de7e1
Use site part of the endpoint but fix "/api/v1". Use FallBack if necessary.
Ollivier Robert <roberto@keltia.net>
parents:
67
diff
changeset
|
17 |
|
83
adc39ae774c0
Make it work with non-defaut instances
Mikael Berthe <mikael@lilotux.net>
parents:
77
diff
changeset
|
18 |
// NoRedirect is the URI for no redirection in the App registration |
21
555716349f64
Move App stuff into app.go.
Ollivier Robert <roberto@keltia.net>
parents:
13
diff
changeset
|
19 |
NoRedirect = "urn:ietf:wg:oauth:2.0:oob" |
7 | 20 |
) |
21 |
||
99
6ec2a44a1bd1
Return error rather than empty entities
Mikael Berthe <mikael@lilotux.net>
parents:
89
diff
changeset
|
22 |
// Error codes |
33
bce8b17415ae
Add new error ErrAlreadyRegistered.
Ollivier Robert <roberto@keltia.net>
parents:
26
diff
changeset
|
23 |
var ( |
99
6ec2a44a1bd1
Return error rather than empty entities
Mikael Berthe <mikael@lilotux.net>
parents:
89
diff
changeset
|
24 |
ErrAlreadyRegistered = errors.New("app already registered") |
6ec2a44a1bd1
Return error rather than empty entities
Mikael Berthe <mikael@lilotux.net>
parents:
89
diff
changeset
|
25 |
ErrEntityNotFound = errors.New("entity not found") |
104
fc338e606d37
Introduce new error message constant
Mikael Berthe <mikael@lilotux.net>
parents:
101
diff
changeset
|
26 |
ErrInvalidParameter = errors.New("incorrect parameter") |
101
16d7500c19dd
Add a generic error identifier
Mikael Berthe <mikael@lilotux.net>
parents:
99
diff
changeset
|
27 |
ErrInvalidID = errors.New("incorrect entity ID") |
33
bce8b17415ae
Add new error ErrAlreadyRegistered.
Ollivier Robert <roberto@keltia.net>
parents:
26
diff
changeset
|
28 |
) |