// GetByIDs sends out all items matching a set of IDs
15797
func (r *BeeResource) GetByIDs(ctx smolder.APIContext, request *restful.Request, response *restful.Response, ids []string) {
	resp := BeeResponse{}
	resp.Init(ctx)

	for _, id := range ids {
		bee := bees.GetBee(id)
		if bee == nil {
			r.NotFound(request, response)
			return
		}

		resp.AddBee(bee)
	}

	resp.Send(response)
}
1163567
func (r *BulkResponse) ById(id string) []*BulkResponseItem {
	if r.Items == nil {
		return nil
	}
	items := make([]*BulkResponseItem, 0)
	for _, item := range r.Items {
		for _, result := range item {
			if result.Id == id {
				items = append(items, result)
			}
		}
	}
	return items
}
975984
func (c *Cloud) getInstanceByID(instanceID string) (*ec2.Instance, error) {
	instances, err := c.getInstancesByIDs([]*string{&instanceID})
	if err != nil {
		return nil, err
	}

	if len(instances) == 0 {
		return nil, cloudprovider.ErrInstanceNotFound
	}
	if len(instances) > 1 {
		return nil, fmt.Errorf("multiple instances found for instance: %s", instanceID)
	}

	return instances[instanceID], nil
}
146981
func (_m *DBClient) ReadingById(id string) (models.Reading, error) {
	ret := _m.Called(id)

	var r0 models.Reading
	if rf, ok := ret.Get(0).(func(string) models.Reading); ok {
		r0 = rf(id)
	} else {
		r0 = ret.Get(0).(models.Reading)
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(string) error); ok {
		r1 = rf(id)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}
1294656
func (c *Connection) LookupByID(msgID uint16) (api.Message, error) {
	if c == nil {
		return nil, errors.New("nil connection passed in")
	}

	if msg, ok := c.msgMap[msgID]; ok {
		return msg, nil
	}

	return nil, fmt.Errorf("unknown message ID: %d", msgID)
}
676585
func (u *UniterAPIV5) RelationById(args params.RelationIds) (params.RelationResultsV5, error) {
	v6Results, err := u.UniterAPI.RelationById(args)
	if err != nil {
		return params.RelationResultsV5{}, errors.Trace(err)
	}
	return relationResultsToV5(v6Results), nil
}
614
func (f *File) ItemByID(id uint32) (*Item, error) {
	meta, err := f.getMeta()
	if err != nil {
		return nil, err
	}
	it := &Item{
		f:  f,
		ID: id,
	}
	if meta.ItemLocation != nil {
		for _, ilbe := range meta.ItemLocation.Items {
			if uint32(ilbe.ItemID) == id {
				shallowCopy := ilbe
				it.Location = &shallowCopy
			}
		}
	}
	if meta.ItemInfo != nil {
		for _, iie := range meta.ItemInfo.ItemInfos {
			if uint32(iie.ItemID) == id {
				it.Info = iie
			}
		}
	}
	if it.Info == nil {
		return nil, ErrUnknownItem
	}
	if meta.Properties != nil {
		allProps := meta.Properties.PropertyContainer.Properties
		for _, ipa := range meta.Properties.Associations {
			// TODO: I've never seen a file with more than
			// top-level ItemPropertyAssociation box, but
			// apparently they can exist with different
			// versions/flags. For now we just merge them
			// all together, but that's not really right.
			// So for now, just bail once a previous loop
			// found anything.
			if len(it.Properties) > 0 {
				break
			}

			for _, ipai := range ipa.Entries {
				if ipai.ItemID != id {
					continue
				}
				for _, ass := range ipai.Associations {
					if ass.Index != 0 && int(ass.Index) <= len(allProps) {
						box := allProps[ass.Index-1]
						boxp, err := box.Parse()
						if err == nil {
							box = boxp
						}
						it.Properties = append(it.Properties, box)
					}
				}
			}
		}
	}
	return it, nil
}
143569
func (res RPCResponses) GetByID(id int) *RPCResponse {
	for _, r := range res {
		if r.ID == id {
			return r
		}
	}

	return nil
}
84947
func (r Resource) GetByIDs(request *restful.Request, response *restful.Response) {
	if resource, ok := r.Parent.(GetIDSupported); ok {
		context := r.Context.NewAPIContext()
		if resource.GetByIDsAuthRequired() {
			auth, err := context.Authentication(request)
			if err != nil || auth == nil {
				ErrorResponseHandler(request, response, err, NewErrorResponse(
					http.StatusUnauthorized,
					"Invalid accesstoken",
					"GET"))
				return
			}
		}

		ids := []string{}
		if ql, ok := request.Request.URL.Query()["ids[]"]; ok {
			for _, q := range ql {
				if len(q) > 0 {
					ids = append(ids, q)
				}
			}
		}
		pathID := request.PathParameter("id")
		if len(pathID) > 0 {
			ids = append(ids, pathID)
		}

		if len(ids) == 0 {
			ErrorResponseHandler(request, response, nil, NewErrorResponse(
				http.StatusBadRequest,
				"No item-id(s) specified",
				"validate"))
			return
		}

		resource.GetByIDs(context, request, response, ids)
		request.SetAttribute("context", context)
	}
}
274091
func (c *Client) GetLightByID(id uint64) (light common.Light, err error) {
	dev, err := c.GetDeviceByID(id)
	if err != nil {
		return nil, err
	}

	light, ok := dev.(common.Light)
	if !ok {
		return nil, common.ErrDeviceInvalidType
	}

	return light, nil
}
570125
func (c *Client) GetGifsById(ids ...string) ([]*Gif, error) {

	// check that a query string was actually passed in
	if len(ids) > 100 {
		err := errors.New("Cannot fetch more than 100 GIFs at a time.")
		return nil, err
	}

	// build query string that will be appended to url
	qs := &url.Values{}
	qs.Set("ids", strings.Join(ids, ","))

	// construct and execute the HTTP request
	pr := &paginatedResults{}
	if err := c.makeRequest("gifs", qs, pr); err != nil {
		return nil, err
	}

	return pr.Data, nil
}
990525
func (_m *DBClient) GetDeviceById(id string) (models.Device, error) {
	ret := _m.Called(id)

	var r0 models.Device
	if rf, ok := ret.Get(0).(func(string) models.Device); ok {
		r0 = rf(id)
	} else {
		r0 = ret.Get(0).(models.Device)
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(string) error); ok {
		r1 = rf(id)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}
1320189
func (c *Cache) GetBytes(id string) (ItemInfo, []byte, error) {
	id = cleanID(id)

	c.nlocker.Lock(id)
	defer c.nlocker.Unlock(id)

	info := ItemInfo{Name: id}

	if r := c.getOrRemove(id); r != nil {
		defer r.Close()
		b, err := ioutil.ReadAll(r)
		return info, b, err
	}

	return info, nil, nil
}
364242
func (p *ProfilesClient) ListByID(ctx context.Context, userIDs []identity.ID) ([]apitypes.Profile, error) {
	v := &url.Values{}
	for _, id := range userIDs {
		v.Add("id", id.String())
	}

	var results []apitypes.Profile
	err := p.client.RoundTrip(ctx, "GET", "/profiles", v, nil, &results)
	return results, err
}
1274898
func (d *Daemon) GetIDByName(name string) (string, error) {
	return d.inspectFieldWithError(name, "Id")
}
152608
func (c *Client) GetSchemaByID(subjectID int) (string, error) {
	// # Get the schema for a particular subject id
	// GET /schemas/ids/{int: id}
	path := fmt.Sprintf(schemaPath, subjectID)
	resp, err := c.do(http.MethodGet, path, "", nil)
	if err != nil {
		return "", err
	}

	var res schemaOnlyJSON
	if err = c.readJSON(resp, &res); err != nil {
		return "", err
	}

	return res.Schema, nil
}
956395
func RetrieveVoutsByIDs(ctx context.Context, db *sql.DB, voutDbIDs []uint64) ([]dbtypes.Vout, error) {
	vouts := make([]dbtypes.Vout, len(voutDbIDs))
	for i, id := range voutDbIDs {
		vout := &vouts[i]
		var id0 uint64
		var reqSigs uint32
		var scriptType, addresses string
		err := db.QueryRowContext(ctx, internal.SelectVoutByID, id).Scan(&id0, &vout.TxHash,
			&vout.TxIndex, &vout.TxTree, &vout.Value, &vout.Version,
			&vout.ScriptPubKey, &reqSigs, &scriptType, &addresses)
		if err != nil {
			return nil, err
		}
		// Parse the addresses array
		replacer := strings.NewReplacer("{", "", "}", "")
		addresses = replacer.Replace(addresses)

		vout.ScriptPubKeyData.ReqSigs = reqSigs
		vout.ScriptPubKeyData.Type = scriptType
		// If there are no addresses, the Addresses should be nil or length
		// zero. However, strings.Split will return [""] if addresses is "".
		// If that is the case, leave it as a nil slice.
		if len(addresses) > 0 {
			vout.ScriptPubKeyData.Addresses = strings.Split(addresses, ",")
		}
	}
	return vouts, nil
}