mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-09-30 19:22:08 +00:00
36 lines
860 B
Go
36 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
|
||
|
}
|