示例#1
0
        /// <inheritdoc />
        protected override void ProcessRecord()
        {
            if (!this.ValidateHasExactlyOneValue(Identity, queryType: nameof(Identity)))
            {
                return;
            }

            var request = new AssetCheckInRequest(Identity.Value[0]);

            if (!string.IsNullOrEmpty(Note))
            {
                request.Note = Note;
            }
            if (null != Location)
            {
                request.Location = Location?.Value[0];
            }
            if (null != Status)
            {
                request.StatusLabel = Status?.Value[0];
            }
            if (!string.IsNullOrEmpty(AssetName))
            {
                request.AssetName = AssetName;
            }
            WriteObject(ApiHelper.Instance.Assets.CheckIn(request));
        }
示例#2
0
 /// <summary>
 /// Check in an asset.
 /// </summary>
 /// <param name="request">An asset check-in request.</param>
 /// <returns></returns>
 public RequestResponse <ApiObject> CheckIn(AssetCheckInRequest request)
 => Api.RequestManager.Post <AssetCheckInRequest, ApiObject>($"{EndPointInfo.BaseUri}/{request.Asset.Id}/checkin", request).RethrowExceptionIfAny().Value;