author | Mikael Berthe <mikael@lilotux.net> |
Mon, 17 Apr 2017 12:07:44 +0200 | |
changeset 131 | 68ef6504637e |
parent 130 | c450bb73f59a |
permissions | -rw-r--r-- |
130 | 1 |
/* |
2 |
Copyright 2017 Ollivier Robert |
|
3 |
Copyright 2017 Mikael Berthe |
|
4 |
||
5 |
Licensed under the MIT license. Please see the LICENSE file is this directory. |
|
6 |
*/ |
|
7 |
||
7 | 8 |
package gondole |
9 |
||
21
555716349f64
Move App stuff into app.go.
Ollivier Robert <roberto@keltia.net>
parents:
13
diff
changeset
|
10 |
import ( |
83
adc39ae774c0
Make it work with non-defaut instances
Mikael Berthe <mikael@lilotux.net>
parents:
77
diff
changeset
|
11 |
"errors" |
21
555716349f64
Move App stuff into app.go.
Ollivier Robert <roberto@keltia.net>
parents:
13
diff
changeset
|
12 |
) |
7 | 13 |
|
120 | 14 |
// apiCallParams is a map with the parameters for an API call |
15 |
type apiCallParams map[string]string |
|
16 |
||
7 | 17 |
const ( |
83
adc39ae774c0
Make it work with non-defaut instances
Mikael Berthe <mikael@lilotux.net>
parents:
77
diff
changeset
|
18 |
// GondoleVersion contains the version of the Gondole implementation |
131
68ef6504637e
Introduce RestoreApp(), bump library version
Mikael Berthe <mikael@lilotux.net>
parents:
130
diff
changeset
|
19 |
GondoleVersion = "0.1" |
12
4f58e9f1e2bc
Add APIEndpoint. Fill in Gondole variable.
Ollivier Robert <roberto@keltia.net>
parents:
7
diff
changeset
|
20 |
|
131
68ef6504637e
Introduce RestoreApp(), bump library version
Mikael Berthe <mikael@lilotux.net>
parents:
130
diff
changeset
|
21 |
// API version implemented in this library |
68ef6504637e
Introduce RestoreApp(), bump library version
Mikael Berthe <mikael@lilotux.net>
parents:
130
diff
changeset
|
22 |
apiVersion = "v1" |
68ef6504637e
Introduce RestoreApp(), bump library version
Mikael Berthe <mikael@lilotux.net>
parents:
130
diff
changeset
|
23 |
currentAPIPath = "/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
|
24 |
|
83
adc39ae774c0
Make it work with non-defaut instances
Mikael Berthe <mikael@lilotux.net>
parents:
77
diff
changeset
|
25 |
// 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
|
26 |
NoRedirect = "urn:ietf:wg:oauth:2.0:oob" |
7 | 27 |
) |
28 |
||
99
6ec2a44a1bd1
Return error rather than empty entities
Mikael Berthe <mikael@lilotux.net>
parents:
89
diff
changeset
|
29 |
// Error codes |
33
bce8b17415ae
Add new error ErrAlreadyRegistered.
Ollivier Robert <roberto@keltia.net>
parents:
26
diff
changeset
|
30 |
var ( |
99
6ec2a44a1bd1
Return error rather than empty entities
Mikael Berthe <mikael@lilotux.net>
parents:
89
diff
changeset
|
31 |
ErrAlreadyRegistered = errors.New("app already registered") |
6ec2a44a1bd1
Return error rather than empty entities
Mikael Berthe <mikael@lilotux.net>
parents:
89
diff
changeset
|
32 |
ErrEntityNotFound = errors.New("entity not found") |
104
fc338e606d37
Introduce new error message constant
Mikael Berthe <mikael@lilotux.net>
parents:
101
diff
changeset
|
33 |
ErrInvalidParameter = errors.New("incorrect parameter") |
101
16d7500c19dd
Add a generic error identifier
Mikael Berthe <mikael@lilotux.net>
parents:
99
diff
changeset
|
34 |
ErrInvalidID = errors.New("incorrect entity ID") |
33
bce8b17415ae
Add new error ErrAlreadyRegistered.
Ollivier Robert <roberto@keltia.net>
parents:
26
diff
changeset
|
35 |
) |