Пример #1
0
func (m *HTTPManager) FindByRemoteSubject(provider, subject string) (*Connection, error) {
	var connection Connection
	var u = pkg.CopyURL(m.Endpoint)
	var q = u.Query()
	q.Add("remote_subject", subject)
	q.Add("provider", provider)
	u.RawQuery = q.Encode()

	var r = pkg.NewSuperAgent(u.String())
	r.Client = m.Client
	r.Dry = m.Dry
	if err := r.Get(&connection); err != nil {
		return nil, err
	}

	return &connection, nil
}
Пример #2
0
func (m *HTTPManager) FindAllByLocalSubject(subject string) ([]*Connection, error) {
	var connection []*Connection
	var u = pkg.CopyURL(m.Endpoint)
	var q = u.Query()

	q.Add("local_subject", subject)
	u.RawQuery = q.Encode()

	var r = pkg.NewSuperAgent(u.String())
	r.Client = m.Client
	r.Dry = m.Dry
	if err := r.Get(&connection); err != nil {
		return nil, err
	}

	return connection, nil
}