diff options
Diffstat (limited to 'internal/api')
| -rw-r--r-- | internal/api/client/notifications/notifications.go | 10 | ||||
| -rw-r--r-- | internal/api/client/notifications/notificationsget.go | 63 | 
2 files changed, 36 insertions, 37 deletions
diff --git a/internal/api/client/notifications/notifications.go b/internal/api/client/notifications/notifications.go index 52b06f385..8e0890461 100644 --- a/internal/api/client/notifications/notifications.go +++ b/internal/api/client/notifications/notifications.go @@ -36,12 +36,10 @@ const (  	// ExcludeTypes is an array specifying notification types to exclude  	ExcludeTypesKey = "exclude_types[]" -	// MaxIDKey is the url query for setting a max notification ID to return -	MaxIDKey = "max_id" -	// LimitKey is for specifying maximum number of notifications to return. -	LimitKey = "limit" -	// SinceIDKey is for specifying the minimum notification ID to return. -	SinceIDKey = "since_id" +	MaxIDKey        = "max_id" +	LimitKey        = "limit" +	SinceIDKey      = "since_id" +	MinIDKey        = "min_id"  )  type Module struct { diff --git a/internal/api/client/notifications/notificationsget.go b/internal/api/client/notifications/notificationsget.go index adfc1bcc3..6ce8adcab 100644 --- a/internal/api/client/notifications/notificationsget.go +++ b/internal/api/client/notifications/notificationsget.go @@ -50,6 +50,29 @@ import (  //  //	parameters:  //	- +//		name: max_id +//		type: string +//		description: >- +//			Return only notifications *OLDER* than the given max notification ID. +//			The notification with the specified ID will not be included in the response. +//		in: query +//		required: false +//	- +//		name: since_id +//		type: string +//		description: >- +//			Return only notifications *newer* than the given since notification ID. +//			The notification with the specified ID will not be included in the response. +//		in: query +//	- +//		name: min_id +//		type: string +//		description: >- +//			Return only notifications *immediately newer* than the given since notification ID. +//			The notification with the specified ID will not be included in the response. +//		in: query +//		required: false +//	-  //		name: limit  //		type: integer  //		description: Number of notifications to return. @@ -64,22 +87,6 @@ import (  //			description: Array of types of notifications to exclude (follow, favourite, reblog, mention, poll, follow_request)  //		in: query  //		required: false -//	- -//		name: max_id -//		type: string -//		description: >- -//			Return only notifications *OLDER* than the given max status ID. -//			The status with the specified ID will not be included in the response. -//		in: query -//		required: false -//	- -//		name: since_id -//		type: string -//		description: |- -//			Return only notifications *NEWER* than the given since status ID. -//			The status with the specified ID will not be included in the response. -//		in: query -//		required: false  //  //	security:  //	- OAuth2 Bearer: @@ -131,21 +138,15 @@ func (m *Module) NotificationsGETHandler(c *gin.Context) {  		limit = int(i)  	} -	maxID := "" -	maxIDString := c.Query(MaxIDKey) -	if maxIDString != "" { -		maxID = maxIDString -	} - -	sinceID := "" -	sinceIDString := c.Query(SinceIDKey) -	if sinceIDString != "" { -		sinceID = sinceIDString -	} - -	excludeTypes := c.QueryArray(ExcludeTypesKey) - -	resp, errWithCode := m.processor.NotificationsGet(c.Request.Context(), authed, excludeTypes, limit, maxID, sinceID) +	resp, errWithCode := m.processor.NotificationsGet( +		c.Request.Context(), +		authed, +		c.Query(MaxIDKey), +		c.Query(SinceIDKey), +		c.Query(MinIDKey), +		limit, +		c.QueryArray(ExcludeTypesKey), +	)  	if errWithCode != nil {  		apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)  		return  | 
