You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@esme.apache.org by Richard Hirsch <hi...@gmail.com> on 2011/06/06 11:07:26 UTC

new API2 calls for 1.3

Checked my first steps for follow/unfollow for tag/conversations.

Conversations looks fine (I haven't tested it yet) but there is a
compile problem for the tags-related code.

@Ethan - can you take a quick look at it and see what I did wrong...

D.

Re: new API2 calls for 1.3

Posted by Richard Hirsch <hi...@gmail.com>.
Yep that was my assumption - I didn't consider the use case of an
admin making changes for other users.

D.

On Tue, Jun 7, 2011 at 8:40 AM, Ethan Jewett <es...@gmail.com> wrote:
> Because we need to let the API know which follower to delete/unfollow.
> For now you can definitely leave it off, as we don't have the concept
> of an administrative user with control over other users. So it would
> just be DELETE api2/tags/TAGNAME/followers and then get the user to
> unfollow from User.currentUser.
>
> Ethan
>
> On Tue, Jun 7, 2011 at 8:34 AM, Richard Hirsch <hi...@gmail.com> wrote:
>> OK - working on it now.. Just checked in the code
>>
>> Why is the "USERID" in the DELETE api2/tags/TAGNAME/followers/USERID
>> call necessary?
>>
>> D.
>>
>> On Tue, Jun 7, 2011 at 8:15 AM, Ethan Jewett <es...@gmail.com> wrote:
>>> Hi Dick,
>>>
>>> It looks like it is problems with Boxed vs. un-Boxed values. The error
>>> you are currently seeing is because tagId is a Box[String] but By()
>>> expects a String in that position. So you need to un-Box it. I'd
>>> recommend changing
>>>
>>> def followTag(tagId: Box[String]): LiftResponse = {
>>>  val ret: Box[Tuple3[Int,Map[String,String],Box[Elem]]] =
>>>    for (user <- User.currentUser)
>>>    yield {
>>>      val tag = Tag.findAll(By(Tag.name, tagId)).headOption
>>>
>>> to
>>>
>>> def followTag(tagId: Box[String]): LiftResponse = {
>>>  val ret: Box[Tuple3[Int,Map[String,String],Box[Elem]]] =
>>>    for (user <- User.currentUser)
>>>    yield {
>>>      val tag = Tag.findAll(By(Tag.name, tagId.openOr(""))).headOption
>>>
>>> Calling the openOr() method on a Box will return the value inside the
>>> Box (a String in this case), or if the Box is Empty it will return the
>>> parameter passed to the method ("" in this case). Hopefully searching
>>> for a blank string will not return any results, but please check for
>>> that!
>>>
>>> Once you make this change, you'll get a bunch more errors that we can
>>> work through. Most of them are similar, revolving around Box or Option
>>> and incorrect type signatures for functions. Let's work through these
>>> one-by-one? I should be able to respond more quickly today.
>>>
>>> Cheers,
>>> Ethan
>>>
>>> On Mon, Jun 6, 2011 at 11:15 AM, Ethan Jewett <es...@gmail.com> wrote:
>>>> Hi Dick,
>>>>
>>>> Great! I'll definitely take a look tonight.
>>>>
>>>> Cheers,
>>>> Ethan
>>>>
>>>> On Mon, Jun 6, 2011 at 11:07 AM, Richard Hirsch <hi...@gmail.com> wrote:
>>>>> Checked my first steps for follow/unfollow for tag/conversations.
>>>>>
>>>>> Conversations looks fine (I haven't tested it yet) but there is a
>>>>> compile problem for the tags-related code.
>>>>>
>>>>> @Ethan - can you take a quick look at it and see what I did wrong...
>>>>>
>>>>> D.
>>>>>
>>>>
>>>
>>
>

Re: new API2 calls for 1.3

Posted by Ethan Jewett <es...@gmail.com>.
Because we need to let the API know which follower to delete/unfollow.
For now you can definitely leave it off, as we don't have the concept
of an administrative user with control over other users. So it would
just be DELETE api2/tags/TAGNAME/followers and then get the user to
unfollow from User.currentUser.

Ethan

On Tue, Jun 7, 2011 at 8:34 AM, Richard Hirsch <hi...@gmail.com> wrote:
> OK - working on it now.. Just checked in the code
>
> Why is the "USERID" in the DELETE api2/tags/TAGNAME/followers/USERID
> call necessary?
>
> D.
>
> On Tue, Jun 7, 2011 at 8:15 AM, Ethan Jewett <es...@gmail.com> wrote:
>> Hi Dick,
>>
>> It looks like it is problems with Boxed vs. un-Boxed values. The error
>> you are currently seeing is because tagId is a Box[String] but By()
>> expects a String in that position. So you need to un-Box it. I'd
>> recommend changing
>>
>> def followTag(tagId: Box[String]): LiftResponse = {
>>  val ret: Box[Tuple3[Int,Map[String,String],Box[Elem]]] =
>>    for (user <- User.currentUser)
>>    yield {
>>      val tag = Tag.findAll(By(Tag.name, tagId)).headOption
>>
>> to
>>
>> def followTag(tagId: Box[String]): LiftResponse = {
>>  val ret: Box[Tuple3[Int,Map[String,String],Box[Elem]]] =
>>    for (user <- User.currentUser)
>>    yield {
>>      val tag = Tag.findAll(By(Tag.name, tagId.openOr(""))).headOption
>>
>> Calling the openOr() method on a Box will return the value inside the
>> Box (a String in this case), or if the Box is Empty it will return the
>> parameter passed to the method ("" in this case). Hopefully searching
>> for a blank string will not return any results, but please check for
>> that!
>>
>> Once you make this change, you'll get a bunch more errors that we can
>> work through. Most of them are similar, revolving around Box or Option
>> and incorrect type signatures for functions. Let's work through these
>> one-by-one? I should be able to respond more quickly today.
>>
>> Cheers,
>> Ethan
>>
>> On Mon, Jun 6, 2011 at 11:15 AM, Ethan Jewett <es...@gmail.com> wrote:
>>> Hi Dick,
>>>
>>> Great! I'll definitely take a look tonight.
>>>
>>> Cheers,
>>> Ethan
>>>
>>> On Mon, Jun 6, 2011 at 11:07 AM, Richard Hirsch <hi...@gmail.com> wrote:
>>>> Checked my first steps for follow/unfollow for tag/conversations.
>>>>
>>>> Conversations looks fine (I haven't tested it yet) but there is a
>>>> compile problem for the tags-related code.
>>>>
>>>> @Ethan - can you take a quick look at it and see what I did wrong...
>>>>
>>>> D.
>>>>
>>>
>>
>

Re: new API2 calls for 1.3

Posted by Richard Hirsch <hi...@gmail.com>.
OK - working on it now.. Just checked in the code

Why is the "USERID" in the DELETE api2/tags/TAGNAME/followers/USERID
call necessary?

D.

On Tue, Jun 7, 2011 at 8:15 AM, Ethan Jewett <es...@gmail.com> wrote:
> Hi Dick,
>
> It looks like it is problems with Boxed vs. un-Boxed values. The error
> you are currently seeing is because tagId is a Box[String] but By()
> expects a String in that position. So you need to un-Box it. I'd
> recommend changing
>
> def followTag(tagId: Box[String]): LiftResponse = {
>  val ret: Box[Tuple3[Int,Map[String,String],Box[Elem]]] =
>    for (user <- User.currentUser)
>    yield {
>      val tag = Tag.findAll(By(Tag.name, tagId)).headOption
>
> to
>
> def followTag(tagId: Box[String]): LiftResponse = {
>  val ret: Box[Tuple3[Int,Map[String,String],Box[Elem]]] =
>    for (user <- User.currentUser)
>    yield {
>      val tag = Tag.findAll(By(Tag.name, tagId.openOr(""))).headOption
>
> Calling the openOr() method on a Box will return the value inside the
> Box (a String in this case), or if the Box is Empty it will return the
> parameter passed to the method ("" in this case). Hopefully searching
> for a blank string will not return any results, but please check for
> that!
>
> Once you make this change, you'll get a bunch more errors that we can
> work through. Most of them are similar, revolving around Box or Option
> and incorrect type signatures for functions. Let's work through these
> one-by-one? I should be able to respond more quickly today.
>
> Cheers,
> Ethan
>
> On Mon, Jun 6, 2011 at 11:15 AM, Ethan Jewett <es...@gmail.com> wrote:
>> Hi Dick,
>>
>> Great! I'll definitely take a look tonight.
>>
>> Cheers,
>> Ethan
>>
>> On Mon, Jun 6, 2011 at 11:07 AM, Richard Hirsch <hi...@gmail.com> wrote:
>>> Checked my first steps for follow/unfollow for tag/conversations.
>>>
>>> Conversations looks fine (I haven't tested it yet) but there is a
>>> compile problem for the tags-related code.
>>>
>>> @Ethan - can you take a quick look at it and see what I did wrong...
>>>
>>> D.
>>>
>>
>

Re: new API2 calls for 1.3

Posted by Ethan Jewett <es...@gmail.com>.
Hi Dick,

It looks like it is problems with Boxed vs. un-Boxed values. The error
you are currently seeing is because tagId is a Box[String] but By()
expects a String in that position. So you need to un-Box it. I'd
recommend changing

def followTag(tagId: Box[String]): LiftResponse = {
  val ret: Box[Tuple3[Int,Map[String,String],Box[Elem]]] =
    for (user <- User.currentUser)
    yield {
      val tag = Tag.findAll(By(Tag.name, tagId)).headOption

to

def followTag(tagId: Box[String]): LiftResponse = {
  val ret: Box[Tuple3[Int,Map[String,String],Box[Elem]]] =
    for (user <- User.currentUser)
    yield {
      val tag = Tag.findAll(By(Tag.name, tagId.openOr(""))).headOption

Calling the openOr() method on a Box will return the value inside the
Box (a String in this case), or if the Box is Empty it will return the
parameter passed to the method ("" in this case). Hopefully searching
for a blank string will not return any results, but please check for
that!

Once you make this change, you'll get a bunch more errors that we can
work through. Most of them are similar, revolving around Box or Option
and incorrect type signatures for functions. Let's work through these
one-by-one? I should be able to respond more quickly today.

Cheers,
Ethan

On Mon, Jun 6, 2011 at 11:15 AM, Ethan Jewett <es...@gmail.com> wrote:
> Hi Dick,
>
> Great! I'll definitely take a look tonight.
>
> Cheers,
> Ethan
>
> On Mon, Jun 6, 2011 at 11:07 AM, Richard Hirsch <hi...@gmail.com> wrote:
>> Checked my first steps for follow/unfollow for tag/conversations.
>>
>> Conversations looks fine (I haven't tested it yet) but there is a
>> compile problem for the tags-related code.
>>
>> @Ethan - can you take a quick look at it and see what I did wrong...
>>
>> D.
>>
>

Re: new API2 calls for 1.3

Posted by Ethan Jewett <es...@gmail.com>.
Hi Dick,

Great! I'll definitely take a look tonight.

Cheers,
Ethan

On Mon, Jun 6, 2011 at 11:07 AM, Richard Hirsch <hi...@gmail.com> wrote:
> Checked my first steps for follow/unfollow for tag/conversations.
>
> Conversations looks fine (I haven't tested it yet) but there is a
> compile problem for the tags-related code.
>
> @Ethan - can you take a quick look at it and see what I did wrong...
>
> D.
>