public AssetLocationData(Models.LocationType type) { Type = type; }
public AssetAndLocation(int assetId, Models.LocationType locationType) { AssetId = assetId; LocationType = locationType; }
public async Task <Models.AssetLocation> AddAssetLocationToAssetAsync( int assetId, Models.LocationType assetLocationType, string location, CancellationToken cancellationToken = default ) { if (assetLocationType == default(Models.LocationType)) { throw new ArgumentNullException(nameof(assetLocationType)); } if (string.IsNullOrEmpty(location)) { throw new ArgumentNullException(nameof(location)); } const string apiVersion = "2020-02-20"; var _baseUri = Client.Options.BaseUri; var _url = new RequestUriBuilder(); _url.Reset(_baseUri); _url.AppendPath( "/api/assets/{assetId}/locations".Replace("{assetId}", Uri.EscapeDataString(Client.Serialize(assetId))), false); if (!string.IsNullOrEmpty(location)) { _url.AppendQuery("location", Client.Serialize(location)); } if (assetLocationType != default(Models.LocationType)) { _url.AppendQuery("assetLocationType", Client.Serialize(assetLocationType)); } _url.AppendQuery("api-version", Client.Serialize(apiVersion)); using (var _req = Client.Pipeline.CreateRequest()) { _req.Uri = _url; _req.Method = RequestMethod.Post; using (var _res = await Client.SendAsync(_req, cancellationToken).ConfigureAwait(false)) { if (_res.Status < 200 || _res.Status >= 300) { await OnAddAssetLocationToAssetFailed(_req, _res).ConfigureAwait(false); } if (_res.ContentStream == null) { await OnAddAssetLocationToAssetFailed(_req, _res).ConfigureAwait(false); } using (var _reader = new StreamReader(_res.ContentStream)) { var _content = await _reader.ReadToEndAsync().ConfigureAwait(false); var _body = Client.Deserialize <Models.AssetLocation>(_content); return(_body); } } } }
public AssetLocation(int id, Models.LocationType type, string location) { Id = id; Type = type; Location = location; }