本文整理匯總了Golang中github.com/go-swagger/go-swagger/client.Request類的典型用法代碼示例。如果您正苦於以下問題:Golang Request類的具體用法?Golang Request怎麽用?Golang Request使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Request類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: WriteToRequest
// WriteToRequest writes these params to a swagger request
func (o *DiscoveryParams) WriteToRequest(r client.Request, reg strfmt.Registry) error {
var res []error
if o.Internal != nil {
// query param internal
var qrInternal bool
if o.Internal != nil {
qrInternal = *o.Internal
}
qInternal := swag.FormatBool(qrInternal)
if qInternal != "" {
if err := r.SetQueryParam("internal", qInternal); err != nil {
return err
}
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
示例2: 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
}
示例3: 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
}
示例4: 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
}
示例5: WriteToRequest
// WriteToRequest writes these params to a swagger request
func (o *ConductSearchParams) WriteToRequest(r client.Request, reg strfmt.Registry) error {
var res []error
if o.Query != nil {
// query param query
var qrQuery string
if o.Query != nil {
qrQuery = *o.Query
}
qQuery := qrQuery
if qQuery != "" {
if err := r.SetQueryParam("query", qQuery); err != nil {
return err
}
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
示例6: WriteToRequest
// 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
}
示例7: WriteToRequest
// 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
}
示例8: WriteToRequest
// WriteToRequest writes these params to a swagger request
func (o *CreateTaskParams) WriteToRequest(r client.Request, reg strfmt.Registry) error {
var res []error
if err := r.SetBodyParam(o.Body); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
示例9: 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
}
示例10: WriteToRequest
// 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
}
示例11: WriteToRequest
// 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
}
示例12: WriteToRequest
// WriteToRequest writes these params to a swagger request
func (o *GetPullRequestActivitiesParams) WriteToRequest(r client.Request, reg strfmt.Registry) error {
var res []error
// query param limit
var qrLimit int64
if o.Limit != nil {
qrLimit = *o.Limit
}
qLimit := swag.FormatInt64(qrLimit)
if err := r.SetQueryParam("limit", qLimit); err != nil {
return err
}
// path param project
if err := r.SetPathParam("project", o.Project); err != nil {
return err
}
// path param pullRequestId
if err := r.SetPathParam("pullRequestId", swag.FormatInt64(o.PullRequestID)); err != nil {
return err
}
// path param repo
if err := r.SetPathParam("repo", o.Repo); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
示例13: WriteToRequest
// 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
}
示例14: WriteToRequest
// WriteToRequest writes these params to a swagger request
func (o *ConductSearchParams) WriteToRequest(r client.Request, reg strfmt.Registry) error {
var res []error
// query param query
if err := r.SetQueryParam("query", o.Query); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
示例15: WriteToRequest
// WriteToRequest writes these params to a swagger request
func (o *GetUserRobotsParams) WriteToRequest(r client.Request, reg strfmt.Registry) error {
var res []error
// query param permissions
if err := r.SetQueryParam("permissions", swag.FormatBool(o.Permissions)); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}