{"modulePath":"github.com/ethersphere/bee","version":"v1.18.2","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package api\n\nPackage api provides the functionality of the Bee client-facing HTTP API.\n\nCopyright 2023 The Swarm Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.\n\n## Constants\n\n```go\nconst (\n\tSwarmPinHeader            = \"Swarm-Pin\"\n\tSwarmTagHeader            = \"Swarm-Tag\"\n\tSwarmEncryptHeader        = \"Swarm-Encrypt\"\n\tSwarmIndexDocumentHeader  = \"Swarm-Index-Document\"\n\tSwarmErrorDocumentHeader  = \"Swarm-Error-Document\"\n\tSwarmFeedIndexHeader      = \"Swarm-Feed-Index\"\n\tSwarmFeedIndexNextHeader  = \"Swarm-Feed-Index-Next\"\n\tSwarmCollectionHeader     = \"Swarm-Collection\"\n\tSwarmPostageBatchIdHeader = \"Swarm-Postage-Batch-Id\"\n\tSwarmDeferredUploadHeader = \"Swarm-Deferred-Upload\"\n\n\tImmutableHeader = \"Immutable\"\n\tGasPriceHeader  = \"Gas-Price\"\n\tGasLimitHeader  = \"Gas-Limit\"\n\tETagHeader      = \"ETag\"\n\n\tAuthorizationHeader      = \"Authorization\"\n\tAcceptEncodingHeader     = \"Accept-Encoding\"\n\tContentTypeHeader        = \"Content-Type\"\n\tContentDispositionHeader = \"Content-Disposition\"\n\tContentLengthHeader      = \"Content-Length\"\n\tRangeHeader              = \"Range\"\n\tOriginHeader             = \"Origin\"\n)\n```\n\n## Variables\n\n```go\nvar DebugVersion = \"0.0.0\"\n```\n\n```go\nvar Version = \"0.0.0\"\n```\nVersion is set in the build process.\n\n## Functions\n\n```go\nfunc CalculateNumberOfChunks(contentLength int64, isEncrypted bool) int64\n```\nCalculateNumberOfChunks calculates the number of chunks in an arbitrary content length.\n\n## Types\n\n```go\ntype BeeNodeMode uint\n```\n\n```go\nconst (\n\tUnknownMode BeeNodeMode = iota\n\tLightMode\n\tFullMode\n\tDevMode\n\tUltraLightMode\n)\n```\n\n```go\nfunc (b BeeNodeMode) String() string\n```\n\n```go\ntype BlockListedPeer struct {\n\tPeer\n\tReason   string `json:\"reason\"`\n\tDuration int    `json:\"duration\"`\n}\n```\n\n```go\ntype ChunkInclusionProof struct {\n\tProofSegments  []string     `json:\"proofSegments\"`\n\tProveSegment   string       `json:\"proveSegment\"`\n\tProofSegments2 []string     `json:\"proofSegments2\"`\n\tProveSegment2  string       `json:\"proveSegment2\"`\n\tChunkSpan      uint64       `json:\"chunkSpan\"`\n\tProofSegments3 []string     `json:\"proofSegments3\"`\n\tPostageProof   PostageProof `json:\"postageProof\"`\n\tSocProof       []SOCProof   `json:\"socProof\"`\n}\n```\nChunkInclusionProof structure must exactly match corresponding structure (of the same name) in Redistribution.sol smart contract. github.com/ethersphere/storage-incentives/blob/ph\\_f2/src/Redistribution.sol github.com/ethersphere/storage-incentives/blob/master/src/Redistribution.sol (when merged to master)\n\n```go\ntype ChunkInclusionProofs struct {\n\tA ChunkInclusionProof `json:\"proof1\"`\n\tB ChunkInclusionProof `json:\"proof2\"`\n\tC ChunkInclusionProof `json:\"proofLast\"`\n}\n```\n\n```go\ntype ExtraOptions struct {\n\tPingpong        pingpong.Interface\n\tTopologyDriver  topology.Driver\n\tLightNodes      *lightnode.Container\n\tAccounting      accounting.Interface\n\tPseudosettle    settlement.Interface\n\tSwap            swap.Interface\n\tChequebook      chequebook.Service\n\tBlockTime       time.Duration\n\tStorer          Storer\n\tResolver        resolver.Interface\n\tPss             pss.Interface\n\tFeedFactory     feeds.Factory\n\tPost            postage.Service\n\tPostageContract postagecontract.Interface\n\tStaking         staking.Contract\n\tSteward         steward.Interface\n\tSyncStatus      func() (bool, error)\n\tNodeStatus      *status.Service\n}\n```\n\n```go\ntype FileInfo struct {\n\tPath        string\n\tName        string\n\tContentType string\n\tSize        int64\n\tReader      io.Reader\n}\n```\n\n```go\ntype Options struct {\n\tCORSAllowedOrigins []string\n\tWsPingPeriod       time.Duration\n\tRestricted         bool\n}\n```\n\n```go\ntype Peer struct {\n\tAddress  swarm.Address `json:\"address\"`\n\tFullNode bool          `json:\"fullNode\"`\n}\n```\nPeer holds information about a Peer.\n\n```go\ntype PostageProof struct {\n\tSignature string `json:\"signature\"`\n\tPostageId string `json:\"postageId\"`\n\tIndex     string `json:\"index\"`\n\tTimeStamp string `json:\"timeStamp\"`\n}\n```\nSOCProof structure must exactly match corresponding structure (of the same name) in Redistribution.sol smart contract.\n\n```go\ntype Probe struct {\n\t// contains filtered or unexported fields\n}\n```\nProbe structure holds flags which indicate node healthiness (sometimes refert also as liveness) and readiness.\n\n```go\nfunc NewProbe() *Probe\n```\nNewProbe returns new Probe.\n\n```go\nfunc (p *Probe) Healthy() ProbeStatus\n```\nHealthy returns the value of the healthy status.\n\n```go\nfunc (p *Probe) Ready() ProbeStatus\n```\nReady returns the value of the ready status.\n\n```go\nfunc (p *Probe) SetHealthy(ps ProbeStatus)\n```\nSetHealthy updates the value of the healthy status.\n\n```go\nfunc (p *Probe) SetReady(ps ProbeStatus)\n```\nSetReady updates the value of the ready status.\n\n```go\ntype ProbeStatus int32\n```\nProbeStatus is the status of a probe. ProbeStatus is treated as a sync/atomic int32.\n\n```go\nconst (\n\t// ProbeStatusOK indicates positive ProbeStatus status.\n\tProbeStatusOK ProbeStatus = 1\n\n\t// ProbeStatusNOK indicates negative ProbeStatus status.\n\tProbeStatusNOK ProbeStatus = 0\n)\n```\n\n```go\nfunc (ps ProbeStatus) String() string\n```\nString implements the fmt.Stringer interface.\n\n```go\ntype RCHashResponse struct {\n\tHash     swarm.Address        `json:\"hash\"`\n\tProofs   ChunkInclusionProofs `json:\"proofs\"`\n\tDuration time.Duration        `json:\"duration\"`\n}\n```\n\n```go\ntype SOCProof struct {\n\tSigner     string `json:\"signer\"`\n\tSignature  string `json:\"signature\"`\n\tIdentifier string `json:\"identifier\"`\n\tChunkAddr  string `json:\"chunkAddr\"`\n}\n```\nSOCProof structure must exactly match corresponding structure (of the same name) in Redistribution.sol smart contract.\n\n```go\ntype Service struct {\n\tOptions\n\n\thttp.Handler\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc New(\n\tpublicKey, pssPublicKey ecdsa.PublicKey,\n\tethereumAddress common.Address,\n\tlogger log.Logger,\n\ttransaction transaction.Service,\n\tbatchStore postage.Storer,\n\tbeeMode BeeNodeMode,\n\tchequebookEnabled bool,\n\tswapEnabled bool,\n\tchainBackend transaction.Backend,\n\tcors []string,\n\tstamperStore storage.Store,\n) *Service\n```\n\n```go\nfunc (s *Service) Close() error\n```\nClose hangs up running websockets on shutdown.\n\n```go\nfunc (s *Service) Configure(signer crypto.Signer, auth auth.Authenticator, tracer *tracing.Tracer, o Options, e ExtraOptions, chainID int64, erc20 erc20.Service)\n```\nConfigure will create a and initialize a new API service.\n\n```go\nfunc (s *Service) Metrics() []prometheus.Collector\n```\n\n```go\nfunc (s *Service) MetricsRegistry() *prometheus.Registry\n```\n\n```go\nfunc (s *Service) MountAPI()\n```\n\n```go\nfunc (s *Service) MountDebug(restricted bool)\n```\n\n```go\nfunc (s *Service) MountTechnicalDebug()\n```\n\n```go\nfunc (s *Service) MustRegisterMetrics(cs ...prometheus.Collector)\n```\n\n```go\nfunc (s *Service) SetP2P(p2p p2p.DebugService)\n```\n\n```go\nfunc (s *Service) SetProbe(probe *Probe)\n```\n\n```go\nfunc (s *Service) SetRedistributionAgent(redistributionAgent *storageincentives.Agent)\n```\n\n```go\nfunc (s *Service) SetSwarmAddress(addr *swarm.Address)\n```\n\n```go\ntype Storer interface {\n\tstorer.UploadStore\n\tstorer.PinStore\n\tstorer.CacheStore\n\tstorer.NetStore\n\tstorer.LocalStore\n\tstorer.RadiusChecker\n\tstorer.Debugger\n}\n```\nStorer interface provides the functionality required from the local storage component of the node.\n\n```go\ntype UpgradedResponseWriter interface {\n\thttp.ResponseWriter\n\thttp.Pusher\n\thttp.Hijacker\n\thttp.Flusher\n\t// staticcheck SA1019 CloseNotifier interface is required by gorilla compress handler\n\t// nolint:staticcheck\n\thttp.CloseNotifier\n}\n```\nUpgradedResponseWriter adds more functionality on top of ResponseWriter\n\n","path":"github.com/ethersphere/bee/pkg/api","name":"api","synopsis":"Package api provides the functionality of the Bee client-facing HTTP API.","isRedistributable":true}
