283 lines
7.2 KiB
Go
283 lines
7.2 KiB
Go
// Code generated by go-swagger; DO NOT EDIT.
|
|
|
|
package organization
|
|
|
|
// This file was generated by the swagger tool.
|
|
// Editing this file might prove futile when you re-run the swagger generate command
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
"fmt"
|
|
"io"
|
|
"strconv"
|
|
|
|
"github.com/go-openapi/errors"
|
|
"github.com/go-openapi/runtime"
|
|
"github.com/go-openapi/strfmt"
|
|
"github.com/go-openapi/swag"
|
|
|
|
"src.opensuse.org/autogits/common/gitea-generated/models"
|
|
)
|
|
|
|
// TeamSearchReader is a Reader for the TeamSearch structure.
|
|
type TeamSearchReader struct {
|
|
formats strfmt.Registry
|
|
}
|
|
|
|
// ReadResponse reads a server response into the received o.
|
|
func (o *TeamSearchReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
|
switch response.Code() {
|
|
case 200:
|
|
result := NewTeamSearchOK()
|
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
|
return nil, err
|
|
}
|
|
return result, nil
|
|
case 404:
|
|
result := NewTeamSearchNotFound()
|
|
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
|
return nil, err
|
|
}
|
|
return nil, result
|
|
default:
|
|
return nil, runtime.NewAPIError("[GET /orgs/{org}/teams/search] teamSearch", response, response.Code())
|
|
}
|
|
}
|
|
|
|
// NewTeamSearchOK creates a TeamSearchOK with default headers values
|
|
func NewTeamSearchOK() *TeamSearchOK {
|
|
return &TeamSearchOK{}
|
|
}
|
|
|
|
/*
|
|
TeamSearchOK describes a response with status code 200, with default header values.
|
|
|
|
SearchResults of a successful search
|
|
*/
|
|
type TeamSearchOK struct {
|
|
Payload *TeamSearchOKBody
|
|
}
|
|
|
|
// IsSuccess returns true when this team search o k response has a 2xx status code
|
|
func (o *TeamSearchOK) IsSuccess() bool {
|
|
return true
|
|
}
|
|
|
|
// IsRedirect returns true when this team search o k response has a 3xx status code
|
|
func (o *TeamSearchOK) IsRedirect() bool {
|
|
return false
|
|
}
|
|
|
|
// IsClientError returns true when this team search o k response has a 4xx status code
|
|
func (o *TeamSearchOK) IsClientError() bool {
|
|
return false
|
|
}
|
|
|
|
// IsServerError returns true when this team search o k response has a 5xx status code
|
|
func (o *TeamSearchOK) IsServerError() bool {
|
|
return false
|
|
}
|
|
|
|
// IsCode returns true when this team search o k response a status code equal to that given
|
|
func (o *TeamSearchOK) IsCode(code int) bool {
|
|
return code == 200
|
|
}
|
|
|
|
// Code gets the status code for the team search o k response
|
|
func (o *TeamSearchOK) Code() int {
|
|
return 200
|
|
}
|
|
|
|
func (o *TeamSearchOK) Error() string {
|
|
payload, _ := json.Marshal(o.Payload)
|
|
return fmt.Sprintf("[GET /orgs/{org}/teams/search][%d] teamSearchOK %s", 200, payload)
|
|
}
|
|
|
|
func (o *TeamSearchOK) String() string {
|
|
payload, _ := json.Marshal(o.Payload)
|
|
return fmt.Sprintf("[GET /orgs/{org}/teams/search][%d] teamSearchOK %s", 200, payload)
|
|
}
|
|
|
|
func (o *TeamSearchOK) GetPayload() *TeamSearchOKBody {
|
|
return o.Payload
|
|
}
|
|
|
|
func (o *TeamSearchOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
|
|
|
o.Payload = new(TeamSearchOKBody)
|
|
|
|
// response payload
|
|
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// NewTeamSearchNotFound creates a TeamSearchNotFound with default headers values
|
|
func NewTeamSearchNotFound() *TeamSearchNotFound {
|
|
return &TeamSearchNotFound{}
|
|
}
|
|
|
|
/*
|
|
TeamSearchNotFound describes a response with status code 404, with default header values.
|
|
|
|
APINotFound is a not found empty response
|
|
*/
|
|
type TeamSearchNotFound struct {
|
|
}
|
|
|
|
// IsSuccess returns true when this team search not found response has a 2xx status code
|
|
func (o *TeamSearchNotFound) IsSuccess() bool {
|
|
return false
|
|
}
|
|
|
|
// IsRedirect returns true when this team search not found response has a 3xx status code
|
|
func (o *TeamSearchNotFound) IsRedirect() bool {
|
|
return false
|
|
}
|
|
|
|
// IsClientError returns true when this team search not found response has a 4xx status code
|
|
func (o *TeamSearchNotFound) IsClientError() bool {
|
|
return true
|
|
}
|
|
|
|
// IsServerError returns true when this team search not found response has a 5xx status code
|
|
func (o *TeamSearchNotFound) IsServerError() bool {
|
|
return false
|
|
}
|
|
|
|
// IsCode returns true when this team search not found response a status code equal to that given
|
|
func (o *TeamSearchNotFound) IsCode(code int) bool {
|
|
return code == 404
|
|
}
|
|
|
|
// Code gets the status code for the team search not found response
|
|
func (o *TeamSearchNotFound) Code() int {
|
|
return 404
|
|
}
|
|
|
|
func (o *TeamSearchNotFound) Error() string {
|
|
return fmt.Sprintf("[GET /orgs/{org}/teams/search][%d] teamSearchNotFound", 404)
|
|
}
|
|
|
|
func (o *TeamSearchNotFound) String() string {
|
|
return fmt.Sprintf("[GET /orgs/{org}/teams/search][%d] teamSearchNotFound", 404)
|
|
}
|
|
|
|
func (o *TeamSearchNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
|
|
|
return nil
|
|
}
|
|
|
|
/*
|
|
TeamSearchOKBody team search o k body
|
|
swagger:model TeamSearchOKBody
|
|
*/
|
|
type TeamSearchOKBody struct {
|
|
|
|
// data
|
|
Data []*models.Team `json:"data"`
|
|
|
|
// ok
|
|
Ok bool `json:"ok,omitempty"`
|
|
}
|
|
|
|
// Validate validates this team search o k body
|
|
func (o *TeamSearchOKBody) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := o.validateData(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (o *TeamSearchOKBody) validateData(formats strfmt.Registry) error {
|
|
if swag.IsZero(o.Data) { // not required
|
|
return nil
|
|
}
|
|
|
|
for i := 0; i < len(o.Data); i++ {
|
|
if swag.IsZero(o.Data[i]) { // not required
|
|
continue
|
|
}
|
|
|
|
if o.Data[i] != nil {
|
|
if err := o.Data[i].Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("teamSearchOK" + "." + "data" + "." + strconv.Itoa(i))
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("teamSearchOK" + "." + "data" + "." + strconv.Itoa(i))
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// ContextValidate validate this team search o k body based on the context it is used
|
|
func (o *TeamSearchOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := o.contextValidateData(ctx, formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (o *TeamSearchOKBody) contextValidateData(ctx context.Context, formats strfmt.Registry) error {
|
|
|
|
for i := 0; i < len(o.Data); i++ {
|
|
|
|
if o.Data[i] != nil {
|
|
|
|
if swag.IsZero(o.Data[i]) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := o.Data[i].ContextValidate(ctx, formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("teamSearchOK" + "." + "data" + "." + strconv.Itoa(i))
|
|
} else if ce, ok := err.(*errors.CompositeError); ok {
|
|
return ce.ValidateName("teamSearchOK" + "." + "data" + "." + strconv.Itoa(i))
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (o *TeamSearchOKBody) MarshalBinary() ([]byte, error) {
|
|
if o == nil {
|
|
return nil, nil
|
|
}
|
|
return swag.WriteJSON(o)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (o *TeamSearchOKBody) UnmarshalBinary(b []byte) error {
|
|
var res TeamSearchOKBody
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*o = res
|
|
return nil
|
|
}
|