Documentation ¶
Index ¶
- Constants
- type ApiApUser
- type ApiAspect
- func (a ApiAspect) Create() revel.Result
- func (a ApiAspect) CreatePerson() revel.Result
- func (a ApiAspect) Delete() revel.Result
- func (a ApiAspect) DeletePerson() revel.Result
- func (a ApiAspect) Index(fields string) revel.Result
- func (a ApiAspect) Show() revel.Result
- func (a ApiAspect) ShowPerson() revel.Result
- type ApiComment
- type ApiError
- type ApiHelper
- type ApiLike
- type ApiNotification
- type ApiOAuth
- type ApiPeople
- type ApiPost
- type ApiProfile
- type ApiSearch
- type ApiUserStream
- type TokenResult
- type TokenString
Constants ¶
View Source
const ( TAG = "APILogger" // error messages ERR_EMPTY_STRING = "String is empty" ERR_GRANT_TYPE = "Grant type not supported" ERR_PASSWORD = "Password did not match" ERR_UNAUTHORIZED = "You are not authenticated" ERR_SERVER = "Internal server error" ERR_USER_NOT_FOUND = "User not found" ERR_POST_NOT_FOUND = "Post not found" ERR_BAD_REQUEST = "Bad request" ERR_NOT_FOUND = "Not found" ERR_NOT_IMPLEMENTED = "Not implemented" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApiApUser ¶
type ApiApUser struct {
ApiHelper
}
*
- @apiDefine ActivityPub ActivityPub related API calls *
- Fetch ActivityStream objects (see https://www.w3.org/TR/activitystreams-core)
func (ApiApUser) Actor ¶
*
- @api {get} /ap/user/:username/actor Display actor information
- @apiName ApiApUser.Actor
- @apiGroup ActivityPub *
- @apiParam {String} username The name associated with the user account *
- @apiSuccess {String} context Activitystreams context
- @apiSuccess {String} id Link to actor profile
- @apiSuccess {String} type Object type e.g. Person
- @apiSuccess {String} inbox Link to user inbox
- @apiSuccess {String} outbox Link to user outbox *
- @apiSuccessExample {json} Success-Response
- HTTP/1.1 200 OK
- {
- "@context": [
- "https://www.w3.org/ns/activitystreams"
- ],
- "id": "http://localhost/api/v0/ap/user/g1/actor",
- "type": "Person",
- "inbox": "http://localhost/api/v0/ap/user/g1/inbox",
- "outbox": "http://localhost/api/v0/ap/user/g1/outbox",
- "following": "http://localhost/api/v0/ap/user/g1/following",
- "followers": "http://localhost/api/v0/ap/user/g1/followers",
- "preferredUsername": "g1",
- "url": "http://localhost/profiles/48e5074b9cada4d58e585f2394b6a4b1",
- "publicKey": {
- "id": "http://localhost/api/v0/ap/user/g1/actor#main-key",
- "owner": "http://localhost/api/v0/ap/user/g1/actor",
- "publicKeyPem": "-----BEGIN PUBLIC KEY-----\n[...]\n-----END PUBLIC KEY-----\n"
- },
- "icon": {
- "url": "http://localhost/public/img/avatar.png"
- },
- "endpoints": {
- "sharedInbox": "http://localhost/api/v0/ap/inbox"
- }
- } *
- @apiError (Errors) {String} error Contains the recent error message *
- @apiErrorExample {json} NotFound
- HTTP/1.1 404 Not Found
- {
- "error": "[...]"
- } *
func (ApiApUser) Followers ¶
*
- @api {get} /ap/user/:username/followers User follower statistics
- @apiName ApiApUser.Followers
- @apiGroup ActivityPub *
- @apiParam {String} username The name associated with the user account *
- @apiSuccessExample {json} Success-Response
- HTTP/1.1 200 OK
- {
- "@context": [
- "https://www.w3.org/ns/activitystreams"
- ],
- "id": "http://localhost/api/v0/ap/user/g1/outbox",
- "type": "OrderedCollection",
- "totalItems": 1,
- "first": "http://localhost/api/v0/ap/user/g1/followers?page=1"
- } *
- @apiError (Errors) {String} error Contains the recent error message *
- @apiErrorExample {json} NotFound
- HTTP/1.1 404 Not Found
- {
- "error": "[...]"
- } *
func (ApiApUser) Following ¶
*
- @api {get} /ap/user/:username/following User following statistics
- @apiName ApiApUser.Following
- @apiGroup ActivityPub *
- @apiParam {String} username The name associated with the user account *
- @apiSuccessExample {json} Success-Response
- HTTP/1.1 200 OK
- {
- "@context": [
- "https://www.w3.org/ns/activitystreams"
- ],
- "id": "http://localhost/api/v0/ap/user/g1/outbox",
- "type": "OrderedCollection",
- "totalItems": 1,
- "first": "http://localhost/api/v0/ap/user/g1/following?page=1"
- } *
- @apiError (Errors) {String} error Contains the recent error message *
- @apiErrorExample {json} NotFound
- HTTP/1.1 404 Not Found
- {
- "error": "[...]"
- } *
func (ApiApUser) Inbox ¶
*
- @api {post} /ap/user/:username/inbox User inbox
- @apiName ApiApUser.Inbox
- @apiGroup ActivityPub *
- @apiParam {String} username The name associated with the user account *
- @apiSuccessExample {json} Success-Response
- HTTP/1.1 200 OK
- {
- "@context": [
- "https://www.w3.org/ns/activitystreams"
- ],
- "id": "http://localhost/api/v0/ap/user/g1/outbox",
- "type": "OrderedCollection",
- "totalItems": 1,
- "first": "http://localhost/api/v0/ap/user/g1/outbox?page=1"
- } *
- @apiError (Errors) {String} error Contains the recent error message *
- @apiErrorExample {json} ServerError
- HTTP/1.1 500 Internal Server Error
- {
- "error": "[...]"
- } *
func (ApiApUser) Outbox ¶
*
- @api {get} /ap/user/:username/outbox User outbox
- @apiName ApiApUser.Outbox
- @apiGroup ActivityPub *
- @apiParam {String} username The name associated with the user account *
- @apiSuccessExample {json} Success-Response
- HTTP/1.1 200 OK
- {
- "@context": [
- "https://www.w3.org/ns/activitystreams"
- ],
- "id": "http://localhost/api/v0/ap/user/g1/outbox",
- "type": "OrderedCollection",
- "totalItems": 1,
- "first": "http://localhost/api/v0/ap/user/g1/outbox?page=1"
- } *
- @apiError (Errors) {String} error Contains the recent error message *
- @apiErrorExample {json} ServerError
- HTTP/1.1 500 Internal Server Error
- {
- "error": "[...]"
- } *
type ApiAspect ¶
type ApiAspect struct { *revel.Controller ApiHelper }
*
- @apiDefine Aspects Aspects endpoint *
- Viewing, creating and deleting Aspect structures
func (ApiAspect) Create ¶
*
- @api {post} /aspects Create new aspect
- @apiName ApiAspect.Create
- @apiGroup Aspects *
- @apiParam {String} aspect_name Aspect name
- @apiParam {String} access_token Oauth access token *
- @apiSuccess {String} CreatedAt Timestamp of creation
- @apiSuccess {String} UpdatedAt Timestamp of last replacment
- @apiSuccess {String} Guid Unique global ID
- @apiSuccess {Number} ID Unique database ID
- @apiSuccess {String} Name Aspect name
- @apiSuccess {Number} UserID User database ID
- @apiSuccess {Boolean} Default Default aspect
- @apiSuccess {Array} Memberships Aspect memberships *
- @apiSuccessExample {json} Success-Response
- HTTP/1.1 200 OK
- {
- "ID": 1,
- "CreatedAt": "2017-12-20T00:02:10Z",
- "UpdatedAt": "2017-12-20T00:02:10Z",
- "Name": "Friends",
- "UserID": 1,
- "Default": false,
- "Memberships": [...]
- } *
- @apiError (Errors) {String} error Contains the recent error message *
- @apiErrorExample {json} Unauthorized
- HTTP/1.1 401 Unauthorized
- {
- "error": "[...]"
- } *
- @apiErrorExample {json} BadRequest
- HTTP/1.1 400 Bad Request
- {
- "error": "[...]"
- } *
- @apiErrorExample {json} ServerError
- HTTP/1.1 500 Internal Server Error
- {
- "error": "[...]"
- } *
func (ApiAspect) CreatePerson ¶
*
- @api {post} /people/:id/aspects/:aspect_id Add person to aspect
- @apiName ApiAspect.CreatePerson
- @apiGroup Aspects *
- @apiParam {Number} id Person database ID
- @apiParam {Number} aspect_id Aspect database ID
- @apiParam {String} access_token Oauth access token *
- @apiSuccess {String} CreatedAt Timestamp of creation
- @apiSuccess {String} UpdatedAt Timestamp of last replacment
- @apiSuccess {Number} ID Unique database ID
- @apiSuccess {Number} AspectID Aspect database ID
- @apiSuccess {Number} PersonID Person database ID *
- @apiSuccessExample {json} Success-Response
- HTTP/1.1 200 OK
- [
- {
- "ID": 1,
- "CreatedAt": "2017-12-20T00:02:10Z",
- "UpdatedAt": "2017-12-20T00:02:10Z",
- "AspectID": 1,
- "PersonID": 1
- }
- ] *
- @apiError (Errors) {String} error Contains the recent error message *
- @apiErrorExample {json} Unauthorized
- HTTP/1.1 401 Unauthorized
- {
- "error": "[...]"
- } *
- @apiErrorExample {json} NotFound
- HTTP/1.1 404 Not Found
- {
- "error": "[...]"
- } *
- @apiErrorExample {json} ServerError
- HTTP/1.1 500 Internal Server Error
- {
- "error": "[...]"
- } *
func (ApiAspect) DeletePerson ¶
*
- @api {delete} /people/:id/aspects/:aspect_id Delete person from aspect
- @apiName ApiAspect.DeletePerson
- @apiGroup Aspects *
- @apiParam {Number} id Person database ID
- @apiParam {Number} aspect_id Aspect database ID
- @apiParam {String} access_token Oauth access token *
- @apiSuccess {String} CreatedAt Timestamp of creation
- @apiSuccess {String} UpdatedAt Timestamp of last replacment
- @apiSuccess {Number} ID Unique database ID
- @apiSuccess {Number} AspectID Aspect database ID
- @apiSuccess {Number} PersonID Person database ID *
- @apiSuccessExample {json} Success-Response
- HTTP/1.1 200 OK
- [
- {
- "ID": 1,
- "CreatedAt": "2017-12-20T00:02:10Z",
- "UpdatedAt": "2017-12-20T00:02:10Z",
- "AspectID": 1,
- "PersonID": 1
- }
- ] *
- @apiError (Errors) {String} error Contains the recent error message *
- @apiErrorExample {json} Unauthorized
- HTTP/1.1 401 Unauthorized
- {
- "error": "[...]"
- } *
- @apiErrorExample {json} NotFound
- HTTP/1.1 404 Not Found
- {
- "error": "[...]"
- } *
- @apiErrorExample {json} ServerError
- HTTP/1.1 500 Internal Server Error
- {
- "error": "[...]"
- } *
func (ApiAspect) Index ¶
*
- @api {get} /aspects Fetch user aspect list
- @apiName ApiAspect.Index
- @apiGroup Aspects *
- @apiParam {String} [fields] Display only specific fields, e.g. fields=ID,Person(ID:Profile(ID:ImageUrl)) *
- @apiSuccess {String} CreatedAt Timestamp of creation
- @apiSuccess {String} UpdatedAt Timestamp of last replacment
- @apiSuccess {String} Guid Unique global ID
- @apiSuccess {Number} ID Unique database ID
- @apiSuccess {String} Name Aspect name
- @apiSuccess {Number} UserID User database ID
- @apiSuccess {Boolean} Default Default aspect
- @apiSuccess {Array} Memberships Aspect memberships *
- @apiSuccessExample {json} Success-Response
- HTTP/1.1 200 OK
- { "0": {
- "ID": 1,
- "CreatedAt": "2017-12-20T00:02:10Z",
- "UpdatedAt": "2017-12-20T00:02:10Z",
- "Name": "Friends",
- "UserID": 1,
- "Default": false,
- "Memberships": [...] }
- } *
- @apiError (Errors) {String} error Contains the recent error message *
- @apiErrorExample {json} Unauthorized
- HTTP/1.1 401 Unauthorized
- {
- "error": "[...]"
- } *
func (ApiAspect) ShowPerson ¶
*
- @api {get} /people/:id/aspects Display aspects which Person is included in
- @apiName ApiAspect.ShowPerson
- @apiGroup Aspects *
- @apiParam {Number} id Person database ID
- @apiParam {String} access_token Oauth access token *
- @apiSuccess {String} CreatedAt Timestamp of creation
- @apiSuccess {String} UpdatedAt Timestamp of last replacment
- @apiSuccess {String} Guid Unique global ID
- @apiSuccess {Number} ID Unique database ID
- @apiSuccess {String} Name Aspect name
- @apiSuccess {Number} UserID User database ID
- @apiSuccess {Boolean} Default Default aspect
- @apiSuccess {Array} Memberships Aspect memberships *
- @apiSuccessExample {json} Success-Response
- HTTP/1.1 200 OK
- [
- {
- "ID": 1,
- "CreatedAt": "2017-12-20T00:02:10Z",
- "UpdatedAt": "2017-12-20T00:02:10Z",
- "Name": "Friends",
- "UserID": 1,
- "Default": false,
- "Memberships": [...]
- }
- ] *
- @apiError (Errors) {String} error Contains the recent error message *
- @apiErrorExample {json} Unauthorized
- HTTP/1.1 401 Unauthorized
- {
- "error": "[...]"
- } *
- @apiErrorExample {json} NotFound
- HTTP/1.1 404 Not Found
- {
- "error": "[...]"
- } *
type ApiComment ¶
type ApiComment struct { *revel.Controller ApiHelper }
*
- @apiDefine Comments Comments endpoint *
- Viewing, creating and deleting Comment structures
func (ApiComment) CreatePost ¶
func (c ApiComment) CreatePost() revel.Result
*
- @api {post} /posts/:id/comments Create comment on post
- @apiName ApiComment.CreatePost
- @apiGroup Comments *
- @apiParam {Number} id Post database ID
- @apiParam {String} comment Status message
- @apiParam {String} [fields] Display only specific fields, e.g. fields=ID,Person(ID:Profile(ID:ImageUrl))
- @apiParam {String} access_token Oauth access token *
- @apiError (Errors) {String} error Contains the recent error message *
- @apiErrorExample {json} Unauthorized
- HTTP/1.1 401 Unauthorized
- {
- "error": "[...]"
- } *
- @apiErrorExample {json} NotFound
- HTTP/1.1 404 Not Found
- {
- "error": "[...]"
- } *
- @apiErrorExample {json} BadRequest
- HTTP/1.1 400 Bad Request
- {
- "error": "[...]"
- } *
func (ApiComment) Delete ¶
func (c ApiComment) Delete(guid string) revel.Result
*
- @api {delete} /comments/:guid Delete a comment
- @apiName ApiComment.Delete
- @apiGroup Comments *
- @apiParam {String} access_token Oauth access token
- @apiParam {String} guid Unique global ID *
- @apiSuccessExample {json} Success-Response
- HTTP/1.1 200 OK
- {} *
- @apiError (Errors) {String} error Contains the recent error message *
- @apiErrorExample {json} BadRequest
- HTTP/1.1 400 BadRequest
- {
- "error": "[...]"
- } *
- @apiErrorExample {json} Unauthorized
- HTTP/1.1 401 Unauthorized
- {
- "error": "[...]"
- } *
- @apiErrorExample {json} NotFound
- HTTP/1.1 404 Not Found
- {
- "error": "[...]"
- } *
func (ApiComment) IndexPost ¶
func (c ApiComment) IndexPost() revel.Result
*
- @api {get} /posts/:id/comments Display comments related to post
- @apiName ApiComment.IndexPost
- @apiGroup Comments *
- @apiParam {Number} id Post database ID
- @apiParam {String} access_token Oauth access token *
- @apiSuccess {String} CreatedAt Timestamp of creation
- @apiSuccess {String} UpdatedAt Timestamp of last replacment
- @apiSuccess {String} Guid Unique global ID
- @apiSuccess {Number} ID Unique database ID
- @apiSuccess {String} Text Status message
- @apiSuccess {Number} ShareableID Post database ID
- @apiSuccess {Number} PersonID Person database ID
- @apiSuccess {String} ShareableType Shareable type e.g. Post, Comment
- @apiSuccess {Hash} CommentSignature Signature
- @apiSuccess {Hash} Person Person structure *
- @apiSuccessExample {json} Success-Response
- HTTP/1.1 200 OK
- [
- {
- "ID": 12,
- "CreatedAt": "2018-01-08T15:25:43Z",
- "UpdatedAt": "2018-01-08T15:25:43Z",
- "Text": "hi",
- "ShareableID": 20,
- "PersonID": 1,
- "Guid": "cc783a9749f09c7d817a1707a4c052bc",
- "LikesCount": 0,
- "ShareableType": "Post",
- [...]
- }
- ] *
- @apiError (Errors) {String} error Contains the recent error message *
- @apiErrorExample {json} Unauthorized
- HTTP/1.1 401 Unauthorized
- {
- "error": "[...]"
- } *
- @apiErrorExample {json} NotFound
- HTTP/1.1 404 Not Found
- {
- "error": "[...]"
- } *
func (ApiComment) Show ¶
func (c ApiComment) Show() revel.Result
* * @api {get} /comments/:id Display a specific comment
- @apiName ApiComment.Show
- @apiGroup Comments *
- @apiParam {Number} id Comment database ID
- @apiParam {String} access_token Oauth access token
- @apiParam {String} [fields] Display only specific fields, e.g. fields=ID,Person(ID:Profile(ID:ImageUrl)) *
- @apiSuccess {String} CreatedAt Timestamp of creation
- @apiSuccess {String} UpdatedAt Timestamp of last replacment
- @apiSuccess {String} Guid Unique global ID
- @apiSuccess {Number} ID Unique database ID
- @apiSuccess {String} Text Status message
- @apiSuccess {Number} ShareableID Post database ID
- @apiSuccess {Number} PersonID Person database ID
- @apiSuccess {String} ShareableType Shareable type e.g. Post, Comment
- @apiSuccess {Hash} CommentSignature Signature
- @apiSuccess {Hash} Person Person structure *
- @apiSuccessExample {json} Success-Response
- HTTP/1.1 200 OK
- {
- "ID": 12,
- "CreatedAt": "2018-01-08T15:25:43Z",
- "UpdatedAt": "2018-01-08T15:25:43Z",
- "Text": "hi",
- "ShareableID": 20,
- "PersonID": 1,
- "Guid": "cc783a9749f09c7d817a1707a4c052bc",
- "LikesCount": 0,
- "ShareableType": "Post",
- [...]
- } *
- @apiError (Errors) {String} error Contains the recent error message *
- @apiErrorExample {json} Unauthorized
- HTTP/1.1 401 Unauthorized
- {
- "error": "[...]"
- } *
- @apiErrorExample {json} NotFound
- HTTP/1.1 404 Not Found
- {
- "error": "[...]"
- } *
type ApiHelper ¶
type ApiHelper struct { *revel.Controller CurrentUser models.User }
func (ApiHelper) RenderJSONLD ¶
type ApiLike ¶
type ApiLike struct { *revel.Controller ApiHelper }
*
- @apiDefine Likes Likes endpoint *
- Viewing, creating and deleting Like structures
func (ApiLike) Create ¶
*
- @api {post} /posts/:id/likes Create a like
- @apiName ApiLike.Create
- @apiGroup Likes *
- @apiParam {Number} id Post database ID
- @apiParam {Boolean} positive Like or dis-like
- @apiParam {String} access_token Oauth access token *
- @apiSuccess {String} CreatedAt Timestamp of creation
- @apiSuccess {String} UpdatedAt Timestamp of last replacment
- @apiSuccess {String} Guid Unique global ID
- @apiSuccess {Number} ID Unique database ID
- @apiSuccess {Boolean} Positive Like or dis-like
- @apiSuccess {Number} TargetID Post database ID
- @apiSuccess {Number} PersonID Person database ID
- @apiSuccess {String} AuthorSignature Signature
- @apiSuccess {String} TargetType Entity type e.g. Post, Comment
- @apiSuccess {Hash} Signature Signature structure *
- @apiSuccessExample {json} Success-Response
- HTTP/1.1 200 OK
- {
- "ID": 12,
- "CreatedAt": "2018-01-08T15:25:43Z",
- "UpdatedAt": "2018-01-08T15:25:43Z",
- "TargetID": 20,
- "PersonID": 1,
- "Positive": true,
- "Guid": "cc783a9749f09c7d817a1707a4c052bc",
- "TargetType": "Post",
- [...]
- } *
- @apiError (Errors) {String} error Contains the recent error message *
- @apiErrorExample {json} Unauthorized
- HTTP/1.1 401 Unauthorized
- {
- "error": "[...]"
- } *
- @apiErrorExample {json} NotFound
- HTTP/1.1 404 Not Found
- {
- "error": "[...]"
- } *
- @apiErrorExample {json} ServerError
- HTTP/1.1 500 Internal Server Error
- {
- "error": "[...]"
- } *
func (ApiLike) Delete ¶
*
- @api {delete} /likes/:guid Delete a like
- @apiName ApiLike.Delete
- @apiGroup Likes *
- @apiParam {String} access_token Oauth access token
- @apiParam {String} guid Unique global ID *
- @apiSuccessExample {json} Success-Response
- HTTP/1.1 200 OK
- {} *
- @apiError (Errors) {String} error Contains the recent error message *
- @apiErrorExample {json} BadRequest
- HTTP/1.1 400 BadRequest
- {
- "error": "[...]"
- } *
- @apiErrorExample {json} Unauthorized
- HTTP/1.1 401 Unauthorized
- {
- "error": "[...]"
- } *
- @apiErrorExample {json} NotFound
- HTTP/1.1 404 Not Found
- {
- "error": "[...]"
- } *
func (ApiLike) Index ¶
*
- @api {get} /posts/:id/likes Display likes related to post
- @apiName ApiLike.Index
- @apiGroup Likes *
- @apiParam {Number} id Post database ID
- @apiParam {String} access_token Oauth access token *
- @apiSuccess {String} CreatedAt Timestamp of creation
- @apiSuccess {String} UpdatedAt Timestamp of last replacment
- @apiSuccess {String} Guid Unique global ID
- @apiSuccess {Number} ID Unique database ID
- @apiSuccess {Boolean} Positive Like or dis-like
- @apiSuccess {Number} TargetID Post database ID
- @apiSuccess {Number} PersonID Person database ID
- @apiSuccess {String} AuthorSignature Signature
- @apiSuccess {String} TargetType Entity type e.g. Post, Comment
- @apiSuccess {Hash} Signature Signature structure *
- @apiSuccessExample {json} Success-Response
- HTTP/1.1 200 OK
- [
- {
- "ID": 12,
- "CreatedAt": "2018-01-08T15:25:43Z",
- "UpdatedAt": "2018-01-08T15:25:43Z",
- "TargetID": 20,
- "PersonID": 1,
- "Positive": true,
- "Guid": "cc783a9749f09c7d817a1707a4c052bc",
- "TargetType": "Post",
- [...]
- }
- ] *
- @apiError (Errors) {String} error Contains the recent error message *
- @apiErrorExample {json} Unauthorized
- HTTP/1.1 401 Unauthorized
- {
- "error": "[...]"
- } *
- @apiErrorExample {json} NotFound
- HTTP/1.1 404 Not Found
- {
- "error": "[...]"
- } *
type ApiNotification ¶
type ApiNotification struct { *revel.Controller ApiHelper }
*
- @apiDefine Notifications Notifications endpoint *
- Viewing, creating and deleting Notification structures
func (ApiNotification) Create ¶
func (n ApiNotification) Create() revel.Result
func (ApiNotification) Index ¶
func (n ApiNotification) Index(fields string, offset int) revel.Result
*
- @api {get} /notifications Display notifications
- @apiName ApiNotification.Index
- @apiGroup Notifications *
- @apiParam {String} access_token Oauth access token
- @apiParam {String} [fields] Display only specific fields, e.g. fields=ID,Person(ID:Profile(ID:ImageUrl))
- @apiParam {Number} [offset] Post offset for database *
- @apiSuccess {String} CreatedAt Timestamp of creation
- @apiSuccess {String} UpdatedAt Timestamp of last replacment
- @apiSuccess {Number} ID Unique database ID
- @apiSuccess {Boolean} Unread If the notification is un-read
- @apiSuccess {String} TargetGuid Entity global ID
- @apiSuccess {String} TargetType Entity type e.g. Post, Comment
- @apiSuccess {Number} PersonID Person database ID
- @apiSuccess {Number} UserID User database ID *
- @apiSuccessExample {json} Success-Response
- HTTP/1.1 200 OK
- {
- "0": {
- "ID": 12,
- "CreatedAt": "2018-01-08T15:25:43Z",
- "UpdatedAt": "2018-01-08T15:25:43Z",
- "TargetGuid": "cc783a9749f09c7d817a1707a4c052bc",
- "PersonID": 1,
- "UserID": 2,
- "Unread": true,
- "TargetType": "Post"
- }
- } *
- @apiError (Errors) {String} error Contains the recent error message *
- @apiErrorExample {json} Unauthorized
- HTTP/1.1 401 Unauthorized
- {
- "error": "[...]"
- } *
- @apiErrorExample {json} NotFound
- HTTP/1.1 404 Not Found
- {
- "error": "[...]"
- } *
func (ApiNotification) Show ¶
func (n ApiNotification) Show() revel.Result
func (ApiNotification) Update ¶
func (n ApiNotification) Update(id uint) revel.Result
* * @api {put} /notifications/:id Set notification read
- @apiName ApiNotification.Update
- @apiGroup Notifications *
- @apiParam {Number} id Notification database ID
- @apiParam {String} access_token Oauth access token *
- @apiSuccess {String} CreatedAt Timestamp of creation
- @apiSuccess {String} UpdatedAt Timestamp of last replacment
- @apiSuccess {Number} ID Unique database ID
- @apiSuccess {Boolean} Unread If the notification is un-read
- @apiSuccess {String} TargetGuid Entity global ID
- @apiSuccess {String} TargetType Entity type e.g. Post, Comment
- @apiSuccess {Number} PersonID Person database ID
- @apiSuccess {Number} UserID User database ID *
- @apiSuccessExample {json} Success-Response
- HTTP/1.1 200 OK
- {
- "ID": 12,
- "CreatedAt": "2018-01-08T15:25:43Z",
- "UpdatedAt": "2018-01-08T15:25:43Z",
- "TargetGuid": "cc783a9749f09c7d817a1707a4c052bc",
- "PersonID": 1,
- "UserID": 2,
- "Unread": false,
- "TargetType": "Post"
- } *
- @apiError (Errors) {String} error Contains the recent error message *
- @apiErrorExample {json} Unauthorized
- HTTP/1.1 401 Unauthorized
- {
- "error": "[...]"
- } *
- @apiErrorExample {json} ServerError
- HTTP/1.1 500 Internal Server Error
- {
- "error": "[...]"
- } *
type ApiOAuth ¶
type ApiOAuth struct { *revel.Controller ApiHelper }
*
- @apiDefine Oauth Oauth endpoint *
- Create and delete oauth tokens *
- ## Authentication Process Example *
- If you want to access API features you will have to register your application first: *
- ```
- curl -X POST -d "grant_type=password&username=ganggo&password=s3cr3t&client_id=MyAwesomeAppID" https://<your-server>/api/v0/oauth/tokens
- ``` *
- This will return an access token which you should include in your HTTP header (access_token=[...]) for future API calls: *
- ```
- curl -H "access_token: 0987654312" -X GET https://<your-server>/api/v0/posts
- ``` *
func (ApiOAuth) Create ¶
*
- @api {post} /oauth/tokens Create/Fetch token
- @apiName ApiOAuth.Create
- @apiGroup Oauth *
- @apiParam {String} grant_type Grant type
- @apiParam {String} username Username
- @apiParam {String} password Password
- @apiParam {String} client_id Client name e.g. android_appXYZ *
- @apiSuccess {String} token Access token *
- @apiSuccessExample {json} Success-Response
- HTTP/1.1 200 OK
- {
- "token": "5b5d5b4f7044e3444db73504e8b08be8"
- } *
- @apiError (Errors) {String} error Contains the recent error message *
- @apiErrorExample {json} NotFound
- HTTP/1.1 404 Not Found
- {
- "error": "[...]"
- } *
- @apiErrorExample {json} BadRequest
- HTTP/1.1 400 Bad Request
- {
- "error": "[...]"
- } *
- @apiErrorExample {json} ServerError
- HTTP/1.1 500 Internal Server Error
- {
- "error": "[...]"
- } *
func (ApiOAuth) Delete ¶
* * @api {delete} /oauth/tokens/:id Delete token
- @apiName ApiOAuth.Delete
- @apiGroup Oauth *
- @apiParam {Number} id Token database ID *
- @apiSuccess {String} token Access token *
- @apiSuccessExample {json} Success-Response
- HTTP/1.1 200 OK
- {} *
- @apiError (Errors) {String} error Contains the recent error message *
- @apiErrorExample {json} Unauthorized
- HTTP/1.1 401 Unauthorized
- {
- "error": "[...]"
- } *
- @apiErrorExample {json} ServerError
- HTTP/1.1 500 Internal Server Error
- {
- "error": "[...]"
- } *
type ApiPeople ¶
type ApiPeople struct { *revel.Controller ApiHelper }
*
- @apiDefine People People endpoint *
- Viewing, creating and deleting Person structures
func (ApiPeople) Show ¶
*
- @api {get} /people/:id Display a specific person
- @apiName ApiPeople.Show
- @apiGroup People *
- @apiParam {String} id Person database ID
- @apiParam {String} access_token Oauth access token *
- @apiSuccess {String} CreatedAt Timestamp of creation
- @apiSuccess {String} UpdatedAt Timestamp of last replacment
- @apiSuccess {Number} ID Unique database ID
- @apiSuccess {String} Guid Person global ID
- @apiSuccess {String} Author Handle with TLD
- @apiSuccess {String} SerializedPublicKey Public key
- @apiSuccess {Number} UserID User database ID (null if not a local user) *
- @apiSuccessExample {json} Success-Response
- HTTP/1.1 200 OK
- {
- "ID": 12,
- "CreatedAt": "2018-01-08T15:25:43Z",
- "UpdatedAt": "2018-01-08T15:25:43Z",
- "Guid": "cc783a9749f09c7d817a1707a4c052bc",
- "Author": "test@localhost",
- "SerializedPublicKey": "[...]",
- "UserID": 1,
- } *
- @apiError (Errors) {String} error Contains the recent error message *
- @apiErrorExample {json} NotFound
- HTTP/1.1 404 Not Found
- {
- "error": "[...]"
- } *
type ApiPost ¶
type ApiPost struct { *revel.Controller ApiHelper }
*
- @apiDefine Posts Posts endpoint *
- Viewing, creating and deleting Post structures
func (ApiPost) Create ¶
*
- @api {post} /posts Create a new post
- @apiName ApiPost.Create
- @apiGroup Posts *
- @apiParam {String} access_token Oauth access token
- @apiParam {String} aspectID=0 Needs an aspectID if you want to post privately
- @apiParam {String} post The actual post message
- @apiParam {String} [fields] Display only specific fields, e.g. fields=ID,Person(ID:Profile(ID:ImageUrl)) *
- @apiSuccess {Array} Comments Comments related to the post
- @apiSuccess {String} CreatedAt Timestamp of creation
- @apiSuccess {String} Guid Unique global ID
- @apiSuccess {Number} ID Unique database ID
- @apiSuccess {Hash} Person Author of post
- @apiSuccess {Number} PersonID Author database ID
- @apiSuccess {String} ProviderName Provider
- @apiSuccess {Boolean} Public Is it a public or private post
- @apiSuccess {String} Text Post content
- @apiSuccess {String} Type Entity type e.g. StatusMessage
- @apiSuccess {String} UpdatedAt Timestamp of last replacment *
- @apiSuccessExample {json} Success-Response
- HTTP/1.1 200 OK
- {
- "Guid": "5b5d5b4f7044e3444db73504e8b08be8",
- "ID": 20,
- "Text": "hi whats up?\r\n\r\n"
- } *
- @apiError (Errors) {String} error Contains the recent error message *
- @apiErrorExample {json} BadRequest
- HTTP/1.1 400 Bad Request
- {
- "error": "[...]"
- } *
- @apiErrorExample {json} Unauthorized
- HTTP/1.1 401 Unauthorized
- {
- "error": "[...]"
- } *
- @apiErrorExample {json} ServerError
- HTTP/1.1 500 Internal Server Error
- {
- "error": "[...]"
- } *
func (ApiPost) Delete ¶
*
- @api {delete} /posts/:guid Delete post/reshare
- @apiName ApiPost.Delete
- @apiGroup Posts *
- @apiParam {String} access_token Oauth access token
- @apiParam {String} guid Unique global ID *
- @apiSuccessExample {json} Success-Response
- HTTP/1.1 200 OK
- {} *
- @apiError (Errors) {String} error Contains the recent error message *
- @apiErrorExample {json} BadRequest
- HTTP/1.1 400 BadRequest
- {
- "error": "[...]"
- } *
- @apiErrorExample {json} Unauthorized
- HTTP/1.1 401 Unauthorized
- {
- "error": "[...]"
- } *
- @apiErrorExample {json} NotFound
- HTTP/1.1 404 Not Found
- {
- "error": "[...]"
- } *
func (ApiPost) Index ¶
*
- @api {get} /posts Fetch all posts
- @apiName ApiPost.Index
- @apiGroup Posts *
- @apiParam {String} access_token Oauth access token
- @apiParam {Number} [offset] Post offset for database
- @apiParam {String} [fields] Display only specific fields, e.g. fields=ID,Person(ID:Profile(ID:ImageUrl))
- @apiParam {Number} [visibility] 0 = all posts, 1 = public posts, 2 private posts *
- @apiSuccess {Array} Comments Comments related to the post
- @apiSuccess {String} CreatedAt Timestamp of creation
- @apiSuccess {String} Guid Unique global ID
- @apiSuccess {Number} ID Unique database ID
- @apiSuccess {Hash} Person Author of post
- @apiSuccess {Number} PersonID Author database ID
- @apiSuccess {String} ProviderName Provider
- @apiSuccess {Boolean} Public Is it a public or private post
- @apiSuccess {String} Text Post content
- @apiSuccess {String} Type Entity type e.g. StatusMessage
- @apiSuccess {String} UpdatedAt Timestamp of last replacment *
- @apiSuccessExample {json} Success-Response
- HTTP/1.1 200 OK
- {
- "0": {
- "Guid": "5b5d5b4f7044e3444db73504e8b08be8",
- "ID": 20,
- "Text": "hi whats up?\r\n\r\n"
- }
- } *
- @apiError (Errors) {String} error Contains the recent error message *
- @apiErrorExample {json} Unauthorized
- HTTP/1.1 401 Unauthorized
- {
- "error": "[...]"
- } *
- @apiErrorExample {json} NotFound
- HTTP/1.1 404 Not Found
- {
- "error": "[...]"
- } *
func (ApiPost) Reshare ¶
*
- @api {post} /posts/:guid/reshare Reshare a post
- @apiName ApiPost.Reshare
- @apiGroup Posts *
- @apiParam {String} access_token Oauth access token
- @apiParam {String} guid Unique global ID *
- @apiSuccessExample {json} Success-Response
- HTTP/1.1 200 OK
- {} *
- @apiError (Errors) {String} error Contains the recent error message *
- @apiErrorExample {json} BadRequest
- HTTP/1.1 400 BadRequest
- {
- "error": "[...]"
- } *
- @apiErrorExample {json} Unauthorized
- HTTP/1.1 401 Unauthorized
- {
- "error": "[...]"
- } *
- @apiErrorExample {json} NotFound
- HTTP/1.1 404 Not Found
- {
- "error": "[...]"
- } *
- @apiErrorExample {json} ServerError
- HTTP/1.1 500 Internal Server Error
- {
- "error": "[...]"
- } *
func (ApiPost) Show ¶
*
- @api {post} /posts/:guid Fetch a specific post
- @apiName ApiPost.Show
- @apiGroup Posts *
- @apiParam {String} access_token Oauth access token
- @apiParam {String} guid Unique global ID
- @apiParam {String} [fields] Display only specific fields, e.g. fields=ID,Person(ID:Profile(ID:ImageUrl)) *
- @apiSuccess {Array} Comments Comments related to the post
- @apiSuccess {String} CreatedAt Timestamp of creation
- @apiSuccess {String} Guid Unique global ID
- @apiSuccess {Number} ID Unique database ID
- @apiSuccess {Hash} Person Author of post
- @apiSuccess {Number} PersonID Author database ID
- @apiSuccess {String} ProviderName Provider
- @apiSuccess {Boolean} Public Is it a public or private post
- @apiSuccess {String} Text Post content
- @apiSuccess {String} Type Entity type e.g. StatusMessage
- @apiSuccess {String} UpdatedAt Timestamp of last replacment *
- @apiSuccessExample {json} Success-Response
- HTTP/1.1 200 OK
- {
- "Guid": "5b5d5b4f7044e3444db73504e8b08be8",
- "ID": 20,
- "Text": "hi whats up?\r\n\r\n"
- } *
- @apiError (Errors) {String} error Contains the recent error message *
- @apiErrorExample {json} Unauthorized
- HTTP/1.1 401 Unauthorized
- {
- "error": "[...]"
- } *
- @apiErrorExample {json} NotFound
- HTTP/1.1 404 Not Found
- {
- "error": "[...]"
- } *
type ApiProfile ¶
type ApiProfile struct { *revel.Controller ApiHelper }
*
- @apiDefine Profiles Profiles endpoint *
- Viewing, creating and deleting Profile structures
func (ApiProfile) Create ¶
func (p ApiProfile) Create() revel.Result
func (ApiProfile) Delete ¶
func (p ApiProfile) Delete() revel.Result
func (ApiProfile) Show ¶
func (p ApiProfile) Show() revel.Result
*
- @api {get} /people/:id/profile Fetch person profile
- @apiName ApiProfile.Show
- @apiGroup Profiles *
- @apiParam {Number} id Person database ID
- @apiParam {String} access_token Oauth access token *
- @apiSuccess {Number} ID Unique database ID
- @apiSuccess {String} CreatedAt Timestamp of creation
- @apiSuccess {String} UpdatedAt Timestamp of last replacment
- @apiSuccess {String} Author Username with TLD
- @apiSuccess {String} FirstName First name
- @apiSuccess {String} LastName Last name
- @apiSuccess {String} ImageUrl Image URL
- @apiSuccess {String} ImageUrlSmall Image URL
- @apiSuccess {String} ImageUrlMedium Image URL
- @apiSuccess {String} Birthday Date
- @apiSuccess {String} Gender Male, Female, Attack Helicopter
- @apiSuccess {String} Bio Biographie
- @apiSuccess {Boolean} Searchable Hide the profile from searches
- @apiSuccess {Number} PersonID Author database ID
- @apiSuccess {String} Location
- @apiSuccess {String} FullName First and last name
- @apiSuccess {Boolean} Nsfw NSFW user account *
- @apiSuccessExample {json} Success-Response
- HTTP/1.1 200 OK
- {
- "ID": 2,
- "CreatedAt": "2017-12-20T00:02:05Z",
- "UpdatedAt": "2017-12-20T00:02:05Z",
- "Author": "diaspora@localhost:3000",
- "FirstName": "",
- "LastName": "",
- "ImageUrl": "[...]",
- "ImageUrlSmall": "[...]",
- "ImageUrlMedium": "[...]",
- "Birthday": "0001-01-01T00:00:00Z",
- "Gender": "",
- "Bio": "",
- "Searchable": true,
- "PersonID": 2,
- "Location": "",
- "FullName": "",
- "Nsfw":false
- } *
- @apiError (Errors) {String} error Contains the recent error message *
- @apiErrorExample {json} NotFound
- HTTP/1.1 404 Not Found
- {
- "error": "[...]"
- } *
type ApiSearch ¶
type ApiSearch struct { *revel.Controller ApiHelper }
*
- @apiDefine Search Search endpoint *
- Discover new people in the network
func (ApiSearch) Create ¶
*
- @api {post} /search Discover a new person
- @apiName ApiSearch.Create
- @apiGroup Search *
- @apiParam {String} handle Person network handle
- @apiParam {String} access_token Oauth access token *
- @apiSuccess {String} CreatedAt Timestamp of creation
- @apiSuccess {String} UpdatedAt Timestamp of last replacment
- @apiSuccess {Number} ID Unique database ID
- @apiSuccess {String} Guid Person global ID
- @apiSuccess {String} Author Handle with TLD
- @apiSuccess {String} SerializedPublicKey Public key
- @apiSuccess {Number} UserID User database ID (null if not a local user) *
- @apiSuccessExample {json} Success-Response
- HTTP/1.1 200 OK
- {
- "ID": 12,
- "CreatedAt": "2018-01-08T15:25:43Z",
- "UpdatedAt": "2018-01-08T15:25:43Z",
- "Guid": "cc783a9749f09c7d817a1707a4c052bc",
- "Author": "test@localhost",
- "SerializedPublicKey": "[...]",
- "UserID": 1,
- } *
- @apiError (Errors) {String} error Contains the recent error message *
- @apiErrorExample {json} NotFound
- HTTP/1.1 404 Not Found
- {
- "error": "[...]"
- } *
type ApiUserStream ¶
type ApiUserStream struct {
ApiHelper
}
*
- @apiDefine UserStreams UserStreams endpoint *
- Viewing, creating and deleting UserStream structures
func (ApiUserStream) Create ¶
func (s ApiUserStream) Create(name, tags, people, expression string) revel.Result
*
- @api {post} /users/streams Create a new user stream
- @apiName ApiUserStream.Create
- @apiGroup UserStreams *
- @apiParam {String} access_token Oauth access token
- @apiParam {String} name The name of stream
- @apiParam {String} [tags] Tags separated by ","
- @apiParam {String} [people] Author handle (e.g. lukas@sechat.org) separated by ","
- @apiParam {String} [expression] Regular expression *
- @apiSuccess {Number} UserID User database identifier
- @apiSuccess {String} Name User stream name
- @apiSuccess {String} Tags Tags separated by ","
- @apiSuccess {String} People People separated by ","
- @apiSuccess {String} Expression Regular Expression *
- @apiSuccessExample {json} Success-Response
- HTTP/1.1 200 OK
- {
- "UserID": 1,
- "Name": "Test",
- "Tags": "linux,software,opensource",
- "People": "lukas@sechat.org,hq@ggg.social",
- "Expression": "ganggo|socialhome"
- } *
- @apiError (Errors) {String} error Contains the recent error message *
- @apiErrorExample {json} BadRequest
- HTTP/1.1 400 Bad Request
- {
- "error": "[...]"
- } *
- @apiErrorExample {json} Unauthorized
- HTTP/1.1 401 Unauthorized
- {
- "error": "[...]"
- } *
- @apiErrorExample {json} ServerError
- HTTP/1.1 500 Internal Server Error
- {
- "error": "[...]"
- } *
func (ApiUserStream) Delete ¶
func (s ApiUserStream) Delete(id uint) revel.Result
*
- @api {delete} /users/streams/:id Delete a user stream
- @apiName ApiUserStream.Delete
- @apiGroup UserStreams *
- @apiParam {String} access_token Oauth access token
- @apiParam {Number} id The database identifier for the struct *
- @apiSuccessExample {json} Success-Response
- HTTP/1.1 200 OK
- {} *
- @apiError (Errors) {String} error Contains the recent error message *
- @apiErrorExample {json} BadRequest
- HTTP/1.1 400 Bad Request
- {
- "error": "[...]"
- } *
- @apiErrorExample {json} Unauthorized
- HTTP/1.1 401 Unauthorized
- {
- "error": "[...]"
- } *
func (ApiUserStream) ShowPersonStream ¶
func (s ApiUserStream) ShowPersonStream(guid, fields string, offset uint) revel.Result
*
- @api {get} /people/:guid/stream Fetch person stream
- @apiName ApiUserStream.ShowPersonStream
- @apiGroup UserStreams *
- @apiParam {String} guid Unique global or database ID
- @apiParam {Number} [offset] Post offset for database
- @apiParam {String} [fields] Display only specific fields, e.g. fields=ID,Person(ID:Profile(ID:ImageUrl)). This will only work on standard format!
- @apiParam {String} [format] On default we will use the standard GangGo output but for compatibility reasons you can choose format "diaspora" as well *
- @apiSuccessExample {json} Success-Response (format=default)
- HTTP/1.1 200 OK
- {
- "0": {
- "Guid": "5b5d5b4f7044e3444db73504e8b08be8",
- "ID": 20,
- "Text": "hi whats up?\r\n\r\n",
- [...]
- }
- } *
- @apiSuccessExample {json} Success-Response (format=diaspora)
- HTTP/1.1 200 OK
- [
- {
- "public": true,
- "guid": "abe68905a61297a686d675796d6b5169",
- "author": {
- "id": 1,
- "guid": "bb9e7958aa201ffbd47852fe83e1a1fa"
- },
- "post_type": "StatusMessage",
- "text": "a public post",
- "provider_display_name": "GangGo",
- "created_at": "2018-02-03T23:47:35.168488+01:00"
- }
- ] *
- @apiError (Errors) {String} error Contains the recent error message *
- @apiErrorExample {json} Unauthorized
- HTTP/1.1 401 Unauthorized
- {
- "error": "[...]"
- } *
- @apiErrorExample {json} NotFound
- HTTP/1.1 404 Not Found
- {
- "error": "[...]"
- } *
- @apiErrorExample {json} ServerError
- HTTP/1.1 500 Internal Server Error
- {
- "error": "[...]"
- } *
type TokenResult ¶
type TokenResult struct { Token TokenString `json:"token,omitempty"` Error TokenString `json:"error,omitempty"` }
type TokenString ¶
type TokenString string
otherwise omitempty will not work it checks on interface nil value
Click to show internal directories.
Click to hide internal directories.