MCPcopy Index your code
hub / github.com/coder/coder / AsRequestOption

Method AsRequestOption

codersdk/users.go:743–767  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

741}
742
743func (omq OrganizationMembersQuery) AsRequestOption() RequestOption {
744 return func(r *http.Request) {
745 q := r.URL.Query()
746 var sb strings.Builder
747 if omq.UserID != uuid.Nil {
748 _, _ = sb.WriteString("user_id:")
749 _, _ = sb.WriteString(omq.UserID.String())
750 _, _ = sb.WriteString(" ")
751 }
752 if omq.IncludeSystem {
753 _, _ = sb.WriteString("include_system:true")
754 }
755 if omq.GithubUserID != 0 {
756 _, _ = sb.WriteString("github_user_id:")
757 _, _ = sb.WriteString(strconv.FormatInt(omq.GithubUserID, 10))
758 _, _ = sb.WriteString(" ")
759 }
760 qs := strings.TrimSpace(sb.String())
761 if len(qs) == 0 {
762 return
763 }
764 q.Set("q", qs)
765 r.URL.RawQuery = q.Encode()
766 }
767}
768
769type OrganizationMembersQueryOption func(*OrganizationMembersQuery)
770

Callers 1

OrganizationMembersMethod · 0.95

Calls 4

WriteStringMethod · 0.80
EncodeMethod · 0.80
SetMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected