$56 GRAYBYTE WORDPRESS FILE MANAGER $13

SERVER : in-mum-web1330.main-hosting.eu #1 SMP Mon Feb 10 22:45:17 UTC 2025
SERVER IP : 93.127.173.121 | ADMIN IP 216.73.216.215
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/opt/go/pkg/mod/github.com/go-openapi/runtime@v0.26.0/

HOME
Current File : /opt/go/pkg/mod/github.com/go-openapi/runtime@v0.26.0//client_response.go
// Copyright 2015 go-swagger maintainers
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//    http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package runtime

import (
	"encoding/json"
	"fmt"
	"io"
)

// A ClientResponse represents a client response
// This bridges between responses obtained from different transports
type ClientResponse interface {
	Code() int
	Message() string
	GetHeader(string) string
	GetHeaders(string) []string
	Body() io.ReadCloser
}

// A ClientResponseReaderFunc turns a function into a ClientResponseReader interface implementation
type ClientResponseReaderFunc func(ClientResponse, Consumer) (interface{}, error)

// ReadResponse reads the response
func (read ClientResponseReaderFunc) ReadResponse(resp ClientResponse, consumer Consumer) (interface{}, error) {
	return read(resp, consumer)
}

// A ClientResponseReader is an interface for things want to read a response.
// An application of this is to create structs from response values
type ClientResponseReader interface {
	ReadResponse(ClientResponse, Consumer) (interface{}, error)
}

// NewAPIError creates a new API error
func NewAPIError(opName string, payload interface{}, code int) *APIError {
	return &APIError{
		OperationName: opName,
		Response:      payload,
		Code:          code,
	}
}

// APIError wraps an error model and captures the status code
type APIError struct {
	OperationName string
	Response      interface{}
	Code          int
}

func (o *APIError) Error() string {
	var resp []byte
	if err, ok := o.Response.(error); ok {
		resp = []byte("'" + err.Error() + "'")
	} else {
		resp, _ = json.Marshal(o.Response)
	}
	return fmt.Sprintf("%s (status %d): %s", o.OperationName, o.Code, resp)
}

func (o *APIError) String() string {
	return o.Error()
}

// IsSuccess returns true when this elapse o k response returns a 2xx status code
func (o *APIError) IsSuccess() bool {
	return o.Code/100 == 2
}

// IsRedirect returns true when this elapse o k response returns a 3xx status code
func (o *APIError) IsRedirect() bool {
	return o.Code/100 == 3
}

// IsClientError returns true when this elapse o k response returns a 4xx status code
func (o *APIError) IsClientError() bool {
	return o.Code/100 == 4
}

// IsServerError returns true when this elapse o k response returns a 5xx status code
func (o *APIError) IsServerError() bool {
	return o.Code/100 == 5
}

// IsCode returns true when this elapse o k response returns a 4xx status code
func (o *APIError) IsCode(code int) bool {
	return o.Code == code
}

// A ClientResponseStatus is a common interface implemented by all responses on the generated code
// You can use this to treat any client response based on status code
type ClientResponseStatus interface {
	IsSuccess() bool
	IsRedirect() bool
	IsClientError() bool
	IsServerError() bool
	IsCode(int) bool
}

Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
25 Jan 2024 4.43 PM
root / root
0755
.github
--
25 Jan 2024 4.43 PM
root / root
0555
client
--
25 Jan 2024 4.43 PM
root / root
0555
fixtures
--
25 Jan 2024 4.43 PM
root / root
0555
flagext
--
25 Jan 2024 4.43 PM
root / root
0555
hack
--
25 Jan 2024 4.43 PM
root / root
0555
internal
--
25 Jan 2024 4.43 PM
root / root
0555
logger
--
25 Jan 2024 4.43 PM
root / root
0555
middleware
--
25 Jan 2024 4.43 PM
root / root
0555
security
--
25 Jan 2024 4.43 PM
root / root
0555
yamlpc
--
25 Jan 2024 4.43 PM
root / root
0555
.editorconfig
0.526 KB
25 Jan 2024 4.43 PM
root / root
0444
.gitattributes
0.017 KB
25 Jan 2024 4.43 PM
root / root
0444
.gitignore
0.047 KB
25 Jan 2024 4.43 PM
root / root
0444
.golangci.yml
0.699 KB
25 Jan 2024 4.43 PM
root / root
0444
CODE_OF_CONDUCT.md
3.157 KB
25 Jan 2024 4.43 PM
root / root
0444
LICENSE
11.092 KB
25 Jan 2024 4.43 PM
root / root
0444
README.md
0.705 KB
25 Jan 2024 4.43 PM
root / root
0444
authinfo_test.go
1.071 KB
25 Jan 2024 4.43 PM
root / root
0444
bytestream.go
4.137 KB
25 Jan 2024 4.43 PM
root / root
0444
bytestream_test.go
6.246 KB
25 Jan 2024 4.43 PM
root / root
0444
client_auth_info.go
1.16 KB
25 Jan 2024 4.43 PM
root / root
0444
client_operation.go
1.366 KB
25 Jan 2024 4.43 PM
root / root
0444
client_request.go
3.655 KB
25 Jan 2024 4.43 PM
root / root
0444
client_request_test.go
1.113 KB
25 Jan 2024 4.43 PM
root / root
0444
client_response.go
3.201 KB
25 Jan 2024 4.43 PM
root / root
0444
client_response_test.go
2.477 KB
25 Jan 2024 4.43 PM
root / root
0444
constants.go
1.664 KB
25 Jan 2024 4.43 PM
root / root
0444
csv.go
1.865 KB
25 Jan 2024 4.43 PM
root / root
0444
csv_test.go
1.764 KB
25 Jan 2024 4.43 PM
root / root
0444
discard.go
0.329 KB
25 Jan 2024 4.43 PM
root / root
0444
file.go
0.659 KB
25 Jan 2024 4.43 PM
root / root
0444
file_test.go
0.584 KB
25 Jan 2024 4.43 PM
root / root
0444
go.mod
1.254 KB
25 Jan 2024 4.43 PM
root / root
0444
go.sum
19.355 KB
25 Jan 2024 4.43 PM
root / root
0444
headers.go
1.114 KB
25 Jan 2024 4.43 PM
root / root
0444
headers_test.go
2.018 KB
25 Jan 2024 4.43 PM
root / root
0444
interfaces.go
3.99 KB
25 Jan 2024 4.43 PM
root / root
0444
json.go
1.117 KB
25 Jan 2024 4.43 PM
root / root
0444
json_test.go
1.471 KB
25 Jan 2024 4.43 PM
root / root
0444
request.go
3.33 KB
25 Jan 2024 4.43 PM
root / root
0444
request_test.go
5.06 KB
25 Jan 2024 4.43 PM
root / root
0444
statuses.go
2.515 KB
25 Jan 2024 4.43 PM
root / root
0444
text.go
2.821 KB
25 Jan 2024 4.43 PM
root / root
0444
text_test.go
4.952 KB
25 Jan 2024 4.43 PM
root / root
0444
values.go
0.483 KB
25 Jan 2024 4.43 PM
root / root
0444
values_test.go
0.596 KB
25 Jan 2024 4.43 PM
root / root
0444
xml.go
1.038 KB
25 Jan 2024 4.43 PM
root / root
0444
xml_test.go
1.438 KB
25 Jan 2024 4.43 PM
root / root
0444

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF