示例#1
0
    public User GetMe()
    {
        if (MeID == 0)
        {
            User me = new CampfireRequest(this).GetOne(ApiUrlBuilder.GetMe(), User.LoadMe);
            MeID = me.ID;

            if (!Users.Any(u => u.ID == me.ID))
            {
                Users.Add(me);
            }
        }

        return Users.Single(u => u.ID == MeID);
    }
示例#2
0
    private Message Speak(string messageBody, string messageType)
    {
      var data = new
      {
        message = new
        {
          body = messageBody,
          type = messageType
        }
      };

      JToken response = new CampfireRequest(this.site, this.site.Credentials)
          .Post(this.site.ApiUrlBuilder.Speak(ID), data);

      return Message.Load(response.First.First, this.site);
    }
示例#3
0
    /// <summary>
    /// Gets the user's API token using the current credentials.
    /// </summary>
    /// <returns>The API token.</returns>
    public string GetApiToken()
    {
      var me = new CampfireRequest(this, Credentials)
        .GetOne(ApiUrlBuilder.GetMe(), User.LoadMe);

      return me.ApiToken;
    }