func ProfileIdsFromRpcArray(rpc []*ProfileId) ([]*entity.ProfileId, error) {
  arr := make([]*entity.ProfileId, len(rpc))
  for i, encoded := range rpc {
    profileId, err := ProfileIdFromRpc(encoded)
    if err != nil {
      return nil, err
    }
    if profileId == nil {
      return nil, errors.New("encountered one or more unpopulated profiles in response")
    }
    arr[i] = profileId
  }
  return arr, nil
}
Converts an array of profileIds into their fully parsed representation
package rpc
import (
  "errors"
  "fmt"
  "time"
  "github.com/dotStart/Stockpile/entity"
  "github.com/dotStart/Stockpile/stockpile/plugin"
  "github.com/golang/protobuf/proto"
  "github.com/golang/protobuf/ptypes"
  "github.com/golang/protobuf/ptypes/any"
  "github.com/google/uuid"
)
const MessageTypeBaseUrl = "github.com/dotStart/Stockpile/stockpile/server/rpc/"
func ProfileIdFromRpc(rpc *ProfileId) (*entity.ProfileId, error) {
  if !rpc.IsPopulated() {
    return nil, nil
  }
  id, err := uuid.Parse(rpc.Id)
  if err != nil {
    return nil, err
  }
  return &entity.ProfileId{
    Id:          id,
    Name:        rpc.Name,
    FirstSeenAt: time.Unix(rpc.FirstSeenAt, 0),
    LastSeenAt:  time.Unix(rpc.LastSeenAt, 0),
    ValidUntil:  time.Unix(rpc.ValidUntil, 0),
  }, nil
}