Documentation
¶
Overview ¶
Package restapi Friends Management API definitions
Schemes: http https Host: localhost BasePath: /api/v1 Version: 0.0.1 License: Copyright 2019 SPGroup. All rights reserved. Consumes: - application/json Produces: - application/json
swagger:meta
Index ¶
Constants ¶
View Source
const AuthKey contextKey = "Auth"
Variables ¶
View Source
var ( ErrorResponseQueryParse = query.MustNewBuilder(&query.Config{Model: models.ErrorResponse{}}).ParseRequest FriendQueryParse = query.MustNewBuilder(&query.Config{Model: models.Friend{}}).ParseRequest FriendsQueryParse = query.MustNewBuilder(&query.Config{Model: models.Friends{}}).ParseRequest FriendsListResponseQueryParse = query.MustNewBuilder(&query.Config{Model: models.FriendsListResponse{}}).ParseRequest ReceiveUpdatesFriendsQueryParse = query.MustNewBuilder(&query.Config{Model: models.ReceiveUpdatesFriends{}}).ParseRequest ReceiveUpdatesFriendsResponseQueryParse = query.MustNewBuilder(&query.Config{Model: models.ReceiveUpdatesFriendsResponse{}}).ParseRequest SubscribeFriendsQueryParse = query.MustNewBuilder(&query.Config{Model: models.SubscribeFriends{}}).ParseRequest SuccessResponseQueryParse = query.MustNewBuilder(&query.Config{Model: models.SuccessResponse{}}).ParseRequest )
Query parse functions for all the models Those can be used to extract database query from the http path's query string
View Source
var ( // SwaggerJSON embedded version of the swagger document used at generation time SwaggerJSON json.RawMessage // FlatSwaggerJSON embedded flattened version of the swagger document used at generation time FlatSwaggerJSON json.RawMessage )
Functions ¶
Types ¶
type Config ¶
type Config struct { FriendsAPI Logger func(string, ...interface{}) // InnerMiddleware is for the handler executors. These do not apply to the swagger.json document. // The middleware executes after routing but before authentication, binding and validation InnerMiddleware func(http.Handler) http.Handler // Authorizer is used to authorize a request after the Auth function was called using the "Auth*" functions // and the principal was stored in the context in the "AuthKey" context value. Authorizer func(*http.Request) error }
Config is configuration for Handler
type FriendsAPI ¶
type FriendsAPI interface { // PostFriendsCommonList is 3. As a user, I need an API to retrieve the common friends list between two email addresses. PostFriendsCommonList(ctx context.Context, params friends.PostFriendsCommonListParams) middleware.Responder // PostFriendsConnections is 1. As a user, I need an API to create a friend connection between two email addresses. PostFriendsConnections(ctx context.Context, params friends.PostFriendsConnectionsParams) middleware.Responder // PostFriendsConnectionsList is 2. As a user, I need an API to retrieve the friends list for an email address. PostFriendsConnectionsList(ctx context.Context, params friends.PostFriendsConnectionsListParams) middleware.Responder // PostFriendsUpdatesBlock is 5. As a user, I need an API to block updates from an email address.</br> Suppose andy@example.com blocks john@example.com:</br> <ul> <li>if they are connected as friends, then andy will no longer receive notifications from john</li> <li>if they are not connected as friends, then no new friends connection can be added</li> </ul> PostFriendsUpdatesBlock(ctx context.Context, params friends.PostFriendsUpdatesBlockParams) middleware.Responder // PostFriendsUpdatesList is 6. As a user, I need an API to retrieve all email addresses that can receive updates from an email address.</br> Eligibility for receiving updates from i.e. john@example.com</br> <ul> <li>has not blocked updates from john@example.com, and</li> <li>at least one of the following:</li> <ul> <li>has a friend connection with john@example.com</li> <li>has subscribed to updates from john@example.com</li> <li>has been @mentioned in the update</li> </ul> </ul> PostFriendsUpdatesList(ctx context.Context, params friends.PostFriendsUpdatesListParams) middleware.Responder // PostFriendsUpdatesSubscribe is 4. As a user, I need an API to subscribe to updates from an email address.</br> Please note that subscribing to updates is NOT equivalent to adding a friend connection PostFriendsUpdatesSubscribe(ctx context.Context, params friends.PostFriendsUpdatesSubscribeParams) middleware.Responder }
FriendsAPI
Source Files
¶
Click to show internal directories.
Click to hide internal directories.