// Site returns messages for a set of users.
// Requires special permission to access.
// https://dev.twitter.com/streaming/reference/get/site
961187
func (srv *StreamService) Site(params *StreamSiteParams) (*Stream, error) {
	req, err := srv.site.New().Get("site.json").QueryStruct(params).Request()
	if err != nil {
		return nil, err
	}
	return newStream(srv.client, req), nil
}
1056004
func (user *User) Info() *Info {
	website, _ := url.Parse(user.Profile.Website)
	gravaURL := utils.Gravatar(user.Email)
	boardURL, _ := url.Parse(Configuration.NERDZHost)
	boardURL.Path = user.Username + "."

	return &Info{
		ID:          user.ID(),
		Owner:       nil,
		Name:        user.Name,
		Username:    user.Username,
		Website:     website,
		Image:       gravaURL,
		Closed:      user.Profile.Closed,
		BoardString: boardURL.String(),
		Type:        UserBoardID}
}
1357876
func (s *FileStorage) LoadSite(domain string) (*SiteData, error) {
	var err error
	siteData := new(SiteData)
	siteData.Cert, err = s.readFile(s.siteCertFile(domain))
	if err != nil {
		return nil, err
	}
	siteData.Key, err = s.readFile(s.siteKeyFile(domain))
	if err != nil {
		return nil, err
	}
	siteData.Meta, err = s.readFile(s.siteMetaFile(domain))
	if err != nil {
		return nil, err
	}
	return siteData, nil
}
902647
func Twitter(key, secret, callback string) *AuthHandler {
	return New(NewTwitterProvider(key, secret, callback))
}
224955
func (c *githubAPIClient) getUser() (*userResponse, error) {
	// Ignore pagination links, we should never get more than a single user here.
	bytes, _, err := c.get("/user")
	if err != nil {
		return nil, trace.Wrap(err)
	}
	var user userResponse
	err = json.Unmarshal(bytes, &user)
	if err != nil {
		return nil, trace.Wrap(err)
	}
	return &user, nil
}
843258
func (user *User) Home(options PostlistOptions) *[]Message {
	var message Message
	query := Db().
		CTE(`WITH blist AS (SELECT "to" FROM blacklist WHERE "from" = ?)`, user.ID()). // WITH cte
		Table(message.TableName()).                                                    // select * from messages
		Where(`"from" NOT IN (SELECT * FROM blist) AND
		CASE type
		WHEN 1 THEN "to" NOT IN (SELECT * FROM blist)
		ELSE ( -- groups conditions
			TRUE IN (SELECT visible FROM groups g WHERE g.counter = "to")
			OR
			(? IN (
				SELECT "from" FROM groups_members gm WHERE gm."to" = "to"
				UNION ALL
				SELECT "from" FROM groups_owners go WHERE go."to" = "to")
			)
		)
		END`, user.ID()).
		Order("time DESC")

	options.Model = message
	query = postlistQueryBuilder(query, options, user) // handle following, followers, language, newer, older, between...
	var posts []Message
	query.Scan(&posts)
	return &posts
}
389054
func (s *UserService) GetUser(p *GetUserParams) (*GetUserResponse, error) {
	resp, err := s.cs.newRequest("getUser", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r GetUserResponse
	if err := json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	return &r, nil
}
205820
func (bow *Browser) SiteCookies() []*http.Cookie {
	if bow.client == nil {
		bow.client = bow.buildClient()
	}
	return bow.client.Jar.Cookies(bow.Url())
}
1175006
func (srv *StreamService) User(params *StreamUserParams) (*Stream, error) {
	req, err := srv.user.New().Get("user.json").QueryStruct(params).Request()
	if err != nil {
		return nil, err
	}
	return newStream(srv.client, req), nil
}
158482
func Messages(
	bot reddit.Bot,
	kill <-chan bool,
	errs chan<- error,
) (
	<-chan *reddit.Message,
	error,
) {
	onlyMessages := make(chan *reddit.Message)

	messages, err := inboxStream(bot, kill, errs, "inbox")
	go func() {
		for m := range messages {
			if !m.WasComment {
				onlyMessages <- m
			}
		}
	}()

	return onlyMessages, err
}
191527
func (s *TimelineService) UserTimeline(params *UserTimelineParams) ([]Tweet, *http.Response, error) {
	tweets := new([]Tweet)
	apiError := new(APIError)
	resp, err := s.sling.New().Get("user_timeline.json").QueryStruct(params).Receive(tweets, apiError)
	return *tweets, resp, relevantError(err, *apiError)
}
721482
func (_class PVSProxyClass) GetSite(sessionID SessionRef, self PVSProxyRef) (_retval PVSSiteRef, _err error) {
	_method := "PVS_proxy.get_site"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_selfArg, _err := convertPVSProxyRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
	if _err != nil {
		return
	}
	_result, _err := _class.client.APICall(_method, _sessionIDArg, _selfArg)
	if _err != nil {
		return
	}
	_retval, _err = convertPVSSiteRefToGo(_method + " -> ", _result.Value)
	return
}
795488
func getFromSite(comment []string) string {
	if len(comment) == 0 {
		return ""
	}

	// Where we should check the website.
	idx := 2
	if len(comment) < 3 {
		idx = 0
	} else if len(comment) == 4 {
		idx = 3
	}

	// Pick the site.
	results := botFromSiteRegexp.FindStringSubmatch(comment[idx])
	if len(results) == 1 {
		// If it's a simple comment, just return the name of the site.
		if idx == 0 {
			return results[0]
		}

		// This is a large comment, usually the name will be in the previous
		// field of the comment.
		return strings.TrimSpace(comment[idx-1])
	}
	return ""
}
1240329
func (gitter *Gitter) GetUser() (*User, error) {

	var users []User
	response, err := gitter.get(gitter.config.apiBaseURL + "user")
	if err != nil {
		gitter.log(err)
		return nil, err
	}

	err = json.Unmarshal(response, &users)
	if err != nil {
		gitter.log(err)
		return nil, err
	}

	if len(users) > 0 {
		return &users[0], nil
	}

	err = APIError{What: "Failed to retrieve current user"}
	gitter.log(err)
	return nil, err
}
314754
func go_message_to_user(spSession unsafe.Pointer, message *C.char) {
	sessionCall(spSession, func(s *Session) {
		s.cbMessagesToUser(C.GoString(message))
	})
}
968326
func (self *Notifications) Get(request *gottp.Request) {
	var args struct {
		Organization string `json:"org"`
		AppName      string `json:"app_name"`
		User         string `json:"user" required:"true"`
	}

	request.ConvertArguments(&args)
	paginator := request.GetPaginator()

	all, err := sentApi.GetAll(paginator, args.User, args.AppName, args.Organization)

	if err != nil {
		if err != mgo.ErrNotFound {
			log.Println(err)
			request.Raise(gottp.HttpError{
				http.StatusInternalServerError,
				"Unable to fetch data, Please try again later.",
			})

		} else {
			request.Raise(gottp.HttpError{
				http.StatusNotFound,
				"Not Found.",
			})
		}
		return
	}

	request.Write(all)
	return
}
51041
func (site *Site) Update() (*Response, error) {
	options := &RequestOptions{JsonBody: site.mutableParams()}

	return site.client.Request("PUT", site.apiPath(), options, site)
}