forgejo/services/federation/result.go
Michael Jerger 388e4eb44b fix: assorted ActivityPub code only refactors (#8708)
Fix parts of issue #8221 and part of PR #4767

Is linked to https://codeberg.org/forgejo/forgejo/pulls/8274

The commit 555f6e57ad fixes timeout forgejo/forgejo#8274 (Kommentar)

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8708
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Michael Jerger <michael.jerger@meissa-gmbh.de>
Co-committed-by: Michael Jerger <michael.jerger@meissa-gmbh.de>
2025-07-28 15:17:29 +02:00

35 lines
860 B
Go

// Copyright 2025 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package federation
import "github.com/go-ap/activitypub"
type ServiceResult struct {
HTTPStatus int
Bytes []byte
Activity activitypub.Activity
withBytes bool
withActivity bool
statusOnly bool
}
func NewServiceResultStatusOnly(status int) ServiceResult {
return ServiceResult{HTTPStatus: status, statusOnly: true}
}
func NewServiceResultWithBytes(status int, bytes []byte) ServiceResult {
return ServiceResult{HTTPStatus: status, Bytes: bytes, withBytes: true}
}
func (serviceResult ServiceResult) WithBytes() bool {
return serviceResult.withBytes
}
func (serviceResult ServiceResult) WithActivity() bool {
return serviceResult.withActivity
}
func (serviceResult ServiceResult) StatusOnly() bool {
return serviceResult.statusOnly
}