/// <summary> /// [DEPRECATED - use /share-invite-monetary-account-response] Create a new share inquiry for a monetary /// account, specifying the permission the other bunq user will have on it. /// </summary> /// <param name="counterUserAlias">The pointer of the user to share with.</param> /// <param name="shareDetail">The share details. Only one of these objects may be passed.</param> /// <param name="status">The status of the share. Can be PENDING, REVOKED (the user deletes the share inquiry before it's accepted), ACCEPTED, CANCELLED (the user deletes an active share) or CANCELLATION_PENDING, CANCELLATION_ACCEPTED, CANCELLATION_REJECTED (for canceling mutual connects).</param> /// <param name="draftShareInviteBankId">The id of the draft share invite bank.</param> /// <param name="shareType">The share type, either STANDARD or MUTUAL.</param> /// <param name="startDate">The start date of this share.</param> /// <param name="endDate">The expiration date of this share.</param> public static BunqResponse <int> Create(Pointer counterUserAlias, ShareDetail shareDetail, string status, int?monetaryAccountId = null, int?draftShareInviteBankId = null, string shareType = null, string startDate = null, string endDate = null, IDictionary <string, string> customHeaders = null) { if (customHeaders == null) { customHeaders = new Dictionary <string, string>(); } var apiClient = new ApiClient(GetApiContext()); var requestMap = new Dictionary <string, object> { { FIELD_COUNTER_USER_ALIAS, counterUserAlias }, { FIELD_DRAFT_SHARE_INVITE_BANK_ID, draftShareInviteBankId }, { FIELD_SHARE_DETAIL, shareDetail }, { FIELD_STATUS, status }, { FIELD_SHARE_TYPE, shareType }, { FIELD_START_DATE, startDate }, { FIELD_END_DATE, endDate }, }; var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); var responseRaw = apiClient.Post( string.Format(ENDPOINT_URL_CREATE, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId)), requestBytes, customHeaders); return(ProcessForId(responseRaw)); }
/// <summary> /// [DEPRECATED - use /share-invite-monetary-account-response] Update the details of a share. This includes /// updating status (revoking or cancelling it), granted permission and validity period of this share. /// </summary> /// <param name="shareDetail">The share details. Only one of these objects may be passed.</param> /// <param name="status">The status of the share. Can be PENDING, REVOKED (the user deletes the share inquiry before it's accepted), ACCEPTED, CANCELLED (the user deletes an active share) or CANCELLATION_PENDING, CANCELLATION_ACCEPTED, CANCELLATION_REJECTED (for canceling mutual connects).</param> /// <param name="startDate">The start date of this share.</param> /// <param name="endDate">The expiration date of this share.</param> public static BunqResponse <int> Update(int shareInviteMonetaryAccountInquiryId, int?monetaryAccountId = null, ShareDetail shareDetail = null, string status = null, string startDate = null, string endDate = null, IDictionary <string, string> customHeaders = null) { if (customHeaders == null) { customHeaders = new Dictionary <string, string>(); } var apiClient = new ApiClient(GetApiContext()); var requestMap = new Dictionary <string, object> { { FIELD_SHARE_DETAIL, shareDetail }, { FIELD_STATUS, status }, { FIELD_START_DATE, startDate }, { FIELD_END_DATE, endDate }, }; var requestBytes = Encoding.UTF8.GetBytes(BunqJsonConvert.SerializeObject(requestMap)); var responseRaw = apiClient.Put( string.Format(ENDPOINT_URL_UPDATE, DetermineUserId(), DetermineMonetaryAccountId(monetaryAccountId), shareInviteMonetaryAccountInquiryId), requestBytes, customHeaders); return(ProcessForId(responseRaw)); }
// POST: api/ShareDetail public HttpResponseMessage Post([FromBody] ShareDetail detail) { var response = Request.CreateResponse <ShareDetail>(HttpStatusCode.Created, detail); try { service.Add(detail); } catch (Exception e) { response = Request.CreateResponse <ShareDetail>(HttpStatusCode.BadRequest, detail); return(response); } string uri = Url.Link("DefaultApi", new { id = detail.ShareId }); response.Headers.Location = new Uri(uri); return(response); }