mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-31 08:22:27 -05:00 
			
		
		
		
	[chore] stub /api/v1/accounts/{id}/featured_tags endpoint (#3598)
* [chore] stub /api/v1/accounts/{id}/featured_tags endpoint
* fix swagger parsing issue
---------
Co-authored-by: tobi <31960611+tsmethurst@users.noreply.github.com>
Co-authored-by: tobi <tobi.smethurst@protonmail.com>
	
	
This commit is contained in:
		
					parent
					
						
							
								23fc70f4e6
							
						
					
				
			
			
				commit
				
					
						642f5230e6
					
				
			
		
					 3 changed files with 122 additions and 0 deletions
				
			
		|  | @ -3648,6 +3648,41 @@ paths: | ||||||
|             summary: Block account with id. |             summary: Block account with id. | ||||||
|             tags: |             tags: | ||||||
|                 - accounts |                 - accounts | ||||||
|  |     /api/v1/accounts/{id}/featured_tags: | ||||||
|  |         get: | ||||||
|  |             description: 'THIS ENDPOINT IS CURRENTLY NOT FULLY IMPLEMENTED: it will always return an empty array.' | ||||||
|  |             operationId: accountsFeaturedTags | ||||||
|  |             parameters: | ||||||
|  |                 - description: The id of the account. | ||||||
|  |                   in: path | ||||||
|  |                   name: id | ||||||
|  |                   required: true | ||||||
|  |                   type: string | ||||||
|  |             produces: | ||||||
|  |                 - application/json | ||||||
|  |             responses: | ||||||
|  |                 "200": | ||||||
|  |                     description: "" | ||||||
|  |                     schema: | ||||||
|  |                         items: | ||||||
|  |                             type: object | ||||||
|  |                         type: array | ||||||
|  |                 "400": | ||||||
|  |                     description: bad request | ||||||
|  |                 "401": | ||||||
|  |                     description: unauthorized | ||||||
|  |                 "404": | ||||||
|  |                     description: not found | ||||||
|  |                 "406": | ||||||
|  |                     description: not acceptable | ||||||
|  |                 "500": | ||||||
|  |                     description: internal server error | ||||||
|  |             security: | ||||||
|  |                 - OAuth2 Bearer: | ||||||
|  |                     - read:accounts | ||||||
|  |             summary: Get an array of target account's featured tags. | ||||||
|  |             tags: | ||||||
|  |                 - accounts | ||||||
|     /api/v1/accounts/{id}/follow: |     /api/v1/accounts/{id}/follow: | ||||||
|         post: |         post: | ||||||
|             consumes: |             consumes: | ||||||
|  |  | ||||||
|  | @ -40,6 +40,7 @@ const ( | ||||||
| 
 | 
 | ||||||
| 	BlockPath         = BasePathWithID + "/block" | 	BlockPath         = BasePathWithID + "/block" | ||||||
| 	DeletePath        = BasePath + "/delete" | 	DeletePath        = BasePath + "/delete" | ||||||
|  | 	FeaturedTagsPath  = BasePathWithID + "/featured_tags" | ||||||
| 	FollowersPath     = BasePathWithID + "/followers" | 	FollowersPath     = BasePathWithID + "/followers" | ||||||
| 	FollowingPath     = BasePathWithID + "/following" | 	FollowingPath     = BasePathWithID + "/following" | ||||||
| 	FollowPath        = BasePathWithID + "/follow" | 	FollowPath        = BasePathWithID + "/follow" | ||||||
|  | @ -98,6 +99,9 @@ func (m *Module) Route(attachHandler func(method string, path string, f ...gin.H | ||||||
| 	// get account's statuses | 	// get account's statuses | ||||||
| 	attachHandler(http.MethodGet, StatusesPath, m.AccountStatusesGETHandler) | 	attachHandler(http.MethodGet, StatusesPath, m.AccountStatusesGETHandler) | ||||||
| 
 | 
 | ||||||
|  | 	// get account's featured tags | ||||||
|  | 	attachHandler(http.MethodGet, FeaturedTagsPath, m.AccountFeaturedTagsGETHandler) | ||||||
|  | 
 | ||||||
| 	// get following or followers | 	// get following or followers | ||||||
| 	attachHandler(http.MethodGet, FollowersPath, m.AccountFollowersGETHandler) | 	attachHandler(http.MethodGet, FollowersPath, m.AccountFollowersGETHandler) | ||||||
| 	attachHandler(http.MethodGet, FollowingPath, m.AccountFollowingGETHandler) | 	attachHandler(http.MethodGet, FollowingPath, m.AccountFollowingGETHandler) | ||||||
|  |  | ||||||
							
								
								
									
										83
									
								
								internal/api/client/accounts/featuredtags.go
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										83
									
								
								internal/api/client/accounts/featuredtags.go
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,83 @@ | ||||||
|  | // GoToSocial | ||||||
|  | // Copyright (C) GoToSocial Authors admin@gotosocial.org | ||||||
|  | // SPDX-License-Identifier: AGPL-3.0-or-later | ||||||
|  | // | ||||||
|  | // This program is free software: you can redistribute it and/or modify | ||||||
|  | // it under the terms of the GNU Affero General Public License as published by | ||||||
|  | // the Free Software Foundation, either version 3 of the License, or | ||||||
|  | // (at your option) any later version. | ||||||
|  | // | ||||||
|  | // This program is distributed in the hope that it will be useful, | ||||||
|  | // but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||||
|  | // GNU Affero General Public License for more details. | ||||||
|  | // | ||||||
|  | // You should have received a copy of the GNU Affero General Public License | ||||||
|  | // along with this program.  If not, see <http://www.gnu.org/licenses/>. | ||||||
|  | 
 | ||||||
|  | package accounts | ||||||
|  | 
 | ||||||
|  | import ( | ||||||
|  | 	"net/http" | ||||||
|  | 
 | ||||||
|  | 	"github.com/gin-gonic/gin" | ||||||
|  | 	apiutil "github.com/superseriousbusiness/gotosocial/internal/api/util" | ||||||
|  | 	"github.com/superseriousbusiness/gotosocial/internal/gtserror" | ||||||
|  | 	"github.com/superseriousbusiness/gotosocial/internal/oauth" | ||||||
|  | ) | ||||||
|  | 
 | ||||||
|  | // AccountFeaturedTagsGETHandler swagger:operation GET /api/v1/accounts/{id}/featured_tags accountsFeaturedTags | ||||||
|  | // | ||||||
|  | // Get an array of target account's featured tags. | ||||||
|  | // | ||||||
|  | // THIS ENDPOINT IS CURRENTLY NOT FULLY IMPLEMENTED: it will always return an empty array. | ||||||
|  | // | ||||||
|  | //	--- | ||||||
|  | //	tags: | ||||||
|  | //	- accounts | ||||||
|  | // | ||||||
|  | //	produces: | ||||||
|  | //	- application/json | ||||||
|  | // | ||||||
|  | //	parameters: | ||||||
|  | //	- | ||||||
|  | //		name: id | ||||||
|  | //		type: string | ||||||
|  | //		description: The id of the account. | ||||||
|  | //		in: path | ||||||
|  | //		required: true | ||||||
|  | // | ||||||
|  | //	security: | ||||||
|  | //	- OAuth2 Bearer: | ||||||
|  | //		- read:accounts | ||||||
|  | // | ||||||
|  | //	responses: | ||||||
|  | //		'200': | ||||||
|  | //			schema: | ||||||
|  | //				type: array | ||||||
|  | //				items: | ||||||
|  | //					type: object | ||||||
|  | //		'400': | ||||||
|  | //			description: bad request | ||||||
|  | //		'401': | ||||||
|  | //			description: unauthorized | ||||||
|  | //		'404': | ||||||
|  | //			description: not found | ||||||
|  | //		'406': | ||||||
|  | //			description: not acceptable | ||||||
|  | //		'500': | ||||||
|  | //			description: internal server error | ||||||
|  | func (m *Module) AccountFeaturedTagsGETHandler(c *gin.Context) { | ||||||
|  | 	_, err := oauth.Authed(c, true, true, true, true) | ||||||
|  | 	if err != nil { | ||||||
|  | 		apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1) | ||||||
|  | 		return | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	if _, err := apiutil.NegotiateAccept(c, apiutil.JSONAcceptHeaders...); err != nil { | ||||||
|  | 		apiutil.ErrorHandler(c, gtserror.NewErrorNotAcceptable(err, err.Error()), m.processor.InstanceGetV1) | ||||||
|  | 		return | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	apiutil.Data(c, http.StatusOK, apiutil.AppJSON, apiutil.EmptyJSONArray) | ||||||
|  | } | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue