當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Request.SetPathParam方法代碼示例

本文整理匯總了Golang中github.com/go-swagger/go-swagger/client.Request.SetPathParam方法的典型用法代碼示例。如果您正苦於以下問題:Golang Request.SetPathParam方法的具體用法?Golang Request.SetPathParam怎麽用?Golang Request.SetPathParam使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/go-swagger/go-swagger/client.Request的用法示例。


在下文中一共展示了Request.SetPathParam方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: WriteToRequest

// 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
}
開發者ID:chancez,項目名稱:go-quay,代碼行數:30,代碼來源:get_matching_entities_parameters.go

示例2: WriteToRequest

// 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
}
開發者ID:carriercomm,項目名稱:go-quay,代碼行數:31,代碼來源:get_org_robots_parameters.go

示例3: WriteToRequest

// 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
}
開發者ID:MStoykov,項目名稱:go-swagger,代碼行數:31,代碼來源:upload_task_file_parameters.go

示例4: WriteToRequest

// 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
}
開發者ID:carriercomm,項目名稱:go-quay,代碼行數:36,代碼來源:list_tag_images_parameters.go

示例5: WriteToRequest

// 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
}
開發者ID:wangfeiping,項目名稱:go-coding,代碼行數:28,代碼來源:tweets_list_parameters.go

示例6: WriteToRequest

// 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
}
開發者ID:MStoykov,項目名稱:go-swagger,代碼行數:33,代碼來源:get_task_comments_parameters.go

示例7: WriteToRequest

// 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
}
開發者ID:carriercomm,項目名稱:go-quay,代碼行數:36,代碼來源:list_trigger_recent_builds_parameters.go

示例8: WriteToRequest

// 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
}
開發者ID:chancez,項目名稱:go-quay,代碼行數:28,代碼來源:manually_start_build_trigger_parameters.go

示例9: WriteToRequest

// 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
}
開發者ID:carriercomm,項目名稱:go-quay,代碼行數:28,代碼來源:update_organization_application_parameters.go

示例10: WriteToRequest

// 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
}
開發者ID:chancez,項目名稱:go-quay,代碼行數:35,代碼來源:list_org_logs_parameters.go

示例11: WriteToRequest

// 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
}
開發者ID:carriercomm,項目名稱:go-quay,代碼行數:36,代碼來源:get_repo_tag_vulnerabilities_parameters.go

示例12: WriteToRequest

// 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
}
開發者ID:chancez,項目名稱:go-quay,代碼行數:28,代碼來源:change_token_parameters.go

示例13: WriteToRequest

// 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
}
開發者ID:chancez,項目名稱:go-quay,代碼行數:28,代碼來源:update_organization_team_parameters.go

示例14: WriteToRequest

// 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
}
開發者ID:chancez,項目名稱:go-quay,代碼行數:28,代碼來源:change_tag_image_parameters.go

示例15: WriteToRequest

// 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
}
開發者ID:carriercomm,項目名稱:go-quay,代碼行數:36,代碼來源:get_organization_team_members_parameters.go


注:本文中的github.com/go-swagger/go-swagger/client.Request.SetPathParam方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。