// WriteToRequest writes these params to a swagger request
func (o *GetMatchingEntitiesParams) WriteToRequest(r client.Request, reg strfmt.Registry) error {

	var res []error

	// query param includeOrgs
	if err := r.SetQueryParam("includeOrgs", swag.FormatBool(o.IncludeOrgs)); err != nil {
		return err
	}

	// query param includeTeams
	if err := r.SetQueryParam("includeTeams", swag.FormatBool(o.IncludeTeams)); err != nil {
		return err
	}

	// query param namespace
	if err := r.SetQueryParam("namespace", o.Namespace); err != nil {
		return err
	}

	// path param prefix
	if err := r.SetPathParam("prefix", o.Prefix); err != nil {
		return err
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
// WriteToRequest writes these params to a swagger request
func (o *GetOrgRobotsParams) WriteToRequest(r client.Request, reg strfmt.Registry) error {

	var res []error

	// path param orgname
	if err := r.SetPathParam("orgname", o.Orgname); err != nil {
		return err
	}

	if o.Permissions != nil {

		// query param permissions
		var qrPermissions bool
		if o.Permissions != nil {
			qrPermissions = *o.Permissions
		}
		qPermissions := swag.FormatBool(qrPermissions)
		if qPermissions != "" {
			if err := r.SetQueryParam("permissions", qPermissions); err != nil {
				return err
			}
		}

	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
// WriteToRequest writes these params to a swagger request
func (o *UploadTaskFileParams) WriteToRequest(r client.Request, reg strfmt.Registry) error {

	var res []error

	// form param description
	frDescription := o.Description
	fDescription := frDescription
	if fDescription != "" {
		if err := r.SetFormParam("description", fDescription); err != nil {
			return err
		}
	}

	if o.File != nil {
		// form file param file
		if err := r.SetFileParam("file", o.File); err != nil {
			return err
		}
	}

	// path param id
	if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil {
		return err
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
// WriteToRequest writes these params to a swagger request
func (o *ListTagImagesParams) WriteToRequest(r client.Request, reg strfmt.Registry) error {

	var res []error

	if o.Owned != nil {

		// query param owned
		var qrOwned bool
		if o.Owned != nil {
			qrOwned = *o.Owned
		}
		qOwned := swag.FormatBool(qrOwned)
		if qOwned != "" {
			if err := r.SetQueryParam("owned", qOwned); err != nil {
				return err
			}
		}

	}

	// path param repository
	if err := r.SetPathParam("repository", o.Repository); err != nil {
		return err
	}

	// path param tag
	if err := r.SetPathParam("tag", o.Tag); err != nil {
		return err
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
// WriteToRequest writes these params to a swagger request
// API: GET /api/social/tweet/public_tweets
func (o *TweetsListParams) WriteToRequest(r client.Request, reg strfmt.Registry) error {
	// path param name
	if err := r.SetPathParam("social/tweet", "public_tweets"); err != nil {
		return err
	}
	if err := r.SetQueryParam("sort", o.Sort); err != nil {
		return err
	}
	if o.LastId > 0 {
		if err := r.SetQueryParam("last_id",
			fmt.Sprintf("%d", o.LastId)); err != nil {
			return err
		}
	}
	if o.DefaultLikeCount > 0 {
		if err := r.SetQueryParam("default_like_count",
			fmt.Sprintf("%d", o.DefaultLikeCount)); err != nil {
			return err
		}
	}
	if err := r.SetQueryParam("filter",
		strconv.FormatBool(o.Filter)); err != nil {
		return err
	}
	return nil
}
// WriteToRequest writes these params to a swagger request
func (o *GetTaskCommentsParams) WriteToRequest(r client.Request, reg strfmt.Registry) error {

	var res []error

	// path param id
	if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil {
		return err
	}

	// query param pageSize
	qrPageSize := o.PageSize
	qPageSize := swag.FormatInt32(qrPageSize)
	if qPageSize != "" {
		if err := r.SetQueryParam("pageSize", qPageSize); err != nil {
			return err
		}
	}

	// query param since
	qrSince := o.Since
	qSince := qrSince.String()
	if qSince != "" {
		if err := r.SetQueryParam("since", qSince); err != nil {
			return err
		}
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
// WriteToRequest writes these params to a swagger request
func (o *ListTriggerRecentBuildsParams) WriteToRequest(r client.Request, reg strfmt.Registry) error {

	var res []error

	if o.Limit != nil {

		// query param limit
		var qrLimit int64
		if o.Limit != nil {
			qrLimit = *o.Limit
		}
		qLimit := swag.FormatInt64(qrLimit)
		if qLimit != "" {
			if err := r.SetQueryParam("limit", qLimit); err != nil {
				return err
			}
		}

	}

	// path param repository
	if err := r.SetPathParam("repository", o.Repository); err != nil {
		return err
	}

	// path param trigger_uuid
	if err := r.SetPathParam("trigger_uuid", o.TriggerUUID); err != nil {
		return err
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
// WriteToRequest writes these params to a swagger request
func (o *ManuallyStartBuildTriggerParams) WriteToRequest(r client.Request, reg strfmt.Registry) error {

	var res []error

	if o.Body == nil {
		o.Body = new(models.RunParameters)
	}

	if err := r.SetBodyParam(o.Body); err != nil {
		return err
	}

	// path param repository
	if err := r.SetPathParam("repository", o.Repository); err != nil {
		return err
	}

	// path param trigger_uuid
	if err := r.SetPathParam("trigger_uuid", o.TriggerUUID); err != nil {
		return err
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
// WriteToRequest writes these params to a swagger request
func (o *UpdateOrganizationApplicationParams) WriteToRequest(r client.Request, reg strfmt.Registry) error {

	var res []error

	if o.Body == nil {
		o.Body = new(models.UpdateApp)
	}

	if err := r.SetBodyParam(o.Body); err != nil {
		return err
	}

	// path param client_id
	if err := r.SetPathParam("client_id", o.ClientID); err != nil {
		return err
	}

	// path param orgname
	if err := r.SetPathParam("orgname", o.Orgname); err != nil {
		return err
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
// WriteToRequest writes these params to a swagger request
func (o *ListOrgLogsParams) WriteToRequest(r client.Request, reg strfmt.Registry) error {

	var res []error

	// query param endtime
	if err := r.SetQueryParam("endtime", o.Endtime); err != nil {
		return err
	}

	// path param orgname
	if err := r.SetPathParam("orgname", o.Orgname); err != nil {
		return err
	}

	// query param page
	if err := r.SetQueryParam("page", swag.FormatInt64(o.Page)); err != nil {
		return err
	}

	// query param performer
	if err := r.SetQueryParam("performer", o.Performer); err != nil {
		return err
	}

	// query param starttime
	if err := r.SetQueryParam("starttime", o.Starttime); err != nil {
		return err
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
// WriteToRequest writes these params to a swagger request
func (o *GetRepoTagVulnerabilitiesParams) WriteToRequest(r client.Request, reg strfmt.Registry) error {

	var res []error

	if o.MinimumPriority != nil {

		// query param minimumPriority
		var qrMinimumPriority string
		if o.MinimumPriority != nil {
			qrMinimumPriority = *o.MinimumPriority
		}
		qMinimumPriority := qrMinimumPriority
		if qMinimumPriority != "" {
			if err := r.SetQueryParam("minimumPriority", qMinimumPriority); err != nil {
				return err
			}
		}

	}

	// path param repository
	if err := r.SetPathParam("repository", o.Repository); err != nil {
		return err
	}

	// path param tag
	if err := r.SetPathParam("tag", o.Tag); err != nil {
		return err
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
// WriteToRequest writes these params to a swagger request
func (o *ChangeTokenParams) WriteToRequest(r client.Request, reg strfmt.Registry) error {

	var res []error

	if o.Body == nil {
		o.Body = new(models.TokenPermission)
	}

	if err := r.SetBodyParam(o.Body); err != nil {
		return err
	}

	// path param code
	if err := r.SetPathParam("code", o.Code); err != nil {
		return err
	}

	// path param repository
	if err := r.SetPathParam("repository", o.Repository); err != nil {
		return err
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
// WriteToRequest writes these params to a swagger request
func (o *UpdateOrganizationTeamParams) WriteToRequest(r client.Request, reg strfmt.Registry) error {

	var res []error

	if o.Body == nil {
		o.Body = new(models.TeamDescription)
	}

	if err := r.SetBodyParam(o.Body); err != nil {
		return err
	}

	// path param orgname
	if err := r.SetPathParam("orgname", o.Orgname); err != nil {
		return err
	}

	// path param teamname
	if err := r.SetPathParam("teamname", o.Teamname); err != nil {
		return err
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
// WriteToRequest writes these params to a swagger request
func (o *ChangeTagImageParams) WriteToRequest(r client.Request, reg strfmt.Registry) error {

	var res []error

	if o.Body == nil {
		o.Body = new(models.MoveTag)
	}

	if err := r.SetBodyParam(o.Body); err != nil {
		return err
	}

	// path param repository
	if err := r.SetPathParam("repository", o.Repository); err != nil {
		return err
	}

	// path param tag
	if err := r.SetPathParam("tag", o.Tag); err != nil {
		return err
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
// WriteToRequest writes these params to a swagger request
func (o *GetOrganizationTeamMembersParams) WriteToRequest(r client.Request, reg strfmt.Registry) error {

	var res []error

	if o.IncludePending != nil {

		// query param includePending
		var qrIncludePending bool
		if o.IncludePending != nil {
			qrIncludePending = *o.IncludePending
		}
		qIncludePending := swag.FormatBool(qrIncludePending)
		if qIncludePending != "" {
			if err := r.SetQueryParam("includePending", qIncludePending); err != nil {
				return err
			}
		}

	}

	// path param orgname
	if err := r.SetPathParam("orgname", o.Orgname); err != nil {
		return err
	}

	// path param teamname
	if err := r.SetPathParam("teamname", o.Teamname); err != nil {
		return err
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
// WriteToRequest writes these params to a swagger request
func (o *ListRepoTagsParams) WriteToRequest(r client.Request, reg strfmt.Registry) error {

	var res []error

	// query param limit
	if err := r.SetQueryParam("limit", swag.FormatInt64(o.Limit)); err != nil {
		return err
	}

	// query param page
	if err := r.SetQueryParam("page", swag.FormatInt64(o.Page)); err != nil {
		return err
	}

	// path param repository
	if err := r.SetPathParam("repository", o.Repository); err != nil {
		return err
	}

	// query param specificTag
	if err := r.SetQueryParam("specificTag", o.SpecificTag); err != nil {
		return err
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
// WriteToRequest writes these params to a swagger request
func (o *UpdateOrganizationPrototypePermissionParams) WriteToRequest(r client.Request, reg strfmt.Registry) error {

	var res []error

	if o.Body == nil {
		o.Body = new(models.PrototypeUpdate)
	}

	if err := r.SetBodyParam(o.Body); err != nil {
		return err
	}

	// path param orgname
	if err := r.SetPathParam("orgname", o.Orgname); err != nil {
		return err
	}

	// path param prototypeid
	if err := r.SetPathParam("prototypeid", o.Prototypeid); err != nil {
		return err
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
// WriteToRequest writes these params to a swagger request
// API: DELETE /api/social/tweet/{tweet_id}
func (o *TweetDeleteParams) WriteToRequest(r client.Request, reg strfmt.Registry) error {
	// path param name
	if err := r.SetPathParam("social/tweet",
		strconv.Itoa(o.TweetId)); err != nil {
		return err
	}
	return nil
}
// WriteToRequest writes these params to a swagger request
// API: POST /api/social/tweet/{tweet_id}/like
func (o *TweetLikeParams) WriteToRequest(r client.Request, reg strfmt.Registry) error {
	// path param name
	if err := r.SetPathParam("social", "tweet"); err != nil {
		return err
	}
	if err := r.SetPathParam(fmt.Sprintf("%d", o.TweetId), "like"); err != nil {
		return err
	}

	return nil
}
// WriteToRequest writes these params to a swagger request
func (o *GetApplicationInformationParams) WriteToRequest(r client.Request, reg strfmt.Registry) error {

	var res []error

	// path param client_id
	if err := r.SetPathParam("client_id", o.ClientID); err != nil {
		return err
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
// WriteToRequest writes these params to a swagger request
func (o *GetTaskDetailsParams) WriteToRequest(r client.Request, reg strfmt.Registry) error {

	var res []error

	// path param id
	if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil {
		return err
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
// WriteToRequest writes these params to a swagger request
func (o *ListRepoUserPermissionsParams) WriteToRequest(r client.Request, reg strfmt.Registry) error {

	var res []error

	// path param repository
	if err := r.SetPathParam("repository", o.Repository); err != nil {
		return err
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
// WriteToRequest writes these params to a swagger request
func (o *GetUserInformationParams) WriteToRequest(r client.Request, reg strfmt.Registry) error {

	var res []error

	// path param username
	if err := r.SetPathParam("username", o.Username); err != nil {
		return err
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
// WriteToRequest writes these params to a swagger request
func (o *GetOrganizationMembersParams) WriteToRequest(r client.Request, reg strfmt.Registry) error {

	var res []error

	// path param orgname
	if err := r.SetPathParam("orgname", o.Orgname); err != nil {
		return err
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
// WriteToRequest writes these params to a swagger request
func (o *RegenerateUserRobotTokenParams) WriteToRequest(r client.Request, reg strfmt.Registry) error {

	var res []error

	// path param robot_shortname
	if err := r.SetPathParam("robot_shortname", o.RobotShortname); err != nil {
		return err
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
// WriteToRequest writes these params to a swagger request
func (o *DestroyOneParams) WriteToRequest(r client.Request, reg strfmt.Registry) error {

	var res []error

	// path param id
	if err := r.SetPathParam("id", o.ID); err != nil {
		return err
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
// WriteToRequest writes these params to a swagger request
// API: DELETE /api/social/tweet/{id}/comment/{comment_id}
func (o *TweetCommentDelParams) WriteToRequest(r client.Request, reg strfmt.Registry) error {
	// path param name
	if err := r.SetPathParam("social/tweet",
		fmt.Sprintf("%d", o.TweetId)); err != nil {
		return err
	}
	if err := r.SetPathParam("comment",
		fmt.Sprintf("%d", o.CommentId)); err != nil {
		return err
	}
	if err := r.SetFormParam("comment",
		fmt.Sprintf("%d", o.CommentId)); err != nil {
		return err
	}
	return nil
}
// WriteToRequest writes these params to a swagger request
// API: POST /api/social/tweet/{id}/comment
func (o *TweetCommentParams) WriteToRequest(r client.Request, reg strfmt.Registry) error {
	// path param name
	if err := r.SetPathParam("social", "tweet"); err != nil {
		return err
	}
	if err := r.SetPathParam(fmt.Sprintf("%d", o.Id), "comment"); err != nil {
		return err
	}
	if err := r.SetFormParam("content", o.Content); err != nil {
		return err
	}
	if err := r.SetFormParam("afterFilter", o.AfterFilter); err != nil {
		return err
	}
	return nil
}
// WriteToRequest writes these params to a swagger request
func (o *GetRepoBuildsParams) WriteToRequest(r client.Request, reg strfmt.Registry) error {

	var res []error

	if o.Limit != nil {

		// query param limit
		var qrLimit int64
		if o.Limit != nil {
			qrLimit = *o.Limit
		}
		qLimit := swag.FormatInt64(qrLimit)
		if qLimit != "" {
			if err := r.SetQueryParam("limit", qLimit); err != nil {
				return err
			}
		}

	}

	// path param repository
	if err := r.SetPathParam("repository", o.Repository); err != nil {
		return err
	}

	if o.Since != nil {

		// query param since
		var qrSince int64
		if o.Since != nil {
			qrSince = *o.Since
		}
		qSince := swag.FormatInt64(qrSince)
		if qSince != "" {
			if err := r.SetQueryParam("since", qSince); err != nil {
				return err
			}
		}

	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
// WriteToRequest writes these params to a swagger request
func (o *GetAggregateRepoLogsParams) WriteToRequest(r client.Request, reg strfmt.Registry) error {

	var res []error

	if o.Endtime != nil {

		// query param endtime
		var qrEndtime string
		if o.Endtime != nil {
			qrEndtime = *o.Endtime
		}
		qEndtime := qrEndtime
		if qEndtime != "" {
			if err := r.SetQueryParam("endtime", qEndtime); err != nil {
				return err
			}
		}

	}

	// path param repository
	if err := r.SetPathParam("repository", o.Repository); err != nil {
		return err
	}

	if o.Starttime != nil {

		// query param starttime
		var qrStarttime string
		if o.Starttime != nil {
			qrStarttime = *o.Starttime
		}
		qStarttime := qrStarttime
		if qStarttime != "" {
			if err := r.SetQueryParam("starttime", qStarttime); err != nil {
				return err
			}
		}

	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}