/// <summary> /// If payload type is HAck. /// </summary> /// <returns>The payload of HAck type.</returns> public HAck GetPayloadAsHAck() { HAck payload = null; try { payload = new HAck(JObject.Parse(this["payload"].ToString())); } catch (Exception e) { Debug.WriteLine("{0} : Can not fetch the payload attribute", e.ToString()); } return(payload); }
public void SetPayload(HAck payload) { try { if (payload == null) { this.Remove("payload"); } else { this["payload"] = payload; } } catch (Exception e) { Debug.WriteLine("{0} : Can not update the payload attribute", e.ToString()); } }
public HMessage BuildMessage(string actor, string type, HAck payload, HMessageOptions mOptions) { return InnerBuildMessage(actor, type, payload, mOptions); }
//HAckValue à faire /// <summary> /// The client MUST be connected to access to this service. /// Allow a hubapp client to create a hMessage with a hAck payload. /// </summary> /// <param name="actor"></param> /// <param name="ref"></param> /// <param name="ackValue"> /// The following values are authorized : /// “recv” / HAckValue.RECV : means that the message has been received by the participant (on at least one of its devices) /// “read” / HAckValue.READ : means that the message has been read by the participant /// </param> /// <param name="mOptions"></param> /// <returns></returns> public HMessage BuildAck(string actor, string @ref, string ackValue, HMessageOptions mOptions) { if (actor == null || actor.Length <= 0) throw new MissingAttrException("actor"); if (@ref == null || @ref.Length <= 0) throw new MissingAttrException("ref"); if (ackValue == null) throw new MissingAttrException("ack"); if (HUtil.CheckAck(ackValue)) throw new Exception("only 'recv' and 'read' are authorized for ack"); HAck hack = new HAck(); hack.SetAck(ackValue); if (mOptions == null) mOptions = new HMessageOptions(); mOptions.Ref = @ref; HMessage message = BuildMessage(actor, "hAck", hack, mOptions); return message; }
/// <summary> /// If payload type is HAck. /// </summary> /// <returns>The payload of HAck type.</returns> public HAck GetPayloadAsHAck() { HAck payload = null; try { payload = new HAck(JObject.Parse(this["payload"].ToString())); } catch (Exception e) { Debug.WriteLine("{0} : Can not fetch the payload attribute", e.ToString()); } return payload; }