Commit Graph

37 Commits

Author SHA1 Message Date
Adrien Marquès 822ef823e9
migrate: symbols import paths to github 2021-06-20 21:29:46 +02:00
Adrien Marquès af63c4514b
refactor: idiomatic remove of api.Context for context.Context, custom middlewares for standard http middlewares
continuous-integration/drone/push Build is passing Details
- remove api.Context as using context.Context is more idiomatic
 - remove api.Adapter as it is redundant with func(http.Handler) http.Handler
 - remove authentication middlewares as they be achieved as normal middlewares but launched around the handler (after the service has been found and validated)
 - builder.With() adds an standard Middleware that runs before any aicra code
 - builder.WithContext() adds an http middleware that runs just before the service handler is called. The http.Request provided contains a context with useful values such as the required permissions (from the service configuration).
 - handlers take a context.Context variable as first argument instead of api.Context
2021-06-20 02:14:31 +02:00
Adrien Marquès ed404106f2
refactor: rename api.Ctx to api.Context, extends context.Context with helper methods 2021-06-20 00:46:42 +02:00
Adrien Marquès fa1ecfd97f
feat: create internal context.Context custom keys 2021-06-20 00:46:04 +02:00
Adrien Marquès 214e2348aa Merge pull request 'feature: authentication middlewares' (#20) from feature/expose-scope into 0.3.0
continuous-integration/drone/push Build is passing Details
Reviewed-on: #20
2021-05-18 13:57:56 +00:00
xdrm-brackets 3bb02fcbb7
fix: remove error status from json
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
2021-05-18 11:10:12 +02:00
xdrm-brackets 4f55302e8a
feat: add WithAuth() to builder using api.AuthAdapter interface 2021-05-18 09:36:33 +02:00
xdrm-brackets 18d809c4ca
feat: create api.Auth wrapping authorization management 2021-05-18 09:34:01 +02:00
Adrien Marquès 939ab2e57d fixup: expose api context fields 2021-04-18 19:31:40 +02:00
Adrien Marquès f334d19ef4 feat: add api context type 2021-04-18 18:14:30 +02:00
Adrien Marquès 87c15b91e5 feat: add middleware (Adapter) type 2021-04-18 16:49:24 +02:00
Adrien Marquès 6039fbb41f
update: api.Err system
- rename 'Error' to 'Err'
 - use struct instead of int as underlying type ; remove dependency on 2 maps for reason and HTTP status codes
 - remove useless json implementation
2021-03-28 18:49:23 +02:00
Adrien Marquès 3c453e7f89
remove api useless request, update default errors and bind status codes to errors
continuous-integration/drone/push Build is passing Details
2020-04-04 16:03:50 +02:00
Adrien Marquès 60ef4717a8
clarity: aicra server request management 2020-04-04 12:05:17 +02:00
Adrien Marquès eb690cf862
add api errors for storage 2020-04-04 10:10:24 +02:00
Adrien Marquès 00e2a96c79
fix: ErrNoMatchFound error 2020-03-29 16:22:32 +02:00
Adrien Marquès e7dd1e7a56
migrate handler from api to aicra; check for service when setting handler 2020-03-29 15:04:12 +02:00
Adrien Marquès af09466013
migrate api.response to const errors; make HandlerFn return an api.Error; rename http HandlFunc to Handle;
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
2020-03-28 14:57:28 +01:00
Adrien Marquès 5504e4b3ec
make api errors int; allow for const defaults 2020-03-28 14:51:49 +01:00
Adrien Marquès 3a258400c0
remove api useless errors : UnkonwnMethod and UncallableMethod 2020-03-21 14:19:35 +01:00
Adrien Marquès 9475fe4526
use private errors do avoid overlapping types among packages 2020-03-21 14:19:14 +01:00
Adrien Marquès 8c539370aa
remove cerr 2020-03-16 12:53:48 +01:00
Adrien Marquès acdba4121b
rename ambiguous variable
continuous-integration/drone/push Build is passing Details
2020-03-09 19:12:26 +01:00
Adrien Marquès bafaad97e6 clean: request param now uses internal const error 'cerr' 2019-05-05 19:01:54 +02:00
Adrien Marquès a83d077569 feat: add builtin types [int, uint] | fix request param getters | add request param getters [GetFloat, GetInt, GetUint, GetStrings] with permissive possible types and 'automatic' conversion 2019-05-05 19:01:54 +02:00
Adrien Marquès 189d3b40a6 fix: semantic (comments) renaming : 'controller' to 'service', more explicit names 2019-05-05 19:01:54 +02:00
Adrien Marquès 6afedf190f ref 1: clean server.go code + response implements http.Handler + add generic getter on request params Get() (interface{},error) 2019-05-05 19:01:54 +02:00
Adrien Marquès 0912e07f4f fix: pass error arguments as values not array + set header after
WriteHeader()
2019-05-05 19:01:54 +02:00
Adrien Marquès 7a87288876 fix: rename 'WrapError' to 'SetError' + shadow response error + response implements Error() 2019-05-05 19:01:54 +02:00
Adrien Marquès 1e4476ced5 feat: rename 'Error.Put' to 'SetArguments' with n >= 1 arguments + move 'WrapError' to response 2019-05-05 19:01:54 +02:00
Adrien Marquès b9ca1801bd fix: rename 'NewError' to 'WrapError' 2019-05-05 19:01:54 +02:00
Adrien Marquès b9f240b86b feat: fix error creation to bind arguments directly + add optional error argument in NewResponse() 2019-05-05 19:01:54 +02:00
Adrien Marquès 4e25c647b2 feat: add status code in response 2019-05-01 16:40:26 +02:00
Adrien Marquès 98ae854251 feat: add scope to request 2019-05-01 15:56:18 +02:00
Adrien Marquès cd2bcdd8bc ref 0: first working version ; totest 2019-05-01 15:14:49 +02:00
Adrien Marquès 7e66b6ddd5 ref 0: big refactor of concerns between api request, server, etc 2019-05-01 13:44:45 +02:00
Adrien Marquès 049400e2be rename 'response' to 'api' 2018-10-07 11:23:00 +02:00